Skip to content

Commit

Permalink
Merge pull request #92 from ethpandaops/add-shadowfork-from-file
Browse files Browse the repository at this point in the history
add shadowfork with file
  • Loading branch information
parithosh authored Jan 31, 2024
2 parents 6a952c5 + b584475 commit 72bf7e4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 https://github.com/protolambda/eth2-testnet-genesis.git \
&& cd eth2-testnet-genesis \
&& go install . \
&& go install github.com/protolambda/eth2-val-tools@latest \
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions config-example/el/latest_block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"jsonrpc":"2.0","id":1,"result":{}}
1 change: 1 addition & 0 deletions config-example/values.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -76,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
Expand Down

0 comments on commit 72bf7e4

Please sign in to comment.