From 181e3745f1b202e85f20d6255d19a9e721e9c609 Mon Sep 17 00:00:00 2001 From: nabarun Date: Mon, 2 May 2022 11:18:20 +0530 Subject: [PATCH] Run CI tests using stack-orchestrator --- .github/workflows/on-pr.yaml | 132 +++++++++++++++++++++++++++++--- environments/example.toml | 6 ++ test/contract/hardhat.config.js | 4 +- test/integration_test.go | 2 +- 4 files changed, 132 insertions(+), 12 deletions(-) diff --git a/.github/workflows/on-pr.yaml b/.github/workflows/on-pr.yaml index 2fc0f567..338fee8d 100644 --- a/.github/workflows/on-pr.yaml +++ b/.github/workflows/on-pr.yaml @@ -60,11 +60,15 @@ jobs: integrationtest: name: Run integration tests env: + STACK_ORCHESTRATOR_REF: 8020f339565a5df57a1d3b44eb49e879b0d89a0e + GO_ETHEREUM_REF: 498101102c891c4f8c3cab5649158c642ee1fd6b GOPATH: /tmp/go DB_WRITE: true ETH_FORWARD_ETH_CALLS: false ETH_PROXY_ON_ERROR: false - ETH_HTTP_PATH: "dapptools:8545" + ETH_HTTP_PATH: "go-ethereum:8545" + WATCHED_ADDRESS_GAP_FILLER_ENABLED: false + WATCHED_ADDRESS_GAP_FILLER_INTERVAL: 2 strategy: matrix: go-version: [1.16.x] @@ -78,10 +82,44 @@ jobs: with: go-version: ${{ matrix.go-version }} - uses: actions/checkout@v2 - - name: Run database - run: docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db dapptools contract eth-server + with: + path: "./ipld-eth-server" + - uses: actions/checkout@v2 + with: + ref: ${{ env.STACK_ORCHESTRATOR_REF }} + path: "./stack-orchestrator/" + repository: vulcanize/stack-orchestrator + - uses: actions/checkout@v2 + with: + ref: ${{ env.GO_ETHEREUM_REF }} + repository: vulcanize/go-ethereum + path: "./go-ethereum/" + - name: Create config file + run: | + echo vulcanize_go_ethereum=$GITHUB_WORKSPACE/go-ethereum/ > ./config.sh + echo vulcanize_ipld_eth_server=$GITHUB_WORKSPACE/ipld-eth-server/ >> ./config.sh + echo db_write=$DB_WRITE >> ./config.sh + echo eth_forward_eth_calls=$ETH_FORWARD_ETH_CALLS >> ./config.sh + echo eth_proxy_on_error=$ETH_PROXY_ON_ERROR >> ./config.sh + echo eth_http_path=$ETH_HTTP_PATH >> ./config.sh + cat ./config.sh + - name: Build geth + run: | + cd $GITHUB_WORKSPACE/stack-orchestrator/helper-scripts + ./compile-geth.sh \ + -p "$GITHUB_WORKSPACE/config.sh" \ + -e docker + - name: Run docker compose + run: | + docker-compose \ + -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/latest/docker-compose-db.yml" \ + -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" \ + -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ipld-eth-server.yml" \ + --env-file "$GITHUB_WORKSPACE/config.sh" \ + up -d --build - name: Test run: | + cd $GITHUB_WORKSPACE/ipld-eth-server while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8081)" != "200" ]; do echo "waiting for ipld-eth-server..." && sleep 5; done && \ while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \ make integrationtest @@ -89,11 +127,15 @@ jobs: integrationtest_forwardethcalls: name: Run integration tests for direct proxy fall-through of eth_calls env: + STACK_ORCHESTRATOR_REF: 8020f339565a5df57a1d3b44eb49e879b0d89a0e + GO_ETHEREUM_REF: 498101102c891c4f8c3cab5649158c642ee1fd6b GOPATH: /tmp/go DB_WRITE: false ETH_FORWARD_ETH_CALLS: true ETH_PROXY_ON_ERROR: false - ETH_HTTP_PATH: "dapptools:8545" + ETH_HTTP_PATH: "go-ethereum:8545" + WATCHED_ADDRESS_GAP_FILLER_ENABLED: false + WATCHED_ADDRESS_GAP_FILLER_INTERVAL: 2 strategy: matrix: go-version: [1.16.x] @@ -107,10 +149,44 @@ jobs: with: go-version: ${{ matrix.go-version }} - uses: actions/checkout@v2 - - name: Run database - run: docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db dapptools contract eth-server + with: + path: "./ipld-eth-server" + - uses: actions/checkout@v2 + with: + ref: ${{ env.STACK_ORCHESTRATOR_REF }} + path: "./stack-orchestrator/" + repository: vulcanize/stack-orchestrator + - uses: actions/checkout@v2 + with: + ref: ${{ env.GO_ETHEREUM_REF }} + repository: vulcanize/go-ethereum + path: "./go-ethereum/" + - name: Create config file + run: | + echo vulcanize_go_ethereum=$GITHUB_WORKSPACE/go-ethereum/ > ./config.sh + echo vulcanize_ipld_eth_server=$GITHUB_WORKSPACE/ipld-eth-server/ >> ./config.sh + echo db_write=$DB_WRITE >> ./config.sh + echo eth_forward_eth_calls=$ETH_FORWARD_ETH_CALLS >> ./config.sh + echo eth_proxy_on_error=$ETH_PROXY_ON_ERROR >> ./config.sh + echo eth_http_path=$ETH_HTTP_PATH >> ./config.sh + cat ./config.sh + - name: Build geth + run: | + cd $GITHUB_WORKSPACE/stack-orchestrator/helper-scripts + ./compile-geth.sh \ + -p "$GITHUB_WORKSPACE/config.sh" \ + -e docker + - name: Run docker compose + run: | + docker-compose \ + -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/latest/docker-compose-db.yml" \ + -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" \ + -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ipld-eth-server.yml" \ + --env-file "$GITHUB_WORKSPACE/config.sh" \ + up -d --build - name: Test run: | + cd $GITHUB_WORKSPACE/ipld-eth-server while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8081)" != "200" ]; do echo "waiting for ipld-eth-server..." && sleep 5; done && \ while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \ make integrationtest @@ -118,11 +194,13 @@ jobs: integrationtest_watchedaddress_gapfillingservice: name: Run integration tests for watched addresses with gap filling service enabled env: + STACK_ORCHESTRATOR_REF: 8020f339565a5df57a1d3b44eb49e879b0d89a0e + GO_ETHEREUM_REF: 498101102c891c4f8c3cab5649158c642ee1fd6b GOPATH: /tmp/go DB_WRITE: true ETH_FORWARD_ETH_CALLS: false ETH_PROXY_ON_ERROR: false - ETH_HTTP_PATH: "dapptools:8545" + ETH_HTTP_PATH: "go-ethereum:8545" WATCHED_ADDRESS_GAP_FILLER_ENABLED: true WATCHED_ADDRESS_GAP_FILLER_INTERVAL: 2 strategy: @@ -138,10 +216,46 @@ jobs: with: go-version: ${{ matrix.go-version }} - uses: actions/checkout@v2 - - name: Run database - run: docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db dapptools contract eth-server + with: + path: "./ipld-eth-server" + - uses: actions/checkout@v2 + with: + ref: ${{ env.STACK_ORCHESTRATOR_REF }} + path: "./stack-orchestrator/" + repository: vulcanize/stack-orchestrator + - uses: actions/checkout@v2 + with: + ref: ${{ env.GO_ETHEREUM_REF }} + repository: vulcanize/go-ethereum + path: "./go-ethereum/" + - name: Create config file + run: | + echo vulcanize_go_ethereum=$GITHUB_WORKSPACE/go-ethereum/ > ./config.sh + echo vulcanize_ipld_eth_server=$GITHUB_WORKSPACE/ipld-eth-server/ >> ./config.sh + echo db_write=$DB_WRITE >> ./config.sh + echo eth_forward_eth_calls=$ETH_FORWARD_ETH_CALLS >> ./config.sh + echo eth_proxy_on_error=$ETH_PROXY_ON_ERROR >> ./config.sh + echo eth_http_path=$ETH_HTTP_PATH >> ./config.sh + echo watched_addres_gap_filler_enabled=$WATCHED_ADDRESS_GAP_FILLER_ENABLED >> ./config.sh + echo watched_addres_gap_filler_interval=$WATCHED_ADDRESS_GAP_FILLER_INTERVAL >> ./config.sh + cat ./config.sh + - name: Build geth + run: | + cd $GITHUB_WORKSPACE/stack-orchestrator/helper-scripts + ./compile-geth.sh \ + -p "$GITHUB_WORKSPACE/config.sh" \ + -e docker + - name: Run docker compose + run: | + docker-compose \ + -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/latest/docker-compose-db.yml" \ + -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" \ + -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ipld-eth-server.yml" \ + --env-file "$GITHUB_WORKSPACE/config.sh" \ + up -d --build - name: Test run: | + cd $GITHUB_WORKSPACE/ipld-eth-server while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8081)" != "200" ]; do echo "waiting for ipld-eth-server..." && sleep 5; done && \ while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \ make integrationtest diff --git a/environments/example.toml b/environments/example.toml index 102a592c..8713c71f 100644 --- a/environments/example.toml +++ b/environments/example.toml @@ -16,6 +16,7 @@ graphqlEndpoint = "127.0.0.1:8083" # $SERVER_GRAPHQL_ENDPOINT [ethereum] + chainConfig = "./chain.json" # ETH_CHAIN_CONFIG chainID = "1" # $ETH_CHAIN_ID defaultSender = "" # $ETH_DEFAULT_SENDER_ADDR rpcGasCap = "1000000000000" # $ETH_RPC_GAS_CAP @@ -27,3 +28,8 @@ clientName = "Geth" # $ETH_CLIENT_NAME genesisBlock = "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3" # $ETH_GENESIS_BLOCK networkID = "1" # $ETH_NETWORK_ID + +[watch] + [watch.fill] + enabled = false + interval = 30 diff --git a/test/contract/hardhat.config.js b/test/contract/hardhat.config.js index c452b963..6bd2508a 100644 --- a/test/contract/hardhat.config.js +++ b/test/contract/hardhat.config.js @@ -32,11 +32,11 @@ module.exports = { networks: { local: { url: 'http://127.0.0.1:8545', - chainId: 4 + chainId: 99 }, docker: { url: process.env.ETH_ADDR, - chainId: 4 + chainId: 99 } } }; diff --git a/test/integration_test.go b/test/integration_test.go index cb2850ab..e5cf6acd 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -592,7 +592,7 @@ func compareTxs(tx1 *types.Transaction, tx2 *types.Transaction) { Expect(tx1.Hash()).To(Equal(tx2.Hash())) Expect(tx1.Size()).To(Equal(tx2.Size())) - signer := types.NewEIP155Signer(big.NewInt(4)) + signer := types.NewEIP155Signer(big.NewInt(99)) gethSender, err := types.Sender(signer, tx1) Expect(err).ToNot(HaveOccurred())