Skip to content

Commit 229bee0

Browse files
authored
Merge pull request #201 from cyjseagull/release-2.7.0
sync code from release-2.7.0 into master
2 parents 5a5afc4 + 023360f commit 229bee0

File tree

92 files changed

+1344
-5390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1344
-5390
lines changed

.ci/ci_check.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ check_sm_node()
113113
}
114114
LOG_INFO "------ download_tassl---------"
115115
download_tassl
116-
LOG_INFO "------ check_basic---------"
117-
./gradlew build -x test
118116
LOG_INFO "------ download_build_chain---------"
119117
download_build_chain
120118
LOG_INFO "------ check_standard_node---------"

.ci/ci_check_commit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44

55
scan_code_script="cobra/cobra.py -f json -o /tmp/report.json -t "
66
ignore_files=(sh crt key json toml SignatureTest.java Ok.java bin abi ChannelTest.java ParallelOkDemo.java PerformanceAmop.java DagPrecompiledDemo.java KeyToolTest.java CryptoSuite.java AmopMsgHandlerTest.java TopicManager.java PrivateTopicVerifyTest.java AmopMsgBuilder.java TopicManagerTest.java AmopSubscribe.java AmopPublisher.java AmopPublisherPrivate.java AmopSubscribePrivate.java AmopPublisherFile.java AmopPublisherPrivateFile.java DemoAmopCallback.java FileToByteArrayHelper.java OkD.java TableTest.java PerformanceTable.java HelloWorld.java PerformanceRPC.java CodecTest.java ResponseTest.java ConfigTest.java)
7-
commit_limit=6
7+
commit_limit=100
88

99
LOG_ERROR() {
1010
content=${1}

Changelog.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
1+
## v2.7.0
2+
(2020-11-20)
3+
Please read documentation of Java SDK.
4+
5+
* [English User Handbook](https://fisco-bcos-documentation.readthedocs.io/en/latest/docs/sdk/java_sdk/index.html)
6+
* [Chinese User Handbook](https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/sdk/java_sdk/index.html#)
7+
* [Chinese WIKI](https://github.com/FISCO-BCOS/java-sdk/wiki)
8+
9+
Added:
10+
* Added `getBatchReceiptsByBlockNumberAndRange` and `getBatchReceiptsByBlockHashAndRange` interfaces to support batch pull block transaction receipts
11+
* Added the `getNodeInfo` interface to obtain subscribed topics information
12+
* Added `revokeManager` interface to revoke contract life cycle management authority
13+
* `ChainGovernanceService` adds `queryVotesOfMember` and `queryVotesOfThreshold` interfaces to support query voting status
14+
15+
Changed:
16+
* Separate `sdk-demo` as a `java-sdk-demo` project
17+
18+
Fixed:
19+
* Fix the exception of contract receipt parsing null pointer exception when deploying constructor with event
20+
21+
Compatibility
22+
23+
* FISCO BCOS v2.0+
24+
* AMOP Not compatible with Web3SDK
25+
26+
----
27+
请参考文档:
28+
* [英文版用户手册](https://fisco-bcos-documentation.readthedocs.io/en/latest/docs/sdk/java_sdk/index.html)
29+
* [中文版用户手册](https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/sdk/java_sdk/index.html#)
30+
* [中文版WIKI](https://github.com/FISCO-BCOS/java-sdk/wiki)
31+
32+
添加:
33+
* 添加`getBatchReceiptsByBlockNumberAndRange``getBatchReceiptsByBlockHashAndRange`接口,支持批量拉取区块交易回执
34+
* 添加`getNodeInfo`接口,获取订阅的topics信息
35+
* 添加`revokeManager`接口,撤销合约生命周期管理权限
36+
* `ChainGovernanceService`添加`queryVotesOfMember``queryVotesOfThreshold`接口,支持查询投票情况
37+
38+
修改:
39+
*`sdk-demo`独立为`java-sdk-demo`项目
40+
41+
修复:
42+
* 修复部署构造函数带有event的合约异常时,合约回执解析空指针异常
43+
44+
适配性:
45+
* 适配FISCO BCOS v2.0+
46+
* AMOP功能不兼容Web3SDK
47+
148
## v2.6.1
249
(2020-10-29)
350
Please read documentation of Java SDK.
@@ -21,8 +68,8 @@ Fixed:
2168

2269
Compatibility
2370

24-
* FISCO BCOS v2.0+.
25-
* Not compatible with Web3SDK. When two users want to use AMOP functions to talk with each other, they should either both use Java SDK, or both use Web3SDK.
71+
* FISCO BCOS v2.0+
72+
* AMOP Not compatible with Web3SDK
2673

2774
----
2875
请参考文档:

build.gradle

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ ext {
2626
bcprovJDK15onVersion = "1.60"
2727
keyMiniToolkit = "1.0.2"
2828

29-
solcJVersion = "0.4.25.1"
30-
//solcJVersion = "0.5.2.0"
31-
//solcJVersion = "0.6.10.0"
3229
slf4jVersion = "1.7.30"
3330
junitVersion = "4.12"
3431
commonsCollections4Version = "4.4"
@@ -39,7 +36,7 @@ ext {
3936
// integrationTest.mustRunAfter test
4037
allprojects {
4138
group = 'org.fisco-bcos.java-sdk'
42-
version = '2.6.1'
39+
version = '2.7.0-SNAPSHOT'
4340
apply plugin: 'maven'
4441
apply plugin: 'maven-publish'
4542
apply plugin: 'idea'
@@ -58,12 +55,14 @@ allprojects {
5855
html.enabled false
5956
}
6057
}
61-
sourceCompatibility = '1.8'
58+
sourceCompatibility = 1.8
59+
targetCompatibility = 1.8
6260

6361
// In this section you declare where to find the dependencies of your project
6462
repositories {
6563
mavenCentral()
6664
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
65+
maven { url "https://oss.sonatype.org/service/local/staging/deploy/maven2"}
6766
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
6867
}
6968

@@ -156,7 +155,6 @@ sourceSets {
156155
compileClasspath += main.output + test.output
157156
runtimeClasspath += main.output + test.output
158157
srcDir file('src/integration-test/java')
159-
srcDir file('sdk-demo/src/main')
160158
}
161159
resources.srcDir file('src/integration-test/resources')
162160
}
@@ -191,7 +189,6 @@ dependencies {
191189
compile ("com.moandjiezana.toml:toml4j:${toml4jVersion}")
192190

193191
testCompile ("org.apache.commons:commons-collections4:${commonsCollections4Version}")
194-
testCompile ("org.fisco-bcos:solcJ:${solcJVersion}")
195192
testCompile ("com.google.guava:guava:${guavaVersion}")
196193
}
197194

sdk-amop/src/main/java/org/fisco/bcos/sdk/amop/AmopImp.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,18 @@ public void sendAmopMsg(AmopMsgOut content, AmopResponseCallback callback) {
115115
new ResponseCallback() {
116116
@Override
117117
public void onResponse(Response response) {
118+
logger.trace(
119+
"receive response from subscriber, seq:{}",
120+
response.getMessageID());
118121
AmopResponse amopResponse = new AmopResponse(response);
119122
callback.onResponse(amopResponse);
120123
}
121124
};
122125
this.channel.asyncSendToRandom(msg, cb, ops);
123126
logger.info(
124-
"send amop msg to a random peer, seq{} topic{}", msg.getSeq(), content.getTopic());
127+
"send amop msg to a random peer, seq: {} topic: {}",
128+
msg.getSeq(),
129+
content.getTopic());
125130
}
126131

127132
@Override

sdk-amop/src/main/java/org/fisco/bcos/sdk/amop/topic/AmopMsgHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ public void onConnect(ChannelHandlerContext ctx) {
9090

9191
@Override
9292
public void onMessage(ChannelHandlerContext ctx, Message msg) {
93-
logger.trace(
94-
"receive msg, msg type:{}, content:{}", msg.getType(), new String(msg.getData()));
93+
logger.trace("receive msg, msg type:{}, seq:{}", msg.getType(), msg.getSeq());
9594
if (!isRunning) {
9695
logger.warn("Amop on msg, amop is not running, exit.");
9796
}

sdk-core/src/main/java/org/fisco/bcos/sdk/channel/ChannelImp.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,11 @@ public void run(Timeout timeout) {
327327
@Override
328328
public void asyncSendToRandom(Message out, ResponseCallback callback, Options options) {
329329
List<String> peerList = getAvailablePeer();
330+
if (peerList.size() == 0) {
331+
logger.warn(
332+
"no available peer to send to, seq: {}, type: {}", out.getSeq(), out.getType());
333+
return;
334+
}
330335
int random = (int) (Math.random() * (peerList.size()));
331336
String peerIpPort = peerList.get(random);
332337
logger.trace("send message to random peer {} ", peerIpPort);

sdk-core/src/main/java/org/fisco/bcos/sdk/channel/ChannelMsgHandler.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public void onConnect(ChannelHandlerContext ctx) {
120120

121121
@Override
122122
public void onMessage(ChannelHandlerContext ctx, Message msg) {
123-
logger.trace(
123+
logger.debug(
124124
"onMessage in ChannelMsgHandler called, host : {}, seq : {}, msgType : {}",
125125
ChannelVersionNegotiation.getPeerHost(ctx),
126126
msg.getSeq(),
@@ -129,10 +129,10 @@ public void onMessage(ChannelHandlerContext ctx, Message msg) {
129129
if (callback != null) {
130130
callback.cancelTimeout();
131131
logger.trace(
132-
" receive response, seq: {}, result: {}, content: {}",
132+
" call registered callback, seq: {}, type: {} ,result: {}",
133133
msg.getSeq(),
134-
msg.getResult(),
135-
new String(msg.getData()));
134+
msg.getType(),
135+
msg.getResult());
136136

137137
Response response = new Response();
138138
if (msg.getResult() != 0) {
@@ -144,15 +144,16 @@ public void onMessage(ChannelHandlerContext ctx, Message msg) {
144144
response.setCtx(ctx);
145145
callback.onResponse(response);
146146
} else {
147-
logger.trace(
148-
" receive response with invalid seq, type: {}, result: {}, content: {}",
149-
(int) msg.getType(),
150-
msg.getResult(),
151-
new String(msg.getData()));
152147
MsgHandler msgHandler = msgHandlers.get(msg.getType().intValue());
153148
if (msgHandler != null) {
149+
logger.trace(
150+
" receive message, no callback, call handler, seq:{} , type: {}, result: {}",
151+
msg.getSeq(),
152+
(int) msg.getType(),
153+
msg.getResult());
154154
msgHandler.onMessage(ctx, msg);
155155
}
156+
logger.debug(" call ");
156157
}
157158
}
158159

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2014-2020 [fisco-dev]
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5+
* in compliance with the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License
10+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
* or implied. See the License for the specific language governing permissions and limitations under
12+
* the License.
13+
*
14+
*/
15+
16+
package org.fisco.bcos.sdk.model;
17+
18+
import java.io.ByteArrayOutputStream;
19+
import java.io.IOException;
20+
import java.util.Arrays;
21+
import java.util.zip.DataFormatException;
22+
import java.util.zip.Deflater;
23+
import java.util.zip.Inflater;
24+
25+
public class DataCompress {
26+
public static byte[] compress(String data) {
27+
28+
Deflater compress = new Deflater();
29+
30+
compress.setInput(data.getBytes());
31+
32+
byte[] compressedData = new byte[data.length()];
33+
compress.finish();
34+
35+
int compressLength = compress.deflate(compressedData, 0, compressedData.length);
36+
return Arrays.copyOfRange(compressedData, 0, compressLength);
37+
}
38+
39+
public static byte[] uncompress(byte[] compressedData) throws IOException, DataFormatException {
40+
41+
Inflater decompressor = new Inflater();
42+
decompressor.setInput(compressedData);
43+
44+
try (ByteArrayOutputStream bos = new ByteArrayOutputStream(compressedData.length)) {
45+
byte[] buf = new byte[1024];
46+
while (!decompressor.finished()) {
47+
int count = decompressor.inflate(buf);
48+
bos.write(buf, 0, count);
49+
}
50+
51+
return bos.toByteArray();
52+
}
53+
}
54+
}

sdk-core/src/main/java/org/fisco/bcos/sdk/model/PrecompiledRetCode.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ public class PrecompiledRetCode {
4646
new RetCode(-52000, "The committee member already exist");
4747

4848
// ContractLifeCyclePrecompiled -51999 ~ -51900
49+
public static final RetCode CODE_INVALID_REVOKE_LAST_AUTHORIZATION =
50+
new RetCode(
51+
-51907, "The permission of the last contract status manager can't be revoked");
52+
public static final RetCode CODE_INVALID_NON_EXIST_AUTHORIZATION =
53+
new RetCode(-51906, "The contract status manager doesn't exist");
4954
public static final RetCode CODE_INVALID_NO_AUTHORIZED =
5055
new RetCode(-51905, "Have no permission to access the contract table");
5156
public static final RetCode CODE_INVALID_TABLE_NOT_EXIST =
@@ -72,6 +77,8 @@ public class PrecompiledRetCode {
7277
new RetCode(-51600, "Execute PaillierAdd failed");
7378

7479
// CRUDPrecompiled -51599 ~ -51500
80+
public static final RetCode CODE_INVALID_UPDATE_TABLE_KEY =
81+
new RetCode(-51503, "Don't update the table key");
7582
public static final RetCode CODE_CONDITION_OPERATION_UNDEFINED =
7683
new RetCode(-51502, "Undefined function of Condition Precompiled");
7784
public static final RetCode CODE_PARSE_CONDITION_ERROR =
@@ -100,7 +107,7 @@ public class PrecompiledRetCode {
100107
-51004,
101108
"The committee permission control by ChainGovernancePrecompiled are recommended");
102109
public static final RetCode CODE_CONTRACT_NOT_EXIST =
103-
new RetCode(-51003, "The contract is not exist");
110+
new RetCode(-51003, "The contract doesn't exist");
104111
public static final RetCode CODE_TABLE_NAME_OVERFLOW =
105112
new RetCode(-51002, "The table name string length exceeds the maximum limit");
106113
public static final RetCode CODE_TABLE_AND_ADDRESS_NOT_EXIST =

0 commit comments

Comments
 (0)