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

Ci fixes #1

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
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
8 changes: 8 additions & 0 deletions scripts/apply_test_vectors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ 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: 18 additions & 5 deletions scripts/generate_test_vectors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ DIR="$(dirname "$0")"
OUT_DIR=$DIR/blocks
mkdir -p $OUT_DIR


# 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}' \
Expand All @@ -24,14 +23,29 @@ until curl -X POST -H "Content-Type: application/json" \
sleep 2
done

echo "Nethermind is available"

BLOCK_COUNTER=0

function make_block() {

# increment block counter
((BLOCK_COUNTER++))

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 @@ -103,7 +117,6 @@ function make_block() {
echo $BLOCK | jq '.' > $OUT_DIR/block_$BLOCK_NUMBER_HEX.json

# send the new block as payload

RESPONSE=$(curl -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer $JWT_TOKEN" \
--data "{
Expand Down Expand Up @@ -139,13 +152,13 @@ function make_block() {
http://localhost:8546 \
)
echo engine_forkchoiceUpdatedV1 set new block as head RESPONSE $RESPONSE

}

# Number of times to call make_block
N=5

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

1 change: 0 additions & 1 deletion scripts/generate_test_vectors_nethermind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ cleanup() {
trap cleanup EXIT

$DIR/generate_test_vectors.sh

2 changes: 2 additions & 0 deletions scripts/run_reth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#
# 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