-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Post-merge test vectors from Nethermind to Reth (#8)
* Can gen 0x1 block * function and latest * Can gen 5 blocks without transactions * Run apply test vectors * Run on reth * unschedule shangai * Add CI step * jq * Fix blockRewardsContract address
- Loading branch information
Showing
22 changed files
with
455 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
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 | ||
- name: Test jq is installed | ||
run: jq --help | ||
# 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 | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Expects reth to be running on the background | ||
|
||
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 | ||
BLOCK=$(<$BLOCK_FILEPATH) | ||
echo Applying $BLOCK | ||
|
||
# The ASCII representation of `2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a` | ||
JWT_SECRET="********************************" | ||
# Generate a JWT token using the secret key | ||
# jwt is this CLI tool https://github.com/mike-engel/jwt-cli/tree/main | ||
# iat is appended automatically | ||
JWT_TOKEN=$(jwt encode --alg HS256 --secret "$JWT_SECRET") | ||
echo JWT_TOKEN: $JWT_TOKEN | ||
|
||
RESPONSE=$(curl -X POST -H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $JWT_TOKEN" \ | ||
--data "{ | ||
\"jsonrpc\":\"2.0\", | ||
\"method\":\"engine_newPayloadV1\", | ||
\"params\":[ | ||
$BLOCK | ||
], | ||
\"id\":1 | ||
}" \ | ||
http://localhost:8546 \ | ||
) | ||
echo engine_newPayloadV1 with new block RESPONSE $RESPONSE | ||
|
||
BLOCK_HASH=$(echo $BLOCK | jq --raw-output '.blockHash') | ||
|
||
RESPONSE=$(curl -X POST -H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $JWT_TOKEN" \ | ||
--data "{ | ||
\"jsonrpc\":\"2.0\", | ||
\"method\":\"engine_forkchoiceUpdatedV1\", | ||
\"params\":[ | ||
{ | ||
\"headBlockHash\": \"$BLOCK_HASH\", | ||
\"safeBlockHash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\", | ||
\"finalizedBlockHash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\" | ||
}, | ||
null | ||
], | ||
\"id\":1 | ||
}" \ | ||
http://localhost:8546 \ | ||
) | ||
echo engine_forkchoiceUpdatedV1 set new block as head RESPONSE $RESPONSE | ||
} | ||
|
||
|
||
for ((i = 1; i <= N; i++)); do | ||
BLOCK_FILEPATH=$OUT_DIR/block_$i.json | ||
apply_block_file $BLOCK_FILEPATH | ||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
./run_reth.sh & | ||
./apply_test_vectors.sh | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"baseFeePerGas": "0x342770c0", | ||
"blockHash": "0xc0f683b61355455d49af3dbb11fe1f65e9ae8670890d6fb1aadcbf5f8acc960b", | ||
"blockNumber": "0x1", | ||
"extraData": "0x4e65746865726d696e64", | ||
"feeRecipient": "0x0000000000000000000000000000000000000000", | ||
"gasLimit": "0x989680", | ||
"gasUsed": "0x0", | ||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"parentHash": "0xa7931c99fd2b7b5e323a2fda8a2dd607cea04f03835c3f29bfe7c057c8b5672e", | ||
"prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"stateRoot": "0xa59f6ea19d9ee6d7e79bcb286e6d8838b47b48351b37960e24c0a72d41fa1629", | ||
"timestamp": "0x6553f101", | ||
"transactions": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"baseFeePerGas": "0x2da282a8", | ||
"blockHash": "0xc314b27368528ec560d035ef9f5dc46e2aea6d21b618eeb37e91723fefdfb2d9", | ||
"blockNumber": "0x2", | ||
"extraData": "0x4e65746865726d696e64", | ||
"feeRecipient": "0x0000000000000000000000000000000000000000", | ||
"gasLimit": "0x989680", | ||
"gasUsed": "0x0", | ||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"parentHash": "0xc0f683b61355455d49af3dbb11fe1f65e9ae8670890d6fb1aadcbf5f8acc960b", | ||
"prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"stateRoot": "0xa59f6ea19d9ee6d7e79bcb286e6d8838b47b48351b37960e24c0a72d41fa1629", | ||
"timestamp": "0x6553f102", | ||
"transactions": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"baseFeePerGas": "0x27ee3253", | ||
"blockHash": "0xd51a4d79676ddad8e938c38ec1344a77feefa369475acb358563f37a74a4d9d6", | ||
"blockNumber": "0x3", | ||
"extraData": "0x4e65746865726d696e64", | ||
"feeRecipient": "0x0000000000000000000000000000000000000000", | ||
"gasLimit": "0x989680", | ||
"gasUsed": "0x0", | ||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"parentHash": "0xc314b27368528ec560d035ef9f5dc46e2aea6d21b618eeb37e91723fefdfb2d9", | ||
"prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"stateRoot": "0xa59f6ea19d9ee6d7e79bcb286e6d8838b47b48351b37960e24c0a72d41fa1629", | ||
"timestamp": "0x6553f103", | ||
"transactions": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"baseFeePerGas": "0x22f06c09", | ||
"blockHash": "0x011405450b1431877c952c73d0ea0c964c67d006b3134aea5be7a59823e40e39", | ||
"blockNumber": "0x4", | ||
"extraData": "0x4e65746865726d696e64", | ||
"feeRecipient": "0x0000000000000000000000000000000000000000", | ||
"gasLimit": "0x989680", | ||
"gasUsed": "0x0", | ||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"parentHash": "0xd51a4d79676ddad8e938c38ec1344a77feefa369475acb358563f37a74a4d9d6", | ||
"prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"stateRoot": "0xa59f6ea19d9ee6d7e79bcb286e6d8838b47b48351b37960e24c0a72d41fa1629", | ||
"timestamp": "0x6553f104", | ||
"transactions": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"baseFeePerGas": "0x1e925e88", | ||
"blockHash": "0x9a86f6d4d524388c300b8a09a145d0406fcf13d343ef8574c46fc0ffad9a45a0", | ||
"blockNumber": "0x5", | ||
"extraData": "0x4e65746865726d696e64", | ||
"feeRecipient": "0x0000000000000000000000000000000000000000", | ||
"gasLimit": "0x989680", | ||
"gasUsed": "0x0", | ||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"parentHash": "0x011405450b1431877c952c73d0ea0c964c67d006b3134aea5be7a59823e40e39", | ||
"prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"stateRoot": "0xa59f6ea19d9ee6d7e79bcb286e6d8838b47b48351b37960e24c0a72d41fa1629", | ||
"timestamp": "0x6553f105", | ||
"transactions": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.