Skip to content

Commit

Permalink
update web3sdk version (#191)
Browse files Browse the repository at this point in the history
* update web3sdk version

* update fisco-bcos version

* update web3sdk to fix merkle proof failed bug
  • Loading branch information
ywy2090 authored Jun 8, 2022
1 parent 9aa1c67 commit d11b57b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .ci/ci_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ echo " Not SM ============>>>> "
echo " Not SM ============>>>> "

# download build_chain.sh to build fisco-bcos block chain
curl -LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.6.0/build_chain.sh && chmod u+x build_chain.sh
curl -LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.8.0/build_chain.sh && chmod u+x build_chain.sh
echo "127.0.0.1:4 agency1 1,2,3" > ipconf
bash build_chain.sh -f ipconf
./nodes/127.0.0.1/fisco-bcos -v
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
apply plugin: 'com.github.johnrengelman.shadow'

group 'com.webank.wecross'
version '1.2.1'
version '1.2.2'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down Expand Up @@ -84,7 +84,7 @@ dependencies {
implementation 'com.google.guava:guava:30.1-jre'
implementation 'org.yaml:snakeyaml:1.27'

implementation ('org.fisco-bcos:web3sdk:2.6.4') {
implementation ('org.fisco-bcos:web3sdk:2.6.5') {
exclude group: "org.ethereum"
exclude group: "org.fisco-bcos", module: "tcnative"
exclude group: "io.netty"
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/webank/wecross/stub/bcos/BCOSDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,8 @@ private void asyncSendTransactionByProxy(
.getTransactionHash(),
block
.getBlockHeader(),
receipt);
receipt,
nodeVersion);
}

transactionResponse
Expand Down Expand Up @@ -1060,6 +1061,7 @@ public void asyncGetTransaction(
transactionHash,
blockManager,
proof,
nodeVersion,
verifyException -> {
if (Objects.nonNull(verifyException)) {
callback.onResponse(verifyException, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ public class MerkleValidation {
* @throws BCOSStubException
*/
public static void verifyTransactionReceiptProof(
String hash, BlockHeader blockHeader, TransactionReceipt transactionReceipt)
String hash,
BlockHeader blockHeader,
TransactionReceipt transactionReceipt,
String nodeVersion)
throws BCOSStubException {

// verify transaction
if (!MerkleProofUtility.verifyTransactionReceipt(
blockHeader.getReceiptRoot(),
transactionReceipt,
transactionReceipt.getReceiptProof())) {
transactionReceipt.getReceiptProof(),
nodeVersion)) {
throw new BCOSStubException(
BCOSStatusCode.TransactionReceiptProofVerifyFailed,
BCOSStatusCode.getStatusMessage(
Expand Down Expand Up @@ -63,6 +67,7 @@ public static void verifyTransactionProof(
String hash,
BlockManager blockManager,
TransactionProof transactionProof,
String nodeVersion,
VerifyCallback callback) {
blockManager.asyncGetBlock(
blockNumber,
Expand All @@ -81,7 +86,8 @@ public static void verifyTransactionProof(
// verify transaction
if (!MerkleProofUtility.verifyTransactionReceipt(
block.getBlockHeader().getReceiptRoot(),
transactionProof.getReceiptAndProof())) {
transactionProof.getReceiptAndProof(),
nodeVersion)) {
callback.onResponse(
new BCOSStubException(
BCOSStatusCode.TransactionReceiptProofVerifyFailed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ public void verifyTransactionReceiptTest() {

assertTrue(
MerkleProofUtility.verifyTransactionReceipt(
block.getReceiptsRoot(), receiptAndProof));
block.getReceiptsRoot(), receiptAndProof, null));

assertTrue(
MerkleProofUtility.verifyTransactionReceipt(
block0.getReceiptsRoot(), receiptAndProof0));
block0.getReceiptsRoot(), receiptAndProof0, null));
}

@Test
Expand All @@ -121,10 +121,10 @@ public void verifyTransactionWithProofTest() {
public void verifyTransactionReceiptWithProofTest() {
assertTrue(
MerkleProofUtility.verifyTransactionReceipt(
block.getReceiptsRoot(), receipt, receipt.getReceiptProof()));
block.getReceiptsRoot(), receipt, receipt.getReceiptProof(), null));

assertTrue(
MerkleProofUtility.verifyTransactionReceipt(
block0.getReceiptsRoot(), receipt0, receipt0.getReceiptProof()));
block0.getReceiptsRoot(), receipt0, receipt0.getReceiptProof(), null));
}
}

0 comments on commit d11b57b

Please sign in to comment.