diff --git a/build.gradle b/build.gradle index 0e48a5bb..f2fa19f6 100644 --- a/build.gradle +++ b/build.gradle @@ -38,21 +38,21 @@ subprojects { } dependencies { - compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' - compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.25' - compile "org.slf4j:jcl-over-slf4j:1.7.25" - compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.9' + compile group: 'org.slf4j', name: 'slf4j-api', version: '2.0.2' + compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: '2.0.2' + compile "org.slf4j:jcl-over-slf4j:2.0.2" + compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.3.14' compileOnly 'org.projectlombok:lombok:1.18.12' annotationProcessor 'org.projectlombok:lombok:1.18.12' testCompileOnly 'org.projectlombok:lombok:1.18.12' testAnnotationProcessor 'org.projectlombok:lombok:1.18.12' - compile group: 'com.google.guava', name: 'guava', version: '24.1-jre' + compile group: 'com.google.guava', name: 'guava', version: '32.0.0-jre' compile "com.google.code.findbugs:jsr305:3.0.0" - compile group: 'org.springframework', name: 'spring-context', version: '4.2.4.RELEASE' - compile group: 'org.springframework', name: 'spring-tx', version: '4.2.4.RELEASE' + compile group: 'org.springframework', name: 'spring-context', version: '5.3.27' + compile group: 'org.springframework', name: 'spring-tx', version: '5.3.27' compile "org.apache.commons:commons-lang3:3.4" compile group: 'org.apache.commons', name: 'commons-math', version: '2.2' - compile "org.apache.commons:commons-collections4:4.0" + compile "org.apache.commons:commons-collections4:4.1" compile group: 'joda-time', name: 'joda-time', version: '2.3' compile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.12.11' compile group: 'org.mongodb', name: 'bson', version: '4.6.0' diff --git a/protocol/build.gradle b/protocol/build.gradle index b8180085..5f940d5c 100644 --- a/protocol/build.gradle +++ b/protocol/build.gradle @@ -1,15 +1,15 @@ apply plugin: 'com.google.protobuf' dependencies { - compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.4.0' - compile group: 'com.google.protobuf', name: 'protobuf-java-util', version: '3.4.0' + compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.16.3' + compile group: 'com.google.protobuf', name: 'protobuf-java-util', version: '3.25.2' compile group: 'net.jcip', name: 'jcip-annotations', version: '1.0' // checkstyleConfig "com.puppycrawl.tools:checkstyle:${versions.checkstyle}" // google grpc - compile group: 'io.grpc', name: 'grpc-netty', version: '1.14.0' - compile group: 'io.grpc', name: 'grpc-protobuf', version: '1.14.0' - compile group: 'io.grpc', name: 'grpc-stub', version: '1.14.0' + compile group: 'io.grpc', name: 'grpc-netty', version: '1.63.0' + compile group: 'io.grpc', name: 'grpc-protobuf', version: '1.63.0' + compile group: 'io.grpc', name: 'grpc-stub', version: '1.63.0' // end google grpc compile group: 'com.google.api.grpc', name: 'googleapis-common-protos', version: '0.0.3' diff --git a/testcase/build.gradle b/testcase/build.gradle index 39636df0..b8756abd 100644 --- a/testcase/build.gradle +++ b/testcase/build.gradle @@ -41,62 +41,62 @@ dependencies { testCompile group: 'org.testng', name: 'testng', version: '6.14.3' - compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.69' + compile group: 'org.bouncycastle', name: 'bcprov-jdk18on', version: '1.78.1' compile group: 'com.typesafe', name: 'config', version: '1.3.2' - compile "com.cedarsoftware:java-util:1.8.0" + compile "com.cedarsoftware:java-util:1.11.0" - compile group: 'com.beust', name: 'jcommander', version: '1.72' + compile group: 'com.beust', name: 'jcommander', version: '1.82' - compile group: 'junit', name: 'junit', version: '4.12' + compile group: 'junit', name: 'junit', version: '4.13.2' compile group: 'net.jcip', name: 'jcip-annotations', version: '1.0' compile group: 'com.google.inject', name: 'guice', version: '4.1.0' - compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.10.3' - compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.5' + compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.7.1' + compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.6' compile group: 'io.dropwizard.metrics', name: 'metrics-core', version: '3.1.2' compile group: 'com.github.davidb', name: 'metrics-influxdb', version: '0.8.2' compile group: 'com.carrotsearch', name: 'java-sizeof', version: '0.0.5' - compile 'org.aspectj:aspectjrt:1.8.13' - compile 'org.aspectj:aspectjweaver:1.8.13' - compile 'org.aspectj:aspectjtools:1.8.13' - compile 'com.googlecode.cqengine:cqengine:2.12.4' - compile group: 'com.google.api.grpc', name: 'googleapis-common-protos', version: '0.0.3' +// compile 'org.aspectj:aspectjrt:1.9.22' +// compile 'org.aspectj:aspectjweaver:1.9.22' +// compile 'org.aspectj:aspectjtools:1.9.22' +// compile 'com.googlecode.cqengine:cqengine:3.6.0' +// compile group: 'com.google.api.grpc', name: 'googleapis-common-protos', version: '0.0.3' // http - compile 'org.eclipse.jetty:jetty-server:9.4.11.v20180605' + compile 'org.eclipse.jetty:jetty-server:9.4.53.v20231009' compile 'org.eclipse.jetty:jetty-servlet:9.4.11.v20180605' - compile 'com.alibaba:fastjson:1.2.70' - compile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.1' + compile 'com.alibaba:fastjson:1.2.83' + compile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.5' // end http // https://mvnrepository.com/artifact/com.github.briandilley.jsonrpc4j/jsonrpc4j - compile group: 'com.github.briandilley.jsonrpc4j', name: 'jsonrpc4j', version: '1.6' +// compile group: 'com.github.briandilley.jsonrpc4j', name: 'jsonrpc4j', version: '1.6' // https://mvnrepository.com/artifact/javax.portlet/portlet-api compileOnly group: 'javax.portlet', name: 'portlet-api', version: '3.0.1' compile "io.vavr:vavr:0.9.2" - compile group: 'org.pf4j', name: 'pf4j', version: '2.5.0' + compile group: 'org.pf4j', name: 'pf4j', version: '3.10.0' - compile group: 'org.zeromq', name: 'jeromq', version: '0.5.0' + compile group: 'org.zeromq', name: 'jeromq', version: '0.6.0' compile 'io.github.tronprotocol:zksnark-java-sdk:1.0.0' compile project(":protocol") // compile group: 'org.iq80.leveldb', name: 'leveldb', version: '0.12' compile group: leveldbGroup, name: leveldbName, version: leveldbVersion - implementation 'io.grpc:grpc-netty-shaded:1.31.0' - implementation 'io.grpc:grpc-netty:1.31.0' - implementation 'io.grpc:grpc-protobuf:1.31.0' - implementation 'io.grpc:grpc-stub:1.31.0' - implementation 'com.google.guava:guava:28.0-jre' + implementation 'io.grpc:grpc-netty-shaded:1.63.0' + implementation 'io.grpc:grpc-netty:1.63.0' + implementation 'io.grpc:grpc-protobuf:1.63.0' + implementation 'io.grpc:grpc-stub:1.63.0' + implementation 'com.google.guava:guava:32.0-jre' implementation fileTree(dir: 'libs', include: '*.jar') } diff --git a/testcase/libs/abi-0.8.0.jar b/testcase/libs/abi-0.9.0.jar similarity index 84% rename from testcase/libs/abi-0.8.0.jar rename to testcase/libs/abi-0.9.0.jar index 0e86b0ba..f4925adf 100644 Binary files a/testcase/libs/abi-0.8.0.jar and b/testcase/libs/abi-0.9.0.jar differ diff --git a/testcase/libs/core-0.8.0.jar b/testcase/libs/core-0.8.0.jar deleted file mode 100644 index 48f39b80..00000000 Binary files a/testcase/libs/core-0.8.0.jar and /dev/null differ diff --git a/testcase/libs/core-0.9.0.jar b/testcase/libs/core-0.9.0.jar new file mode 100644 index 00000000..b8abadd5 Binary files /dev/null and b/testcase/libs/core-0.9.0.jar differ diff --git a/testcase/libs/utils-0.8.0.jar b/testcase/libs/utils-0.9.0.jar similarity index 92% rename from testcase/libs/utils-0.8.0.jar rename to testcase/libs/utils-0.9.0.jar index 915551ac..49de6de4 100644 Binary files a/testcase/libs/utils-0.8.0.jar and b/testcase/libs/utils-0.9.0.jar differ diff --git a/testcase/src/test/java/stest/tron/wallet/dailybuild/grpcurl/GrpcReflectionTest001.java b/testcase/src/test/java/stest/tron/wallet/dailybuild/grpcurl/GrpcReflectionTest001.java index c2900f5a..24973493 100644 --- a/testcase/src/test/java/stest/tron/wallet/dailybuild/grpcurl/GrpcReflectionTest001.java +++ b/testcase/src/test/java/stest/tron/wallet/dailybuild/grpcurl/GrpcReflectionTest001.java @@ -5,7 +5,6 @@ import com.alibaba.fastjson.parser.ParserConfig; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.google.protobuf.ByteString; -import com.googlecode.cqengine.query.simple.In; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; import lombok.extern.slf4j.Slf4j; diff --git a/testcase/src/test/java/stest/tron/wallet/dailybuild/manual/EstimateEnergyTest001.java b/testcase/src/test/java/stest/tron/wallet/dailybuild/manual/EstimateEnergyTest001.java index 7f76ea42..6fc385c3 100644 --- a/testcase/src/test/java/stest/tron/wallet/dailybuild/manual/EstimateEnergyTest001.java +++ b/testcase/src/test/java/stest/tron/wallet/dailybuild/manual/EstimateEnergyTest001.java @@ -5,7 +5,6 @@ import com.google.gson.JsonObject; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; -import javassist.bytecode.BadBytecode; import lombok.extern.slf4j.Slf4j; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; diff --git a/testcase/src/test/java/stest/tron/wallet/dailybuild/tvmnewcommand/isContract/isContractCommand001.java b/testcase/src/test/java/stest/tron/wallet/dailybuild/tvmnewcommand/isContract/isContractCommand001.java index 2e1723de..38303c33 100644 --- a/testcase/src/test/java/stest/tron/wallet/dailybuild/tvmnewcommand/isContract/isContractCommand001.java +++ b/testcase/src/test/java/stest/tron/wallet/dailybuild/tvmnewcommand/isContract/isContractCommand001.java @@ -28,6 +28,8 @@ public class isContractCommand001 { .getString("foundationAccount.key2"); private final byte[] testNetAccountAddress = PublicMethed.getFinalAddress(testNetAccountKey); byte[] contractAddress = null; + byte[] contractA = null; + byte[] contractC = null; ECKey ecKey1 = new ECKey(Utils.getRandom()); byte[] contractExcAddress = ecKey1.getAddress(); String contractExcKey = ByteArray.toHexString(ecKey1.getPrivKeyBytes()); @@ -71,6 +73,17 @@ public void beforeClass() { contractAddress = PublicMethed .deployContract(contractName, abi, code, "", maxFeeLimit, 0L, 100, null, contractExcKey, contractExcAddress, blockingStubFull); + + + contractName = "C"; + retMap = PublicMethed.getBycodeAbi(filePath, contractName); + code = retMap.get("byteCode").toString(); + abi = retMap.get("abI").toString(); + contractC = PublicMethed + .deployContract(contractName, abi, code, "", maxFeeLimit, 0L, 100, null, contractExcKey, + contractExcAddress, blockingStubFull); + + PublicMethed.waitProduceNextBlock(blockingStubFull); } @@ -332,6 +345,99 @@ public void test05ActiveContractBeforeDeploy() { Assert.assertEquals("CONTRACT_VALIDATE_ERROR", response.getCode().name()); Assert.assertFalse(response.getResult()); } + + @Test(enabled = true, description = "deploy A in create2, A trigger B's iscontract in it's constructor") + public void test06TriggerInCreate2Constructor() { + String contractName = "A"; + String filePath = "src/test/resources/soliditycode/TvmIsContract001.sol"; + HashMap retMap = PublicMethed.getBycodeAbi(filePath, contractName); + String code = retMap.get("byteCode").toString(); + String hexB = ByteArray.toHexString(contractAddress); + String testContractCode = code; + testContractCode += "000000000000000000000000" + hexB; + Long salt = 7L; + + String param = "\"" + testContractCode + "\"," + salt; + + String triggerTxid = PublicMethed.triggerContract(contractC, + "create2(bytes,uint256)", param, false, 0L, + 1000000000L, "0", 0, contractExcAddress, contractExcKey, blockingStubFull); + PublicMethed.waitProduceNextBlock(blockingStubFull); + Optional info = PublicMethed + .getTransactionInfoById(triggerTxid, blockingStubFull); + Assert.assertTrue(info.get().getResultValue() == 0); + + String hexA = "41" + ByteArray.toHexString(info.get().getContractResult(0).toByteArray()).substring(24); + logger.info("hexA: " + hexA); + contractA = ByteArray.fromHexString(hexA); + TransactionExtention transactionExtention = PublicMethed + .triggerConstantContractForExtention(contractA, "testConstructorView()", "", false, 0, + 0, "0", 0, contractExcAddress, contractExcKey, blockingStubFull); + logger.info("trigger A testConstructorView : " + transactionExtention.toString()); + Assert.assertEquals("SUCCESS", transactionExtention.getResult().getCode().toString()); + Assert + .assertEquals(1, ByteArray.toInt(transactionExtention.getConstantResult(0).toByteArray())); + } + + @Test(enabled = true, description = "deploy A in create, A trigger B's iscontract in it's constructor") + public void test07TriggerInCreateConstructor() { + String contractName = "A"; + String filePath = "src/test/resources/soliditycode/TvmIsContract001.sol"; + HashMap retMap = PublicMethed.getBycodeAbi(filePath, contractName); + String code = retMap.get("byteCode").toString(); + String hexB = ByteArray.toHexString(contractAddress); + String testContractCode = code; + testContractCode += "000000000000000000000000" + hexB; + + String param = "\"" + testContractCode + "\""; + + String triggerTxid = PublicMethed.triggerContract(contractC, + "create(bytes)", param, false, 0L, + 1000000000L, "0", 0, contractExcAddress, contractExcKey, blockingStubFull); + PublicMethed.waitProduceNextBlock(blockingStubFull); + Optional info = PublicMethed + .getTransactionInfoById(triggerTxid, blockingStubFull); + Assert.assertTrue(info.get().getResultValue() == 0); + + String hexA = "41" + ByteArray.toHexString(info.get().getContractResult(0).toByteArray()).substring(24); + logger.info("hexA: " + hexA); + contractA = ByteArray.fromHexString(hexA); + TransactionExtention transactionExtention = PublicMethed + .triggerConstantContractForExtention(contractA, "testConstructorView()", "", false, 0, + 0, "0", 0, contractExcAddress, contractExcKey, blockingStubFull); + logger.info("trigger A testConstructorView : " + transactionExtention.toString()); + Assert.assertEquals("SUCCESS", transactionExtention.getResult().getCode().toString()); + Assert + .assertEquals(1, ByteArray.toInt(transactionExtention.getConstantResult(0).toByteArray())); + } + + + @Test(enabled = true, description = "A call B's iscontract in it's constructor") + public void test08ConstructorCall() { + String filePath = "src/test/resources/soliditycode/TvmIsContract001.sol"; + String contractName = "A"; + HashMap retMap = PublicMethed.getBycodeAbi(filePath, contractName); + String code = retMap.get("byteCode").toString(); + String abi = retMap.get("abI").toString(); + String param = "\"" + Base58.encode58Check(contractAddress) + "\""; + String txid = PublicMethed + .deployContractWithConstantParame(contractName, abi, code, "constructor(address)",param,null, + maxFeeLimit, 0L, 100, + null, contractExcKey, contractExcAddress, blockingStubFull); + PublicMethed.waitProduceNextBlock(blockingStubFull); + Optional info = PublicMethed.getTransactionInfoById(txid, blockingStubFull); + Assert.assertTrue(info.get().getResultValue() == 0); + byte[] aContract = info.get().getContractAddress().toByteArray(); + + TransactionExtention transactionExtention = PublicMethed + .triggerConstantContractForExtention(aContract, "testConstructorView()", "", false, 0, + 0, "0", 0, contractExcAddress, contractExcKey, blockingStubFull); + logger.info("test08 A call B in constructor :" + transactionExtention.toString()); + Assert.assertEquals("SUCCESS", transactionExtention.getResult().getCode().toString()); + Assert + .assertEquals(1, ByteArray.toInt(transactionExtention.getConstantResult(0).toByteArray())); + } + /** * constructor. */ diff --git a/testcase/src/test/java/tron/trident/client/HeaderClientInterceptor.java b/testcase/src/test/java/tron/trident/client/HeaderClientInterceptor.java new file mode 100644 index 00000000..af0e8cba --- /dev/null +++ b/testcase/src/test/java/tron/trident/client/HeaderClientInterceptor.java @@ -0,0 +1,28 @@ +package tron.trident.client; + +import io.grpc.*; + +public class HeaderClientInterceptor implements ClientInterceptor { + @Override + public ClientCall interceptCall(MethodDescriptor method, CallOptions callOptions, Channel next) { + return new ForwardingClientCall.SimpleForwardingClientCall(next.newCall(method, callOptions)) { + @Override + public void start(Listener responseListener, Metadata headers) { + headers.put(Metadata.Key.of("content-length", Metadata.ASCII_STRING_MARSHALLER), "5"); + headers + .put(Metadata.Key.of("Content-Type", Metadata.ASCII_STRING_MARSHALLER), "application/grpc"); + headers + .put(Metadata.Key.of("Host", Metadata.ASCII_STRING_MARSHALLER), "grpc.demo.com"); + headers + .put(Metadata.Key.of("x-trace-id", Metadata.ASCII_STRING_MARSHALLER), "testGroupAutoTest"); + headers + .put(Metadata.Key.of("x-trace-path", Metadata.ASCII_STRING_MARSHALLER), "123 23123"); + headers + .put(Metadata.Key.of("x-trace-name", Metadata.ASCII_STRING_MARSHALLER), "!@^&$!* ()^&%"); + headers.put(Metadata.Key.of("my-header", Metadata.ASCII_STRING_MARSHALLER), "header-value"); + super.start(responseListener, headers); + } + }; + } + +} diff --git a/testcase/src/test/java/tron/trident/client/TestApiKey.java b/testcase/src/test/java/tron/trident/client/TestApiKey.java new file mode 100644 index 00000000..a0b2bb20 --- /dev/null +++ b/testcase/src/test/java/tron/trident/client/TestApiKey.java @@ -0,0 +1,58 @@ +package tron.trident.client; + +import io.grpc.ClientInterceptor; +import io.grpc.StatusRuntimeException; +import lombok.extern.slf4j.Slf4j; +import org.testng.Assert; +import org.testng.annotations.Test; +import org.tron.trident.core.ApiWrapper; +import org.tron.trident.core.Constant; +import org.tron.trident.core.exceptions.IllegalException; +import org.tron.trident.proto.Chain; +import tron.trident.utils.TestBase; + +import java.util.ArrayList; +import java.util.List; + + + +@Slf4j +public class TestApiKey extends TestBase { + + @Test(enabled = true, description = "test header with api key") + public void test01HeaderWithApiKey() throws IllegalException { + wrapper.close(); + wrapper = new ApiWrapper( + Constant.FULLNODE_NILE, + Constant.FULLNODE_NILE_SOLIDITY, + ownerKey, "dba1984e-b96d-4a6c-ac8f-919409625ba9" + ); + Chain.Block block = wrapper.getNowBlock(); + logger.info(block.toString()); + Assert.assertTrue(block.toString().contains("block_header")); + wrapper.close(); + } + + @Test(enabled = true, description = "test header with clientInterceptors") + public void test02HeaderWithClientInterceptor() throws IllegalException { + wrapper.close(); + List clientInterceptors = new ArrayList<>(); + //custom header Class + ClientInterceptor interceptors = new HeaderClientInterceptor(); + clientInterceptors.add(interceptors); + wrapper = new ApiWrapper( + Constant.FULLNODE_NILE, + Constant.FULLNODE_NILE_SOLIDITY, + ownerKey, clientInterceptors + ); + Chain.Block block = wrapper.getNowBlock(); + logger.info(block.toString()); + Assert.assertTrue(block.toString().contains("block_header")); + wrapper.close(); + } + + + + + +} diff --git a/testcase/src/test/java/tron/trident/client/TestTimeout.java b/testcase/src/test/java/tron/trident/client/TestTimeout.java new file mode 100644 index 00000000..a5b429b2 --- /dev/null +++ b/testcase/src/test/java/tron/trident/client/TestTimeout.java @@ -0,0 +1,92 @@ +package tron.trident.client; + +import io.grpc.ClientInterceptor; +import io.grpc.StatusRuntimeException; +import lombok.extern.slf4j.Slf4j; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.tron.protos.Protocol; +import org.tron.trident.core.ApiWrapper; +import org.tron.trident.core.Constant; +import org.tron.trident.core.exceptions.IllegalException; +import org.tron.trident.proto.Chain; +import org.tron.trident.proto.Response; +import tron.trident.utils.TestBase; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class TestTimeout extends TestBase { + + @Test(enabled = true, description = "test timeout 10ms request failed") + public void test01TimeOutFailed() throws IllegalException { + wrapper.close(); + List clientInterceptors = new ArrayList<>(); + wrapper = new ApiWrapper( + Constant.FULLNODE_NILE, + Constant.FULLNODE_NILE_SOLIDITY, + ownerKey, clientInterceptors, 10 + ); + try { + Chain.Block block = wrapper.getNowBlock(); + } catch (StatusRuntimeException e) { + logger.info("assert timeout exception: "); + logger.info(e.toString()); + Assert.assertTrue(e.toString().contains("DEADLINE_EXCEEDED")); + return; + } finally { + wrapper.close(); + } + // if not, case failed + Assert.fail(); + } + + + @Test(enabled = true, description = "test timeout 10ms request failed") + public void test02TimeOutFailedSolidity() throws IllegalException { + wrapper.close(); + wrapper = new ApiWrapper( + Constant.FULLNODE_NILE, + Constant.FULLNODE_NILE_SOLIDITY, + ownerKey, 10 + ); + try { + Response.Account account = wrapper.getAccountSolidity(owner); + } catch (StatusRuntimeException e) { + logger.info("assert timeout exception: "); + logger.info(e.toString()); + Assert.assertTrue(e.toString().contains("DEADLINE_EXCEEDED")); + return; + } finally { + wrapper.close(); + } + // if not, case failed + Assert.fail(); + } + + @Test(enabled = true, description = "test timeout 2000ms request success") + public void test03TimeOutFailed() throws IllegalException { + wrapper.close(); + List clientInterceptors = new ArrayList<>(); + wrapper = new ApiWrapper( + Constant.FULLNODE_NILE, + Constant.FULLNODE_NILE_SOLIDITY, + ownerKey, clientInterceptors, 2000 + ); + try { + Chain.Block block = wrapper.getNowBlock(); + logger.info(block.toString()); + Assert.assertTrue(block.toString().contains("number")); + } catch (Exception e) { + logger.info(e.toString()); + Assert.fail(); + } finally { + wrapper.close(); + } + } + + + +} diff --git a/testcase/src/test/resources/soliditycode/TvmIsContract001.sol b/testcase/src/test/resources/soliditycode/TvmIsContract001.sol index 77aae930..33f45505 100644 --- a/testcase/src/test/resources/soliditycode/TvmIsContract001.sol +++ b/testcase/src/test/resources/soliditycode/TvmIsContract001.sol @@ -22,3 +22,41 @@ function testConstructorView() public view returns(bool){ return isContrct; } } + + +contract A{ + bool public isContrct; + constructor (address B) public { + (bool success, bytes memory data) = address(B).call(abi.encodeWithSignature("testIsContractView(address)",address(this))); + isContrct = success; + + } + function testConstructorView() public view returns(bool){ + return isContrct; + } +} + +contract C{ + + function create2(bytes memory code, uint256 salt) public returns(address){ + address addr; + assembly { + addr := create2(0, add(code, 0x20), mload(code), salt) + if iszero(extcodesize(addr)) { + revert(0, 0) + } + } + return addr; + } + + function create(bytes memory code) public returns(address){ + address addr; + assembly { + addr := create(0, add(code, 0x20), mload(code)) + if iszero(extcodesize(addr)) { + revert(0, 0) + } + } + return addr; + } +} diff --git a/testcase/src/test/resources/testng.conf b/testcase/src/test/resources/testng.conf index 5dda4652..5aa248e7 100644 --- a/testcase/src/test/resources/testng.conf +++ b/testcase/src/test/resources/testng.conf @@ -171,6 +171,8 @@ commitData = { "77:1" "78:864000" "79:1" + "81:1" + "82:1500" ] }