Skip to content

Commit 0e3638d

Browse files
authored
Merge pull request #769 from kyonRay/master
Release-3.4.0
2 parents be8707f + afec489 commit 0e3638d

File tree

6 files changed

+82
-42
lines changed

6 files changed

+82
-42
lines changed

.ci/ci_check.sh

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,7 @@ prepare_environment()
6767

6868
build_node()
6969
{
70-
local node_type="${1}"
71-
if [ "${node_type}" == "sm" ];then
72-
bash build_chain.sh -l 127.0.0.1:4 -s -A -e ./fisco-bcos
73-
else
74-
bash build_chain.sh -l 127.0.0.1:4 -A -e ./fisco-bcos
75-
fi
70+
bash build_chain.sh -l 127.0.0.1:4 ${@} -e ./fisco-bcos
7671
./nodes/127.0.0.1/fisco-bcos -v
7772
./nodes/127.0.0.1/start_all.sh
7873
}
@@ -88,7 +83,7 @@ clean_node()
8883

8984
check_standard_node()
9085
{
91-
build_node
86+
build_node ${@:2}
9287
prepare_environment
9388
## run integration test
9489
bash gradlew test --info
@@ -98,7 +93,7 @@ check_standard_node()
9893

9994
check_sm_node()
10095
{
101-
build_node sm
96+
build_node ${@:2} -s
10297
prepare_environment sm
10398
## run integration test
10499
bash gradlew test --info
@@ -118,26 +113,34 @@ bash gradlew integrationTest --info
118113
}
119114

120115
#cp src/integration-test/resources/config-example.toml src/integration-test/resources/config.toml
121-
#LOG_INFO "------ download_build_chain---------"
122-
download_binary "v3.2.0"
123-
download_build_chain "v3.2.0"
116+
download_tassl
117+
LOG_INFO "------ download_binary: v3.3.0---------"
118+
download_binary "v3.3.0"
119+
download_build_chain "v3.3.0"
124120
LOG_INFO "------ check_standard_node---------"
125121
check_standard_node false
126122
LOG_INFO "------ check_sm_node---------"
127123
check_sm_node true
128124
LOG_INFO "------ check_basic---------"
129125
check_basic
130126

127+
LOG_INFO "------ download_binary: v3.2.0---------"
128+
download_binary "v3.2.0"
129+
download_build_chain "v3.2.0"
130+
LOG_INFO "------ check_standard_node---------"
131+
check_standard_node -s
132+
rm -rf ./bin
133+
131134
LOG_INFO "------ download_binary: v3.1.0---------"
132135
download_binary "v3.1.0"
133136
download_build_chain "v3.1.0"
134137
LOG_INFO "------ check_standard_node---------"
135-
check_standard_node
138+
check_standard_node -s
136139
rm -rf ./bin
137140

138141
LOG_INFO "------ download_binary: v3.0.0---------"
139142
download_binary "v3.0.0"
140143
download_build_chain "v3.0.0"
141144
LOG_INFO "------ check_standard_node---------"
142-
check_standard_node
145+
check_standard_node -s
143146
rm -rf ./bin

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies {
4040
//compile 'org.fisco-bcos:solcJ:0.5.2.1'
4141
compile 'org.fisco-bcos:solcJ:0.8.11.1'
4242

43-
compile('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:3.3.0') {
43+
compile('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:3.4.0-SNAPSHOT') {
4444
exclude group: "org.slf4j"
4545
}
4646

src/main/java/console/common/ConsoleUtils.java

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import console.contract.utils.ContractCompiler;
66
import console.exception.ConsoleMessageException;
77
import java.io.File;
8+
import java.io.FileFilter;
89
import java.io.IOException;
910
import java.io.Reader;
1011
import java.io.StreamTokenizer;
@@ -561,6 +562,50 @@ public static String getLiquidFilePath(String liquidFileNameOrPath)
561562
return liquidFile.getAbsolutePath();
562563
}
563564

565+
// scan file in path matches suffix
566+
public static String scanPathWithSuffix(String path, String suffix)
567+
throws ConsoleMessageException {
568+
class FileSuffixFilter implements FileFilter {
569+
final String suffix;
570+
571+
FileSuffixFilter(String suffix) {
572+
this.suffix = suffix.toLowerCase();
573+
}
574+
575+
@Override
576+
public boolean accept(File pathname) {
577+
if (pathname.getName().toLowerCase().endsWith(this.suffix)) {
578+
return !pathname.getName().toLowerCase().endsWith("_gm" + this.suffix);
579+
}
580+
return false;
581+
}
582+
}
583+
File scanFile = new File(path);
584+
// not exist or not a directory, use contract path
585+
if (!scanFile.exists() || !scanFile.isDirectory()) {
586+
scanFile =
587+
new File(
588+
suffix.equals(SOL_SUFFIX)
589+
? SOLIDITY_PATH
590+
: LIQUID_PATH + File.separator + path);
591+
}
592+
// still not exist
593+
if (!scanFile.exists() || !scanFile.isDirectory()) {
594+
throw new ConsoleMessageException("There is no any file end with " + suffix);
595+
}
596+
File[] files = scanFile.listFiles(new FileSuffixFilter(suffix));
597+
if (files == null || files.length == 0) {
598+
throw new ConsoleMessageException("There is no any file end with " + suffix);
599+
} else if (files.length > 1) {
600+
throw new ConsoleMessageException(
601+
"There are more than one file end with "
602+
+ suffix
603+
+ ": "
604+
+ Arrays.toString(files));
605+
}
606+
return files[0].getAbsolutePath();
607+
}
608+
564609
public static String resolvePath(String path) {
565610
if (path.startsWith("~/")) {
566611
return Paths.get(System.getProperty("user.home")).resolve(path.substring(2)).toString();

src/main/java/console/common/ConsoleVersion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class ConsoleVersion {
44

5-
public static final String Version = "3.3.0";
5+
public static final String Version = "3.4.0";
66

77
public static void main(String[] args) {
88
System.out.println("console version: " + Version);

src/main/java/console/contract/ConsoleContractImpl.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,9 @@ public void deploy(String[] params, String pwd) throws Exception {
148148
? "_gm" + ContractCompiler.WASM_SUFFIX
149149
: ContractCompiler.WASM_SUFFIX;
150150
String liquidDir = paramsList.get(1);
151-
// test/test.wasm test/test_gm.wasm
152-
String wasmBinPath =
153-
liquidDir + File.separator + FilenameUtils.getBaseName(liquidDir) + wasmSuffix;
154-
// test/test.abi
155-
String abi =
156-
liquidDir
157-
+ File.separator
158-
+ FilenameUtils.getBaseName(liquidDir)
159-
+ ContractCompiler.ABI_SUFFIX;
160-
String binPath = ConsoleUtils.getLiquidFilePath(ConsoleUtils.resolvePath(wasmBinPath));
161-
String abiPath = ConsoleUtils.getLiquidFilePath(ConsoleUtils.resolvePath(abi));
151+
String binPath = ConsoleUtils.scanPathWithSuffix(liquidDir, wasmSuffix);
152+
String abiPath =
153+
ConsoleUtils.scanPathWithSuffix(liquidDir, ContractCompiler.ABI_SUFFIX);
162154
String path = paramsList.get(2);
163155
try {
164156
path = ConsoleUtils.fixedBfsParam(path, pwd);
@@ -182,7 +174,7 @@ public void deploy(String[] params, String pwd) throws Exception {
182174
}
183175

184176
private void deployLink(String linkPath, String address, String abiString) throws Exception {
185-
EnumNodeVersion.Version supportedVersion = bfsService.getCurrentVersion().toVersionObj();
177+
EnumNodeVersion.Version supportedVersion = bfsService.getCurrentVersion();
186178
final RetCode retCode;
187179
if (supportedVersion.compareTo(EnumNodeVersion.BCOS_3_1_0.toVersionObj()) >= 0) {
188180
retCode =
@@ -742,7 +734,7 @@ private void sendCall(
742734
}
743735
CryptoKeyPair cryptoKeyPair = client.getCryptoSuite().getCryptoKeyPair();
744736
CallResponse response =
745-
assembleTransactionProcessor.sendCallWithStringParams(
737+
assembleTransactionProcessor.sendCallWithSignWithStringParams(
746738
cryptoKeyPair.getAddress(),
747739
contractAddress,
748740
abiAndBin.getAbi(),

src/main/java/console/precompiled/PrecompiledImpl.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void desc(String[] params) throws Exception {
138138
}
139139
Map<String, List<String>> tableDesc;
140140
EnumNodeVersion.Version supportedVersion =
141-
EnumNodeVersion.valueOf((int) tableCRUDService.getCurrentVersion()).toVersionObj();
141+
EnumNodeVersion.valueFromCompatibilityVersion(tableCRUDService.getCurrentVersion());
142142
if (supportedVersion.compareTo(EnumNodeVersion.BCOS_3_2_0.toVersionObj()) >= 0) {
143143
tableDesc = tableCRUDService.descWithKeyOrder(tableName);
144144
} else {
@@ -164,7 +164,7 @@ public void createTable(String sql) throws Exception {
164164
}
165165
CRUDParseUtils.parseCreateTable(sql, table);
166166
EnumNodeVersion.Version supportedVersion =
167-
EnumNodeVersion.valueOf((int) tableCRUDService.getCurrentVersion()).toVersionObj();
167+
EnumNodeVersion.valueFromCompatibilityVersion(tableCRUDService.getCurrentVersion());
168168
RetCode result;
169169
if (supportedVersion.compareTo(EnumNodeVersion.BCOS_3_2_0.toVersionObj()) >= 0) {
170170
result =
@@ -217,8 +217,8 @@ public void insert(String sql) throws Exception {
217217
Table table = new Table();
218218
String tableName = CRUDParseUtils.parseTableNameFromSql(sql);
219219
EnumNodeVersion.Version supportedVersion =
220-
EnumNodeVersion.valueOf((int) tableCRUDService.getCurrentVersion())
221-
.toVersionObj();
220+
EnumNodeVersion.valueFromCompatibilityVersion(
221+
tableCRUDService.getCurrentVersion());
222222
Map<String, List<String>> descTable;
223223
if (supportedVersion.compareTo(EnumNodeVersion.BCOS_3_2_0.toVersionObj()) >= 0) {
224224
descTable = tableCRUDService.descWithKeyOrder(tableName);
@@ -281,8 +281,8 @@ public void update(String sql) throws Exception {
281281
table.setValueFields(descTable.get(PrecompiledConstant.VALUE_FIELD_NAME));
282282

283283
EnumNodeVersion.Version supportedVersion =
284-
EnumNodeVersion.valueOf((int) tableCRUDService.getCurrentVersion())
285-
.toVersionObj();
284+
EnumNodeVersion.valueFromCompatibilityVersion(
285+
tableCRUDService.getCurrentVersion());
286286
RetCode updateResult;
287287
if (supportedVersion.compareTo(EnumNodeVersion.BCOS_3_2_0.toVersionObj()) >= 0) {
288288
ConditionV320 conditionV320 = new ConditionV320();
@@ -330,8 +330,9 @@ public void remove(String sql) throws Exception {
330330
table.setValueFields(descTable.get(PrecompiledConstant.VALUE_FIELD_NAME));
331331

332332
EnumNodeVersion.Version supportedVersion =
333-
EnumNodeVersion.valueOf((int) tableCRUDService.getCurrentVersion())
334-
.toVersionObj();
333+
EnumNodeVersion.valueFromCompatibilityVersion(
334+
tableCRUDService.getCurrentVersion());
335+
335336
RetCode removeResult;
336337
if (supportedVersion.compareTo(EnumNodeVersion.BCOS_3_2_0.toVersionObj()) >= 0) {
337338
ConditionV320 conditionV320 = new ConditionV320();
@@ -385,8 +386,8 @@ public void select(String sql) throws ConsoleMessageException, ContractException
385386
table.setValueFields(descTable.get(PrecompiledConstant.VALUE_FIELD_NAME));
386387

387388
EnumNodeVersion.Version supportedVersion =
388-
EnumNodeVersion.valueOf((int) tableCRUDService.getCurrentVersion())
389-
.toVersionObj();
389+
EnumNodeVersion.valueFromCompatibilityVersion(
390+
tableCRUDService.getCurrentVersion());
390391
List<Map<String, String>> result = new ArrayList<>();
391392
if (supportedVersion.compareTo(EnumNodeVersion.BCOS_3_2_0.toVersionObj()) >= 0) {
392393
ConditionV320 conditionV320 = new ConditionV320();
@@ -466,7 +467,7 @@ public void changeDir(String[] params) throws Exception {
466467
pwd = path;
467468
return;
468469
}
469-
EnumNodeVersion.Version supportedVersion = bfsService.getCurrentVersion().toVersionObj();
470+
EnumNodeVersion.Version supportedVersion = bfsService.getCurrentVersion();
470471
if (supportedVersion.compareTo(EnumNodeVersion.BCOS_3_1_0.toVersionObj()) >= 0) {
471472
BFSInfo bfsInfo = bfsService.isExist(path);
472473
if (bfsInfo != null) {
@@ -527,8 +528,7 @@ public void listDir(String[] params) throws Exception {
527528
BigInteger offset = BigInteger.ZERO;
528529
do {
529530
Tuple2<BigInteger, List<BfsInfo>> fileInfoList;
530-
EnumNodeVersion.Version supportedVersion =
531-
bfsService.getCurrentVersion().toVersionObj();
531+
EnumNodeVersion.Version supportedVersion = bfsService.getCurrentVersion();
532532
if (supportedVersion.compareTo(EnumNodeVersion.BCOS_3_1_0.toVersionObj()) >= 0) {
533533
fileInfoList = bfsService.list(listPath, offset, Common.LS_DEFAULT_COUNT);
534534
} else {
@@ -677,7 +677,7 @@ public void link(String[] params) throws Exception {
677677
}
678678

679679
RetCode retCode;
680-
EnumNodeVersion.Version supportedVersion = bfsService.getCurrentVersion().toVersionObj();
680+
EnumNodeVersion.Version supportedVersion = bfsService.getCurrentVersion();
681681
if (supportedVersion.compareTo(EnumNodeVersion.BCOS_3_1_0.toVersionObj()) >= 0) {
682682
retCode =
683683
bfsService.link(

0 commit comments

Comments
 (0)