diff --git a/.github/workflows/post-merge-run.yml b/.github/workflows/post-merge-run.yml new file mode 100644 index 0000000..2938781 --- /dev/null +++ b/.github/workflows/post-merge-run.yml @@ -0,0 +1,46 @@ +name: Test + +on: + pull_request: + push: + branches: + - master + +env: + REQWEST_TEST_BODY_FULL: 1 + RUST_BACKTRACE: 1 + +jobs: + post-merge-run: + name: Test post merge run + runs-on: 'ubuntu-latest' + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust || 'stable' }} + targets: ${{ matrix.target }} + - name: Setup docker (missing on MacOS) + if: runner.os == 'macos' + run: | + brew install docker + brew install docker-buildx + # Vectors are already generated, but this serves as a test + - name: Generate vectors + run: ./generate_test_vectors.sh + # Test vectors against nethermind + - name: Apply vectors to Nethermind + run: ./apply_test_vectors_nethermind.sh + # Test vectors against Reth + - name: Apply vectors to Reth + run: ./apply_test_vectors_reth.sh + + diff --git a/apply_test_vectors.sh b/apply_test_vectors.sh index 4fbbc70..99ec2df 100755 --- a/apply_test_vectors.sh +++ b/apply_test_vectors.sh @@ -7,6 +7,14 @@ OUT_DIR=./blocks N=5 +# Retry the curl command until it succeeds +until curl -X POST -H "Content-Type: application/json" \ + --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0", false],"id":1}' \ + http://localhost:8545; do + echo "Retrying..." + sleep 2 +done + function apply_block_file() { BLOCK_FILEPATH=$1 diff --git a/apply_test_vectors_nethermind.sh b/apply_test_vectors_nethermind.sh new file mode 100755 index 0000000..82d4841 --- /dev/null +++ b/apply_test_vectors_nethermind.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e + +./run_nethermind.sh & +./apply_test_vectors.sh +# TODO more resilient shutdown +docker rm -f neth-vec-gen 2>/dev/null + diff --git a/apply_test_vectors_reth.sh b/apply_test_vectors_reth.sh new file mode 100755 index 0000000..1a44521 --- /dev/null +++ b/apply_test_vectors_reth.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e + +./run_reth.sh & +./apply_test_vectors.sh + +