diff --git a/actuator/src/main/java/org/tron/core/vm/nativecontract/UnfreezeBalanceV2Processor.java b/actuator/src/main/java/org/tron/core/vm/nativecontract/UnfreezeBalanceV2Processor.java index 56366bbdb0c..c8199651a7f 100644 --- a/actuator/src/main/java/org/tron/core/vm/nativecontract/UnfreezeBalanceV2Processor.java +++ b/actuator/src/main/java/org/tron/core/vm/nativecontract/UnfreezeBalanceV2Processor.java @@ -84,7 +84,7 @@ public void validate(UnfreezeBalanceV2Param param, Repository repo) if (!checkUnfreezeBalance(accountCapsule, param.getUnfreezeBalance(), param.getResourceType())) { throw new ContractValidateException( - "Invalid unfreeze_balance, [" + param.getUnfreezeBalance() + "] is error"); + "Invalid unfreeze_balance, [" + param.getUnfreezeBalance() + "] is too large"); } } diff --git a/framework/src/test/java/org/tron/common/runtime/vm/BatchValidateSignContractTest.java b/framework/src/test/java/org/tron/common/runtime/vm/BatchValidateSignContractTest.java index d094f1a3d05..fc60d8c0648 100644 --- a/framework/src/test/java/org/tron/common/runtime/vm/BatchValidateSignContractTest.java +++ b/framework/src/test/java/org/tron/common/runtime/vm/BatchValidateSignContractTest.java @@ -79,7 +79,6 @@ public void staticCallTest() { @Test public void correctionTest() { - contract.setConstantCall(false); List signatures = new ArrayList<>(); List addresses = new ArrayList<>(); byte[] hash = Hash.sha3(longData); @@ -128,7 +127,8 @@ Pair validateMultiSign(byte[] hash, List signatures, List parameters = Arrays.asList("0x" + Hex.toHexString(hash), signatures, addresses); byte[] input = Hex.decode(AbiUtil.parseParameters(METHOD_SIGN, parameters)); contract.getEnergyForData(input); - contract.setVmShouldEndInUs(System.nanoTime() / 1000 + 500 * 1000); + long maxExecutionTime = 2000; // ms + contract.setVmShouldEndInUs(System.nanoTime() / 1000 + maxExecutionTime * 1000); Pair ret = contract.execute(input); logger.info("BytesArray:{},HexString:{}", Arrays.toString(ret.getValue()), Hex.toHexString(ret.getValue())); diff --git a/framework/src/test/java/org/tron/common/runtime/vm/Create2Test.java b/framework/src/test/java/org/tron/common/runtime/vm/Create2Test.java index 79ed1c7e1f8..b1ed4f7af70 100644 --- a/framework/src/test/java/org/tron/common/runtime/vm/Create2Test.java +++ b/framework/src/test/java/org/tron/common/runtime/vm/Create2Test.java @@ -160,9 +160,16 @@ public void testCreate2() // Trigger contract method: deploy(bytes,uint) long salt = 100L; String hexInput = AbiUtil.parseMethod(methodSign, Arrays.asList(testCode, salt)); + + long preTime = manager.getDynamicPropertiesStore().getMaxCpuTimeOfOneTx(); + // set max cpu time to 500 + manager.getDynamicPropertiesStore().saveMaxCpuTimeOfOneTx(500L); TVMTestResult result = TvmTestUtils .triggerContractAndReturnTvmTestResult(Hex.decode(OWNER_ADDRESS), factoryAddress, Hex.decode(hexInput), 0, fee, manager, null); + // restore max cpu time + manager.getDynamicPropertiesStore().saveMaxCpuTimeOfOneTx(preTime); + Assert.assertNull(result.getRuntime().getRuntimeError()); byte[] returnValue = result.getRuntime().getResult().getHReturn();