From 1a73eb8515d04149cbf789ca6041498a5c1dd02d Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Tue, 14 Mar 2023 17:59:23 -0500 Subject: [PATCH 01/36] Update tests to be able to run using a leap dev-install package. --- tests/leap/nodeos_trust_evm_test.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/leap/nodeos_trust_evm_test.py b/tests/leap/nodeos_trust_evm_test.py index 847786f2..da08f94e 100755 --- a/tests/leap/nodeos_trust_evm_test.py +++ b/tests/leap/nodeos_trust_evm_test.py @@ -9,13 +9,13 @@ from binascii import unhexlify from web3 import Web3 -sys.path.append(os.getcwd()) sys.path.append(os.path.join(os.getcwd(), "tests")) -from TestHarness import Cluster, TestHelper, Utils, WalletMgr -from TestHarness.TestHelper import AppArgs -from core_symbol import CORE_SYMBOL +os.environ["CORE_SYMBOL_NAME"]='EOS' +print(f"CORE_SYMBOL_NAME: {os.environ.get('CORE_SYMBOL_NAME')}") +from TestHarness import Cluster, TestHelper, Utils, WalletMgr, CORE_SYMBOL +from TestHarness.TestHelper import AppArgs ############################################################### # nodeos_trust_evm_test @@ -25,13 +25,16 @@ # Need to install: # web3 - pip install web3 # -# --turst-evm-root should point to the root of TrustEVM build dir # --trust-evm-contract-root should point to root of TrustEVM contract build dir # contracts should be built with -DWITH_TEST_ACTIONS=On # -# Example: -# cd ~/ext/leap/build -# ~/ext/TrustEVM/tests/leap/nodeos_trust_evm_test.py --trust-evm-contract-root ~/ext/TrustEVM/contract/build --leave-running +# Example (Running with leap src build): +# cd ~/leap/build +# ~/TrustEVM/tests/leap/nodeos_trust_evm_test.py --trust-evm-contract-root ~/TrustEVM/contract/build --leave-running +# +# Example (Running with leap dev-install): +# export PYTHONPATH=/lib/python3/dist-packages +# ~/TrustEVM/tests/leap/nodeos_trust_evm_test.py --trust-evm-contract-root ~/TrustEVM/contract/build --leave-running # # Launches wallet at port: 9899 # Example: bin/cleos --wallet-url http://127.0.0.1:9899 ... From d3f9b0481608bd26b38db97689c4d7186a80f3cb Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 19 Jul 2023 16:42:06 -0500 Subject: [PATCH 02/36] Add leap integration test to contract CICD workflow. --- .github/workflows/contract.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 1e2faa4f..ef044523 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -108,3 +108,7 @@ jobs: name: test-results.xml path: test-results.xml if-no-files-found: error + + - name: Test Leap Integration + if: ${{ matrix.DWITH_TEST_ACTIONS == 'on' }} + run: ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper From 4995c1626876e1b4244899af53534a0ada728412 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 19 Jul 2023 18:36:39 -0500 Subject: [PATCH 03/36] Add install web3 to workflow. Temporarily move leap integration test before contract tests for quicker CICD debugging iteration. --- .github/workflows/contract.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index ef044523..3efdeac5 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -97,6 +97,12 @@ jobs: path: contract-test.tar.gz if-no-files-found: error + - name: Test Leap Integration + if: ${{ matrix.DWITH_TEST_ACTIONS == 'on' }} + run: | + pip install web3 + ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper + - name: Test EOS EVM Contract run: .github/workflows/test-contract.sh env: @@ -108,7 +114,3 @@ jobs: name: test-results.xml path: test-results.xml if-no-files-found: error - - - name: Test Leap Integration - if: ${{ matrix.DWITH_TEST_ACTIONS == 'on' }} - run: ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper From 0e9d95c3ee8e59eb5ac318b7a6ebe9443ed0fa76 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 19 Jul 2023 18:55:24 -0500 Subject: [PATCH 04/36] Put leap integration test into own job in workflow. Use leap and cdt versions 4 with the leap integration test. --- .github/workflows/contract.yml | 66 ++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 6 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 3efdeac5..9ebc1701 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -97,12 +97,6 @@ jobs: path: contract-test.tar.gz if-no-files-found: error - - name: Test Leap Integration - if: ${{ matrix.DWITH_TEST_ACTIONS == 'on' }} - run: | - pip install web3 - ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper - - name: Test EOS EVM Contract run: .github/workflows/test-contract.sh env: @@ -114,3 +108,63 @@ jobs: name: test-results.xml path: test-results.xml if-no-files-found: error + + leap-integration: + runs-on: ubuntu-20.04 + name: EOS EVM Leap Integration Tests + env: + CC: gcc-10 + CXX: g++-10 + DCMAKE_BUILD_TYPE: 'Release' + + steps: + - name: Authenticate + id: auth + uses: AntelopeIO/github-app-token-action@v1 + with: + app_id: ${{ secrets.TRUSTEVM_CI_APP_ID }} + private_key: ${{ secrets.TRUSTEVM_CI_APP_KEY }} + + - name: Checkout Repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + submodules: 'recursive' + token: ${{ steps.auth.outputs.token }} + + - name: Download CDT + uses: AntelopeIO/asset-artifact-download-action@v2 + with: + owner: AntelopeIO + repo: cdt + target: 'v4' + prereleases: false + file: 'cdt_.*amd64.deb' + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install CDT + run: sudo apt-get install -y ./cdt*.deb + + - name: Build EOS EVM Contract + run: .github/workflows/build-contract.sh + env: + DWITH_TEST_ACTIONS: ${{ matrix.DWITH_TEST_ACTIONS }} + + - name: Download Leap - dev binary + uses: AntelopeIO/asset-artifact-download-action@v2 + with: + owner: AntelopeIO + repo: leap + target: 'v4' + prereleases: false + file: 'leap-dev.*(x86_64|amd64).deb' + container-package: experimental-binaries + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install Leap + run: sudo apt-get install -y ./leap*.deb + + - name: Test Leap Integration + run: | + pip install web3 + ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper From 7f7d855782d01f6561384377cae7defd6b7ca099 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 19 Jul 2023 19:02:18 -0500 Subject: [PATCH 05/36] Revert back to CDT v3.1.0 for leap integration test --- .github/workflows/contract.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 9ebc1701..f9f0b17a 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -137,7 +137,7 @@ jobs: with: owner: AntelopeIO repo: cdt - target: 'v4' + target: 'v3.1.0' prereleases: false file: 'cdt_.*amd64.deb' token: ${{ secrets.GITHUB_TOKEN }} From 8340a2946a89614047cffa52d3608f6c4cf11f72 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 19 Jul 2023 19:17:31 -0500 Subject: [PATCH 06/36] Try setting the PYTHONPATH --- .github/workflows/contract.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index f9f0b17a..188e5041 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -167,4 +167,5 @@ jobs: - name: Test Leap Integration run: | pip install web3 + export PYTHONPATH=/usr/lib/python3/dist-packages ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper From 33f27a42d5ad4ab5d09dc9e04b749c89a55597e6 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Thu, 20 Jul 2023 11:51:35 -0500 Subject: [PATCH 07/36] Fix python path to installed leap-dev modules. --- .github/workflows/contract.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 188e5041..e0a8045f 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -167,5 +167,5 @@ jobs: - name: Test Leap Integration run: | pip install web3 - export PYTHONPATH=/usr/lib/python3/dist-packages + export PYTHONPATH=/usr/local/lib/python3/dist-packages ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper From ba3bf6507f604fb176a02ea375c9c0256d678f40 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Thu, 20 Jul 2023 12:05:42 -0500 Subject: [PATCH 08/36] See where leap-dev is being installed. --- .github/workflows/contract.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index e0a8045f..11c9a4f6 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -162,7 +162,9 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Install Leap - run: sudo apt-get install -y ./leap*.deb + run: | + sudo apt-get install -y ./leap*.deb + dpkg -L leap-dev | grep TestHarness - name: Test Leap Integration run: | From 4c3ac5faeac5c223a08fac1622f90f4919b8479a Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Thu, 20 Jul 2023 12:13:24 -0500 Subject: [PATCH 09/36] Endeavor to fix the python path to TestHarness. --- .github/workflows/contract.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 11c9a4f6..b1817b76 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -164,10 +164,9 @@ jobs: - name: Install Leap run: | sudo apt-get install -y ./leap*.deb - dpkg -L leap-dev | grep TestHarness - name: Test Leap Integration run: | pip install web3 - export PYTHONPATH=/usr/local/lib/python3/dist-packages + export PYTHONPATH=/usr/share/leap_testing/tests/TestHarness ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper From aafc9a2fde0d6947a2b2792b83ceb96a0bbaf432 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Thu, 20 Jul 2023 13:16:29 -0500 Subject: [PATCH 10/36] Debugging lack of symlink during install. --- .github/workflows/contract.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index b1817b76..874d9299 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -163,7 +163,11 @@ jobs: - name: Install Leap run: | - sudo apt-get install -y ./leap*.deb + apt update && apt upgrade -y + sudo apt install -y ./leap*.deb + dpkg -L leap-dev | grep TestHarness + python3 --version + - name: Test Leap Integration run: | From f1c2b10ba5548848b917e310e9adfc48cd7937d6 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Thu, 20 Jul 2023 15:40:50 -0500 Subject: [PATCH 11/36] Revert back to installing using apt-get. --- .github/workflows/contract.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 874d9299..7f657001 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -163,8 +163,8 @@ jobs: - name: Install Leap run: | - apt update && apt upgrade -y - sudo apt install -y ./leap*.deb + apt-get update && apt-get upgrade -y + sudo apt-get install -y ./leap*.deb dpkg -L leap-dev | grep TestHarness python3 --version From f10749977b4686429b210beaecf4c4c0da0cb81f Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Thu, 20 Jul 2023 16:30:22 -0500 Subject: [PATCH 12/36] Walk web3 back to a potentially more stable version. --- .github/workflows/contract.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 7f657001..b24db0e6 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -168,9 +168,8 @@ jobs: dpkg -L leap-dev | grep TestHarness python3 --version - - name: Test Leap Integration run: | - pip install web3 + pip install --upgrade web3=6.5.0 export PYTHONPATH=/usr/share/leap_testing/tests/TestHarness ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper From 80ecdf898aedac0d2eac7b60e1aad1fa7140edd2 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Thu, 20 Jul 2023 16:40:06 -0500 Subject: [PATCH 13/36] Fix pip install version selection. --- .github/workflows/contract.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index b24db0e6..482904be 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -170,6 +170,6 @@ jobs: - name: Test Leap Integration run: | - pip install --upgrade web3=6.5.0 + pip install --upgrade web3==6.5.0 export PYTHONPATH=/usr/share/leap_testing/tests/TestHarness ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper From 8bdd860c8d829f35a2f6e41be4aa2898a0a57d1c Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Fri, 21 Jul 2023 14:50:44 -0500 Subject: [PATCH 14/36] Working through dependency issues. Need to link TestHarness into typical python dist-packages. This is taken care of automatically in the install in leap main but not in v4.0.4 being used here. TestHarness has a dependency on cleos which currently is not installed in the leap-dev package, so need leap package for now as well. --- .github/workflows/contract.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 482904be..dd0fd5e7 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -150,7 +150,7 @@ jobs: env: DWITH_TEST_ACTIONS: ${{ matrix.DWITH_TEST_ACTIONS }} - - name: Download Leap - dev binary + - name: Download leap-dev binary uses: AntelopeIO/asset-artifact-download-action@v2 with: owner: AntelopeIO @@ -161,12 +161,24 @@ jobs: container-package: experimental-binaries token: ${{ secrets.GITHUB_TOKEN }} + - name: Download leap binary + uses: AntelopeIO/asset-artifact-download-action@v2 + with: + owner: AntelopeIO + repo: leap + target: 'v4' + file: 'leap.*(x86_64|amd64).deb' + token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Leap run: | apt-get update && apt-get upgrade -y sudo apt-get install -y ./leap*.deb dpkg -L leap-dev | grep TestHarness - python3 --version + dpkg -L leap | grep cleos + + - name: Link Leap TestHarness Module (fix for v4 of leap) + run: ln -s /usr/share/leap_testing/tests/TestHarness /usr/lib/python3/dist-packages/TestHarness - name: Test Leap Integration run: | From 36acfe3400d0957ca465def8cef7563ce95dd493 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Fri, 21 Jul 2023 16:30:41 -0500 Subject: [PATCH 15/36] Sudo to gain permissions to create the symlink. --- .github/workflows/contract.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index dd0fd5e7..73e74175 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -178,7 +178,7 @@ jobs: dpkg -L leap | grep cleos - name: Link Leap TestHarness Module (fix for v4 of leap) - run: ln -s /usr/share/leap_testing/tests/TestHarness /usr/lib/python3/dist-packages/TestHarness + run: sudo ln -s /usr/share/leap_testing/tests/TestHarness /usr/lib/python3/dist-packages/TestHarness - name: Test Leap Integration run: | From 7e02722cfc212f909364b0d8634032a4dfde4e46 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Fri, 21 Jul 2023 16:40:57 -0500 Subject: [PATCH 16/36] Remove PYTHONPATH now that symlink is created. PYTHONPATH was not what we wanted here anyway. Also believe we can remove the concrete version specification for web3 as it was not the cause of the issue. --- .github/workflows/contract.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 73e74175..a1345953 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -182,6 +182,5 @@ jobs: - name: Test Leap Integration run: | - pip install --upgrade web3==6.5.0 - export PYTHONPATH=/usr/share/leap_testing/tests/TestHarness + pip install --upgrade web3 ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper From 2f65d15907d02a20ce9253fa8d66900eb852ec18 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Mon, 24 Jul 2023 10:06:27 -0500 Subject: [PATCH 17/36] Set test environment variables. --- .github/workflows/contract.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index a1345953..a5ca4bff 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -116,6 +116,12 @@ jobs: CC: gcc-10 CXX: g++-10 DCMAKE_BUILD_TYPE: 'Release' + EOS_RPC: "http://127.0.0.1:8888" + EOS_KEY: "5HrGbW2ofxkh6FJx6C69DdTUMgcW2kZWX6UWPuPBEAPUvbcioFT" + HOST: "127.0.0.1" + PORT: "18888" + EOS_EVM_ACCOUNT: "evmevmevmevm" + EOS_SENDER: "woixzhsdkaaa" steps: - name: Authenticate From a16a4c22d10b6da0e364df4d8ab24fc4e89dcd65 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Mon, 24 Jul 2023 10:15:30 -0500 Subject: [PATCH 18/36] Revert "Set test environment variables." This reverts commit 2f65d15907d02a20ce9253fa8d66900eb852ec18. --- .github/workflows/contract.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index a5ca4bff..a1345953 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -116,12 +116,6 @@ jobs: CC: gcc-10 CXX: g++-10 DCMAKE_BUILD_TYPE: 'Release' - EOS_RPC: "http://127.0.0.1:8888" - EOS_KEY: "5HrGbW2ofxkh6FJx6C69DdTUMgcW2kZWX6UWPuPBEAPUvbcioFT" - HOST: "127.0.0.1" - PORT: "18888" - EOS_EVM_ACCOUNT: "evmevmevmevm" - EOS_SENDER: "woixzhsdkaaa" steps: - name: Authenticate From 836fe142536b6a36878b2ebc9abbe620d2af217f Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Tue, 25 Jul 2023 13:31:07 -0500 Subject: [PATCH 19/36] Leap integration test workflow updates. Update Web3 functions now using snake case instead of camel case. Update tx_wrapper index.js to use fetch import over require. Workflow needs to install some dependencies as documented in test. --- .github/workflows/contract.yml | 13 ++++++++++- peripherals/tx_wrapper/index.js | 4 ++-- tests/leap/nodeos_eos_evm_test.py | 38 +++++++++++++++++-------------- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index a1345953..634e22e1 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -180,7 +180,18 @@ jobs: - name: Link Leap TestHarness Module (fix for v4 of leap) run: sudo ln -s /usr/share/leap_testing/tests/TestHarness /usr/lib/python3/dist-packages/TestHarness - - name: Test Leap Integration + - name: Install Test Depedencies run: | pip install --upgrade web3 + sudo apt install nodejs + sudo apt install npm + npm install eosjs + npm install ethereumjs-util + npm install node-fetch + npm install http-jsonrpc-server + npm install dotenv + npm install is-valid-hostname + + - name: Test Leap Integration + run: | ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper diff --git a/peripherals/tx_wrapper/index.js b/peripherals/tx_wrapper/index.js index 1256e503..cdcf94c2 100644 --- a/peripherals/tx_wrapper/index.js +++ b/peripherals/tx_wrapper/index.js @@ -1,7 +1,7 @@ const { Api, JsonRpc, RpcError } = require("eosjs"); const { JsSignatureProvider } = require("eosjs/dist/eosjs-jssig"); // development only -const fetch = require("node-fetch"); // node only; not needed in browsers -//const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); +// const fetch = require("node-fetch"); // node only; not needed in browsers +const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); const { TextEncoder, TextDecoder } = require("util"); // node only; native TextEncoder/Decoder const RpcServer = require("http-jsonrpc-server"); diff --git a/tests/leap/nodeos_eos_evm_test.py b/tests/leap/nodeos_eos_evm_test.py index 68a5c025..b4114e4b 100755 --- a/tests/leap/nodeos_eos_evm_test.py +++ b/tests/leap/nodeos_eos_evm_test.py @@ -113,13 +113,13 @@ def interact_with_storage_contract(dest, nonce): nonce=nonce, gas=100000, #100k Gas gasPrice=gasP, - to=Web3.toChecksumAddress(dest), + to=Web3.to_checksum_address(dest), value=amount, data=unhexlify("6057361d00000000000000000000000000000000000000000000000000000000000000%02x" % nonce), chainId=evmChainId ), evmSendKey) - actData = {"miner":minerAcc.name, "rlptx":Web3.toHex(signed_trx.rawTransaction)[2:]} + actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]} retValue = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name)) assert retValue[0], "pushtx to ETH contract failed." Utils.Print("\tBlock#", retValue[1]["processed"]["block_num"]) @@ -139,6 +139,7 @@ def writeTxWrapperEnv(): PORT="18888" EOS_EVM_ACCOUNT="evmevmevmevm" EOS_SENDER="{txWrapAcc.name}" +EOS_PERMISSION="active" ''' envFile.write(env) @@ -187,6 +188,9 @@ def processUrllibRequest(endpoint, payload={}, silentErrors=False, exitOnError=F unhandledEnumType(returnType) else: return None + except: + Utils.Print("Unknown exception occurred during processUrllibRequest") + raise if exitMsg is not None: exitMsg=": " + exitMsg @@ -221,7 +225,7 @@ def normalize_address(x, allow_blank=False): return x def makeContractAddress(sender, nonce): - return Web3.toHex(Web3.keccak(rlp.encode([normalize_address(sender), nonce]))[12:]) + return Web3.to_hex(Web3.keccak(rlp.encode([normalize_address(sender), nonce]))[12:]) def makeReservedEvmAddress(account): bytearr = [0xbb, 0xbb, 0xbb, 0xbb, @@ -374,7 +378,7 @@ def makeReservedEvmAddress(account): # init with 1 Million EOS for i,k in enumerate(addys): - print("addys: [{0}] [{1}] [{2}]".format(i,k[2:].lower(), len(k[2:]))) + Utils.Print("addys: [{0}] [{1}] [{2}]".format(i,k[2:].lower(), len(k[2:]))) transferAmount="1000000.0000 {0}".format(CORE_SYMBOL) Print("Transfer funds %s from account %s to %s" % (transferAmount, cluster.eosioAccount.name, evmAcc.name)) prodNode.transferFunds(cluster.eosioAccount, evmAcc, transferAmount, "0x" + k[2:].lower(), waitForTransBlock=True) @@ -393,13 +397,13 @@ def makeReservedEvmAddress(account): nonce=nonce, gas=100000, #100k Gas gasPrice=gasP, - to=Web3.toChecksumAddress(toAdd), + to=Web3.to_checksum_address(toAdd), value=amount, data=b'', chainId=evmChainId ), evmSendKey) - actData = {"miner":minerAcc.name, "rlptx":Web3.toHex(signed_trx.rawTransaction)[2:]} + actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]} trans = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name)) prodNode.waitForTransBlockIfNeeded(trans[1], True) @@ -419,13 +423,13 @@ def makeReservedEvmAddress(account): nonce=nonce, gas=100000, #100k Gas gasPrice=gasP, - to=Web3.toChecksumAddress(toAdd), + to=Web3.to_checksum_address(toAdd), value=amount, data=b'', chainId=evmChainId ), evmSendKey) - actData = {"miner":minerAcc.name, "rlptx":Web3.toHex(signed_trx.rawTransaction)[2:]} + actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]} Utils.Print("Send balance again, with correct nonce") retValue = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name), silentErrors=True) assert retValue[0], f"push trx should have succeeded: {retValue}" @@ -438,13 +442,13 @@ def makeReservedEvmAddress(account): nonce=nonce, gas=100000, #100k Gas gasPrice=gasP, - to=Web3.toChecksumAddress(toAdd), + to=Web3.to_checksum_address(toAdd), value=amount, data=b'', chainId=evmChainId ), evmSendKey) - actData = {"miner":minerAcc.name, "rlptx":Web3.toHex(signed_trx.rawTransaction)[2:]} + actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]} Utils.Print("Send balance again, with invalid chainid") retValue = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name), silentErrors=True) assert not retValue[0], f"push trx should have failed: {retValue}" @@ -472,11 +476,11 @@ def makeReservedEvmAddress(account): nonce=nonce, gas=1000000, #5M Gas gasPrice=gasP, - data=Web3.toBytes(hexstr='608060405234801561001057600080fd5b50610150806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100a1565b60405180910390f35b610073600480360381019061006e91906100ed565b61007e565b005b60008054905090565b8060008190555050565b6000819050919050565b61009b81610088565b82525050565b60006020820190506100b66000830184610092565b92915050565b600080fd5b6100ca81610088565b81146100d557600080fd5b50565b6000813590506100e7816100c1565b92915050565b600060208284031215610103576101026100bc565b5b6000610111848285016100d8565b9150509291505056fea2646970667358fe12209ffe32fe5779018f7ee58886c856a4cfdf550f2df32cec944f57716a3abf4a5964736f6c63430008110033'), + data=Web3.to_bytes(hexstr='608060405234801561001057600080fd5b50610150806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100a1565b60405180910390f35b610073600480360381019061006e91906100ed565b61007e565b005b60008054905090565b8060008190555050565b6000819050919050565b61009b81610088565b82525050565b60006020820190506100b66000830184610092565b92915050565b600080fd5b6100ca81610088565b81146100d557600080fd5b50565b6000813590506100e7816100c1565b92915050565b600060208284031215610103576101026100bc565b5b6000610111848285016100d8565b9150509291505056fea2646970667358fe12209ffe32fe5779018f7ee58886c856a4cfdf550f2df32cec944f57716a3abf4a5964736f6c63430008110033'), chainId=evmChainId ), evmSendKey) - actData = {"miner":minerAcc.name, "rlptx":Web3.toHex(signed_trx.rawTransaction)[2:]} + actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]} retValue = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name), silentErrors=True) assert retValue[0], f"push trx should have succeeded: {retValue}" nonce = interact_with_storage_contract(makeContractAddress(fromAdd, nonce), nonce) @@ -592,12 +596,12 @@ def makeReservedEvmAddress(account): nonce=nonce, gas=100000, #100k Gas gasPrice=gasP, - to=Web3.toChecksumAddress(toAdd), + to=Web3.to_checksum_address(toAdd), value=int(amount*10000*szabo*100), # .0001 EOS is 100 szabos data=b'', chainId=evmChainId ), evmSendKey) - actData = {"miner":minerAcc.name, "rlptx":Web3.toHex(signed_trx.rawTransaction)[2:]} + actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]} trans = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name), silentErrors=True) prodNode.waitForTransBlockIfNeeded(trans[1], True) row4=prodNode.getTableRow(evmAcc.name, evmAcc.name, "account", 4) # 4th balance of this integration test @@ -625,12 +629,12 @@ def makeReservedEvmAddress(account): nonce=nonce, gas=100000, #100k Gas gasPrice=gasP, - to=Web3.toChecksumAddress(toAdd), + to=Web3.to_checksum_address(toAdd), value=int(amount*10000*szabo*100), data=b'', chainId=evmChainId ), evmSendKey) - actData = {"miner":minerAcc.name, "rlptx":Web3.toHex(signed_trx.rawTransaction)[2:]} + actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]} trans = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name), silentErrors=True) prodNode.waitForTransBlockIfNeeded(trans[1], True) row4=prodNode.getTableRow(evmAcc.name, evmAcc.name, "account", 4) # 4th balance of this integration test @@ -667,7 +671,7 @@ def makeReservedEvmAddress(account): rows=prodNode.getTable(evmAcc.name, evmAcc.name, "account") for row in rows['rows']: Utils.Print("Checking 0x{0} balance".format(row['eth_address'])) - r = w3.eth.get_balance(Web3.toChecksumAddress('0x'+row['eth_address'])) + r = w3.eth.get_balance(Web3.to_checksum_address('0x'+row['eth_address'])) assert r == int(row['balance'],16), f"{row['eth_address']} {r} != {int(row['balance'],16)}" foundErr = False From c18a1f4ff4af5aba97d996442f3251f673ba3970 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Tue, 25 Jul 2023 13:56:32 -0500 Subject: [PATCH 20/36] Workflow updates. Break out step for update package index and upgrading packages first. Add step to check versions and check tx_wrapper logs. --- .github/workflows/contract.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 634e22e1..e4e8f043 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -118,6 +118,11 @@ jobs: DCMAKE_BUILD_TYPE: 'Release' steps: + - name: Update Package Index & Upgrade Packages + run: | + apt-get update + apt-get upgrade -y + - name: Authenticate id: auth uses: AntelopeIO/github-app-token-action@v1 @@ -172,7 +177,6 @@ jobs: - name: Install Leap run: | - apt-get update && apt-get upgrade -y sudo apt-get install -y ./leap*.deb dpkg -L leap-dev | grep TestHarness dpkg -L leap | grep cleos @@ -192,6 +196,15 @@ jobs: npm install dotenv npm install is-valid-hostname + - name: Check Depedency Versions + run: | + pip show web3 + node --version + - name: Test Leap Integration run: | ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper + + -name: Check Logs + run: | + cat $(find . -name tx_wrapper.stderr) From 16aa94409807a2d2474bb47855e261766fa48137 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Tue, 25 Jul 2023 13:58:21 -0500 Subject: [PATCH 21/36] Fix syntax. --- .github/workflows/contract.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index e4e8f043..42f55c5e 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -205,6 +205,6 @@ jobs: run: | ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper - -name: Check Logs + - name: Check Logs run: | cat $(find . -name tx_wrapper.stderr) From eb484fa5b32f8a92edd86b0c47687018f16ec766 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Tue, 25 Jul 2023 14:00:53 -0500 Subject: [PATCH 22/36] Elevate permissions. --- .github/workflows/contract.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 42f55c5e..0fffbed5 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -120,8 +120,8 @@ jobs: steps: - name: Update Package Index & Upgrade Packages run: | - apt-get update - apt-get upgrade -y + sudo apt-get update + sudo apt-get upgrade -y - name: Authenticate id: auth From 8acaca54911d6216d3cd19be5905a3a870565bb6 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Tue, 25 Jul 2023 14:13:40 -0500 Subject: [PATCH 23/36] Make logs checking steps always run even on failure. --- .github/workflows/contract.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 0fffbed5..3f49f96b 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -205,6 +205,12 @@ jobs: run: | ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper - - name: Check Logs + - name: Check Tx_Wrapper Logs + if: always() run: | cat $(find . -name tx_wrapper.stderr) + + - name: Check eos-evm-node Logs + if: always() + run: | + cat $(find . -name eos-evm-node.stderr) From d8f5ec8c1d8884e77d628b42b345a7c413b248ad Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Tue, 25 Jul 2023 14:31:06 -0500 Subject: [PATCH 24/36] Build eos-evm-node step. --- .github/workflows/contract.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 3f49f96b..928c0c10 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -184,6 +184,12 @@ jobs: - name: Link Leap TestHarness Module (fix for v4 of leap) run: sudo ln -s /usr/share/leap_testing/tests/TestHarness /usr/lib/python3/dist-packages/TestHarness + - name: Build EOS EVM Node + run: .github/workflows/build-node.sh + env: + CC: gcc-10 + CXX: g++-10 + - name: Install Test Depedencies run: | pip install --upgrade web3 From 43dbf437b1569a6e65d403df5241f157aac5eee5 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Tue, 25 Jul 2023 16:41:45 -0500 Subject: [PATCH 25/36] Upload test logs when test fails. --- .github/workflows/contract.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 928c0c10..3033c25e 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -220,3 +220,15 @@ jobs: if: always() run: | cat $(find . -name eos-evm-node.stderr) + + - name: Prepare Logs + if: failure() + run: | + tar -czf leap-int-test-logs.tar.gz TestLogs/* + + - name: Upload logs from failed tests + uses: actions/upload-artifact@v3 + if: failure() + with: + name: leap-int-test-logs.tar.gz + path: leap-int-test-logs.tar.gz From 7b6a1eefc3c7ff80911dc350da9ef9cf26377cdd Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 26 Jul 2023 08:41:31 -0500 Subject: [PATCH 26/36] check the genesis file. --- .github/workflows/contract.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 3033c25e..93bbe035 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -216,6 +216,11 @@ jobs: run: | cat $(find . -name tx_wrapper.stderr) + - name: Check Genesis + if: always() + run: | + cat $(find . -name eos-evm-genesis.json) + - name: Check eos-evm-node Logs if: always() run: | From d2b49ab9c7c3aa31414726dd9b611225b321e569 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 26 Jul 2023 08:50:23 -0500 Subject: [PATCH 27/36] Run with verbose output. --- .github/workflows/contract.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 93bbe035..f3bf7e9f 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -209,7 +209,7 @@ jobs: - name: Test Leap Integration run: | - ./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper + ./tests/leap/nodeos_eos_evm_test.py -v --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper - name: Check Tx_Wrapper Logs if: always() From 12d4576a75f41772cdae633af183a28048fa64e9 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 26 Jul 2023 10:58:04 -0500 Subject: [PATCH 28/36] Make root directory for testing to collect all artifacts. --- .github/workflows/contract.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index f3bf7e9f..1bd1e2b6 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -209,7 +209,9 @@ jobs: - name: Test Leap Integration run: | - ./tests/leap/nodeos_eos_evm_test.py -v --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper + mkdir test_run_root + cd test_run_root + ./../tests/leap/nodeos_eos_evm_test.py -v --eos-evm-contract-root ../contract/build --eos-evm-build-root ../build --use-tx-wrapper ../peripherals/tx_wrapper - name: Check Tx_Wrapper Logs if: always() @@ -229,7 +231,8 @@ jobs: - name: Prepare Logs if: failure() run: | - tar -czf leap-int-test-logs.tar.gz TestLogs/* + cd .. + tar -czf leap-int-test-logs.tar.gz test_run_root/* - name: Upload logs from failed tests uses: actions/upload-artifact@v3 From 166bf930298c8bf2efe4f274f0ab8c540fe204ef Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 26 Jul 2023 12:49:22 -0500 Subject: [PATCH 29/36] Increase eos-evm-node verbosity for debugging workflow in cicd. --- tests/leap/nodeos_eos_evm_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/leap/nodeos_eos_evm_test.py b/tests/leap/nodeos_eos_evm_test.py index b4114e4b..2d031c6d 100755 --- a/tests/leap/nodeos_eos_evm_test.py +++ b/tests/leap/nodeos_eos_evm_test.py @@ -661,7 +661,7 @@ def makeReservedEvmAddress(account): os.makedirs(dataDir) outFile = open(nodeStdOutDir, "w") errFile = open(nodeStdErrDir, "w") - cmd = "%s/cmd/eos-evm-node --plugin=blockchain_plugin --ship-endpoint=127.0.0.1:8999 --genesis-json=%s --chain-data=%s --verbosity=5 --nocolor=1 --plugin=rpc_plugin --eos-evm-node=127.0.0.1:8080 --http-port=0.0.0.0:8881 --api-spec=eth,debug,net,trace --chaindata=%s" % (eosEvmBuildRoot, gensisJson, dataDir, dataDir) + cmd = "%s/cmd/eos-evm-node --plugin=blockchain_plugin --ship-endpoint=127.0.0.1:8999 --genesis-json=%s --chain-data=%s --verbosity=9 --nocolor=1 --plugin=rpc_plugin --eos-evm-node=127.0.0.1:8080 --http-port=0.0.0.0:8881 --api-spec=eth,debug,net,trace --chaindata=%s" % (eosEvmBuildRoot, gensisJson, dataDir, dataDir) Utils.Print("Launching: %s" % cmd) evmNodePOpen=Utils.delayedCheckOutput(cmd, stdout=outFile, stderr=errFile) From 78e28c637e5beb85bdff0e9782770bc679b29ed4 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 26 Jul 2023 12:52:43 -0500 Subject: [PATCH 30/36] Debug where the test logs directory is. --- .github/workflows/contract.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 1bd1e2b6..db64709d 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -231,7 +231,9 @@ jobs: - name: Prepare Logs if: failure() run: | + pwd cd .. + pwd tar -czf leap-int-test-logs.tar.gz test_run_root/* - name: Upload logs from failed tests From 534fd6673c1df030b7f9412f45da0f9b7bdc92ff Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 26 Jul 2023 13:21:34 -0500 Subject: [PATCH 31/36] Give eos-evm-node longer to spin up and sync. --- tests/leap/nodeos_eos_evm_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/leap/nodeos_eos_evm_test.py b/tests/leap/nodeos_eos_evm_test.py index 2d031c6d..b85b9b06 100755 --- a/tests/leap/nodeos_eos_evm_test.py +++ b/tests/leap/nodeos_eos_evm_test.py @@ -665,7 +665,7 @@ def makeReservedEvmAddress(account): Utils.Print("Launching: %s" % cmd) evmNodePOpen=Utils.delayedCheckOutput(cmd, stdout=outFile, stderr=errFile) - time.sleep(10) # allow time to sync trxs + time.sleep(30) # allow time to sync trxs # Validate all balances are the same on both sides rows=prodNode.getTable(evmAcc.name, evmAcc.name, "account") From 0cb41adc7d8d3083a746b5cbb0c324817298a4eb Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 26 Jul 2023 13:45:19 -0500 Subject: [PATCH 32/36] Allow waiting and retrying row validation with eos-evm-node for slower trx sync machines. --- tests/leap/nodeos_eos_evm_test.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/leap/nodeos_eos_evm_test.py b/tests/leap/nodeos_eos_evm_test.py index b85b9b06..33a54b61 100755 --- a/tests/leap/nodeos_eos_evm_test.py +++ b/tests/leap/nodeos_eos_evm_test.py @@ -661,17 +661,24 @@ def makeReservedEvmAddress(account): os.makedirs(dataDir) outFile = open(nodeStdOutDir, "w") errFile = open(nodeStdErrDir, "w") - cmd = "%s/cmd/eos-evm-node --plugin=blockchain_plugin --ship-endpoint=127.0.0.1:8999 --genesis-json=%s --chain-data=%s --verbosity=9 --nocolor=1 --plugin=rpc_plugin --eos-evm-node=127.0.0.1:8080 --http-port=0.0.0.0:8881 --api-spec=eth,debug,net,trace --chaindata=%s" % (eosEvmBuildRoot, gensisJson, dataDir, dataDir) + cmd = "%s/cmd/eos-evm-node --plugin=blockchain_plugin --ship-endpoint=127.0.0.1:8999 --genesis-json=%s --chain-data=%s --verbosity=6 --nocolor=1 --plugin=rpc_plugin --eos-evm-node=127.0.0.1:8080 --http-port=0.0.0.0:8881 --api-spec=eth,debug,net,trace --chaindata=%s" % (eosEvmBuildRoot, gensisJson, dataDir, dataDir) Utils.Print("Launching: %s" % cmd) evmNodePOpen=Utils.delayedCheckOutput(cmd, stdout=outFile, stderr=errFile) - time.sleep(30) # allow time to sync trxs + time.sleep(10) # allow time to sync trxs # Validate all balances are the same on both sides rows=prodNode.getTable(evmAcc.name, evmAcc.name, "account") for row in rows['rows']: Utils.Print("Checking 0x{0} balance".format(row['eth_address'])) r = w3.eth.get_balance(Web3.to_checksum_address('0x'+row['eth_address'])) + if int(row['balance'],16) != 0: + max = 0 + while r == 0 and max < 60: + time.sleep(1) + max+=1 + Utils.Print("Re-Checking 0x{0} balance".format(row['eth_address'])) + r = w3.eth.get_balance(Web3.to_checksum_address('0x'+row['eth_address'])) assert r == int(row['balance'],16), f"{row['eth_address']} {r} != {int(row['balance'],16)}" foundErr = False From ad13c150ec4cd39464002e3ca4816da63e88e49d Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 26 Jul 2023 14:39:27 -0500 Subject: [PATCH 33/36] Trying to debug log upload. --- .github/workflows/contract.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index db64709d..f455edcb 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -232,8 +232,7 @@ jobs: if: failure() run: | pwd - cd .. - pwd + ls tar -czf leap-int-test-logs.tar.gz test_run_root/* - name: Upload logs from failed tests From 7f679fe7d46e78e85b9ea9a773dc2548f0cb47b8 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Wed, 26 Jul 2023 15:57:33 -0500 Subject: [PATCH 34/36] Increase sleep time for syncing. --- tests/leap/nodeos_eos_evm_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/leap/nodeos_eos_evm_test.py b/tests/leap/nodeos_eos_evm_test.py index 33a54b61..ee885e7a 100755 --- a/tests/leap/nodeos_eos_evm_test.py +++ b/tests/leap/nodeos_eos_evm_test.py @@ -665,7 +665,7 @@ def makeReservedEvmAddress(account): Utils.Print("Launching: %s" % cmd) evmNodePOpen=Utils.delayedCheckOutput(cmd, stdout=outFile, stderr=errFile) - time.sleep(10) # allow time to sync trxs + time.sleep(30) # allow time to sync trxs # Validate all balances are the same on both sides rows=prodNode.getTable(evmAcc.name, evmAcc.name, "account") From 02079ac6ca85b385a4aa7da170268f2dfe34ca1a Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Thu, 27 Jul 2023 08:12:17 -0500 Subject: [PATCH 35/36] Troubleshooting eos evm node not spinning up in time and whether sleep is working correctly in CICD. --- tests/leap/nodeos_eos_evm_test.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/leap/nodeos_eos_evm_test.py b/tests/leap/nodeos_eos_evm_test.py index ee885e7a..0c34f620 100755 --- a/tests/leap/nodeos_eos_evm_test.py +++ b/tests/leap/nodeos_eos_evm_test.py @@ -665,20 +665,29 @@ def makeReservedEvmAddress(account): Utils.Print("Launching: %s" % cmd) evmNodePOpen=Utils.delayedCheckOutput(cmd, stdout=outFile, stderr=errFile) - time.sleep(30) # allow time to sync trxs + Utils.Print(f"Allow time for evm node to start and sync trxs - start {time.ctime()}") + time.sleep(60) # allow time to sync trxs + Utils.Print(f"Allow time for evm node to start and sync trxs - finish {time.ctime()}") # Validate all balances are the same on both sides rows=prodNode.getTable(evmAcc.name, evmAcc.name, "account") for row in rows['rows']: Utils.Print("Checking 0x{0} balance".format(row['eth_address'])) - r = w3.eth.get_balance(Web3.to_checksum_address('0x'+row['eth_address'])) + r = 0 + try: + r = w3.eth.get_balance(Web3.to_checksum_address('0x'+row['eth_address'])) + except: + Utils.Print("Exception thrown - Checking 0x{0} balance".format(row['eth_address'])) if int(row['balance'],16) != 0: max = 0 while r == 0 and max < 60: time.sleep(1) max+=1 Utils.Print("Re-Checking 0x{0} balance".format(row['eth_address'])) - r = w3.eth.get_balance(Web3.to_checksum_address('0x'+row['eth_address'])) + try: + r = w3.eth.get_balance(Web3.to_checksum_address('0x'+row['eth_address'])) + except: + Utils.Print("Exception thrown - Re-Checking 0x{0} balance".format(row['eth_address'])) assert r == int(row['balance'],16), f"{row['eth_address']} {r} != {int(row['balance'],16)}" foundErr = False From f2c09a72a41679b2bf043a6d9b9e83186ac16f8e Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Thu, 27 Jul 2023 08:14:37 -0500 Subject: [PATCH 36/36] Now that uploading all logs, don't need these steps. --- .github/workflows/contract.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index f455edcb..f86bbe29 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -213,26 +213,9 @@ jobs: cd test_run_root ./../tests/leap/nodeos_eos_evm_test.py -v --eos-evm-contract-root ../contract/build --eos-evm-build-root ../build --use-tx-wrapper ../peripherals/tx_wrapper - - name: Check Tx_Wrapper Logs - if: always() - run: | - cat $(find . -name tx_wrapper.stderr) - - - name: Check Genesis - if: always() - run: | - cat $(find . -name eos-evm-genesis.json) - - - name: Check eos-evm-node Logs - if: always() - run: | - cat $(find . -name eos-evm-node.stderr) - - name: Prepare Logs if: failure() run: | - pwd - ls tar -czf leap-int-test-logs.tar.gz test_run_root/* - name: Upload logs from failed tests