diff --git a/.github/workflows/post-merge-run.yml b/.github/workflows/post-merge-run.yml index c1f6ebe..36c4d74 100644 --- a/.github/workflows/post-merge-run.yml +++ b/.github/workflows/post-merge-run.yml @@ -35,6 +35,8 @@ jobs: brew install docker-buildx - name: Test jq is installed run: jq --help + - name: Install jwt and add to path + run: cargo install jwt-cli && export PATH=$HOME/.cargo/bin:$PATH # Vectors are already generated, but this serves as a test - name: Generate vectors run: bash ./scripts/generate_test_vectors_nethermind.sh diff --git a/scripts/apply_test_vectors.sh b/scripts/apply_test_vectors.sh index 972e966..115b4b0 100755 --- a/scripts/apply_test_vectors.sh +++ b/scripts/apply_test_vectors.sh @@ -66,6 +66,15 @@ function apply_block_file() { http://localhost:8546 \ ) echo engine_forkchoiceUpdatedV1 set new block as head RESPONSE $RESPONSE + + + PAYLOAD_STATUS=$(echo $RESPONSE | jq --raw-output '.result.payloadStatus.status') + echo PAYLOAD_STATUS: $PAYLOAD_STATUS + # If the status is not "VALID", exit the script with a non-zero code to make CI fail + if [ "$PAYLOAD_STATUS" != "VALID" ]; then + echo "Error: Payload status is $PAYLOAD_STATUS, failing CI." + exit 1 + fi } diff --git a/scripts/generate_test_vectors.sh b/scripts/generate_test_vectors.sh index 0a37782..1b007e5 100755 --- a/scripts/generate_test_vectors.sh +++ b/scripts/generate_test_vectors.sh @@ -24,14 +24,28 @@ until curl -X POST -H "Content-Type: application/json" \ sleep 2 done -BLOCK_COUNTER=0 +echo "Nethermind is available" + +declare -i BLOCK_COUNTER=0 function make_block() { - ((BLOCK_COUNTER++)) + # increment block counter + BLOCK_COUNTER=$((BLOCK_COUNTER + 1)) + + echo "Making block $BLOCK_COUNTER" HEAD_BLOCK=$(curl -X POST -H "Content-Type: application/json" \ - --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", false],"id":1}' \ - http://localhost:8545) + --data "{ + \"jsonrpc\":\"2.0\", + \"method\":\"eth_getBlockByNumber\", + \"params\":[ + \"latest\", + false + ], + \"id\":1 + }" \ + http://localhost:8545 \ + ) # --raw-output remove the double quotes HEAD_BLOCK_HASH=$(echo $HEAD_BLOCK | jq --raw-output '.result.hash') @@ -146,6 +160,7 @@ function make_block() { N=5 for ((i = 1; i <= N; i++)); do + echo "Making block $i" make_block done diff --git a/scripts/run_reth.sh b/scripts/run_reth.sh index e141973..a99a3ca 100755 --- a/scripts/run_reth.sh +++ b/scripts/run_reth.sh @@ -4,6 +4,9 @@ # # reth genesis from https://github.com/ethpandaops/ethereum-genesis-generator/blob/a4b6733ea9d47b2b2ec497f5212f0265b83fb601/apps/el-gen/genesis_geth.py#L34 +# if TMPDIR is empty, use /tmp +TMPDIR=${TMPDIR:-/tmp} + DATA_DIR=$TMPDIR/reth_test # Ensure no data from previous tests rm -rf $DATA_DIR