Skip to content

Commit 0f89b80

Browse files
authored
Merge 9640b51 into 0d7c686
2 parents 0d7c686 + 9640b51 commit 0f89b80

File tree

22 files changed

+360
-111
lines changed

22 files changed

+360
-111
lines changed

.ci/ci_check.sh

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,11 @@ pwd
157157
ls -la
158158
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
159159
download_tassl
160-
LOG_INFO "------ download_build_chain: v3.3.0---------"
161-
download_binary "v3.3.0"
162-
download_build_chain "v3.3.0"
160+
LOG_INFO "------ download_binary: v3.0.0---------"
161+
download_build_chain "v3.0.0"
162+
download_binary "v3.0.0"
163163
LOG_INFO "------ check_standard_node---------"
164-
check_standard_node "false" "sm" "-s"
165-
LOG_INFO "------ check_wasm_node---------"
166-
check_wasm_node "true"
167-
LOG_INFO "------ check_basic---------"
168-
check_basic
164+
check_standard_node
169165
rm -rf ./bin
170166

171167
LOG_INFO "------ download_binary: v3.2.0---------"
@@ -182,9 +178,18 @@ LOG_INFO "------ check_standard_node---------"
182178
check_standard_node
183179
rm -rf ./bin
184180

185-
LOG_INFO "------ download_binary: v3.0.0---------"
186-
download_build_chain "v3.0.0"
187-
download_binary "v3.0.0"
181+
LOG_INFO "------ download_binary: v3.2.0---------"
182+
download_build_chain "v3.2.0"
183+
download_binary "v3.2.0"
188184
LOG_INFO "------ check_standard_node---------"
189-
check_standard_node
190-
rm -rf ./bin
185+
check_standard_node "true" "sm" "-s -A"
186+
rm -rf ./bin
187+
188+
LOG_INFO "------ download_build_chain: v3.3.0---------"
189+
download_binary "v3.3.0"
190+
download_build_chain "v3.3.0"
191+
LOG_INFO "------ check_wasm_node---------"
192+
check_wasm_node "false"
193+
LOG_INFO "------ check_standard_node---------"
194+
check_standard_node "true" "sm" "-s"
195+
rm -rf ./bin

.github/workflows/workflow.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ jobs:
7878
- name: install CentOS dependencies
7979
run: yum install -y epel-release centos-release-scl wget which git openssl-devel openssl java java-devel tree
8080
- name: run build test
81-
run: /bin/bash gradlew build --info && tree ./build/reports
81+
run: /bin/bash gradlew build --info
82+
- name: run integration testing
83+
run: /bin/bash .ci/ci_check.sh && tree ./build/reports
8284
- name: upload unittest coverage
8385
run: curl -LO https://codecov.io/bash && /bin/bash ./bash
8486
# uses: codecov/codecov-action@v3
@@ -87,6 +89,4 @@ jobs:
8789
# files: ./build/reports/jacoco/test/jacocoTestReport.xml
8890
# flags: unittest
8991
# fail_ci_if_error: true
90-
# verbose: true
91-
- name: run integration testing
92-
run: /bin/bash .ci/ci_check.sh
92+
# verbose: true

Changelog.md

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,86 @@
1+
## v3.4.0
2+
(2023-06-09)
3+
4+
请阅读Java SDK v3.x+文档:
5+
6+
- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/develop/sdk/java_sdk/index.html)
7+
8+
### 新增
9+
10+
- 新增call with sign接口,支持在发起static call请求时使用私钥对请求体(to+data)进行签名,在节点侧将会对应恢复出签名对应的用户地址,合约中可以取到call请求时的tx.origin和msg.sender,达到用户身份认证的目的。
11+
- `Client`类新增`isEnableCommittee()`方法,与`isAuthCheck()`进行区分,用于判断当前链是否启用了治理委员会。
12+
- `Client`类新增 `getChainCompatibilityVersion()`,用于获取当前链的数据兼容版本号。
13+
14+
### 更新
15+
16+
-`Client`类的`getChainVersion()`设置为@Deprecated,建议使用`getChainCompatibilityVersion()`
17+
18+
### 修复
19+
20+
- 修复了开启治理委员会后,发起 `addSealerProposal` 提案时可能出现的观察节点未达到块高差值门限的问题。
21+
- 修复回执中状态数据与节点不匹配的问题。
22+
23+
### 兼容性说明
24+
25+
- 不兼容 FISCO BCOS 2.0+ 版本
26+
- 兼容java-sdk v3.0+的历史版本
27+
- 支持[FISCO BCOS 3.4.0](https://github.com/FISCO-BCOS/FISCO-BCOS/releases/tag/v3.4.0)版本,以及3.0.0正式版以来的所有版本。
28+
- 账户权限管理接口、BFS新增的list分页接口与link接口只在 FISCO BCOS 3.1.0支持使用。
29+
- 新增的CRUD接口,如条件范围遍历查询、修改、删除等接口,只在FISCO BCOS 3.2.0支持使用。
30+
- 新增的ShardService, 只在FISCO BCOS 3.3.0支持使用。
31+
32+
### 遗留问题说明
33+
34+
在工作量与收益之间做平衡之后,目前还遗留以下几种场景的编解码仍然可能会有问题,欢迎社区用户贡献解决方案或实现代码 :-)
35+
- 三维及以上的数组作为输入输出参数时,使用`contract2java`编译成Java文件后,方法接口可能会出现调用错误。
36+
- 在使用类似 `bytes[2][]` 这样的动态数组套静态数组,且基础类型仍然是动态类型的类型时,使用`contract2java`编译成Java文件后,方法接口调用时编解码可能会出现问题。
37+
- 在使用liquid合约时,如果使用上一条所述的类型作为输入输出参数,在合约方法接口调用时编解码可能会出现问题。
38+
- 在使用liquid合约时,将u256与i256类型的输入输出参数,如果输入最大值,BigInteger生成的bytes会超过大小限制。
39+
- 在使用liquid合约时,因为liquid合约的事件编码与Solidity合约的事件编码不同,所以在使用liquid合约的事件时,会出现Java sdk解析失败的问题。
40+
41+
---
42+
43+
## v3.4.0
44+
(2023-06-09)
45+
Please refer to the Java SDK v3.x+ documentation:
46+
47+
- [Chinese User Manual](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/develop/sdk/java_sdk/index.html)
48+
49+
### Added
50+
51+
- Added the "call with sign" interface, which supports signing the request body (to+data) with a private key when initiating a static call request. The corresponding user address will be recovered with the signature on the node side, and the tx.origin and msg.sender at the time of the call request can be obtained in the contract, achieving user identity authentication.
52+
- Added the `isEnableCommittee()` method to the `Client` class, which is used to determine whether the current chain has enabled the governance committee, differentiating it from `isAuthCheck()`.
53+
- Added the `getChainCompatibilityVersion()` method to the `Client` class, which is used to obtain the data compatibility version of the current chain.
54+
55+
### Updated
56+
57+
- Deprecated the `getChainVersion()` method of the `Client` class, and recommend using `getChainCompatibilityVersion()` instead.
58+
59+
### Fixed
60+
61+
- Fixed the issue where when the governance committee is enabled, there might be a problem with the observer nodes not reaching the block height difference threshold when initiating the `addSealerProposal` proposal.
62+
- Fixed the issue where the status data in the receipt does not match the chain node.
63+
64+
### Compatibility Notes
65+
66+
- Not compatible with FISCO BCOS 2.0+ versions.
67+
- Compatible with historical versions of java-sdk v3.0+.
68+
- Supports [FISCO BCOS 3.4.0](https://github.com/FISCO-BCOS/FISCO-BCOS/releases/tag/v3.4.0) version and all versions since the official release of 3.0.0.
69+
- The account permission management interface, list pagination interface, and link interface added by BFS are only supported in FISCO BCOS 3.1.0.
70+
- The newly added CRUD interfaces, such as conditional range traversal query, modification, deletion, etc., are only supported in FISCO BCOS 3.2.0.
71+
- The newly added ShardService is only supported in FISCO BCOS 3.3.0.
72+
73+
### Known Issues
74+
75+
After balancing the workload and benefits, there are still potential issues with the following scenarios in the encoding and decoding process. Community users are welcome to contribute solutions or implementation code :-)
76+
- When using arrays of three dimensions or more as input or output parameters, there may be invocation errors in the method interface after compiling into Java files using `contract2java`.
77+
- When using a dynamic array nested in a static array, such as `bytes[2][]`, and the base type is still a dynamic type, there may be issues with encoding and decoding in the method interface when compiling into Java files using `contract2java`.
78+
- When using the liquid contract, if the aforementioned types are used as input or output parameters, there may be issues with encoding and decoding in the method interface when calling the contract.
79+
- When using the liquid contract, if the u256 and i256 types are used as input or output parameters and the maximum value is input, the bytes generated by BigInteger may exceed the size limit.
80+
- When using the liquid contract, because the event encoding of the liquid contract is different from that of Solidity contract, there may be issues with Java SDK parsing when using the events of the liquid contract.
81+
82+
---
83+
184
## v3.3.0
285
(2023-04-17)
386

@@ -40,9 +123,10 @@
40123

41124
- 不兼容 FISCO BCOS 2.0+ 版本
42125
- 兼容java-sdk v3.0+的历史版本
43-
- 支持[FISCO BCOS 3.2.0](https://github.com/FISCO-BCOS/FISCO-BCOS/releases/tag/v3.2.0)版本
126+
- 支持[FISCO BCOS 3.3.0](https://github.com/FISCO-BCOS/FISCO-BCOS/releases/tag/v3.3.0)版本
44127
- 账户权限管理接口、BFS新增的list分页接口与link接口只在 FISCO BCOS 3.1.0支持使用。
45128
- 新增的CRUD接口,如条件范围遍历查询、修改、删除等接口,只在FISCO BCOS 3.2.0支持使用。
129+
- 新增的ShardService, 只在FISCO BCOS 3.3.0支持使用。
46130

47131
### 遗留问题说明
48132

build.gradle

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ext {
2525
junitVersion = '4.13.2'
2626
commonsCollections4Version = "4.4"
2727
guavaVersion = '31.1-jre'
28-
bcosSdkJniVersion = "3.3.0"
28+
bcosSdkJniVersion = "3.4.0"
2929
slf4jApiVerison = '1.7.36'
3030
mockitoVersion = '4.8.0'
3131
gsonVersion = '2.10.1'
@@ -35,7 +35,7 @@ ext {
3535
// integrationTest.mustRunAfter test
3636
allprojects {
3737
group = 'org.fisco-bcos.java-sdk'
38-
version = '3.4.0-SNAPSHOT'
38+
version = '3.4.0'
3939

4040
apply plugin: 'maven-publish'
4141
apply plugin: 'idea'
@@ -53,12 +53,6 @@ allprojects {
5353
jacoco {
5454
toolVersion = "0.8.6"
5555
}
56-
jacocoTestReport {
57-
reports {
58-
xml.enabled true
59-
html.enabled false
60-
}
61-
}
6256
sourceCompatibility = 1.8
6357
targetCompatibility = 1.8
6458

@@ -169,11 +163,13 @@ configurations {
169163
}
170164

171165
task integrationTest(type: Test) {
166+
dependsOn test
172167
testClassesDirs = sourceSets.integrationTest.output.classesDirs
173168
classpath = sourceSets.integrationTest.runtimeClasspath
174169
}
175170

176171
task integrationWasmTest(type: Test) {
172+
dependsOn test
177173
testClassesDirs = sourceSets.integrationWasmTest.output.classesDirs
178174
classpath = sourceSets.integrationWasmTest.runtimeClasspath
179175
}
@@ -194,6 +190,22 @@ task javadocJar(type: Jar) {
194190
archiveClassifier = 'javadoc'
195191
}
196192

193+
jacocoTestReport {
194+
// The JaCoCo plugin adds a JacocoTaskExtension extension to all tasks of type Test.
195+
// Use task state to include or not task execution data
196+
// https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskState.html
197+
// This declaration will be used as a closure, notice there no wrapping parenthesis
198+
executionData { tasks.withType(Test).findAll { it.jacoco.destinationFile.exists() }*.jacoco.destinationFile }
199+
reports {
200+
xml.enabled true
201+
html.enabled true
202+
}
203+
}
204+
205+
tasks.withType(Test) {
206+
finalizedBy jacocoTestReport
207+
}
208+
197209
publishing {
198210
publications {
199211
mavenJava(MavenPublication) {

src/integration-test/java/org/fisco/bcos/sdk/v3/test/BcosSDKTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public void onError(Response errorResponse) {
336336
String txHash = receipt.getTransactionHash();
337337
BcosTransaction transaction1 = client.getTransaction(txHash, false);
338338
BcosTransactionReceipt transactionReceipt = client.getTransactionReceipt(txHash, false);
339-
if (client.getChainVersion().compareTo(EnumNodeVersion.BCOS_3_2_0) >= 0) {
339+
if (client.getChainCompatibilityVersion().compareTo(EnumNodeVersion.BCOS_3_2_0.toVersionObj()) >= 0) {
340340
Assert.assertEquals(extraData, transaction1.getResult().getExtraData());
341341
Assert.assertEquals(extraData, transactionReceipt.getResult().getExtraData());
342342
}

src/integration-test/java/org/fisco/bcos/sdk/v3/test/precompiled/PrecompiledTest.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
import org.junit.Test;
6161
import org.junit.runners.MethodSorters;
6262

63+
import static org.fisco.bcos.sdk.v3.contract.precompiled.sysconfig.SystemConfigService.AUTH_STATUS;
64+
6365
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
6466
public class PrecompiledTest {
6567
private static final String configFile =
@@ -158,7 +160,14 @@ public void test3SystemConfigService() throws ConfigException, ContractException
158160

159161
CryptoKeyPair cryptoKeyPair = client.getCryptoSuite().getCryptoKeyPair();
160162
SystemConfigService systemConfigService = new SystemConfigService(client, cryptoKeyPair);
161-
if (client.isAuthCheck()) {
163+
boolean authCheck = client.isAuthCheck();
164+
if (client.getChainCompatibilityVersion().compareTo(EnumNodeVersion.BCOS_3_3_0.toVersionObj()) >= 0) {
165+
String value = client.getSystemConfigByKey(AUTH_STATUS).getSystemConfig().getValue();
166+
if (Objects.equals(value, "0")) {
167+
authCheck = false;
168+
}
169+
}
170+
if (authCheck) {
162171
RetCode retCode = systemConfigService.setValueByKey("tx_count_limit", "100");
163172
Assert.assertEquals(retCode.code, PrecompiledRetCode.CODE_NO_AUTHORIZED.code);
164173
return;
@@ -200,7 +209,7 @@ public void test5CRUDService() throws ConfigException, ContractException {
200209
}
201210
RetCode code;
202211
Map<String, List<String>> desc;
203-
if (client.getChainVersion().compareToVersion(EnumNodeVersion.BCOS_3_2_0) >= 0) {
212+
if (client.getChainCompatibilityVersion().compareTo(EnumNodeVersion.BCOS_3_2_0.toVersionObj()) >= 0) {
204213
code = tableCRUDService.createTable(tableName, Common.TableKeyOrder.valueOf(0), key, valueFields);
205214
desc = tableCRUDService.descWithKeyOrder(tableName);
206215
} else {
@@ -222,7 +231,7 @@ public void test5CRUDService() throws ConfigException, ContractException {
222231
// select key
223232
Map<String, String> result = tableCRUDService.select(tableName, "key1");
224233

225-
if (client.getChainVersion().compareToVersion(EnumNodeVersion.BCOS_3_2_0) >= 0) {
234+
if (client.getChainCompatibilityVersion().compareTo(EnumNodeVersion.BCOS_3_2_0.toVersionObj()) >= 0) {
226235
ConditionV320 condition = new ConditionV320();
227236
condition.EQ(key, "key1");
228237
condition.setLimit(0, 10);
@@ -269,7 +278,7 @@ public void test51SyncCRUDService() throws ConfigException, ContractException, J
269278
List<String> valueFiled = new ArrayList<>();
270279
valueFiled.add("field");
271280
RetCode retCode;
272-
if (client.getChainVersion().compareToVersion(EnumNodeVersion.BCOS_3_2_0) >= 0) {
281+
if (client.getChainCompatibilityVersion().compareTo(EnumNodeVersion.BCOS_3_2_0.toVersionObj()) >= 0) {
273282
retCode = crudService.createTable(tableName, Common.TableKeyOrder.valueOf(0), "key", valueFiled);
274283
} else {
275284
retCode = crudService.createTable(tableName, "key", valueFiled);
@@ -346,7 +355,7 @@ public void test52AsyncCRUDService()
346355
List<String> valueFiled = new ArrayList<>();
347356
valueFiled.add("field");
348357
String key = "key";
349-
if (client.getChainVersion().compareToVersion(EnumNodeVersion.BCOS_3_2_0) >= 0) {
358+
if (client.getChainCompatibilityVersion().compareTo(EnumNodeVersion.BCOS_3_2_0.toVersionObj()) >= 0) {
350359
crudService.createTable(tableName, Common.TableKeyOrder.valueOf(0), key, valueFiled);
351360
} else {
352361
crudService.createTable(tableName, key, valueFiled);
@@ -415,7 +424,7 @@ public void test6KVService() throws ConfigException, ContractException {
415424
Assert.assertEquals(0, code.getCode());
416425
// desc
417426
Map<String, String> desc;
418-
if (client.getChainVersion().compareToVersion(EnumNodeVersion.BCOS_3_2_0) >= 0) {
427+
if (client.getChainCompatibilityVersion().compareTo(EnumNodeVersion.BCOS_3_2_0.toVersionObj()) >= 0) {
419428
desc = kvTableService.descWithKeyOrder(tableName);
420429
} else {
421430
desc = kvTableService.desc(tableName);

src/integration-test/java/org/fisco/bcos/sdk/v3/test/transaction/manager/AssembleTransactionProcessorTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ public void test1HelloWorld() throws Exception {
103103
Assert.assertTrue(Objects.nonNull(transactionReceipt.getOutput()) && StringUtils.isNotBlank(transactionReceipt.getOutput()));
104104
Assert.assertTrue(Objects.nonNull(transactionReceipt.getReceiptHash()) && StringUtils.isNotBlank(transactionReceipt.getReceiptHash()));
105105
Assert.assertTrue(Objects.nonNull(transactionReceipt.getFrom()) && StringUtils.isNotBlank(transactionReceipt.getFrom()));
106-
if (client.getChainVersion().compareToVersion(EnumNodeVersion.BCOS_3_1_0) >= 0) {
106+
if (client.getChainCompatibilityVersion().compareTo(EnumNodeVersion.BCOS_3_1_0.toVersionObj()) >= 0) {
107107
Assert.assertTrue(Objects.nonNull(transactionReceipt.getChecksumContractAddress()) && StringUtils.isNotBlank(transactionReceipt.getChecksumContractAddress()));
108108
Assert.assertTrue(transactionReceipt.getChecksumContractAddress().equalsIgnoreCase(transactionReceipt.getContractAddress()));
109109
}
110110
Assert.assertTrue(Objects.nonNull(transactionReceipt.getTo()));
111111

112-
if (client.getChainVersion().compareToVersion(EnumNodeVersion.BCOS_3_3_0) >= 0) {
112+
if (client.getChainCompatibilityVersion().compareTo(EnumNodeVersion.BCOS_3_3_0.toVersionObj()) >= 0) {
113113
Assert.assertTrue(Objects.nonNull(transactionReceipt.getInput()) && StringUtils.isNotBlank(transactionReceipt.getInput()));
114114
}
115115

@@ -561,7 +561,7 @@ public void test11CallWithSign() throws Exception {
561561
TransactionProcessorFactory.createAssembleTransactionProcessor(
562562
this.client, this.cryptoKeyPair, ABI_FILE, BIN_FILE);
563563

564-
if(client.getChainVersion().compareToVersion(EnumNodeVersion.BCOS_3_4_0) < 0){
564+
if(client.getChainCompatibilityVersion().compareTo(EnumNodeVersion.BCOS_3_4_0.toVersionObj()) < 0){
565565
return;
566566
}
567567
String contractAddress = null;

src/main/java/org/fisco/bcos/sdk/v3/client/Client.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,15 @@ static Client build(String groupId, ConfigOption configOption, long nativePointe
133133
*/
134134
Boolean isAuthCheck();
135135

136+
/**
137+
* Whether is committee enable in chain
138+
*
139+
* @return true when chain can use committee
140+
*/
141+
Boolean isEnableCommittee();
142+
136143
Boolean isSerialExecute();
144+
137145
/**
138146
* get groupId of the client
139147
*
@@ -911,15 +919,20 @@ void getTransactionReceiptAsync(
911919
* get the chain compatibility version
912920
*
913921
* @return the chain compatibility version
922+
* @deprecated use getChainCompatibilityVersion instead, because older version sdk did not
923+
* recognize newer chain node
914924
*/
925+
@Deprecated
915926
EnumNodeVersion getChainVersion();
916927

928+
EnumNodeVersion.Version getChainCompatibilityVersion();
929+
917930
/**
918931
* async get the chain compatibility version
919932
*
920933
* @param versionRespCallback the callback instance
921934
*/
922-
void getChainVersionAsync(RespCallback<EnumNodeVersion> versionRespCallback);
935+
void getChainVersionAsync(RespCallback<EnumNodeVersion.Version> versionRespCallback);
923936

924937
void start();
925938

0 commit comments

Comments
 (0)