From 7a4484cfe63437338f92c6f72d50b8f796a47a1f Mon Sep 17 00:00:00 2001 From: daryl Date: Tue, 22 Aug 2023 11:36:41 +0800 Subject: [PATCH] The evm method is compatible with the unfreezeFragment function --- .../java/org/vision/core/capsule/TransactionCapsule.java | 9 ++++++++- .../src/main/java/org/vision/core/config/Parameter.java | 3 +++ .../org/vision/core/services/jsonrpc/JsonRpcApiUtil.java | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/chainstorage/src/main/java/org/vision/core/capsule/TransactionCapsule.java b/chainstorage/src/main/java/org/vision/core/capsule/TransactionCapsule.java index 4d4b17a6..c1b7dce2 100644 --- a/chainstorage/src/main/java/org/vision/core/capsule/TransactionCapsule.java +++ b/chainstorage/src/main/java/org/vision/core/capsule/TransactionCapsule.java @@ -2046,8 +2046,15 @@ public synchronized UnfreezeBalanceContract rlpParseToUnfreezeBalanceContract() build.setReceiverAddress(ByteString.copyFrom(ByteArray.fromHexString(receiverAddress))); } - if (dataValue.length() >= VALUE_SIZE * 3){ // unfreezeBalance(uint256,address,uint256[]) + if (dataValue.length() >= VALUE_SIZE * 3){ // unfreezeBalance(uint256,address,uint256[]) || unfreezeBalance(uint256,address,uint256[],uint256) int stageIndex = VALUE_SIZE * 3; + + int stageArrIndex = ByteUtil.byteArrayToInt(ByteArray.fromHexString(dataValue.substring(VALUE_SIZE * 2, VALUE_SIZE * 3))) * 2; + if (stageArrIndex == VALUE_SIZE * 4) { + build.setUnfreezeBalance(ByteUtil.byteArrayToLong(ByteArray.fromHexString(dataValue.substring(stageIndex, stageIndex + VALUE_SIZE)))); + stageIndex += VALUE_SIZE; + } + int stageSize = ByteUtil.byteArrayToInt(ByteArray.fromHexString(dataValue.substring(stageIndex, stageIndex + VALUE_SIZE))); int index = 1; int startIndex, endIndex; diff --git a/common/src/main/java/org/vision/core/config/Parameter.java b/common/src/main/java/org/vision/core/config/Parameter.java index 09d44986..24ddf06e 100644 --- a/common/src/main/java/org/vision/core/config/Parameter.java +++ b/common/src/main/java/org/vision/core/config/Parameter.java @@ -149,6 +149,9 @@ public class NativeTransactionContractAbi { public static final String UnfreezeBalanceStage = "unfreezeBalance(uint256,address,uint256[])"; // b1c68f74 3ec3afdfe31282ab0b2c9362ef7c5c113743ee22ae0697d1207a7c06 public static final String UnfreezeBalanceStage_FunctionSelector = "b1c68f74"; + public static final String UnfreezeBalanceStageFragment = "unfreezeBalance(uint256,address,uint256[],uint256)"; // 4d639a82 79345b705fc5a9552f378ef0de3ecdf6163cd6e999898381c0c39942 + public static final String UnfreezeBalanceStageFragment_FunctionSelector = "4d639a82"; + public static final String WithdrawBalance = "withdrawBalance(uint256)"; // da76d5cd be3baa4ef4f3adb20b7af22c89bcd5dc86bb34ab804e6d35b15874d4 public static final String WithdrawBalance_FunctionSelector = "da76d5cd"; diff --git a/framework/src/main/java/org/vision/core/services/jsonrpc/JsonRpcApiUtil.java b/framework/src/main/java/org/vision/core/services/jsonrpc/JsonRpcApiUtil.java index addd0665..894da409 100644 --- a/framework/src/main/java/org/vision/core/services/jsonrpc/JsonRpcApiUtil.java +++ b/framework/src/main/java/org/vision/core/services/jsonrpc/JsonRpcApiUtil.java @@ -337,6 +337,7 @@ public static Transaction parseEvmTransactionData(TransactionCapsule.EthTrx ethT break; case NativeTransactionContractAbi.UnfreezeBalance_FunctionSelector: case NativeTransactionContractAbi.UnfreezeBalanceStage_FunctionSelector: + case NativeTransactionContractAbi.UnfreezeBalanceStageFragment_FunctionSelector: UnfreezeBalanceContract.Builder build1 = ethTrx.rlpParseToUnfreezeBalanceContract().toBuilder(); trxCap = wallet.createTransactionCapsule(build1.build(), ContractType.UnfreezeBalanceContract); break;