Skip to content

Commit 0b19b00

Browse files
add ExtCodeHash
1 parent 746058c commit 0b19b00

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

src/test/java/stest/tron/wallet/precondition/StressPrecondition.java

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ public class StressPrecondition {
121121
byte[] commonContractAddress2;
122122
byte[] commonContractAddress3;
123123
byte[] commonContractAddress4;
124+
byte[] commonContractAddress5;
125+
byte[] commonContractAddress6;
124126

125127

126128
@BeforeSuite
@@ -198,7 +200,7 @@ public void test1CreateProposal() {
198200
PublicMethed.waitProduceNextBlock(blockingStubFull);
199201
PublicMethed.approveProposal(witness005Address, witnessKey005, proposalId,
200202
true, blockingStubFull);
201-
waitProposalApprove(29,blockingStubFull);
203+
waitProposalApprove(29, blockingStubFull);
202204
}
203205
}
204206

@@ -449,6 +451,46 @@ public void test9DeploySmartContract4() {
449451
PublicMethed.waitProduceNextBlock(blockingStubFull);
450452
}
451453

454+
@Test(enabled = true)
455+
public void test10DeploySmartContract5() {
456+
String contractName = "Trigger";
457+
String code = stest.tron.wallet.common.client.Configuration.getByPath("testng.conf")
458+
.getString("code.code_veryLarge");
459+
String abi = stest.tron.wallet.common.client.Configuration.getByPath("testng.conf")
460+
.getString("abi.abi_veryLarge");
461+
462+
commonContractAddress5 = PublicMethed
463+
.deployContract(contractName, abi, code, "", 1000000000L, 0L, 100, 10000, "0", 0, null,
464+
triggerOwnerKey, PublicMethed.getFinalAddress(triggerOwnerKey), blockingStubFull);
465+
newContractAddress = WalletClient.encode58Check(commonContractAddress5);
466+
467+
oldAddress = readWantedText("stress.conf", "commonContractAddress5");
468+
newAddress = " commonContractAddress5 = " + newContractAddress;
469+
logger.info("oldAddress " + oldAddress);
470+
logger.info("newAddress " + newAddress);
471+
replacAddressInConfig("stress.conf", oldAddress, newAddress);
472+
PublicMethed.waitProduceNextBlock(blockingStubFull);
473+
474+
}
475+
476+
@Test(enabled = true)
477+
public void test11DeploySmartContract6() {
478+
String contractName = "Trigger";
479+
String abi = "[{\"constant\":false,\"inputs\":[{\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"test\",\"outputs\":[{\"name\":\"i\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"addrs\",\"type\":\"address[]\"}],\"name\":\"test\",\"outputs\":[{\"name\":\"i\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]";
480+
String code = "608060405234801561001057600080fd5b50d3801561001d57600080fd5b50d2801561002a57600080fd5b506101df8061003a6000396000f3fe608060405234801561001057600080fd5b50d3801561001d57600080fd5b50d2801561002a57600080fd5b506004361061006c577c01000000000000000000000000000000000000000000000000000000006000350463bb29998e8114610071578063d57498ea146100b6575b600080fd5b6100a46004803603602081101561008757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610159565b60408051918252519081900360200190f35b6100a4600480360360208110156100cc57600080fd5b8101906020810181356401000000008111156100e757600080fd5b8201836020820111156100f957600080fd5b8035906020019184602083028401116401000000008311171561011b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610178945050505050565b6000805b6103e85a11156101725750600101813f61015d565b50919050565b600080805b83518110156101ac576000848281518110151561019657fe5b602090810290910101513f92505060010161017d565b939250505056fea165627a7a7230582033651916fb1624df072a51c976207dd49ce0af4f3479f46a4f81f293afcc5f2b0029";
481+
commonContractAddress6 = PublicMethed
482+
.deployContract(contractName, abi, code, "", 1000000000L, 0L, 100, 10000, "0", 0, null,
483+
triggerOwnerKey, PublicMethed.getFinalAddress(triggerOwnerKey), blockingStubFull);
484+
newContractAddress = WalletClient.encode58Check(commonContractAddress6);
485+
486+
oldAddress = readWantedText("stress.conf", "commonContractAddress6");
487+
newAddress = " commonContractAddress6 = " + newContractAddress;
488+
logger.info("oldAddress " + oldAddress);
489+
logger.info("newAddress " + newAddress);
490+
replacAddressInConfig("stress.conf", oldAddress, newAddress);
491+
PublicMethed.waitProduceNextBlock(blockingStubFull);
492+
493+
}
452494

453495

454496
/**
@@ -515,7 +557,8 @@ public static String readWantedText(String url, String wanted) {
515557
return "";
516558
}
517559

518-
public static void waitProposalApprove(Integer proposalIndex,WalletGrpc.WalletBlockingStub blockingStubFull) {
560+
public static void waitProposalApprove(Integer proposalIndex,
561+
WalletGrpc.WalletBlockingStub blockingStubFull) {
519562
Long currentTime = System.currentTimeMillis();
520563
while (System.currentTimeMillis() <= currentTime + 610000) {
521564
ChainParameters chainParameters = blockingStubFull
@@ -529,7 +572,6 @@ public static void waitProposalApprove(Integer proposalIndex,WalletGrpc.WalletBl
529572
}
530573

531574

532-
533575
}
534576

535577

0 commit comments

Comments
 (0)