Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public void staticCallTest() {

@Test
public void correctionTest() {
contract.setConstantCall(false);
List<Object> signatures = new ArrayList<>();
List<Object> addresses = new ArrayList<>();
byte[] hash = Hash.sha3(longData);
Expand Down Expand Up @@ -128,7 +127,8 @@ Pair<Boolean, byte[]> validateMultiSign(byte[] hash, List<Object> signatures,
List<Object> 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<Boolean, byte[]> ret = contract.execute(input);
logger.info("BytesArray:{},HexString:{}", Arrays.toString(ret.getValue()),
Hex.toHexString(ret.getValue()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down