Skip to content

Commit 8aecec9

Browse files
authored
Merge pull request #227 from youwenbusi/develop
v3.0.0 final commit
2 parents d4323b3 + 75a2955 commit 8aecec9

28 files changed

+271
-315
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
### V3.0.0 (2022-12-15)
2+
* 优化功能:
3+
1. 修复registerPolicy失败和部署Evidence合约失败
4+
2. 集成weid-java-sdk 3.0.0和weid-kit 3.0.0
5+
16
### V1.3.1 (2022-10-14)
27
* 优化功能:
38
1. 前端获取weid列表的方式改变

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.1-rc2-SNAPSHOT
1+
3.0.0-rc.1

build.gradle

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def repo ="${repoType}"
3535
sourceCompatibility = 1.8
3636
targetCompatibility = 1.8
3737

38-
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
38+
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'utf-8'
3939

4040
// In this section you declare where to find the dependencies of your project
4141
repositories {
@@ -127,6 +127,10 @@ configurations {
127127
all*.exclude group: "org.apache.logging.log4j", module: "log4j-to-slf4j"
128128
}
129129

130+
configurations.all {
131+
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
132+
}
133+
130134
// In this section you declare the dependencies for your production and test code
131135
dependencies {
132136
localDeps lombok
@@ -142,6 +146,7 @@ dependencies {
142146
exclude group: "javax.validation", module: "validation-api"
143147
exclude group: "org.codehaus.jackson", module: "jackson-mapper-asl"
144148
}
149+
compile("com.webank:weid-kit:3.0.0-rc.1")
145150
}
146151
}
147152
if (gradleVer.startsWith("5")) {
@@ -154,6 +159,7 @@ dependencies {
154159
exclude group: "javax.validation", module: "validation-api"
155160
exclude group: "org.codehaus.jackson", module: "jackson-mapper-asl"
156161
}
162+
compile("com.webank:weid-kit:3.0.0-rc.1")
157163
} else {
158164
compileOnly files('dist/lib/lombok-1.18.12.jar')
159165
annotationProcessor files('dist/lib/lombok-1.18.12.jar')
@@ -187,7 +193,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
187193
artifacts {
188194
archives jar
189195
archives sourcesJar
190-
//archives javadocJar
196+
archives javadocJar
191197
}
192198

193199

@@ -318,9 +324,9 @@ signing {
318324
}
319325

320326
gradle.taskGraph.whenReady { taskGraph ->
321-
if (taskGraph.allTasks.any { it.name == 'build' || it.name == 'assemble' }) {
327+
if (taskGraph.allTasks.any { it.name == 'build' || it.name == 'signDocsJar' || it.name == 'assemble' }) {
322328
tasks.findAll {
323-
it.name == 'signArchives' || it.name == 'signDocsJar' || it.name == 'signTestJar'
329+
it.name == 'signArchives' || it.name == 'signTestJar'
324330
}.each { task ->
325331
task.enabled = false
326332
}

common/script/tpl/weidentity.properties.tpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ chain.id=${CHAIN_ID}
1414
amop.request.timeout=5000
1515

1616
amop.id=${AMOP_ID}
17-
amop.privateKey="xeewrwervvwv"
1817

1918
# Blockchain node info.
2019
nodes=${BLOCKCHIAN_NODE_INFO}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
2-
weidSdkVersion=1.8.6-rc.3-SNAPSHOT
2+
weidSdkVersion=3.0.0-rc.1
33
repoType=zn
44
jdkTlsNamedGroups=secp256r1,secp256k1
55
signing.keyId=

run.config

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
#fill with your node ip and channel_listen_port, example: 0.0.0.0:20200
66
#if you have more than one node ,you can put them with separator","
77
#for example: 0.0.0.0:20200,0:0:0:1:20200
8-
blockchain_address=127.0.0.1:23200
8+
blockchain_address=127.0.0.1:25200
99

1010
#this build tool supports FISCO BCOS 2.0 and FISCO BCOS 3.0
1111
#if you want to build on FISCO BCOS 2.0, please fill with "2".
1212
#if you want to build on FISCO BCOS 3.0, please fill with "3".
1313
#and default value is "2" with FISCO BCOS 2.0.
14-
blockchain_fiscobcos_version=2
14+
blockchain_fiscobcos_version=3
1515

1616
#your organization name, used for communication on blockchain.
1717
org_id=webank
@@ -23,7 +23,7 @@ amop_id=11
2323
chain_id=1
2424

2525
#group id
26-
group_id=1
26+
group_id=group0
2727

2828
#sdk use sm ssl, 0:非国密;1:国密
2929
sm_crypto=1
@@ -41,4 +41,4 @@ redis_password=
4141
#"stg" to set the test environment, "prd" to set the production environment.
4242
#If you do not set it, the system will use allOrg as the environment by default.
4343
#It is not recommended. Production use default configuration
44-
cns_profile_active=prdabe
44+
cns_profile_active=prdabf

src/main/java/com/webank/weid/command/DeployContract.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,24 @@
22

33
package com.webank.weid.command;
44

5-
import com.webank.weid.contract.deploy.v3.DeployContractV3;
6-
import org.apache.commons.lang3.StringUtils;
7-
import org.slf4j.Logger;
8-
import org.slf4j.LoggerFactory;
9-
105
import com.beust.jcommander.JCommander;
11-
import com.webank.weid.config.ContractConfig;
12-
import com.webank.weid.config.FiscoConfig;
6+
import com.webank.weid.blockchain.config.ContractConfig;
7+
import com.webank.weid.blockchain.config.FiscoConfig;
8+
import com.webank.weid.blockchain.constant.CnsType;
9+
import com.webank.weid.blockchain.deploy.v2.DeployContractV2;
10+
import com.webank.weid.blockchain.deploy.v3.DeployContractV3;
1311
import com.webank.weid.config.StaticConfig;
14-
import com.webank.weid.constant.CnsType;
1512
import com.webank.weid.constant.DataFrom;
16-
import com.webank.weid.contract.deploy.v2.DeployContractV2;
1713
import com.webank.weid.dto.DeployInfo;
1814
import com.webank.weid.protocol.base.WeIdPrivateKey;
1915
import com.webank.weid.service.ConfigService;
2016
import com.webank.weid.service.ContractService;
2117
import com.webank.weid.service.GuideService;
2218
import com.webank.weid.util.FileUtils;
2319
import com.webank.weid.util.WeIdSdkUtils;
20+
import org.apache.commons.lang3.StringUtils;
21+
import org.slf4j.Logger;
22+
import org.slf4j.LoggerFactory;
2423

2524
import static com.webank.weid.constant.ChainVersion.FISCO_V2;
2625

@@ -69,9 +68,9 @@ public static void main(String[] args) {
6968
WeIdPrivateKey currentPrivateKey = WeIdSdkUtils.getCurrentPrivateKey();
7069
// 写入全局配置中
7170
if (FISCO_V2.getVersion() == Integer.parseInt(fiscoConfig.getVersion())) {
72-
DeployContractV2.putGlobalValue(fiscoConfig, contract, currentPrivateKey);
71+
DeployContractV2.putGlobalValue(fiscoConfig, contract, currentPrivateKey.getPrivateKey());
7372
} else {
74-
DeployContractV3.putGlobalValue(fiscoConfig, contract, currentPrivateKey);
73+
DeployContractV3.putGlobalValue(fiscoConfig, contract, currentPrivateKey.getPrivateKey());
7574

7675
}
7776
System.out.println("begin enable the hash.");

src/main/java/com/webank/weid/command/DeployEvidence.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
package com.webank.weid.command;
44

5-
import org.apache.commons.lang3.StringUtils;
6-
import org.apache.commons.lang3.math.NumberUtils;
7-
85
import com.beust.jcommander.JCommander;
9-
import com.webank.weid.config.FiscoConfig;
6+
import com.webank.weid.blockchain.config.FiscoConfig;
107
import com.webank.weid.config.StaticConfig;
118
import com.webank.weid.constant.DataFrom;
129
import com.webank.weid.service.ContractService;
1310
import com.webank.weid.service.GuideService;
1411
import com.webank.weid.util.WeIdSdkUtils;
12+
import org.apache.commons.lang3.StringUtils;
13+
import org.apache.commons.lang3.math.NumberUtils;
1514

1615
public class DeployEvidence extends StaticConfig {
1716

@@ -47,7 +46,7 @@ public static void main(String[] args) {
4746
System.out.println("[DeployEvidence] the evidence deploy successfully, cns --> " + hash);
4847
System.exit(0);
4948
} else {
50-
System.out.println("[DeployEvidence] the evidence deploy faile, please check the log.");
49+
System.out.println("[DeployEvidence] the evidence deploy fail, please check the log.");
5150
System.exit(1);
5251
}
5352

src/main/java/com/webank/weid/command/RegistCpt.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
package com.webank.weid.command;
44

5-
import java.io.File;
6-
import java.io.IOException;
7-
8-
import lombok.extern.slf4j.Slf4j;
9-
import org.apache.commons.lang3.StringUtils;
10-
115
import com.beust.jcommander.JCommander;
126
import com.webank.weid.config.StaticConfig;
137
import com.webank.weid.constant.DataFrom;
@@ -16,11 +10,16 @@
1610
import com.webank.weid.protocol.base.WeIdAuthentication;
1711
import com.webank.weid.protocol.base.WeIdPrivateKey;
1812
import com.webank.weid.protocol.response.ResponseData;
19-
import com.webank.weid.rpc.WeIdService;
20-
import com.webank.weid.service.impl.WeIdServiceImpl;
2113
import com.webank.weid.service.WeIdSdkService;
14+
import com.webank.weid.service.impl.WeIdServiceImpl;
15+
import com.webank.weid.service.rpc.WeIdService;
2216
import com.webank.weid.util.FileUtils;
2317
import com.webank.weid.util.WeIdSdkUtils;
18+
import lombok.extern.slf4j.Slf4j;
19+
import org.apache.commons.lang3.StringUtils;
20+
21+
import java.io.File;
22+
import java.io.IOException;
2423

2524
/**
2625
* @author tonychen 2019/4/11

src/main/java/com/webank/weid/command/RegisterEvidenceByGroup.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@
22

33
package com.webank.weid.command;
44

5-
import com.webank.weid.constant.ChainVersion;
6-
import com.webank.weid.contract.deploy.v3.RegisterAddressV3;
7-
import java.math.BigInteger;
8-
9-
import lombok.extern.slf4j.Slf4j;
10-
import org.apache.commons.lang3.StringUtils;
11-
import org.apache.commons.lang3.math.NumberUtils;
12-
135
import com.beust.jcommander.JCommander;
14-
import com.webank.weid.config.FiscoConfig;
15-
import com.webank.weid.constant.CnsType;
6+
import com.webank.weid.blockchain.config.FiscoConfig;
7+
import com.webank.weid.blockchain.constant.CnsType;
8+
import com.webank.weid.blockchain.deploy.v2.RegisterAddressV2;
9+
import com.webank.weid.blockchain.deploy.v3.RegisterAddressV3;
10+
import com.webank.weid.blockchain.service.fisco.BaseServiceFisco;
11+
import com.webank.weid.blockchain.service.fisco.CryptoFisco;
12+
import com.webank.weid.blockchain.service.fisco.server.WeServer;
13+
import com.webank.weid.constant.ChainVersion;
1614
import com.webank.weid.constant.WeIdConstant;
1715
import com.webank.weid.contract.deploy.AddressProcess;
18-
import com.webank.weid.contract.deploy.v2.RegisterAddressV2;
1916
import com.webank.weid.contract.v2.DataBucket;
2017
import com.webank.weid.protocol.base.WeIdPrivateKey;
21-
import com.webank.weid.service.BaseService;
22-
import com.webank.weid.service.fisco.WeServer;
2318
import com.webank.weid.util.DataToolUtils;
2419
import com.webank.weid.util.WeIdSdkUtils;
20+
import lombok.extern.slf4j.Slf4j;
21+
import org.apache.commons.lang3.StringUtils;
22+
import org.apache.commons.lang3.math.NumberUtils;
2523
import org.fisco.bcos.sdk.abi.datatypes.generated.Bytes32;
2624
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple2;
2725
import org.fisco.bcos.sdk.client.Client;
2826
import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair;
2927
import org.fisco.bcos.sdk.v3.crypto.CryptoSuite;
3028

29+
import java.math.BigInteger;
30+
3131
/**
3232
* todo support v3 test
3333
* @author marsli
@@ -64,7 +64,7 @@ public static void main(String[] args) {
6464
System.out.println("[RegisterEvidenceByGroup] begin register evidenceAddress by cns and groupId, cns = "+ cns + ", groupId = " + goupIdStr);
6565
// 检查群组是否存在
6666
String groupId = goupIdStr;
67-
boolean checkGroupId = BaseService.checkGroupId(goupIdStr);
67+
boolean checkGroupId = BaseServiceFisco.checkGroupId(goupIdStr);
6868
if (!checkGroupId) {
6969
System.out.println("[RegisterEvidenceByGroup] input error, the group does not exists, Abort.");
7070
System.exit(1);
@@ -77,7 +77,7 @@ public static void main(String[] args) {
7777
WeServer<?, ?, ?> weServer = WeServer.getInstance(fiscoConfig, groupId);
7878
// v2 chain
7979
if (ChainVersion.FISCO_V2.getVersion() == Integer.parseInt(fiscoConfig.getVersion())) {
80-
CryptoKeyPair credentials = DataToolUtils.cryptoSuite.getKeyPairFactory()
80+
CryptoKeyPair credentials = CryptoFisco.cryptoSuite.getKeyPairFactory()
8181
.createKeyPair(new BigInteger(privatekey));
8282
// 加载DataBucket
8383
DataBucket dataBucket = DataBucket.load(
@@ -102,7 +102,7 @@ public static void main(String[] args) {
102102
// 将地址注册到cns中
103103
CnsType cnsType = CnsType.SHARE;
104104
// 注册SHARE CNS 默认主群组
105-
RegisterAddressV2.registerBucketToCns(cnsType, currentPrivateKey);
105+
RegisterAddressV2.registerBucketToCns(cnsType, currentPrivateKey.getPrivateKey());
106106
// 根据群组和evidence Address获取hash
107107
String hash = AddressProcess.getHashForShare(groupId, evidenceAddress);
108108
// 将evidence地址注册到cns中 默认主群组
@@ -111,19 +111,19 @@ public static void main(String[] args) {
111111
hash,
112112
evidenceAddress,
113113
WeIdConstant.CNS_EVIDENCE_ADDRESS,
114-
currentPrivateKey
114+
currentPrivateKey.getPrivateKey()
115115
);
116116
// 将群组编号注册到cns中 默认主群组
117117
RegisterAddressV2.registerAddress(
118118
cnsType,
119119
hash,
120120
groupId,
121121
WeIdConstant.CNS_GROUP_ID,
122-
currentPrivateKey
122+
currentPrivateKey.getPrivateKey()
123123
);
124124
} else {
125125
org.fisco.bcos.sdk.v3.crypto.keypair.CryptoKeyPair credentials =
126-
new CryptoSuite(DataToolUtils.cryptoSuite.getCryptoTypeConfig()).getKeyPairFactory()
126+
new CryptoSuite(CryptoFisco.cryptoSuite.getCryptoTypeConfig()).getKeyPairFactory()
127127
.createKeyPair(new BigInteger(privatekey));
128128
// 加载DataBucket
129129
com.webank.weid.contract.v3.DataBucket dataBucket =
@@ -150,7 +150,7 @@ public static void main(String[] args) {
150150
// 将地址注册到cns中
151151
CnsType cnsType = CnsType.SHARE;
152152
// 注册SHARE CNS 默认主群组
153-
RegisterAddressV3.registerBucketToCns(cnsType, currentPrivateKey);
153+
RegisterAddressV3.registerBucketToCns(cnsType, currentPrivateKey.getPrivateKey());
154154
// 根据群组和evidence Address获取hash
155155
String hash = AddressProcess.getHashForShare(groupId, evidenceAddress);
156156
// 将evidence地址注册到cns中 默认主群组
@@ -159,15 +159,15 @@ public static void main(String[] args) {
159159
hash,
160160
evidenceAddress,
161161
WeIdConstant.CNS_EVIDENCE_ADDRESS,
162-
currentPrivateKey
162+
currentPrivateKey.getPrivateKey()
163163
);
164164
// 将群组编号注册到cns中 默认主群组
165165
RegisterAddressV3.registerAddress(
166166
cnsType,
167167
hash,
168168
groupId,
169169
WeIdConstant.CNS_GROUP_ID,
170-
currentPrivateKey
170+
currentPrivateKey.getPrivateKey()
171171
);
172172

173173
}

0 commit comments

Comments
 (0)