From 7b0a099794577a4b9ecd9701499b1e0773ea661b Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Thu, 1 Feb 2024 16:04:29 +0100 Subject: [PATCH 01/23] add draft rpc-integration-tests.yml --- .github/workflows/rpc-integration-tests.yml | 83 +++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 .github/workflows/rpc-integration-tests.yml diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml new file mode 100644 index 0000000000..5327836c05 --- /dev/null +++ b/.github/workflows/rpc-integration-tests.yml @@ -0,0 +1,83 @@ +name: QA - RPC Integration Tests + +on: + pull_request: + branches: + - master + types: + - opened + - ready_for_review + +jobs: + integration-test-suite: + runs-on: self-hosted + env: + ERIGON_DATA_DIR: /opt/erigon/data-dir + + steps: + - name: Check out repository + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: "0" + + - name: Clean Build Directory + run: rm -rf ${{runner.workspace}}/build/* + + - name: Create Build Environment + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: | + cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release + + - name: Build SilkRpc + working-directory: ${{runner.workspace}}/build + # Execute the build. You can specify a specific target with "--target " + run: cmake --build . --config Release --target rpcdaemon -j 2 + + - name: Request Erigon ("db-producer") termination + run: | + response=$(curl -o /dev/null -s -w "%{http_code}\n" -X POST http://localhost:8080/production \ + -H "Content-Type: application/json" \ + -d '{"status":"paused"}') + if [ "$response" -ne 200 ]; then + echo "Request failed with status $response" + exit 1 + fi + + - name: Run SilkRpc + working-directory: ${{runner.workspace}}/build/cmd + run: | + rpcdaemon & + RPC_DAEMON_PID=$! + + - name: Run integration tests + run: | + # Run Erigon, send ctrl-c and check logs + python3 ./run_tests.py -c -k jwt.hex -b + + # Capture monitoring script exit status + monitoring_exit_status=$? + + # Clean up Erigon process if it's still running + if kill -0 $RPC_DAEMON_PID 2> /dev/null; then + echo "Terminating rpc-daemon" + kill $RPC_DAEMON_PID + wait $RPC_DAEMON_PID + else + echo "rpc-daemon has already terminated" + fi + + # Check monitoring script exit status + if [ $monitoring_exit_status -eq 0 ]; then + echo "Tests completed successfully" + echo "::notice::Tests completed successfully" + else + echo "Error detected during tests" + echo "::error::Error detected during tests" + exit 1 + fi From efe15d0d7b224bce671360e6c07ad119efc2fa01 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Thu, 1 Feb 2024 16:51:54 +0100 Subject: [PATCH 02/23] add small fix --- .github/workflows/rpc-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 5327836c05..9649940c2e 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -12,7 +12,7 @@ jobs: integration-test-suite: runs-on: self-hosted env: - ERIGON_DATA_DIR: /opt/erigon/data-dir + ERIGON_DATA_DIR: /opt/erigon/datadir steps: - name: Check out repository From 12e995e76a58d0ca37c09f86505c488ed40a2b29 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Fri, 2 Feb 2024 10:26:56 +0100 Subject: [PATCH 03/23] add clean-ups --- .github/workflows/rpc-integration-tests.yml | 30 ++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 9649940c2e..5935278f53 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -39,13 +39,13 @@ jobs: # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config Release --target rpcdaemon -j 2 - - name: Request Erigon ("db-producer") termination + - name: Put Erigon ("db-producer") in paused state run: | response=$(curl -o /dev/null -s -w "%{http_code}\n" -X POST http://localhost:8080/production \ -H "Content-Type: application/json" \ -d '{"status":"paused"}') if [ "$response" -ne 200 ]; then - echo "Request failed with status $response" + echo "::error::Failed to pause Erigon, reason= $response" exit 1 fi @@ -56,6 +56,7 @@ jobs: RPC_DAEMON_PID=$! - name: Run integration tests + id: test_step run: | # Run Erigon, send ctrl-c and check logs python3 ./run_tests.py -c -k jwt.hex -b @@ -76,8 +77,31 @@ jobs: if [ $monitoring_exit_status -eq 0 ]; then echo "Tests completed successfully" echo "::notice::Tests completed successfully" + echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT" else echo "Error detected during tests" echo "::error::Error detected during tests" - exit 1 + echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT" fi + + - name: Resume Erigon ("db-producer") + if: always() + run: | + response=$(curl -o /dev/null -s -w "%{http_code}\n" -X POST http://localhost:8080/production \ + -H "Content-Type: application/json" \ + -d '{"status":"resumed"}') + if [ "$response" -ne 200 ]; then + echo "Request failed with status $response" + echo "::warning::Failed to resume Erigon, reason= $response" + fi + + - name: Action for Success + if: steps.test_step.outputs.TEST_RESULT == 'success' + run: echo "::notice::Tests completed successfully" + + - name: Action for Not Success + if: steps.test_step.outputs.TEST_RESULT != 'success' + run: | + echo "::error::Error detected during tests" + exit 1 + From 5681a9016f0bf0a4fa7f6da20b13ef00c5014ebc Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Mon, 5 Feb 2024 15:59:41 +0100 Subject: [PATCH 04/23] add run_test cmd line --- .github/workflows/rpc-integration-tests.yml | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 5935278f53..8ed7b03c4c 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -13,6 +13,7 @@ jobs: runs-on: self-hosted env: ERIGON_DATA_DIR: /opt/erigon/datadir + RPC_TEST_DIR: /opt/rpc-test steps: - name: Check out repository @@ -39,15 +40,15 @@ jobs: # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config Release --target rpcdaemon -j 2 - - name: Put Erigon ("db-producer") in paused state - run: | - response=$(curl -o /dev/null -s -w "%{http_code}\n" -X POST http://localhost:8080/production \ - -H "Content-Type: application/json" \ - -d '{"status":"paused"}') - if [ "$response" -ne 200 ]; then - echo "::error::Failed to pause Erigon, reason= $response" - exit 1 - fi + #- name: Put Erigon ("db-producer") in paused state + # run: | + # response=$(curl -o /dev/null -s -w "%{http_code}\n" -X POST http://localhost:8080/production \ + # -H "Content-Type: application/json" \ + # -d '{"status":"paused"}') + # if [ "$response" -ne 200 ]; then + # echo "::error::Failed to pause Erigon, reason= $response" + # exit 1 + # fi - name: Run SilkRpc working-directory: ${{runner.workspace}}/build/cmd @@ -58,8 +59,10 @@ jobs: - name: Run integration tests id: test_step run: | + cd $RPC_TEST_DIR/integration + # Run Erigon, send ctrl-c and check logs - python3 ./run_tests.py -c -k jwt.hex -b + python3 ./run_tests.py --continue --blockchain mainnet --jwt /jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json # Capture monitoring script exit status monitoring_exit_status=$? From 7ddc4dddb1e6736d3b0358164acc0fc9545d9d07 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Mon, 5 Feb 2024 16:24:10 +0100 Subject: [PATCH 05/23] add rpcdaemon cmd line --- .github/workflows/rpc-integration-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 8ed7b03c4c..33e9b46878 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -13,7 +13,7 @@ jobs: runs-on: self-hosted env: ERIGON_DATA_DIR: /opt/erigon/datadir - RPC_TEST_DIR: /opt/rpc-test + RPC_TEST_DIR: /opt/rpc-tests steps: - name: Check out repository @@ -53,7 +53,7 @@ jobs: - name: Run SilkRpc working-directory: ${{runner.workspace}}/build/cmd run: | - rpcdaemon & + rpcdaemon --datadir $ERIGON_DATA_DIR --api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --log.verbosity 1 --erigon_compatibility --jwt ./jwt.hex --skip_protocol_check & RPC_DAEMON_PID=$! - name: Run integration tests @@ -62,7 +62,7 @@ jobs: cd $RPC_TEST_DIR/integration # Run Erigon, send ctrl-c and check logs - python3 ./run_tests.py --continue --blockchain mainnet --jwt /jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json + python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json # Capture monitoring script exit status monitoring_exit_status=$? From 7597114c8e5fff1a669f217f330546a785ac6b46 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Mon, 5 Feb 2024 16:33:11 +0100 Subject: [PATCH 06/23] add synchronize trigger --- .github/workflows/rpc-integration-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 33e9b46878..a9b9117db9 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -7,6 +7,7 @@ on: types: - opened - ready_for_review + - synchronize jobs: integration-test-suite: From cc3cca2a8c66e56b4c06884aeae390316c45e8cd Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Mon, 5 Feb 2024 16:56:13 +0100 Subject: [PATCH 07/23] fix build dir --- .github/workflows/rpc-integration-tests.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index a9b9117db9..52ac97262d 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -15,6 +15,7 @@ jobs: env: ERIGON_DATA_DIR: /opt/erigon/datadir RPC_TEST_DIR: /opt/rpc-tests + SILKWORM_BUILD_DIR: ${{runner.workspace}}/silkworm/build steps: - name: Check out repository @@ -24,20 +25,20 @@ jobs: fetch-depth: "0" - name: Clean Build Directory - run: rm -rf ${{runner.workspace}}/build/* + run: rm -rf $SILKWORM_BUILD_DIR - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory # We'll use this as our working directory for all subsequent commands - run: cmake -E make_directory ${{runner.workspace}}/build + run: cmake -E make_directory $SILKWORM_BUILD_DIR - name: Configure CMake - working-directory: ${{runner.workspace}}/build + working-directory: $SILKWORM_BUILD_DIR run: | cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release - name: Build SilkRpc - working-directory: ${{runner.workspace}}/build + working-directory: $SILKWORM_BUILD_DIR # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config Release --target rpcdaemon -j 2 @@ -52,9 +53,9 @@ jobs: # fi - name: Run SilkRpc - working-directory: ${{runner.workspace}}/build/cmd + working-directory: $SILKWORM_BUILD_DIR/cmd run: | - rpcdaemon --datadir $ERIGON_DATA_DIR --api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --log.verbosity 1 --erigon_compatibility --jwt ./jwt.hex --skip_protocol_check & + ./rpcdaemon --datadir $ERIGON_DATA_DIR --api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --log.verbosity 1 --erigon_compatibility --jwt ./jwt.hex --skip_protocol_check & RPC_DAEMON_PID=$! - name: Run integration tests @@ -63,7 +64,7 @@ jobs: cd $RPC_TEST_DIR/integration # Run Erigon, send ctrl-c and check logs - python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json + python3 ./run_tests.py --continue --blockchain mainnet --jwt $SILKWORM_BUILD_DIR/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json # Capture monitoring script exit status monitoring_exit_status=$? From b20f252cc9cee33c830ff5daef01fc3f831a1616 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Mon, 5 Feb 2024 16:59:44 +0100 Subject: [PATCH 08/23] fix build dir (bis) --- .github/workflows/rpc-integration-tests.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 52ac97262d..55e491cc73 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -15,7 +15,6 @@ jobs: env: ERIGON_DATA_DIR: /opt/erigon/datadir RPC_TEST_DIR: /opt/rpc-tests - SILKWORM_BUILD_DIR: ${{runner.workspace}}/silkworm/build steps: - name: Check out repository @@ -25,20 +24,20 @@ jobs: fetch-depth: "0" - name: Clean Build Directory - run: rm -rf $SILKWORM_BUILD_DIR + run: rm -rf ${{runner.workspace}}/silkworm/build - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory # We'll use this as our working directory for all subsequent commands - run: cmake -E make_directory $SILKWORM_BUILD_DIR + run: cmake -E make_directory ${{runner.workspace}}/silkworm/build - name: Configure CMake - working-directory: $SILKWORM_BUILD_DIR + working-directory: ${{runner.workspace}}/silkworm/build run: | cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release - name: Build SilkRpc - working-directory: $SILKWORM_BUILD_DIR + working-directory: ${{runner.workspace}}/silkworm/build # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config Release --target rpcdaemon -j 2 @@ -53,7 +52,7 @@ jobs: # fi - name: Run SilkRpc - working-directory: $SILKWORM_BUILD_DIR/cmd + working-directory: ${{runner.workspace}}/silkworm/build/cmd run: | ./rpcdaemon --datadir $ERIGON_DATA_DIR --api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --log.verbosity 1 --erigon_compatibility --jwt ./jwt.hex --skip_protocol_check & RPC_DAEMON_PID=$! @@ -64,7 +63,7 @@ jobs: cd $RPC_TEST_DIR/integration # Run Erigon, send ctrl-c and check logs - python3 ./run_tests.py --continue --blockchain mainnet --jwt $SILKWORM_BUILD_DIR/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json + python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json # Capture monitoring script exit status monitoring_exit_status=$? From 4ecb457835d54d1fe850818c44e68556d9a45fe4 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Mon, 5 Feb 2024 17:37:24 +0100 Subject: [PATCH 09/23] increase build parallelism --- .github/workflows/rpc-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 55e491cc73..a0b8c029bd 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -39,7 +39,7 @@ jobs: - name: Build SilkRpc working-directory: ${{runner.workspace}}/silkworm/build # Execute the build. You can specify a specific target with "--target " - run: cmake --build . --config Release --target rpcdaemon -j 2 + run: cmake --build . --config Release --target rpcdaemon -j 8 #- name: Put Erigon ("db-producer") in paused state # run: | From 38184f04227dd1a1d7d4e4394f12114da97eb414 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Mon, 5 Feb 2024 17:42:10 +0100 Subject: [PATCH 10/23] comment erigon resume task --- .github/workflows/rpc-integration-tests.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index a0b8c029bd..39b569fe90 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -88,16 +88,16 @@ jobs: echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT" fi - - name: Resume Erigon ("db-producer") - if: always() - run: | - response=$(curl -o /dev/null -s -w "%{http_code}\n" -X POST http://localhost:8080/production \ - -H "Content-Type: application/json" \ - -d '{"status":"resumed"}') - if [ "$response" -ne 200 ]; then - echo "Request failed with status $response" - echo "::warning::Failed to resume Erigon, reason= $response" - fi + #- name: Resume Erigon ("db-producer") + # if: always() + # run: | + # response=$(curl -o /dev/null -s -w "%{http_code}\n" -X POST http://localhost:8080/production \ + # -H "Content-Type: application/json" \ + # -d '{"status":"resumed"}') + # if [ "$response" -ne 200 ]; then + # echo "Request failed with status $response" + # echo "::warning::Failed to resume Erigon, reason= $response" + # fi - name: Action for Success if: steps.test_step.outputs.TEST_RESULT == 'success' From e621a1e35380075cdd2c9d1e07d66f1aab0f6269 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Mon, 5 Feb 2024 17:55:05 +0100 Subject: [PATCH 11/23] raise verbosity of rpc-test --- .github/workflows/rpc-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 39b569fe90..ffe519a6ae 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -63,7 +63,7 @@ jobs: cd $RPC_TEST_DIR/integration # Run Erigon, send ctrl-c and check logs - python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json + python3 ./run_tests.py --verbose 2 --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json # Capture monitoring script exit status monitoring_exit_status=$? From 5b6dbc4cab4d73ba5a8985ba09874c34e1c5420d Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Mon, 5 Feb 2024 19:33:29 +0100 Subject: [PATCH 12/23] lower verbosity of rpc-test --- .github/workflows/rpc-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index ffe519a6ae..39b569fe90 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -63,7 +63,7 @@ jobs: cd $RPC_TEST_DIR/integration # Run Erigon, send ctrl-c and check logs - python3 ./run_tests.py --verbose 2 --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json + python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json # Capture monitoring script exit status monitoring_exit_status=$? From 13b10fa2a7020a8f45e476cb01a13d5e712753fc Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Mon, 5 Feb 2024 19:46:58 +0100 Subject: [PATCH 13/23] save rpc-test results --- .github/workflows/rpc-integration-tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 39b569fe90..0374cc4808 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -15,6 +15,7 @@ jobs: env: ERIGON_DATA_DIR: /opt/erigon/datadir RPC_TEST_DIR: /opt/rpc-tests + RPC_PAST_TEST_RES_DIR: /opt/rpc-past-tests steps: - name: Check out repository @@ -68,6 +69,9 @@ jobs: # Capture monitoring script exit status monitoring_exit_status=$? + # Save test result to a directory with timestamp and commit hash + mv $RPC_TEST_DIR/integration/mainnet/results $RPC_PAST_TEST_RES_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git rev-parse --short HEAD) + # Clean up Erigon process if it's still running if kill -0 $RPC_DAEMON_PID 2> /dev/null; then echo "Terminating rpc-daemon" From 54dba9d2930413ebda1a8d20387e8ce5270c4ec7 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Tue, 6 Feb 2024 11:58:31 +0100 Subject: [PATCH 14/23] save rpc-test results --- .github/workflows/rpc-integration-tests.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 0374cc4808..4c7f65681c 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -14,16 +14,23 @@ jobs: runs-on: self-hosted env: ERIGON_DATA_DIR: /opt/erigon/datadir - RPC_TEST_DIR: /opt/rpc-tests - RPC_PAST_TEST_RES_DIR: /opt/rpc-past-tests + RPC_TEST_DIR: $GITHUB_WORKSPACE/rpc-tests + RPC_PAST_TEST_DIR: /opt/rpc-past-tests steps: - - name: Check out repository + - name: Check out silkworm repository uses: actions/checkout@v3 with: submodules: recursive fetch-depth: "0" + - name: Checkout rpc-tests repository & install requirements + run: | + git clone https://github.com/erigontech/rpc-tests $RPC_TEST_DIR + cd $RPC_TEST_DIR + git checkout main + pip3 install -r requirements.txt + - name: Clean Build Directory run: rm -rf ${{runner.workspace}}/silkworm/build @@ -70,7 +77,7 @@ jobs: monitoring_exit_status=$? # Save test result to a directory with timestamp and commit hash - mv $RPC_TEST_DIR/integration/mainnet/results $RPC_PAST_TEST_RES_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git rev-parse --short HEAD) + mv $RPC_TEST_DIR/integration/mainnet/results $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git rev-parse --short HEAD) # Clean up Erigon process if it's still running if kill -0 $RPC_DAEMON_PID 2> /dev/null; then From 72138ae8371797c56006fd7ca2894deb98bce5bc Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Tue, 6 Feb 2024 12:57:01 +0100 Subject: [PATCH 15/23] fix rpc-test dir; refactor rpcdaemon killing code into a task --- .github/workflows/rpc-integration-tests.yml | 34 +++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 4c7f65681c..ef3e303dc4 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -14,7 +14,6 @@ jobs: runs-on: self-hosted env: ERIGON_DATA_DIR: /opt/erigon/datadir - RPC_TEST_DIR: $GITHUB_WORKSPACE/rpc-tests RPC_PAST_TEST_DIR: /opt/rpc-past-tests steps: @@ -26,8 +25,8 @@ jobs: - name: Checkout rpc-tests repository & install requirements run: | - git clone https://github.com/erigontech/rpc-tests $RPC_TEST_DIR - cd $RPC_TEST_DIR + git clone https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests + cd ${{runner.workspace}}/rpc-tests git checkout main pip3 install -r requirements.txt @@ -64,11 +63,12 @@ jobs: run: | ./rpcdaemon --datadir $ERIGON_DATA_DIR --api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --log.verbosity 1 --erigon_compatibility --jwt ./jwt.hex --skip_protocol_check & RPC_DAEMON_PID=$! + echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" >> $GITHUB_ENV - name: Run integration tests id: test_step run: | - cd $RPC_TEST_DIR/integration + cd ${{runner.workspace}}/rpc-tests/integration # Run Erigon, send ctrl-c and check logs python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json @@ -77,28 +77,30 @@ jobs: monitoring_exit_status=$? # Save test result to a directory with timestamp and commit hash - mv $RPC_TEST_DIR/integration/mainnet/results $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git rev-parse --short HEAD) - - # Clean up Erigon process if it's still running - if kill -0 $RPC_DAEMON_PID 2> /dev/null; then - echo "Terminating rpc-daemon" - kill $RPC_DAEMON_PID - wait $RPC_DAEMON_PID - else - echo "rpc-daemon has already terminated" - fi + mv ${{runner.workspace}}/rpc-tests/integration/mainnet/results $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git rev-parse --short HEAD) # Check monitoring script exit status if [ $monitoring_exit_status -eq 0 ]; then echo "Tests completed successfully" - echo "::notice::Tests completed successfully" echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT" else echo "Error detected during tests" - echo "::error::Error detected during tests" echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT" fi + - name: Stop SilkRpc + working-directory: ${{runner.workspace}}/silkworm/build/cmd + run: | + # Clean up rpcdaemon process if it's still running + echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" + if kill -0 $RPC_DAEMON_PID 2> /dev/null; then + echo "Terminating rpc-daemon" + kill $RPC_DAEMON_PID + wait $RPC_DAEMON_PID + else + echo "rpc-daemon has already terminated" + fi + #- name: Resume Erigon ("db-producer") # if: always() # run: | From a41fe458c70c3e2bed3c8cba43dca25244da9f7b Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Tue, 6 Feb 2024 13:14:28 +0100 Subject: [PATCH 16/23] fix rpcdaemon kill --- .github/workflows/rpc-integration-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index ef3e303dc4..aadaf46fdc 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -96,7 +96,6 @@ jobs: if kill -0 $RPC_DAEMON_PID 2> /dev/null; then echo "Terminating rpc-daemon" kill $RPC_DAEMON_PID - wait $RPC_DAEMON_PID else echo "rpc-daemon has already terminated" fi From 6754dfe7ea327d0dbfd2515b45b7f5da4217c38c Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Tue, 6 Feb 2024 13:23:20 +0100 Subject: [PATCH 17/23] fix rpc-tests checkout --- .github/workflows/rpc-integration-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index aadaf46fdc..af5677883a 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -25,6 +25,7 @@ jobs: - name: Checkout rpc-tests repository & install requirements run: | + rm -rf ${{runner.workspace}}/rpc-tests git clone https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests cd ${{runner.workspace}}/rpc-tests git checkout main From 746ef978efad274e85486c41d10a63001f501311 Mon Sep 17 00:00:00 2001 From: canepat <16927169+canepat@users.noreply.github.com> Date: Tue, 6 Feb 2024 18:21:37 +0100 Subject: [PATCH 18/23] Trigger expected failure with invalid test number --- .github/workflows/rpc-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index af5677883a..1d16b06799 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -72,7 +72,7 @@ jobs: cd ${{runner.workspace}}/rpc-tests/integration # Run Erigon, send ctrl-c and check logs - python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json + python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json -t 300 # Capture monitoring script exit status monitoring_exit_status=$? From 06215a1087c054ff7c370d76040eb568fe344721 Mon Sep 17 00:00:00 2001 From: canepat <16927169+canepat@users.noreply.github.com> Date: Tue, 6 Feb 2024 19:24:30 +0100 Subject: [PATCH 19/23] Remove intentional wrong parameter --- .github/workflows/rpc-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 1d16b06799..af5677883a 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -72,7 +72,7 @@ jobs: cd ${{runner.workspace}}/rpc-tests/integration # Run Erigon, send ctrl-c and check logs - python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json -t 300 + python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json # Capture monitoring script exit status monitoring_exit_status=$? From 46f122da44db72695dd8596f617d0c882a2f3a65 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Wed, 7 Feb 2024 10:33:13 +0100 Subject: [PATCH 20/23] do cleanup on test failure --- .github/workflows/rpc-integration-tests.yml | 31 +++------------------ 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index af5677883a..575116716c 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -35,8 +35,6 @@ jobs: run: rm -rf ${{runner.workspace}}/silkworm/build - name: Create Build Environment - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands run: cmake -E make_directory ${{runner.workspace}}/silkworm/build - name: Configure CMake @@ -46,19 +44,8 @@ jobs: - name: Build SilkRpc working-directory: ${{runner.workspace}}/silkworm/build - # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config Release --target rpcdaemon -j 8 - #- name: Put Erigon ("db-producer") in paused state - # run: | - # response=$(curl -o /dev/null -s -w "%{http_code}\n" -X POST http://localhost:8080/production \ - # -H "Content-Type: application/json" \ - # -d '{"status":"paused"}') - # if [ "$response" -ne 200 ]; then - # echo "::error::Failed to pause Erigon, reason= $response" - # exit 1 - # fi - - name: Run SilkRpc working-directory: ${{runner.workspace}}/silkworm/build/cmd run: | @@ -69,19 +56,21 @@ jobs: - name: Run integration tests id: test_step run: | + set +e # Disable exit on error + cd ${{runner.workspace}}/rpc-tests/integration # Run Erigon, send ctrl-c and check logs python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json # Capture monitoring script exit status - monitoring_exit_status=$? + test_exit_status=$? # Save test result to a directory with timestamp and commit hash mv ${{runner.workspace}}/rpc-tests/integration/mainnet/results $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git rev-parse --short HEAD) # Check monitoring script exit status - if [ $monitoring_exit_status -eq 0 ]; then + if [ $test_exit_status -eq 0 ]; then echo "Tests completed successfully" echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT" else @@ -93,7 +82,6 @@ jobs: working-directory: ${{runner.workspace}}/silkworm/build/cmd run: | # Clean up rpcdaemon process if it's still running - echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" if kill -0 $RPC_DAEMON_PID 2> /dev/null; then echo "Terminating rpc-daemon" kill $RPC_DAEMON_PID @@ -101,17 +89,6 @@ jobs: echo "rpc-daemon has already terminated" fi - #- name: Resume Erigon ("db-producer") - # if: always() - # run: | - # response=$(curl -o /dev/null -s -w "%{http_code}\n" -X POST http://localhost:8080/production \ - # -H "Content-Type: application/json" \ - # -d '{"status":"resumed"}') - # if [ "$response" -ne 200 ]; then - # echo "Request failed with status $response" - # echo "::warning::Failed to resume Erigon, reason= $response" - # fi - - name: Action for Success if: steps.test_step.outputs.TEST_RESULT == 'success' run: echo "::notice::Tests completed successfully" From 837da85925cffd7fbcd2c8d9df655b99d05efe08 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Wed, 7 Feb 2024 10:39:41 +0100 Subject: [PATCH 21/23] trigger expected failure with invalid test number --- .github/workflows/rpc-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 575116716c..b94d28e69e 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -61,7 +61,7 @@ jobs: cd ${{runner.workspace}}/rpc-tests/integration # Run Erigon, send ctrl-c and check logs - python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json + python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json -t 300 # Capture monitoring script exit status test_exit_status=$? From 6cb27a1af87ec3e961c8093349a46798f0e7f23e Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Wed, 7 Feb 2024 10:47:09 +0100 Subject: [PATCH 22/23] remove intentional wrong parameter --- .github/workflows/rpc-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index b94d28e69e..575116716c 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -61,7 +61,7 @@ jobs: cd ${{runner.workspace}}/rpc-tests/integration # Run Erigon, send ctrl-c and check logs - python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json -t 300 + python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json # Capture monitoring script exit status test_exit_status=$? From 8e60557bff3d7174a498a0c71507efdefaec66cc Mon Sep 17 00:00:00 2001 From: canepat <16927169+canepat@users.noreply.github.com> Date: Wed, 7 Feb 2024 16:01:45 +0100 Subject: [PATCH 23/23] Update rpc-integration-tests.yml --- .github/workflows/rpc-integration-tests.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 575116716c..fd6327d99b 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -17,13 +17,13 @@ jobs: RPC_PAST_TEST_DIR: /opt/rpc-past-tests steps: - - name: Check out silkworm repository + - name: Checkout Silkworm Repository uses: actions/checkout@v3 with: submodules: recursive fetch-depth: "0" - - name: Checkout rpc-tests repository & install requirements + - name: Checkout RPC Tests Repository & Install Requirements run: | rm -rf ${{runner.workspace}}/rpc-tests git clone https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests @@ -42,34 +42,34 @@ jobs: run: | cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release - - name: Build SilkRpc + - name: Build Silkworm RpcDaemon working-directory: ${{runner.workspace}}/silkworm/build run: cmake --build . --config Release --target rpcdaemon -j 8 - - name: Run SilkRpc + - name: Run Silkworm RpcDaemon working-directory: ${{runner.workspace}}/silkworm/build/cmd run: | ./rpcdaemon --datadir $ERIGON_DATA_DIR --api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --log.verbosity 1 --erigon_compatibility --jwt ./jwt.hex --skip_protocol_check & RPC_DAEMON_PID=$! echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" >> $GITHUB_ENV - - name: Run integration tests + - name: Run RPC Integration Tests id: test_step run: | set +e # Disable exit on error cd ${{runner.workspace}}/rpc-tests/integration - # Run Erigon, send ctrl-c and check logs + # Run RPC integration test runner python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json - # Capture monitoring script exit status + # Capture test runner script exit status test_exit_status=$? # Save test result to a directory with timestamp and commit hash mv ${{runner.workspace}}/rpc-tests/integration/mainnet/results $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git rev-parse --short HEAD) - # Check monitoring script exit status + # Check test runner exit status if [ $test_exit_status -eq 0 ]; then echo "Tests completed successfully" echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT" @@ -78,7 +78,7 @@ jobs: echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT" fi - - name: Stop SilkRpc + - name: Stop Silkworm RpcDaemon working-directory: ${{runner.workspace}}/silkworm/build/cmd run: | # Clean up rpcdaemon process if it's still running