diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce1ff46..4aa1f04 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: - name: Build Workflow Dispatch uses: convictional/trigger-workflow-and-wait@v1.3.0 with: - owner: web3j + owner: hyperledger repo: web3j-unit github_token: ${{ secrets.GITHUB_TOKEN }} workflow_file_name: build.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index ddcede4..a4b7f48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline ### Bug Fixes -* +* Fix Geth integration tests [#79](https://github.com/hyperledger/web3j-evm/pull/79) ### Features * bump snapshot version 4.11.3 [#76](https://github.com/hyperledger/web3j-unit/pull/76) +* Repo owner Change [#79](https://github.com/hyperledger/web3j-evm/pull/79) ### BREAKING CHANGES diff --git a/src/main/kotlin/org/web3j/container/KGenericContainer.kt b/src/main/kotlin/org/web3j/container/KGenericContainer.kt index d6e8fc1..ee97e13 100644 --- a/src/main/kotlin/org/web3j/container/KGenericContainer.kt +++ b/src/main/kotlin/org/web3j/container/KGenericContainer.kt @@ -19,6 +19,7 @@ import org.testcontainers.containers.wait.strategy.WaitStrategy import org.testcontainers.utility.MountableFile import org.web3j.protocol.Web3jService import org.web3j.protocol.http.HttpService +import java.time.Duration // https://github.com/testcontainers/testcontainers-java/issues/318 open class KGenericContainer( @@ -65,5 +66,5 @@ open class KGenericContainer( private fun inClassPath(path: String) = this.javaClass.classLoader.getResource(path) != null protected open fun withWaitStrategy(): WaitStrategy = - forHttp("/").forStatusCode(200).forPort(8545) + forHttp("/").forStatusCode(200).forPort(8545).withStartupTimeout(Duration.ofMinutes(2)) } diff --git a/src/main/kotlin/org/web3j/container/ServiceBuilder.kt b/src/main/kotlin/org/web3j/container/ServiceBuilder.kt index 5ff1956..2fc69d9 100644 --- a/src/main/kotlin/org/web3j/container/ServiceBuilder.kt +++ b/src/main/kotlin/org/web3j/container/ServiceBuilder.kt @@ -66,7 +66,7 @@ class ServiceBuilder { fun build(): GenericService { return when (type) { NodeType.BESU -> BesuContainer(version, resourceFiles, hostFiles, genesisPath, servicePort) - NodeType.GETH -> GethContainer(version, resourceFiles, hostFiles, genesisPath, servicePort) + NodeType.GETH -> GethContainer("v1.13.15", resourceFiles, hostFiles, genesisPath, servicePort) NodeType.EMBEDDED -> { if (genesisPath == "dev") EmbeddedService(Configuration(Address(selfAddress), 10), PassthroughTracer()) diff --git a/src/main/resources/besu/besu_start.sh b/src/main/resources/besu/besu_start.sh index 91854db..cf977ad 100755 --- a/src/main/resources/besu/besu_start.sh +++ b/src/main/resources/besu/besu_start.sh @@ -1,2 +1,2 @@ #!/bin/bash -/opt/besu/bin/besu --rpc-http-enabled --miner-enabled --miner-coinbase=0x0000000000000000000000000000000000000000 --genesis-file=/genesis.json --rpc-http-api=ETH,NET,WEB3,TRACE,DEBUG --host-allowlist="*" --rpc-http-cors-origins="all" --rpc-http-host=0.0.0.0 \ No newline at end of file +/opt/besu/bin/besu --rpc-http-enabled --miner-enabled --miner-coinbase=0x0000000000000000000000000000000000000000 --genesis-file=/genesis.json --rpc-http-api=ETH,NET,WEB3,TRACE,DEBUG --host-allowlist="*" --rpc-http-cors-origins="all" --rpc-http-host=0.0.0.0 --rpc-http-port=8545 \ No newline at end of file diff --git a/src/main/resources/geth/geth_start.sh b/src/main/resources/geth/geth_start.sh index 37b49b4..93a64df 100755 --- a/src/main/resources/geth/geth_start.sh +++ b/src/main/resources/geth/geth_start.sh @@ -1,4 +1,4 @@ #!/bin/sh geth init ./genesis.json geth account import --password password.txt key.txt -geth --http --http.api "eth,net,txpool" --http.addr=0.0.0.0 --allow-insecure-unlock --unlock 0xfe3b557e8fb62b89f4916b721be55ceb828dbd73 --password /password.txt --mine --miner.etherbase 0xfe3b557e8fb62b89f4916b721be55ceb828dbd73 --rpc.allow-unprotected-txs +geth --http --http.api "eth,net,txpool" --http.addr=0.0.0.0 --http.port=8545 --http.corsdomain '*' --allow-insecure-unlock --unlock 0xfe3b557e8fb62b89f4916b721be55ceb828dbd73 --password /password.txt --mine --miner.etherbase 0xfe3b557e8fb62b89f4916b721be55ceb828dbd73 --rpc.allow-unprotected-txs diff --git a/src/test/kotlin/org/web3j/GethGreeterTest.kt b/src/test/kotlin/org/web3j/GethGreeterTest.kt index af9ee61..53ecf04 100644 --- a/src/test/kotlin/org/web3j/GethGreeterTest.kt +++ b/src/test/kotlin/org/web3j/GethGreeterTest.kt @@ -13,14 +13,13 @@ package org.web3j import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test import org.web3j.greeter.Greeter import org.web3j.protocol.Web3j import org.web3j.protocol.core.DefaultBlockParameterName import org.web3j.tx.TransactionManager import org.web3j.tx.gas.ContractGasProvider -@Disabled + @EVMTest(type = NodeType.GETH) class GethGreeterTest { @@ -30,7 +29,7 @@ class GethGreeterTest { transactionManager: TransactionManager, gasProvider: ContractGasProvider ) { - Thread.sleep(2000) + Thread.sleep(10000) val balance = web3j.ethGetBalance("0xfe3b557e8fb62b89f4916b721be55ceb828dbd73", DefaultBlockParameterName.LATEST).send() .balance diff --git a/src/test/resources/compose/geth.yml b/src/test/resources/compose/geth.yml index b731f85..c2b7de0 100755 --- a/src/test/resources/compose/geth.yml +++ b/src/test/resources/compose/geth.yml @@ -1,7 +1,7 @@ version: '3' services: node1: - image: ethereum/client-go:stable + image: ethereum/client-go:v1.13.15 ports: - 8545:8545 - 30303:30303