Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error early if apply test vectors returns INVALID payload #20

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script maybe called for various clients, it's not nethermind only. You can say "EL is available"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


declare -i BLOCK_COUNTER=0

function make_block() {
((BLOCK_COUNTER++))
# increment block counter
BLOCK_COUNTER=$((BLOCK_COUNTER + 1))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the motivation to change this syntax?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

difference in how this syntax is handled between sh and bash. earlier was getting an error where docker image was exiting as soon as the make_block function got called, this commit fixed it

just verified it again with everything same, just the syntax reverted (https://github.com/debjit-bw/reth_gnosis/actions/runs/11368078320/job/31622284450)


echo "Making block $BLOCK_COUNTER"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a double log between this line and 163

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed from line 163


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
Loading