Skip to content

Commit

Permalink
ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
debjit-bw committed Oct 15, 2024
1 parent ec71c67 commit f506815
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/post-merge-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions scripts/apply_test_vectors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down
23 changes: 19 additions & 4 deletions scripts/generate_test_vectors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -146,6 +160,7 @@ function make_block() {
N=5

for ((i = 1; i <= N; i++)); do
echo "Making block $i"
make_block
done

3 changes: 3 additions & 0 deletions scripts/run_reth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f506815

Please sign in to comment.