From 2b98e185d8757c922823b77bec44b261e4cd4479 Mon Sep 17 00:00:00 2001 From: parithosh Date: Mon, 29 Jan 2024 18:26:16 +0100 Subject: [PATCH 1/3] add shadowfork with file --- Dockerfile | 4 ++-- README.md | 7 +++++++ config-example/el/latest_block.json | 1 + config-example/values.env | 1 + entrypoint.sh | 4 +++- 5 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 config-example/el/latest_block.json diff --git a/Dockerfile b/Dockerfile index e67afb8..b158a31 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -FROM golang:1.19 as builder -RUN git clone https://github.com/protolambda/eth2-testnet-genesis.git \ +FROM golang:1.20 as builder +RUN git clone -b add-shadowfork-from-file https://github.com/protolambda/eth2-testnet-genesis.git \ && cd eth2-testnet-genesis \ && go install . \ && go install github.com/protolambda/eth2-val-tools@latest \ diff --git a/README.md b/README.md index e79c13c..6586a77 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,13 @@ SERVER_PORT | 8000 | Web server port Besides that, you can also use ENV vars in your configuration files. One way of doing this is via the [values.env](config-example/values.env) configuration file. These will be replaced during runtime. +### Shadow Fork +If shadow fork from file is the preferred option, then please ensure the latest block `json` response is collected along with +transactions. This can be done with the below call for example: +```sh +curl -H "Content-Type: application/json" --data-raw '{ "jsonrpc":"2.0","method":"eth_getBlockByNumber", "params":[ "latest", true ], "id":1 }' localhost:8545 +``` + ### Available tools within the image Name | Source diff --git a/config-example/el/latest_block.json b/config-example/el/latest_block.json new file mode 100644 index 0000000..b374a58 --- /dev/null +++ b/config-example/el/latest_block.json @@ -0,0 +1 @@ +{"jsonrpc":"2.0","id":1,"result":{}} \ No newline at end of file diff --git a/config-example/values.env b/config-example/values.env index efeba9c..6da0a8d 100644 --- a/config-example/values.env +++ b/config-example/values.env @@ -16,6 +16,7 @@ export WITHDRAWAL_TYPE="0x00" export WITHDRAWAL_ADDRESS=0xf97e180c050e5Ab072211Ad2C213Eb5AEE4DF134 export BEACON_STATIC_ENR="enr:-Iq4QJk4WqRkjsX5c2CXtOra6HnxN-BMXnWhmhEQO9Bn9iABTJGdjUOurM7Btj1ouKaFkvTRoju5vz2GPmVON2dffQKGAX53x8JigmlkgnY0gmlwhLKAlv6Jc2VjcDI1NmsxoQK6S-Cii_KmfFdUJL2TANL3ksaKUnNXvTCv1tLwXs0QgIN1ZHCCIyk" #export SHADOW_FORK_RPC="http://docker.for.mac.localhost:8545" +#export SHADOW_FORK_FILE="/config/el/latest_block.json" export GENESIS_TIMESTAMP=0 export GENESIS_DELAY=60 export GENESIS_GASLIMIT=25000000 diff --git a/entrypoint.sh b/entrypoint.sh index b427a74..3a28f5f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -61,7 +61,9 @@ gen_cl_config(){ if [[ $WITHDRAWAL_TYPE == "0x01" ]]; then genesis_args+=(--eth1-withdrawal-address $WITHDRAWAL_ADDRESS) fi - if [[ $SHADOW_FORK_RPC != "" ]]; then + if [[ $SHADOW_FORK_FILE != "" ]]; then + genesis_args+=(--shadow-fork-block-file=$SHADOW_FORK_FILE --eth1-config "") + elif [[ $SHADOW_FORK_RPC != "" ]]; then genesis_args+=(--shadow-fork-eth1-rpc=$SHADOW_FORK_RPC --eth1-config "") else genesis_args+=(--eth1-config /data/custom_config_data/genesis.json) From e9c78360f44d0a9a2f89415a7c24d34796e7f5d5 Mon Sep 17 00:00:00 2001 From: parithosh Date: Tue, 30 Jan 2024 12:59:05 +0100 Subject: [PATCH 2/3] update entrypoint --- entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 3a28f5f..d66cef6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -78,6 +78,8 @@ gen_cl_config(){ fi /usr/local/bin/eth2-testnet-genesis "${genesis_args[@]}" /usr/local/bin/zcli pretty capella BeaconState /data/custom_config_data/genesis.ssz > /data/custom_config_data/parsedBeaconState.json + echo "Genesis block number: $(jq -r '.latest_execution_payload_header.block_number' /data/custom_config_data/parsedBeaconState.json)" + echo "Genesis block hash: $(jq -r '.latest_execution_payload_header.block_hash' /data/custom_config_data/parsedBeaconState.json)" jq -r '.eth1_data.block_hash' /data/custom_config_data/parsedBeaconState.json | tr -d '\n' > /data/custom_config_data/deposit_contract_block_hash.txt jq -r '.genesis_validators_root' /data/custom_config_data/parsedBeaconState.json | tr -d '\n' > /data/custom_config_data/genesis_validators_root.txt else From b584475a868cefc43d7c67c3a486a089a0ef70b2 Mon Sep 17 00:00:00 2001 From: parithosh Date: Wed, 31 Jan 2024 16:42:31 +0100 Subject: [PATCH 3/3] switch branch --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b158a31..c685199 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM golang:1.20 as builder -RUN git clone -b add-shadowfork-from-file https://github.com/protolambda/eth2-testnet-genesis.git \ +RUN git clone https://github.com/protolambda/eth2-testnet-genesis.git \ && cd eth2-testnet-genesis \ && go install . \ && go install github.com/protolambda/eth2-val-tools@latest \