diff --git a/Dockerfile b/Dockerfile index 487ef55..eb5dc4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,10 @@ -FROM golang:1.21 as builder +FROM golang:1.21 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 \ - && go install github.com/protolambda/zcli@latest + && go install github.com/protolambda/zcli@latest \ + && go install github.com/miguelmota/go-ethereum-hdwallet/cmd/geth-hdwallet@latest FROM debian:latest WORKDIR /work @@ -11,18 +12,18 @@ VOLUME ["/config", "/data"] EXPOSE 8000/tcp RUN apt-get update && \ apt-get install --no-install-recommends -y \ - ca-certificates build-essential python3 python3-dev python3.11-venv python3-venv python3-pip gettext-base jq wget curl && \ + ca-certificates gettext-base jq yq wget curl && \ apt-get autoremove -y && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* COPY apps /apps -ENV PATH="/root/.cargo/bin:${PATH}" -RUN cd /apps/el-gen && python3 -m venv .venv && /apps/el-gen/.venv/bin/pip3 install -r /apps/el-gen/requirements.txt COPY --from=builder /go/bin/eth2-testnet-genesis /usr/local/bin/eth2-testnet-genesis COPY --from=builder /go/bin/eth2-val-tools /usr/local/bin/eth2-val-tools COPY --from=builder /go/bin/zcli /usr/local/bin/zcli +COPY --from=builder /go/bin/geth-hdwallet /usr/local/bin/geth-hdwallet + COPY config-example /config COPY defaults /defaults COPY entrypoint.sh . diff --git a/apps/el-gen/generate_genesis.sh b/apps/el-gen/generate_genesis.sh new file mode 100644 index 0000000..c21fa2c --- /dev/null +++ b/apps/el-gen/generate_genesis.sh @@ -0,0 +1,373 @@ +#!/bin/bash + +generate_genesis() { + set +x + export CHAIN_ID_HEX="0x$(printf "%x" $CHAIN_ID)" + export GENESIS_TIMESTAMP_HEX="0x$(printf "%x" $GENESIS_TIMESTAMP)" + export GENESIS_GASLIMIT_HEX="0x$(printf "%x" $GENESIS_GASLIMIT)" + + out_dir=$1 + tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) + + is_shadowfork="1" + has_fork="0" + + # has_fork tracks the fork version of the input genesis + # 0 - phase0 + # 1 - altair + # 2 - bellatrix / merge + # 3 - capella / shanghai + # 4 - deneb / cancun + # 5 - electra / prague + # 6 - fulu / osaka + + if [ "$CHAIN_ID" == "1" ]; then + # mainnet shadowfork + has_fork="4" # deneb + cp /apps/el-gen/mainnet/genesis.json $tmp_dir/genesis.json + cp /apps/el-gen/mainnet/chainspec.json $tmp_dir/chainspec.json + cp /apps/el-gen/mainnet/besu_genesis.json $tmp_dir/besu.json + elif [ "$CHAIN_ID" == "11155111" ]; then + # sepolia shadowfork + has_fork="4" # deneb + cp /apps/el-gen/sepolia/genesis.json $tmp_dir/genesis.json + cp /apps/el-gen/sepolia/chainspec.json $tmp_dir/chainspec.json + cp /apps/el-gen/sepolia/besu_genesis.json $tmp_dir/besu.json + elif [ "$CHAIN_ID" == "17000" ]; then + # holesky shadowfork + has_fork="4" # deneb + cp /apps/el-gen/holesky/genesis.json $tmp_dir/genesis.json + cp /apps/el-gen/holesky/chainspec.json $tmp_dir/chainspec.json + cp /apps/el-gen/holesky/besu_genesis.json $tmp_dir/besu.json + else + # Generate base genesis.json, chainspec.json and besu.json + envsubst < /apps/el-gen/tpl-genesis.json > $tmp_dir/genesis.json + envsubst < /apps/el-gen/tpl-chainspec.json > $tmp_dir/chainspec.json + envsubst < /apps/el-gen/tpl-besu.json > $tmp_dir/besu.json + is_shadowfork="0" + has_fork="0" + fi + + # Add additional fork properties + [ $has_fork -lt 2 ] && genesis_add_bellatrix $tmp_dir + [ $has_fork -lt 3 ] && [ ! "$CAPELLA_FORK_EPOCH" == "18446744073709551615" ] && genesis_add_capella $tmp_dir + [ $has_fork -lt 4 ] && [ ! "$DENEB_FORK_EPOCH" == "18446744073709551615" ] && genesis_add_deneb $tmp_dir + [ $has_fork -lt 5 ] && [ ! "$ELECTRA_FORK_EPOCH" == "18446744073709551615" ] && genesis_add_electra $tmp_dir + [ $has_fork -lt 6 ] && [ ! "$FULU_FORK_EPOCH" == "18446744073709551615" ] && genesis_add_fulu $tmp_dir + + if [ "$is_shadowfork" == "0" ]; then + # Initialize allocations with precompiles + echo "Adding precompile allocations..." + cat /apps/el-gen/precompile-allocs.yaml | yq -c > $tmp_dir/allocations.json + + # Add system contracts + genesis_add_system_contracts $tmp_dir + + # Build complete allocations object before applying + if [ -f /config/el/genesis-config.yaml ]; then + envsubst < /config/el/genesis-config.yaml | yq -c > $tmp_dir/el-genesis-config.json + + el_mnemonic=$(jq -r '.mnemonic // env.EL_AND_CL_MNEMONIC' $tmp_dir/el-genesis-config.json) + + # Process all premine wallets in one pass + echo "Adding premine wallets from mnemonic..." + jq -c '.el_premine | to_entries[]' $tmp_dir/el-genesis-config.json | while read premine; do + path=$(echo $premine | jq -r '.key') + address=$(geth-hdwallet -mnemonic "$el_mnemonic" -path "$path" | grep "public address:" | awk '{print $3}') + echo " adding allocation for $address" + echo "$premine" | jq -c '.value |= gsub(" *ETH"; "000000000000000000") | {"'"$address"'":{"balance":.value}}' >> $tmp_dir/allocations.json + done + + # Process static premine addresses + echo "Adding static premine wallets..." + cat $tmp_dir/el-genesis-config.json | jq -c '.el_premine_addrs + | with_entries(.value = (if (.value|type) == "string" then {"balance": .value} else .value end)) + | with_entries(.value.balance |= gsub(" *ETH"; "000000000000000000")) + ' >> $tmp_dir/allocations.json + + # Process additional contracts + additional_contracts=$(cat $tmp_dir/el-genesis-config.json | jq -cr '.additional_preloaded_contracts') + if ! [[ "$(echo "$additional_contracts" | sed -e 's/^[[:space:]]*//')" == {* ]]; then + echo "Additional contracts file: $additional_contracts" + if [ -f "$additional_contracts" ]; then + additional_contracts=$(cat $additional_contracts) + else + additional_contracts="{}" + fi + fi + + # Add additional contracts to allocations + echo "Adding additional contracts..." + echo "$additional_contracts" | jq -c 'with_entries(.value.balance |= gsub(" *ETH"; "000000000000000000"))' >> $tmp_dir/allocations.json + fi + + # Apply combined allocations in one shot + echo "Applying allocations to genesis files..." + allocations=$(jq -s 'reduce .[] as $item ({}; . * $item)' $tmp_dir/allocations.json) + genesis_add_json $tmp_dir/genesis.json '.alloc += '"$allocations" + genesis_add_json $tmp_dir/chainspec.json '.accounts += '"$allocations" + genesis_add_json $tmp_dir/besu.json '.alloc += '"$allocations" + fi + + cat $tmp_dir/genesis.json | jq > $out_dir/genesis.json + cat $tmp_dir/chainspec.json | jq > $out_dir/chainspec.json + cat $tmp_dir/besu.json | jq > $out_dir/besu.json + rm -rf $tmp_dir +} + +genesis_get_activation_time() { + if [ "$1" == "0" ]; then + echo "0" + else + if [ "$PRESET_BASE" == "minimal" ]; then + slots_per_epoch=8 + else + slots_per_epoch=32 + fi + epoch_delay=$(( $SLOT_DURATION_IN_SECONDS * $slots_per_epoch * $1 )) + echo $(( $GENESIS_TIMESTAMP + $GENESIS_DELAY + $epoch_delay )) + fi +} + +genesis_add_json() { + file=$1 + data=$2 + + jq -c "$data" "$file" > "$file.out" + mv "$file.out" "$file" +} + +genesis_add_allocation() { + tmp_dir=$1 + address=$2 + allocation=$3 + + echo " adding allocation for $address" + echo "$allocation" | jq -c '.balance |= gsub(" *ETH"; "000000000000000000") | {("'"$address"'"): .}' >> $tmp_dir/allocations.json +} + +genesis_add_system_contracts() { + tmp_dir=$1 + system_contracts=$(cat /apps/el-gen/system-contracts.yaml | yq -c) + + echo "Adding system contracts" + + # add deposit contract + echo -e " genesis contract:\t$DEPOSIT_CONTRACT_ADDRESS" + genesis_add_allocation $tmp_dir "$DEPOSIT_CONTRACT_ADDRESS" $(echo "$system_contracts" | jq -c '.deposit') + + if [ ! "$DENEB_FORK_EPOCH" == "18446744073709551615" ]; then + # EIP-4788: Beacon block root in the EVM + target_address=$(echo "$system_contracts" | jq -r '.eip4788_address') + echo -e " EIP-4788 contract:\t$target_address" + genesis_add_allocation $tmp_dir $target_address $(echo "$system_contracts" | jq -c '.eip4788') + fi + + if [ ! "$ELECTRA_FORK_EPOCH" == "18446744073709551615" ]; then + # EIP-2935: Serve historical block hashes from state + target_address=$(echo "$system_contracts" | jq -r '.eip2935_address') + echo -e " EIP-2935 contract:\t$target_address" + genesis_add_allocation $tmp_dir $target_address $(echo "$system_contracts" | jq -c '.eip2935') + + # EIP-7002: Execution layer triggerable withdrawals + target_address=$(echo "$system_contracts" | jq -r '.eip7002_address') + echo -e " EIP-7002 contract:\t$target_address" + genesis_add_allocation $tmp_dir $target_address $(echo "$system_contracts" | jq -c '.eip7002') + + # EIP-7251: Increase the MAX_EFFECTIVE_BALANCE + target_address=$(echo "$system_contracts" | jq -r '.eip7251_address') + echo -e " EIP-7251 contract:\t$target_address" + genesis_add_allocation $tmp_dir $target_address $(echo "$system_contracts" | jq -c '.eip7251') + fi +} + +genesis_add_bellatrix() { + tmp_dir=$1 + echo "Adding bellatrix genesis properties" + + # genesis.json + genesis_add_json $tmp_dir/genesis.json '.config += { + "mergeNetsplitBlock": 0, + "terminalTotalDifficulty": 0, + "terminalTotalDifficultyPassed": true + }' + + # chainspec.json + genesis_add_json $tmp_dir/chainspec.json '.params += { + "mergeForkIdTransition": "0x0", + "terminalTotalDifficulty": "0x0" + }' + + # besu.json + genesis_add_json $tmp_dir/besu.json '.config += { + "preMergeForkBlock": 0, + "terminalTotalDifficulty": 0, + "ethash": {} + }' +} + +# add capella fork properties +genesis_add_capella() { + tmp_dir=$1 + echo "Adding capella genesis properties" + shanghai_time=$(genesis_get_activation_time $CAPELLA_FORK_EPOCH) + shanghai_time_hex="0x$(printf "%x" $shanghai_time)" + + # genesis.json + genesis_add_json $tmp_dir/genesis.json '.config += { + "shanghaiTime": '"$shanghai_time"' + }' + + # chainspec.json + genesis_add_json $tmp_dir/chainspec.json '.params += { + "eip4895TransitionTimestamp": "'$shanghai_time_hex'", + "eip3855TransitionTimestamp": "'$shanghai_time_hex'", + "eip3651TransitionTimestamp": "'$shanghai_time_hex'", + "eip3860TransitionTimestamp": "'$shanghai_time_hex'" + }' + + # besu.json + genesis_add_json $tmp_dir/besu.json '.config += { + "shanghaiTime": '"$shanghai_time"' + }' +} + +# add deneb fork properties +genesis_add_deneb() { + tmp_dir=$1 + echo "Adding deneb genesis properties" + cancun_time=$(genesis_get_activation_time $DENEB_FORK_EPOCH) + cancun_time_hex="0x$(printf "%x" $cancun_time)" + target_blobs_per_block_cancun=3 + max_blobs_per_block_cancun=6 + + # genesis.json + genesis_add_json $tmp_dir/genesis.json '.config += { + "cancunTime": '"$cancun_time"', + "blobSchedule": {} + }' + genesis_add_json $tmp_dir/genesis.json '.config.blobSchedule += { + "cancun": { + "target": '"$target_blobs_per_block_cancun"', + "max": '"$max_blobs_per_block_cancun"' + } + }' + + # chainspec.json + genesis_add_json $tmp_dir/chainspec.json '.params += { + "eip4844TransitionTimestamp": "'$cancun_time_hex'", + "eip4788TransitionTimestamp": "'$cancun_time_hex'", + "eip1153TransitionTimestamp": "'$cancun_time_hex'", + "eip5656TransitionTimestamp": "'$cancun_time_hex'", + "eip6780TransitionTimestamp": "'$cancun_time_hex'", + "blobSchedule": {} + }' + genesis_add_json $tmp_dir/chainspec.json '.params.blobSchedule += { + "cancun": { + "target": '"$target_blobs_per_block_cancun"', + "max": '"$max_blobs_per_block_cancun"' + } + }' + + # besu.json + genesis_add_json $tmp_dir/besu.json '.config += { + "cancunTime": '"$cancun_time"', + "blobSchedule": {} + }' + genesis_add_json $tmp_dir/besu.json '.config.blobSchedule += { + "cancun": { + "target": '"$target_blobs_per_block_cancun"', + "max": '"$max_blobs_per_block_cancun"' + } + }' +} + +# add electra fork properties +genesis_add_electra() { + tmp_dir=$1 + echo "Adding electra genesis properties" + prague_time=$(genesis_get_activation_time $ELECTRA_FORK_EPOCH) + prague_time_hex="0x$(printf "%x" $prague_time)" + + # genesis.json + genesis_add_json $tmp_dir/genesis.json '.config += { + "depositContractAddress": "'"$DEPOSIT_CONTRACT_ADDRESS"'", + "pragueTime": '"$prague_time"' + }' + genesis_add_json $tmp_dir/genesis.json '.config.blobSchedule += { + "prague": { + "target": '"$TARGET_BLOBS_PER_BLOCK_ELECTRA"', + "max": '"$MAX_BLOBS_PER_BLOCK_ELECTRA"' + } + }' + + # chainspec.json + genesis_add_json $tmp_dir/chainspec.json '.params += { + "depositContractAddress": "'"$DEPOSIT_CONTRACT_ADDRESS"'", + "eip2537TransitionTimestamp": "'$prague_time_hex'", + "eip2935TransitionTimestamp": "'$prague_time_hex'", + "eip6110TransitionTimestamp": "'$prague_time_hex'", + "eip7002TransitionTimestamp": "'$prague_time_hex'", + "eip7251TransitionTimestamp": "'$prague_time_hex'", + "eip7702TransitionTimestamp": "'$prague_time_hex'" + }' + genesis_add_json $tmp_dir/chainspec.json '.config.blobSchedule += { + "prague": { + "target": '"$TARGET_BLOBS_PER_BLOCK_ELECTRA"', + "max": '"$MAX_BLOBS_PER_BLOCK_ELECTRA"' + } + }' + + # besu.json + genesis_add_json $tmp_dir/besu.json '.config += { + "depositContractAddress": "'"$DEPOSIT_CONTRACT_ADDRESS"'", + "pragueTime": '"$prague_time"' + }' + genesis_add_json $tmp_dir/besu.json '.config.blobSchedule += { + "prague": { + "target": '"$TARGET_BLOBS_PER_BLOCK_ELECTRA"', + "max": '"$MAX_BLOBS_PER_BLOCK_ELECTRA"' + } + }' +} + +# add fulu fork properties +genesis_add_fulu() { + tmp_dir=$1 + echo "Adding fulu genesis properties" + osaka_time=$(genesis_get_activation_time $FULU_FORK_EPOCH) + osaka_time_hex="0x$(printf "%x" $osaka_time)" + + # genesis.json + genesis_add_json $tmp_dir/genesis.json '.config += { + "osakaTime": '"$osaka_time"' + }' + genesis_add_json $tmp_dir/genesis.json '.config.blobSchedule += { + "osaka": { + "target": '"$TARGET_BLOBS_PER_BLOCK_FULU"', + "max": '"$MAX_BLOBS_PER_BLOCK_FULU"' + } + }' + + # chainspec.json + genesis_add_json $tmp_dir/chainspec.json '.params += { + "eip7692TransitionTimestamp": "'$osaka_time_hex'" + }' + genesis_add_json $tmp_dir/chainspec.json '.config.blobSchedule += { + "osaka": { + "target": '"$TARGET_BLOBS_PER_BLOCK_FULU"', + "max": '"$MAX_BLOBS_PER_BLOCK_FULU"' + } + }' + + # besu.json + genesis_add_json $tmp_dir/besu.json '.config += { + "osakaTime": '"$osaka_time"' + }' + genesis_add_json $tmp_dir/besu.json '.config.blobSchedule += { + "osaka": { + "target": '"$TARGET_BLOBS_PER_BLOCK_FULU"', + "max": '"$MAX_BLOBS_PER_BLOCK_FULU"' + } + }' +} diff --git a/apps/el-gen/genesis_besu.py b/apps/el-gen/genesis_besu.py deleted file mode 100644 index a5d0f1d..0000000 --- a/apps/el-gen/genesis_besu.py +++ /dev/null @@ -1,248 +0,0 @@ -from web3.auto import w3 -import json -import ruamel.yaml as yaml -import sys - -w3.eth.account.enable_unaudited_hdwallet_features() - -testnet_config_path = "genesis-config.yaml" -mainnet_config_path = "/apps/el-gen/mainnet/besu_genesis.json" -sepolia_config_path = "/apps/el-gen/sepolia/besu_genesis.json" -goerli_config_path = "/apps/el-gen/goerli/besu_genesis.json" -holesky_config_path = "/apps/el-gen/holesky/besu_genesis.json" -isNamedTestnet = False -combined_allocs = {} - -if len(sys.argv) > 1: - testnet_config_path = sys.argv[1] - -with open(testnet_config_path) as stream: - data = yaml.safe_load(stream) - -if int(data['chain_id']) == 1 or int(data['chain_id']) == 11155111 or int(data['chain_id']) == 17000: - isNamedTestnet = True - -if int(data['chain_id']) == 1: - with open(mainnet_config_path) as m: - mainnet_json = json.loads(m.read()) - out = mainnet_json -elif int(data['chain_id']) == 11155111: - with open(sepolia_config_path) as m: - sepolia_json = json.loads(m.read()) - out = sepolia_json -elif int(data['chain_id']) == 17000: - with open(holesky_config_path) as m: - holesky_json = json.loads(m.read()) - out = holesky_json -else: - out = { - "config": { - "chainId": int(data['chain_id']), - "homesteadBlock":0, - "eip150Block":0, - "eip155Block":0, - "eip158Block":0, - "byzantiumBlock":0, - "constantinopleBlock":0, - "petersburgBlock":0, - "istanbulBlock":0, - "berlinBlock":0, - "londonBlock":0, - "preMergeForkBlock":0, - "depositContractAddress": data["deposit_contract_address"], - }, - "alloc": { - # Allocate 1 wei to all possible pre-compiles. - # See https://github.com/ethereum/EIPs/issues/716 "SpuriousDragon RIPEMD bug" - # E.g. Rinkeby allocates it like this. - # See https://github.com/ethereum/go-ethereum/blob/092856267067dd78b527a773f5b240d5c9f5693a/core/genesis.go#L370 - **{ - "0x" + i.to_bytes(length=20, byteorder='big').hex(): { - "balance": "1", - } for i in range(256) - }, - # deposit contract - data['deposit_contract_address']: { - "balance": "0", - "code": "0x60806040526004361061003f5760003560e01c806301ffc9a71461004457806322895118146100a4578063621fd130146101ba578063c5f2892f14610244575b600080fd5b34801561005057600080fd5b506100906004803603602081101561006757600080fd5b50357fffffffff000000000000000000000000000000000000000000000000000000001661026b565b604080519115158252519081900360200190f35b6101b8600480360360808110156100ba57600080fd5b8101906020810181356401000000008111156100d557600080fd5b8201836020820111156100e757600080fd5b8035906020019184600183028401116401000000008311171561010957600080fd5b91939092909160208101903564010000000081111561012757600080fd5b82018360208201111561013957600080fd5b8035906020019184600183028401116401000000008311171561015b57600080fd5b91939092909160208101903564010000000081111561017957600080fd5b82018360208201111561018b57600080fd5b803590602001918460018302840111640100000000831117156101ad57600080fd5b919350915035610304565b005b3480156101c657600080fd5b506101cf6110b5565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102095781810151838201526020016101f1565b50505050905090810190601f1680156102365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025057600080fd5b506102596110c7565b60408051918252519081900360200190f35b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102fe57507fffffffff0000000000000000000000000000000000000000000000000000000082167f8564090700000000000000000000000000000000000000000000000000000000145b92915050565b6030861461035d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118056026913960400191505060405180910390fd5b602084146103b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061179c6036913960400191505060405180910390fd5b6060821461040f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806118786029913960400191505060405180910390fd5b670de0b6b3a7640000341015610470576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118526026913960400191505060405180910390fd5b633b9aca003406156104cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260338152602001806117d26033913960400191505060405180910390fd5b633b9aca00340467ffffffffffffffff811115610535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602781526020018061182b6027913960400191505060405180910390fd5b6060610540826114ba565b90507f649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c589898989858a8a6105756020546114ba565b6040805160a0808252810189905290819060208201908201606083016080840160c085018e8e80828437600083820152601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690910187810386528c815260200190508c8c808284376000838201819052601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920188810386528c5181528c51602091820193918e019250908190849084905b83811015610648578181015183820152602001610630565b50505050905090810190601f1680156106755780820380516001836020036101000a031916815260200191505b5086810383528881526020018989808284376000838201819052601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169092018881038452895181528951602091820193918b019250908190849084905b838110156106ef5781810151838201526020016106d7565b50505050905090810190601f16801561071c5780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390a1600060028a8a600060801b604051602001808484808284377fffffffffffffffffffffffffffffffff0000000000000000000000000000000090941691909301908152604080517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0818403018152601090920190819052815191955093508392506020850191508083835b602083106107fc57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016107bf565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610859573d6000803e3d6000fd5b5050506040513d602081101561086e57600080fd5b5051905060006002806108846040848a8c6116fe565b6040516020018083838082843780830192505050925050506040516020818303038152906040526040518082805190602001908083835b602083106108f857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016108bb565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610955573d6000803e3d6000fd5b5050506040513d602081101561096a57600080fd5b5051600261097b896040818d6116fe565b60405160009060200180848480828437919091019283525050604080518083038152602092830191829052805190945090925082918401908083835b602083106109f457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016109b7565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610a51573d6000803e3d6000fd5b5050506040513d6020811015610a6657600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610ada57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610a9d565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610b37573d6000803e3d6000fd5b5050506040513d6020811015610b4c57600080fd5b50516040805160208101858152929350600092600292839287928f928f92018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b60208310610bd957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610b9c565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610c36573d6000803e3d6000fd5b5050506040513d6020811015610c4b57600080fd5b50516040518651600291889160009188916020918201918291908601908083835b60208310610ca957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610c6c565b6001836020036101000a0380198251168184511680821785525050505050509050018367ffffffffffffffff191667ffffffffffffffff1916815260180182815260200193505050506040516020818303038152906040526040518082805190602001908083835b60208310610d4e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610d11565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610dab573d6000803e3d6000fd5b5050506040513d6020811015610dc057600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610e3457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610df7565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610e91573d6000803e3d6000fd5b5050506040513d6020811015610ea657600080fd5b50519050858114610f02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260548152602001806117486054913960600191505060405180910390fd5b60205463ffffffff11610f60576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117276021913960400191505060405180910390fd5b602080546001019081905560005b60208110156110a9578160011660011415610fa0578260008260208110610f9157fe5b0155506110ac95505050505050565b600260008260208110610faf57fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061102557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610fe8565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015611082573d6000803e3d6000fd5b5050506040513d602081101561109757600080fd5b50519250600282049150600101610f6e565b50fe5b50505050505050565b60606110c26020546114ba565b905090565b6020546000908190815b60208110156112f05781600116600114156111e6576002600082602081106110f557fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061116b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161112e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa1580156111c8573d6000803e3d6000fd5b5050506040513d60208110156111dd57600080fd5b505192506112e2565b600283602183602081106111f657fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061126b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161122e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa1580156112c8573d6000803e3d6000fd5b5050506040513d60208110156112dd57600080fd5b505192505b6002820491506001016110d1565b506002826112ff6020546114ba565b600060401b6040516020018084815260200183805190602001908083835b6020831061135a57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161131d565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000095909516920191825250604080518083037ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8018152601890920190819052815191955093508392850191508083835b6020831061143f57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611402565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa15801561149c573d6000803e3d6000fd5b5050506040513d60208110156114b157600080fd5b50519250505090565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b826000815181106114f457fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060061a60f81b8260018151811061153757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060051a60f81b8260028151811061157a57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060041a60f81b826003815181106115bd57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060031a60f81b8260048151811061160057fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060021a60f81b8260058151811061164357fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060011a60f81b8260068151811061168657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060001a60f81b826007815181106116c957fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050919050565b6000808585111561170d578182fd5b83861115611719578182fd5b505082019391909203915056fe4465706f736974436f6e74726163743a206d65726b6c6520747265652066756c6c4465706f736974436f6e74726163743a207265636f6e7374727563746564204465706f7369744461746120646f6573206e6f74206d6174636820737570706c696564206465706f7369745f646174615f726f6f744465706f736974436f6e74726163743a20696e76616c6964207769746864726177616c5f63726564656e7469616c73206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c7565206e6f74206d756c7469706c65206f6620677765694465706f736974436f6e74726163743a20696e76616c6964207075626b6579206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f20686967684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f206c6f774465706f736974436f6e74726163743a20696e76616c6964207369676e6174757265206c656e677468a2646970667358221220dceca8706b29e917dacf25fceef95acac8d90d765ac926663ce4096195952b6164736f6c634300060b0033", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000022": "0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b", - "0x0000000000000000000000000000000000000000000000000000000000000023": "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", - "0x0000000000000000000000000000000000000000000000000000000000000024": "0xc78009fdf07fc56a11f122370658a353aaa542ed63e44c4bc15ff4cd105ab33c", - "0x0000000000000000000000000000000000000000000000000000000000000025": "0x536d98837f2dd165a55d5eeae91485954472d56f246df256bf3cae19352a123c", - "0x0000000000000000000000000000000000000000000000000000000000000026": "0x9efde052aa15429fae05bad4d0b1d7c64da64d03d7a1854a588c2cb8430c0d30", - "0x0000000000000000000000000000000000000000000000000000000000000027": "0xd88ddfeed400a8755596b21942c1497e114c302e6118290f91e6772976041fa1", - "0x0000000000000000000000000000000000000000000000000000000000000028": "0x87eb0ddba57e35f6d286673802a4af5975e22506c7cf4c64bb6be5ee11527f2c", - "0x0000000000000000000000000000000000000000000000000000000000000029": "0x26846476fd5fc54a5d43385167c95144f2643f533cc85bb9d16b782f8d7db193", - "0x000000000000000000000000000000000000000000000000000000000000002a": "0x506d86582d252405b840018792cad2bf1259f1ef5aa5f887e13cb2f0094f51e1", - "0x000000000000000000000000000000000000000000000000000000000000002b": "0xffff0ad7e659772f9534c195c815efc4014ef1e1daed4404c06385d11192e92b", - "0x000000000000000000000000000000000000000000000000000000000000002c": "0x6cf04127db05441cd833107a52be852868890e4317e6a02ab47683aa75964220", - "0x000000000000000000000000000000000000000000000000000000000000002d": "0xb7d05f875f140027ef5118a2247bbb84ce8f2f0f1123623085daf7960c329f5f", - "0x000000000000000000000000000000000000000000000000000000000000002e": "0xdf6af5f5bbdb6be9ef8aa618e4bf8073960867171e29676f8b284dea6a08a85e", - "0x000000000000000000000000000000000000000000000000000000000000002f": "0xb58d900f5e182e3c50ef74969ea16c7726c549757cc23523c369587da7293784", - "0x0000000000000000000000000000000000000000000000000000000000000030": "0xd49a7502ffcfb0340b1d7885688500ca308161a7f96b62df9d083b71fcc8f2bb", - "0x0000000000000000000000000000000000000000000000000000000000000031": "0x8fe6b1689256c0d385f42f5bbe2027a22c1996e110ba97c171d3e5948de92beb", - "0x0000000000000000000000000000000000000000000000000000000000000032": "0x8d0d63c39ebade8509e0ae3c9c3876fb5fa112be18f905ecacfecb92057603ab", - "0x0000000000000000000000000000000000000000000000000000000000000033": "0x95eec8b2e541cad4e91de38385f2e046619f54496c2382cb6cacd5b98c26f5a4", - "0x0000000000000000000000000000000000000000000000000000000000000034": "0xf893e908917775b62bff23294dbbe3a1cd8e6cc1c35b4801887b646a6f81f17f", - "0x0000000000000000000000000000000000000000000000000000000000000035": "0xcddba7b592e3133393c16194fac7431abf2f5485ed711db282183c819e08ebaa", - "0x0000000000000000000000000000000000000000000000000000000000000036": "0x8a8d7fe3af8caa085a7639a832001457dfb9128a8061142ad0335629ff23ff9c", - "0x0000000000000000000000000000000000000000000000000000000000000037": "0xfeb3c337d7a51a6fbf00b9e34c52e1c9195c969bd4e7a0bfd51d5c5bed9c1167", - "0x0000000000000000000000000000000000000000000000000000000000000038": "0xe71f0aa83cc32edfbefa9f4d3e0174ca85182eec9f3a09f6a6c0df6377a510d7", - "0x0000000000000000000000000000000000000000000000000000000000000039": "0x31206fa80a50bb6abe29085058f16212212a60eec8f049fecb92d8c8e0a84bc0", - "0x000000000000000000000000000000000000000000000000000000000000003a": "0x21352bfecbeddde993839f614c3dac0a3ee37543f9b412b16199dc158e23b544", - "0x000000000000000000000000000000000000000000000000000000000000003b": "0x619e312724bb6d7c3153ed9de791d764a366b389af13c58bf8a8d90481a46765", - "0x000000000000000000000000000000000000000000000000000000000000003c": "0x7cdd2986268250628d0c10e385c58c6191e6fbe05191bcc04f133f2cea72c1c4", - "0x000000000000000000000000000000000000000000000000000000000000003d": "0x848930bd7ba8cac54661072113fb278869e07bb8587f91392933374d017bcbe1", - "0x000000000000000000000000000000000000000000000000000000000000003e": "0x8869ff2c22b28cc10510d9853292803328be4fb0e80495e8bb8d271f5b889636", - "0x000000000000000000000000000000000000000000000000000000000000003f": "0xb5fe28e79f1b850f8658246ce9b6a1e7b49fc06db7143e8fe0b4f2b0c5523a5c", - "0x0000000000000000000000000000000000000000000000000000000000000040": "0x985e929f70af28d0bdd1a90a808f977f597c7c778c489e98d3bd8910d31ac0f7" - } - }, - # EIP-4788: Beacon block root in the EVM - "0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02": { - "balance": "0", - "nonce": "1", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500" - }, - # EIP-2935: Serve historical block hashes from state - "0x0F792be4B0c0cb4DAE440Ef133E90C0eCD48CCCC": { - "balance": "0", - "nonce": "1", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500" - }, - # EIP-7002: Execution layer triggerable withdrawals - "0x0c15F14308530b7CDB8460094BbB9cC28b9AaaAA": { - "balance": "0", - "nonce": "1", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460cb5760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f457600182026001905f5b5f82111560685781019083028483029004916001019190604d565b909390049250505036603814608857366101f457346101f4575f5260205ff35b34106101f457600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060101160df575060105b5f5b8181146101835782810160030260040181604c02815460601b8152601401816001015481526020019060020154807fffffffffffffffffffffffffffffffff00000000000000000000000000000000168252906010019060401c908160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160e1565b910180921461019557906002556101a0565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101cd57505f5b6001546002828201116101e25750505f6101e8565b01600290035b5f555f600155604c025ff35b5f5ffd", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - } - }, - # EIP-7251: Increase the MAX_EFFECTIVE_BALANCE - "0x00431F263cE400f4455c2dCf564e53007Ca4bbBb": { - "balance": "0", - "nonce": "1", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460d35760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f82111560685781019083028483029004916001019190604d565b9093900492505050366060146088573661019a573461019a575f5260205ff35b341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060021160e7575060025b5f5b8181146101295782810160040260040181607402815460601b815260140181600101548152602001816002015481526020019060030154905260010160e9565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - } - } - }, - "coinbase": "0x0000000000000000000000000000000000000000", - "baseFeePerGas": "0x3B9ACA00", - "difficulty": "0x0", - "extraData": "", - "gasLimit": hex(int(data['genesis_gaslimit'] if 'genesis_gaslimit' in data and data['genesis_gaslimit'] is not None else 25000000)), - "nonce": "0x1234", - "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "timestamp": str(data['genesis_timestamp']) - } - - for key, value in data['el_premine'].items(): - acct = w3.eth.account.from_mnemonic(data['mnemonic'], account_path=key, passphrase='') - weival = value.replace('ETH', '0' * 18) - out["alloc"][acct.address] = {"balance": weival} - - # Some hardcoded addrs - def add_alloc_entry(addr, account): - # Convert balance format - if isinstance(account, dict) and 'balance' in account: - balance_value = account['balance'].replace('ETH', '0' * 18) - else: - # If it's not a dictionary, assume it's a single value for backward compatibility - balance_value = account.replace('ETH', '0' * 18) - - # Create alloc dictionary entry - alloc_entry = {"balance": balance_value} - - # Optionally add code - if 'code' in account: - alloc_entry['code'] = account['code'] - - # Optionally add storage - if 'storage' in account: - alloc_entry['storage'] = account['storage'] - - # Optionally set nonce - if 'nonce' in account: - alloc_entry['nonce'] = account['nonce'] - - # Optionally set private key - if 'secretKey' in account: - alloc_entry['secretKey'] = account['secretKey'] - - # Add alloc entry to output's alloc field - out["alloc"][addr] = alloc_entry - - for addr, account in data['el_premine_addrs'].items(): - add_alloc_entry(addr, account) - - for addr, account in data['additional_preloaded_contracts'].items(): - add_alloc_entry(addr, account) - -# Add fork timestamps for each fork -# Altair and Bellatrix have no EL implication in terms of timestamp and hence are not included here -if 'terminal_total_difficulty' in data and not isNamedTestnet: - if data['terminal_total_difficulty'] != 0: - out['config']['terminalTotalDifficulty'] = data['terminal_total_difficulty'] - else: - out['config']['terminalTotalDifficulty'] = 0 - - -if 'capella_fork_epoch' in data and not isNamedTestnet: - if data['capella_fork_epoch'] != 0: - out['config']['shanghaiTime'] = \ - int(data['genesis_timestamp']) + \ - int(data['genesis_delay']) + \ - int(data['capella_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds']) - else: - out['config']['shanghaiTime'] = 0 - -if 'deneb_fork_epoch' in data and not isNamedTestnet: - if data['deneb_fork_epoch'] != 0: - out['config']['cancunTime'] = \ - int(data['genesis_timestamp']) + \ - int(data['genesis_delay']) + \ - int(data['deneb_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds']) - else: - out['config']['cancunTime'] = 0 - - out['config']['blobSchedule'] = {} - out['config']['blobSchedule']['cancun'] = { - "target": data['target_blobs_per_block_cancun'], - "max": data['max_blobs_per_block_cancun'] - } - -if 'electra_fork_epoch' in data: - if data['electra_fork_epoch'] != 0: - out['config']['pragueTime'] = \ - int(data['genesis_timestamp']) + \ - int(data['genesis_delay']) + \ - int(data['electra_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds']) - else: - out['config']['pragueTime'] = 0 - - out['config']['blobSchedule']['prague'] = { - "target": data['target_blobs_per_block_prague'], - "max": data['max_blobs_per_block_prague'] - } - -if 'fulu_fork_epoch' in data: - if data['fulu_fork_epoch'] != 0: - out['config']['osakaTime'] = \ - int(data['genesis_timestamp']) + \ - int(data['genesis_delay']) + \ - int(data['fulu_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds']) - else: - out['config']['osakaTime'] = 0 - - out['config']['blobSchedule']['osaka'] = { - "target": data['target_blobs_per_block_osaka'], - "max": data['max_blobs_per_block_osaka'] - } - -out['config']['ethash'] = {} -print(json.dumps(out, indent=' ')) diff --git a/apps/el-gen/genesis_chainspec.py b/apps/el-gen/genesis_chainspec.py deleted file mode 100644 index afcb747..0000000 --- a/apps/el-gen/genesis_chainspec.py +++ /dev/null @@ -1,314 +0,0 @@ -from web3.auto import w3 -import json -import ruamel.yaml as yaml -import sys - -w3.eth.account.enable_unaudited_hdwallet_features() - -testnet_config_path = "genesis-config.yaml" -mainnet_config_path = "/apps/el-gen/mainnet/chainspec.json" -sepolia_config_path = "/apps/el-gen/sepolia/chainspec.json" -goerli_config_path = "/apps/el-gen/goerli/chainspec.json" -holesky_config_path = "/apps/el-gen/holesky/chainspec.json" -isNamedTestnet = False -combined_allocs = {} -if len(sys.argv) > 1: - testnet_config_path = sys.argv[1] - -with open(testnet_config_path) as stream: - data = yaml.safe_load(stream) - -if int(data['chain_id']) == 1 or int(data['chain_id']) == 11155111 or int(data['chain_id']) == 17000: - isNamedTestnet = True - -if int(data['chain_id']) == 1: - with open(mainnet_config_path) as m: - mainnet_json = json.loads(m.read()) - out = mainnet_json -elif int(data['chain_id']) == 11155111: - with open(sepolia_config_path) as m: - sepolia_json = json.loads(m.read()) - out = sepolia_json -elif int(data['chain_id']) == 17000: - with open(holesky_config_path) as m: - holesky_json = json.loads(m.read()) - out = holesky_json -else: - out = { - "name": "Testnet", - "engine": {}, - "params": { - "gasLimitBoundDivisor": "0x400", - "registrar": "0x0000000000000000000000000000000000000000", - "accountStartNonce": "0x0", - "maximumExtraDataSize": "0xffff", - "minGasLimit": "0x1388", - "networkID": hex(int(data['chain_id'])), - "MergeForkIdTransition": "0x0", - "maxCodeSize": "0x6000", - "maxCodeSizeTransition": "0x0", - "eip150Transition": "0x0", - "eip158Transition": "0x0", - "eip160Transition": "0x0", - "eip161abcTransition": "0x0", - "eip161dTransition": "0x0", - "eip155Transition": "0x0", - "eip140Transition": "0x0", - "eip211Transition": "0x0", - "eip214Transition": "0x0", - "eip658Transition": "0x0", - "eip145Transition": "0x0", - "eip1014Transition": "0x0", - "eip1052Transition": "0x0", - "eip1283Transition": "0x0", - "eip1283DisableTransition": "0x0", - "eip152Transition": "0x0", - "eip1108Transition": "0x0", - "eip1344Transition": "0x0", - "eip1884Transition": "0x0", - "eip2028Transition": "0x0", - "eip2200Transition": "0x0", - "eip2565Transition": "0x0", - "eip2929Transition": "0x0", - "eip2930Transition": "0x0", - "eip1559Transition": "0x0", - "eip3198Transition": "0x0", - "eip3529Transition": "0x0", - "eip3541Transition": "0x0", - "depositContractAddress": data["deposit_contract_address"], - }, - "genesis": { - "seal": { - "ethereum": { - "nonce": "0x1234", - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" - } - }, - "difficulty": "0x0", - "author": "0x0000000000000000000000000000000000000000", - "timestamp": hex(data['genesis_timestamp']), - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "extraData": "", - "gasLimit": hex(int(data['genesis_gaslimit'] if 'genesis_gaslimit' in data and data['genesis_gaslimit'] is not None else 25000000)) - }, - "accounts": { - # Allocate 1 wei to all possible pre-compiles. - # See https://github.com/ethereum/EIPs/issues/716 "SpuriousDragon RIPEMD bug" - # E.g. Rinkeby allocates it like this. - # See https://github.com/ethereum/go-ethereum/blob/092856267067dd78b527a773f5b240d5c9f5693a/core/genesis.go#L370 - **{ - "0x" + i.to_bytes(length=20, byteorder='big').hex(): { - "balance": "1", - } for i in range(256) - }, - # deposit contract - data['deposit_contract_address']: { - "balance": "0", - "code": "0x60806040526004361061003f5760003560e01c806301ffc9a71461004457806322895118146100a4578063621fd130146101ba578063c5f2892f14610244575b600080fd5b34801561005057600080fd5b506100906004803603602081101561006757600080fd5b50357fffffffff000000000000000000000000000000000000000000000000000000001661026b565b604080519115158252519081900360200190f35b6101b8600480360360808110156100ba57600080fd5b8101906020810181356401000000008111156100d557600080fd5b8201836020820111156100e757600080fd5b8035906020019184600183028401116401000000008311171561010957600080fd5b91939092909160208101903564010000000081111561012757600080fd5b82018360208201111561013957600080fd5b8035906020019184600183028401116401000000008311171561015b57600080fd5b91939092909160208101903564010000000081111561017957600080fd5b82018360208201111561018b57600080fd5b803590602001918460018302840111640100000000831117156101ad57600080fd5b919350915035610304565b005b3480156101c657600080fd5b506101cf6110b5565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102095781810151838201526020016101f1565b50505050905090810190601f1680156102365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025057600080fd5b506102596110c7565b60408051918252519081900360200190f35b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102fe57507fffffffff0000000000000000000000000000000000000000000000000000000082167f8564090700000000000000000000000000000000000000000000000000000000145b92915050565b6030861461035d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118056026913960400191505060405180910390fd5b602084146103b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061179c6036913960400191505060405180910390fd5b6060821461040f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806118786029913960400191505060405180910390fd5b670de0b6b3a7640000341015610470576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118526026913960400191505060405180910390fd5b633b9aca003406156104cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260338152602001806117d26033913960400191505060405180910390fd5b633b9aca00340467ffffffffffffffff811115610535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602781526020018061182b6027913960400191505060405180910390fd5b6060610540826114ba565b90507f649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c589898989858a8a6105756020546114ba565b6040805160a0808252810189905290819060208201908201606083016080840160c085018e8e80828437600083820152601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690910187810386528c815260200190508c8c808284376000838201819052601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920188810386528c5181528c51602091820193918e019250908190849084905b83811015610648578181015183820152602001610630565b50505050905090810190601f1680156106755780820380516001836020036101000a031916815260200191505b5086810383528881526020018989808284376000838201819052601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169092018881038452895181528951602091820193918b019250908190849084905b838110156106ef5781810151838201526020016106d7565b50505050905090810190601f16801561071c5780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390a1600060028a8a600060801b604051602001808484808284377fffffffffffffffffffffffffffffffff0000000000000000000000000000000090941691909301908152604080517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0818403018152601090920190819052815191955093508392506020850191508083835b602083106107fc57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016107bf565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610859573d6000803e3d6000fd5b5050506040513d602081101561086e57600080fd5b5051905060006002806108846040848a8c6116fe565b6040516020018083838082843780830192505050925050506040516020818303038152906040526040518082805190602001908083835b602083106108f857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016108bb565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610955573d6000803e3d6000fd5b5050506040513d602081101561096a57600080fd5b5051600261097b896040818d6116fe565b60405160009060200180848480828437919091019283525050604080518083038152602092830191829052805190945090925082918401908083835b602083106109f457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016109b7565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610a51573d6000803e3d6000fd5b5050506040513d6020811015610a6657600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610ada57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610a9d565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610b37573d6000803e3d6000fd5b5050506040513d6020811015610b4c57600080fd5b50516040805160208101858152929350600092600292839287928f928f92018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b60208310610bd957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610b9c565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610c36573d6000803e3d6000fd5b5050506040513d6020811015610c4b57600080fd5b50516040518651600291889160009188916020918201918291908601908083835b60208310610ca957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610c6c565b6001836020036101000a0380198251168184511680821785525050505050509050018367ffffffffffffffff191667ffffffffffffffff1916815260180182815260200193505050506040516020818303038152906040526040518082805190602001908083835b60208310610d4e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610d11565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610dab573d6000803e3d6000fd5b5050506040513d6020811015610dc057600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610e3457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610df7565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610e91573d6000803e3d6000fd5b5050506040513d6020811015610ea657600080fd5b50519050858114610f02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260548152602001806117486054913960600191505060405180910390fd5b60205463ffffffff11610f60576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117276021913960400191505060405180910390fd5b602080546001019081905560005b60208110156110a9578160011660011415610fa0578260008260208110610f9157fe5b0155506110ac95505050505050565b600260008260208110610faf57fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061102557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610fe8565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015611082573d6000803e3d6000fd5b5050506040513d602081101561109757600080fd5b50519250600282049150600101610f6e565b50fe5b50505050505050565b60606110c26020546114ba565b905090565b6020546000908190815b60208110156112f05781600116600114156111e6576002600082602081106110f557fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061116b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161112e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa1580156111c8573d6000803e3d6000fd5b5050506040513d60208110156111dd57600080fd5b505192506112e2565b600283602183602081106111f657fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061126b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161122e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa1580156112c8573d6000803e3d6000fd5b5050506040513d60208110156112dd57600080fd5b505192505b6002820491506001016110d1565b506002826112ff6020546114ba565b600060401b6040516020018084815260200183805190602001908083835b6020831061135a57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161131d565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000095909516920191825250604080518083037ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8018152601890920190819052815191955093508392850191508083835b6020831061143f57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611402565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa15801561149c573d6000803e3d6000fd5b5050506040513d60208110156114b157600080fd5b50519250505090565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b826000815181106114f457fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060061a60f81b8260018151811061153757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060051a60f81b8260028151811061157a57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060041a60f81b826003815181106115bd57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060031a60f81b8260048151811061160057fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060021a60f81b8260058151811061164357fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060011a60f81b8260068151811061168657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060001a60f81b826007815181106116c957fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050919050565b6000808585111561170d578182fd5b83861115611719578182fd5b505082019391909203915056fe4465706f736974436f6e74726163743a206d65726b6c6520747265652066756c6c4465706f736974436f6e74726163743a207265636f6e7374727563746564204465706f7369744461746120646f6573206e6f74206d6174636820737570706c696564206465706f7369745f646174615f726f6f744465706f736974436f6e74726163743a20696e76616c6964207769746864726177616c5f63726564656e7469616c73206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c7565206e6f74206d756c7469706c65206f6620677765694465706f736974436f6e74726163743a20696e76616c6964207075626b6579206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f20686967684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f206c6f774465706f736974436f6e74726163743a20696e76616c6964207369676e6174757265206c656e677468a2646970667358221220dceca8706b29e917dacf25fceef95acac8d90d765ac926663ce4096195952b6164736f6c634300060b0033", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000022": "0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b", - "0x0000000000000000000000000000000000000000000000000000000000000023": "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", - "0x0000000000000000000000000000000000000000000000000000000000000024": "0xc78009fdf07fc56a11f122370658a353aaa542ed63e44c4bc15ff4cd105ab33c", - "0x0000000000000000000000000000000000000000000000000000000000000025": "0x536d98837f2dd165a55d5eeae91485954472d56f246df256bf3cae19352a123c", - "0x0000000000000000000000000000000000000000000000000000000000000026": "0x9efde052aa15429fae05bad4d0b1d7c64da64d03d7a1854a588c2cb8430c0d30", - "0x0000000000000000000000000000000000000000000000000000000000000027": "0xd88ddfeed400a8755596b21942c1497e114c302e6118290f91e6772976041fa1", - "0x0000000000000000000000000000000000000000000000000000000000000028": "0x87eb0ddba57e35f6d286673802a4af5975e22506c7cf4c64bb6be5ee11527f2c", - "0x0000000000000000000000000000000000000000000000000000000000000029": "0x26846476fd5fc54a5d43385167c95144f2643f533cc85bb9d16b782f8d7db193", - "0x000000000000000000000000000000000000000000000000000000000000002a": "0x506d86582d252405b840018792cad2bf1259f1ef5aa5f887e13cb2f0094f51e1", - "0x000000000000000000000000000000000000000000000000000000000000002b": "0xffff0ad7e659772f9534c195c815efc4014ef1e1daed4404c06385d11192e92b", - "0x000000000000000000000000000000000000000000000000000000000000002c": "0x6cf04127db05441cd833107a52be852868890e4317e6a02ab47683aa75964220", - "0x000000000000000000000000000000000000000000000000000000000000002d": "0xb7d05f875f140027ef5118a2247bbb84ce8f2f0f1123623085daf7960c329f5f", - "0x000000000000000000000000000000000000000000000000000000000000002e": "0xdf6af5f5bbdb6be9ef8aa618e4bf8073960867171e29676f8b284dea6a08a85e", - "0x000000000000000000000000000000000000000000000000000000000000002f": "0xb58d900f5e182e3c50ef74969ea16c7726c549757cc23523c369587da7293784", - "0x0000000000000000000000000000000000000000000000000000000000000030": "0xd49a7502ffcfb0340b1d7885688500ca308161a7f96b62df9d083b71fcc8f2bb", - "0x0000000000000000000000000000000000000000000000000000000000000031": "0x8fe6b1689256c0d385f42f5bbe2027a22c1996e110ba97c171d3e5948de92beb", - "0x0000000000000000000000000000000000000000000000000000000000000032": "0x8d0d63c39ebade8509e0ae3c9c3876fb5fa112be18f905ecacfecb92057603ab", - "0x0000000000000000000000000000000000000000000000000000000000000033": "0x95eec8b2e541cad4e91de38385f2e046619f54496c2382cb6cacd5b98c26f5a4", - "0x0000000000000000000000000000000000000000000000000000000000000034": "0xf893e908917775b62bff23294dbbe3a1cd8e6cc1c35b4801887b646a6f81f17f", - "0x0000000000000000000000000000000000000000000000000000000000000035": "0xcddba7b592e3133393c16194fac7431abf2f5485ed711db282183c819e08ebaa", - "0x0000000000000000000000000000000000000000000000000000000000000036": "0x8a8d7fe3af8caa085a7639a832001457dfb9128a8061142ad0335629ff23ff9c", - "0x0000000000000000000000000000000000000000000000000000000000000037": "0xfeb3c337d7a51a6fbf00b9e34c52e1c9195c969bd4e7a0bfd51d5c5bed9c1167", - "0x0000000000000000000000000000000000000000000000000000000000000038": "0xe71f0aa83cc32edfbefa9f4d3e0174ca85182eec9f3a09f6a6c0df6377a510d7", - "0x0000000000000000000000000000000000000000000000000000000000000039": "0x31206fa80a50bb6abe29085058f16212212a60eec8f049fecb92d8c8e0a84bc0", - "0x000000000000000000000000000000000000000000000000000000000000003a": "0x21352bfecbeddde993839f614c3dac0a3ee37543f9b412b16199dc158e23b544", - "0x000000000000000000000000000000000000000000000000000000000000003b": "0x619e312724bb6d7c3153ed9de791d764a366b389af13c58bf8a8d90481a46765", - "0x000000000000000000000000000000000000000000000000000000000000003c": "0x7cdd2986268250628d0c10e385c58c6191e6fbe05191bcc04f133f2cea72c1c4", - "0x000000000000000000000000000000000000000000000000000000000000003d": "0x848930bd7ba8cac54661072113fb278869e07bb8587f91392933374d017bcbe1", - "0x000000000000000000000000000000000000000000000000000000000000003e": "0x8869ff2c22b28cc10510d9853292803328be4fb0e80495e8bb8d271f5b889636", - "0x000000000000000000000000000000000000000000000000000000000000003f": "0xb5fe28e79f1b850f8658246ce9b6a1e7b49fc06db7143e8fe0b4f2b0c5523a5c", - "0x0000000000000000000000000000000000000000000000000000000000000040": "0x985e929f70af28d0bdd1a90a808f977f597c7c778c489e98d3bd8910d31ac0f7" - } - }, - # EIP-4788: Beacon block root in the EVM - "0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02": { - "balance": "0", - "nonce": "1", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500" - }, - # EIP-2935: Serve historical block hashes from state - "0x0F792be4B0c0cb4DAE440Ef133E90C0eCD48CCCC": { - "balance": "0", - "nonce": "1", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500" - }, - # EIP-7002: Execution layer triggerable withdrawals - "0x0c15F14308530b7CDB8460094BbB9cC28b9AaaAA": { - "balance": "0", - "nonce": "1", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460cb5760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f457600182026001905f5b5f82111560685781019083028483029004916001019190604d565b909390049250505036603814608857366101f457346101f4575f5260205ff35b34106101f457600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060101160df575060105b5f5b8181146101835782810160030260040181604c02815460601b8152601401816001015481526020019060020154807fffffffffffffffffffffffffffffffff00000000000000000000000000000000168252906010019060401c908160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160e1565b910180921461019557906002556101a0565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101cd57505f5b6001546002828201116101e25750505f6101e8565b01600290035b5f555f600155604c025ff35b5f5ffd", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - } - }, - # EIP-7251: Increase the MAX_EFFECTIVE_BALANCE - "0x00431F263cE400f4455c2dCf564e53007Ca4bbBb": { - "balance": "0", - "nonce": "1", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460d35760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f82111560685781019083028483029004916001019190604d565b9093900492505050366060146088573661019a573461019a575f5260205ff35b341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060021160e7575060025b5f5b8181146101295782810160040260040181607402815460601b815260140181600101548152602001816002015481526020019060030154905260010160e9565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - } - } - }, - "nodes": [] - } - - out["engine"]["Ethash"] = {} - - for key, value in data['el_premine'].items(): - acct = w3.eth.account.from_mnemonic(data['mnemonic'], account_path=key, passphrase='') - weival = value.replace('ETH', '0' * 18) - out["accounts"][acct.address] = {"balance": weival} - - # Some hardcoded addrs - def add_alloc_entry(addr, account): - # Convert balance format - if isinstance(account, dict) and 'balance' in account: - balance_value = account['balance'].replace('ETH', '0' * 18) - else: - # If it's not a dictionary, assume it's a single value for backward compatibility - balance_value = account.replace('ETH', '0' * 18) - - # Create alloc dictionary entry - alloc_entry = {"balance": balance_value} - - # Optionally add code - if 'code' in account: - alloc_entry['code'] = account['code'] - - # Optionally add storage - if 'storage' in account: - alloc_entry['storage'] = account['storage'] - - # Optionally set nonce - if 'nonce' in account: - alloc_entry['nonce'] = account['nonce'] - - # Optionally set private key - if 'secretKey' in account: - alloc_entry['secretKey'] = account['secretKey'] - - # Add alloc entry to output's alloc field - out["accounts"][addr] = alloc_entry - - for addr, account in data['el_premine_addrs'].items(): - add_alloc_entry(addr, account) - - for addr, account in data['additional_preloaded_contracts'].items(): - add_alloc_entry(addr, account) - - -# Terminal total difficulty -if 'terminal_total_difficulty' in data and not isNamedTestnet: - if data['terminal_total_difficulty'] != 0: - out['params']['terminalTotalDifficulty'] = hex(data['terminal_total_difficulty']) - else: - out['params']['terminalTotalDifficulty'] = "0x0" -# Capella fork -if 'capella_fork_epoch' in data and not isNamedTestnet: - if data['capella_fork_epoch'] != 0: - capella_timestamp = hex( - int(data['genesis_timestamp']) + - int(data['genesis_delay']) + - int(data['capella_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds']) - ) - out['params']['eip4895TransitionTimestamp'] = capella_timestamp - out['params']['eip3651TransitionTimestamp'] = capella_timestamp - out['params']['eip3855TransitionTimestamp'] = capella_timestamp - out['params']['eip3860TransitionTimestamp'] = capella_timestamp - else: - out['params']['eip4895TransitionTimestamp'] = 0 - out['params']['eip3651TransitionTimestamp'] = 0 - out['params']['eip3855TransitionTimestamp'] = 0 - out['params']['eip3860TransitionTimestamp'] = 0 - -# Dencun fork -if 'deneb_fork_epoch' in data and not isNamedTestnet: - if data['deneb_fork_epoch'] != 0: - deneb_timestamp = hex( - int(data['genesis_timestamp']) + - int(data['genesis_delay']) + - int(data['deneb_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds']) - ) - out['params']['eip4844TransitionTimestamp'] = deneb_timestamp - out['params']['eip4788TransitionTimestamp'] = deneb_timestamp - out['params']['eip1153TransitionTimestamp'] = deneb_timestamp - out['params']['eip5656TransitionTimestamp'] = deneb_timestamp - out['params']['eip6780TransitionTimestamp'] = deneb_timestamp - else: - out['params']['eip4844TransitionTimestamp'] = 0 - out['params']['eip4788TransitionTimestamp'] = 0 - out['params']['eip1153TransitionTimestamp'] = 0 - out['params']['eip5656TransitionTimestamp'] = 0 - out['params']['eip6780TransitionTimestamp'] = 0 - - # add the cancun blobSchedule - out['params']['blobSchedule'] = {} - out['params']['blobSchedule']['cancun'] = { - "target": data['target_blobs_per_block_cancun'], - "max": data['max_blobs_per_block_cancun'] - } - -if 'electra_fork_epoch' in data: - if data['electra_fork_epoch'] != 0: - electra_timestamp = hex( - int(data['genesis_timestamp']) + - int(data['genesis_delay']) + - int(data['electra_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds']) - ) - out['params']['eip2537TransitionTimestamp']= electra_timestamp - out['params']['eip2935TransitionTimestamp']= electra_timestamp - out['params']['eip6110TransitionTimestamp']= electra_timestamp - out['params']['eip7002TransitionTimestamp']= electra_timestamp - out['params']['eip7251TransitionTimestamp']= electra_timestamp - out['params']['eip7702TransitionTimestamp']= electra_timestamp - else: - out['params']['eip2537TransitionTimestamp']= 0 - out['params']['eip2935TransitionTimestamp']= 0 - out['params']['eip6110TransitionTimestamp']= 0 - out['params']['eip7002TransitionTimestamp']= 0 - out['params']['eip7251TransitionTimestamp']= 0 - out['params']['eip7702TransitionTimestamp']= 0 - - # add the prague blobSchedule - out['params']['blobSchedule']['prague'] = { - "target": data['target_blobs_per_block_prague'], - "max": data['max_blobs_per_block_prague'] - } - -if 'fulu_fork_epoch' in data: - if data['fulu_fork_epoch'] != 0: - out['params']['eip7692TransitionTimestamp'] = hex( - int(data['genesis_timestamp']) + \ - int(data['genesis_delay']) + \ - int(data['fulu_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds']) - ) - else: - out['params']['eip7692TransitionTimestamp'] = 0 - - # add the osaka blobSchedule - out['params']['blobSchedule']['osaka'] = { - "target": data['target_blobs_per_block_osaka'], - "max": data['max_blobs_per_block_osaka'] - } -print(json.dumps(out, indent=' ')) diff --git a/apps/el-gen/genesis_geth.py b/apps/el-gen/genesis_geth.py deleted file mode 100644 index 4cda13f..0000000 --- a/apps/el-gen/genesis_geth.py +++ /dev/null @@ -1,246 +0,0 @@ -from web3.auto import w3 -import json -import ruamel.yaml as yaml -import sys - -w3.eth.account.enable_unaudited_hdwallet_features() - -testnet_config_path = "genesis-config.yaml" -mainnet_config_path = "/apps/el-gen/mainnet/genesis.json" -sepolia_config_path = "/apps/el-gen/sepolia/genesis.json" -goerli_config_path = "/apps/el-gen/goerli/genesis.json" -holesky_config_path = "/apps/el-gen/holesky/genesis.json" -isNamedTestnet = False -combined_allocs = {} -if len(sys.argv) > 1: - testnet_config_path = sys.argv[1] - -with open(testnet_config_path) as stream: - data = yaml.safe_load(stream) - -if int(data['chain_id']) == 1 or int(data['chain_id']) == 11155111 or int(data['chain_id']) == 17000: - isNamedTestnet = True - -if int(data['chain_id']) == 1: - with open(mainnet_config_path) as m: - mainnet_json = json.loads(m.read()) - out = mainnet_json -elif int(data['chain_id']) == 11155111: - with open(sepolia_config_path) as m: - sepolia_json = json.loads(m.read()) - out = sepolia_json -elif int(data['chain_id']) == 17000: - with open(holesky_config_path) as m: - holesky_json = json.loads(m.read()) - out = holesky_json -else: - out = { - "config": { - "chainId": int(data['chain_id']), - "homesteadBlock":0, - "eip150Block":0, - "eip155Block":0, - "eip158Block":0, - "byzantiumBlock":0, - "constantinopleBlock":0, - "petersburgBlock":0, - "istanbulBlock":0, - "berlinBlock":0, - "londonBlock":0, - "mergeNetsplitBlock":0, - "depositContractAddress": data["deposit_contract_address"], - }, - "alloc": { - # Allocate 1 wei to all possible pre-compiles. - # See https://github.com/ethereum/EIPs/issues/716 "SpuriousDragon RIPEMD bug" - # E.g. Rinkeby allocates it like this. - # See https://github.com/ethereum/go-ethereum/blob/092856267067dd78b527a773f5b240d5c9f5693a/core/genesis.go#L370 - **{ - "0x" + i.to_bytes(length=20, byteorder='big').hex(): { - "balance": "1", - } for i in range(256) - }, - # deposit contract - data['deposit_contract_address']: { - "balance": "0", - "code": "0x60806040526004361061003f5760003560e01c806301ffc9a71461004457806322895118146100a4578063621fd130146101ba578063c5f2892f14610244575b600080fd5b34801561005057600080fd5b506100906004803603602081101561006757600080fd5b50357fffffffff000000000000000000000000000000000000000000000000000000001661026b565b604080519115158252519081900360200190f35b6101b8600480360360808110156100ba57600080fd5b8101906020810181356401000000008111156100d557600080fd5b8201836020820111156100e757600080fd5b8035906020019184600183028401116401000000008311171561010957600080fd5b91939092909160208101903564010000000081111561012757600080fd5b82018360208201111561013957600080fd5b8035906020019184600183028401116401000000008311171561015b57600080fd5b91939092909160208101903564010000000081111561017957600080fd5b82018360208201111561018b57600080fd5b803590602001918460018302840111640100000000831117156101ad57600080fd5b919350915035610304565b005b3480156101c657600080fd5b506101cf6110b5565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102095781810151838201526020016101f1565b50505050905090810190601f1680156102365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025057600080fd5b506102596110c7565b60408051918252519081900360200190f35b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102fe57507fffffffff0000000000000000000000000000000000000000000000000000000082167f8564090700000000000000000000000000000000000000000000000000000000145b92915050565b6030861461035d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118056026913960400191505060405180910390fd5b602084146103b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061179c6036913960400191505060405180910390fd5b6060821461040f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806118786029913960400191505060405180910390fd5b670de0b6b3a7640000341015610470576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118526026913960400191505060405180910390fd5b633b9aca003406156104cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260338152602001806117d26033913960400191505060405180910390fd5b633b9aca00340467ffffffffffffffff811115610535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602781526020018061182b6027913960400191505060405180910390fd5b6060610540826114ba565b90507f649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c589898989858a8a6105756020546114ba565b6040805160a0808252810189905290819060208201908201606083016080840160c085018e8e80828437600083820152601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690910187810386528c815260200190508c8c808284376000838201819052601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920188810386528c5181528c51602091820193918e019250908190849084905b83811015610648578181015183820152602001610630565b50505050905090810190601f1680156106755780820380516001836020036101000a031916815260200191505b5086810383528881526020018989808284376000838201819052601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169092018881038452895181528951602091820193918b019250908190849084905b838110156106ef5781810151838201526020016106d7565b50505050905090810190601f16801561071c5780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390a1600060028a8a600060801b604051602001808484808284377fffffffffffffffffffffffffffffffff0000000000000000000000000000000090941691909301908152604080517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0818403018152601090920190819052815191955093508392506020850191508083835b602083106107fc57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016107bf565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610859573d6000803e3d6000fd5b5050506040513d602081101561086e57600080fd5b5051905060006002806108846040848a8c6116fe565b6040516020018083838082843780830192505050925050506040516020818303038152906040526040518082805190602001908083835b602083106108f857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016108bb565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610955573d6000803e3d6000fd5b5050506040513d602081101561096a57600080fd5b5051600261097b896040818d6116fe565b60405160009060200180848480828437919091019283525050604080518083038152602092830191829052805190945090925082918401908083835b602083106109f457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016109b7565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610a51573d6000803e3d6000fd5b5050506040513d6020811015610a6657600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610ada57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610a9d565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610b37573d6000803e3d6000fd5b5050506040513d6020811015610b4c57600080fd5b50516040805160208101858152929350600092600292839287928f928f92018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b60208310610bd957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610b9c565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610c36573d6000803e3d6000fd5b5050506040513d6020811015610c4b57600080fd5b50516040518651600291889160009188916020918201918291908601908083835b60208310610ca957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610c6c565b6001836020036101000a0380198251168184511680821785525050505050509050018367ffffffffffffffff191667ffffffffffffffff1916815260180182815260200193505050506040516020818303038152906040526040518082805190602001908083835b60208310610d4e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610d11565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610dab573d6000803e3d6000fd5b5050506040513d6020811015610dc057600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610e3457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610df7565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610e91573d6000803e3d6000fd5b5050506040513d6020811015610ea657600080fd5b50519050858114610f02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260548152602001806117486054913960600191505060405180910390fd5b60205463ffffffff11610f60576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117276021913960400191505060405180910390fd5b602080546001019081905560005b60208110156110a9578160011660011415610fa0578260008260208110610f9157fe5b0155506110ac95505050505050565b600260008260208110610faf57fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061102557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610fe8565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015611082573d6000803e3d6000fd5b5050506040513d602081101561109757600080fd5b50519250600282049150600101610f6e565b50fe5b50505050505050565b60606110c26020546114ba565b905090565b6020546000908190815b60208110156112f05781600116600114156111e6576002600082602081106110f557fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061116b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161112e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa1580156111c8573d6000803e3d6000fd5b5050506040513d60208110156111dd57600080fd5b505192506112e2565b600283602183602081106111f657fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061126b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161122e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa1580156112c8573d6000803e3d6000fd5b5050506040513d60208110156112dd57600080fd5b505192505b6002820491506001016110d1565b506002826112ff6020546114ba565b600060401b6040516020018084815260200183805190602001908083835b6020831061135a57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161131d565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000095909516920191825250604080518083037ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8018152601890920190819052815191955093508392850191508083835b6020831061143f57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611402565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa15801561149c573d6000803e3d6000fd5b5050506040513d60208110156114b157600080fd5b50519250505090565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b826000815181106114f457fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060061a60f81b8260018151811061153757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060051a60f81b8260028151811061157a57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060041a60f81b826003815181106115bd57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060031a60f81b8260048151811061160057fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060021a60f81b8260058151811061164357fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060011a60f81b8260068151811061168657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060001a60f81b826007815181106116c957fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050919050565b6000808585111561170d578182fd5b83861115611719578182fd5b505082019391909203915056fe4465706f736974436f6e74726163743a206d65726b6c6520747265652066756c6c4465706f736974436f6e74726163743a207265636f6e7374727563746564204465706f7369744461746120646f6573206e6f74206d6174636820737570706c696564206465706f7369745f646174615f726f6f744465706f736974436f6e74726163743a20696e76616c6964207769746864726177616c5f63726564656e7469616c73206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c7565206e6f74206d756c7469706c65206f6620677765694465706f736974436f6e74726163743a20696e76616c6964207075626b6579206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f20686967684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f206c6f774465706f736974436f6e74726163743a20696e76616c6964207369676e6174757265206c656e677468a2646970667358221220dceca8706b29e917dacf25fceef95acac8d90d765ac926663ce4096195952b6164736f6c634300060b0033", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000022": "0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b", - "0x0000000000000000000000000000000000000000000000000000000000000023": "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", - "0x0000000000000000000000000000000000000000000000000000000000000024": "0xc78009fdf07fc56a11f122370658a353aaa542ed63e44c4bc15ff4cd105ab33c", - "0x0000000000000000000000000000000000000000000000000000000000000025": "0x536d98837f2dd165a55d5eeae91485954472d56f246df256bf3cae19352a123c", - "0x0000000000000000000000000000000000000000000000000000000000000026": "0x9efde052aa15429fae05bad4d0b1d7c64da64d03d7a1854a588c2cb8430c0d30", - "0x0000000000000000000000000000000000000000000000000000000000000027": "0xd88ddfeed400a8755596b21942c1497e114c302e6118290f91e6772976041fa1", - "0x0000000000000000000000000000000000000000000000000000000000000028": "0x87eb0ddba57e35f6d286673802a4af5975e22506c7cf4c64bb6be5ee11527f2c", - "0x0000000000000000000000000000000000000000000000000000000000000029": "0x26846476fd5fc54a5d43385167c95144f2643f533cc85bb9d16b782f8d7db193", - "0x000000000000000000000000000000000000000000000000000000000000002a": "0x506d86582d252405b840018792cad2bf1259f1ef5aa5f887e13cb2f0094f51e1", - "0x000000000000000000000000000000000000000000000000000000000000002b": "0xffff0ad7e659772f9534c195c815efc4014ef1e1daed4404c06385d11192e92b", - "0x000000000000000000000000000000000000000000000000000000000000002c": "0x6cf04127db05441cd833107a52be852868890e4317e6a02ab47683aa75964220", - "0x000000000000000000000000000000000000000000000000000000000000002d": "0xb7d05f875f140027ef5118a2247bbb84ce8f2f0f1123623085daf7960c329f5f", - "0x000000000000000000000000000000000000000000000000000000000000002e": "0xdf6af5f5bbdb6be9ef8aa618e4bf8073960867171e29676f8b284dea6a08a85e", - "0x000000000000000000000000000000000000000000000000000000000000002f": "0xb58d900f5e182e3c50ef74969ea16c7726c549757cc23523c369587da7293784", - "0x0000000000000000000000000000000000000000000000000000000000000030": "0xd49a7502ffcfb0340b1d7885688500ca308161a7f96b62df9d083b71fcc8f2bb", - "0x0000000000000000000000000000000000000000000000000000000000000031": "0x8fe6b1689256c0d385f42f5bbe2027a22c1996e110ba97c171d3e5948de92beb", - "0x0000000000000000000000000000000000000000000000000000000000000032": "0x8d0d63c39ebade8509e0ae3c9c3876fb5fa112be18f905ecacfecb92057603ab", - "0x0000000000000000000000000000000000000000000000000000000000000033": "0x95eec8b2e541cad4e91de38385f2e046619f54496c2382cb6cacd5b98c26f5a4", - "0x0000000000000000000000000000000000000000000000000000000000000034": "0xf893e908917775b62bff23294dbbe3a1cd8e6cc1c35b4801887b646a6f81f17f", - "0x0000000000000000000000000000000000000000000000000000000000000035": "0xcddba7b592e3133393c16194fac7431abf2f5485ed711db282183c819e08ebaa", - "0x0000000000000000000000000000000000000000000000000000000000000036": "0x8a8d7fe3af8caa085a7639a832001457dfb9128a8061142ad0335629ff23ff9c", - "0x0000000000000000000000000000000000000000000000000000000000000037": "0xfeb3c337d7a51a6fbf00b9e34c52e1c9195c969bd4e7a0bfd51d5c5bed9c1167", - "0x0000000000000000000000000000000000000000000000000000000000000038": "0xe71f0aa83cc32edfbefa9f4d3e0174ca85182eec9f3a09f6a6c0df6377a510d7", - "0x0000000000000000000000000000000000000000000000000000000000000039": "0x31206fa80a50bb6abe29085058f16212212a60eec8f049fecb92d8c8e0a84bc0", - "0x000000000000000000000000000000000000000000000000000000000000003a": "0x21352bfecbeddde993839f614c3dac0a3ee37543f9b412b16199dc158e23b544", - "0x000000000000000000000000000000000000000000000000000000000000003b": "0x619e312724bb6d7c3153ed9de791d764a366b389af13c58bf8a8d90481a46765", - "0x000000000000000000000000000000000000000000000000000000000000003c": "0x7cdd2986268250628d0c10e385c58c6191e6fbe05191bcc04f133f2cea72c1c4", - "0x000000000000000000000000000000000000000000000000000000000000003d": "0x848930bd7ba8cac54661072113fb278869e07bb8587f91392933374d017bcbe1", - "0x000000000000000000000000000000000000000000000000000000000000003e": "0x8869ff2c22b28cc10510d9853292803328be4fb0e80495e8bb8d271f5b889636", - "0x000000000000000000000000000000000000000000000000000000000000003f": "0xb5fe28e79f1b850f8658246ce9b6a1e7b49fc06db7143e8fe0b4f2b0c5523a5c", - "0x0000000000000000000000000000000000000000000000000000000000000040": "0x985e929f70af28d0bdd1a90a808f977f597c7c778c489e98d3bd8910d31ac0f7" - } - }, - # EIP-4788: Beacon block root in the EVM - "0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02": { - "balance": "0", - "nonce": "1", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500" - }, - # EIP-2935: Serve historical block hashes from state - "0x0F792be4B0c0cb4DAE440Ef133E90C0eCD48CCCC": { - "balance": "0", - "nonce": "1", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500" - }, - # EIP-7002: Execution layer triggerable withdrawals - "0x0c15F14308530b7CDB8460094BbB9cC28b9AaaAA": { - "balance": "0", - "nonce": "1", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460cb5760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f457600182026001905f5b5f82111560685781019083028483029004916001019190604d565b909390049250505036603814608857366101f457346101f4575f5260205ff35b34106101f457600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060101160df575060105b5f5b8181146101835782810160030260040181604c02815460601b8152601401816001015481526020019060020154807fffffffffffffffffffffffffffffffff00000000000000000000000000000000168252906010019060401c908160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160e1565b910180921461019557906002556101a0565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101cd57505f5b6001546002828201116101e25750505f6101e8565b01600290035b5f555f600155604c025ff35b5f5ffd", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - } - }, - # EIP-7251: Increase the MAX_EFFECTIVE_BALANCE - "0x00431F263cE400f4455c2dCf564e53007Ca4bbBb": { - "balance": "0", - "nonce": "1", - "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460d35760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f82111560685781019083028483029004916001019190604d565b9093900492505050366060146088573661019a573461019a575f5260205ff35b341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060021160e7575060025b5f5b8181146101295782810160040260040181607402815460601b815260140181600101548152602001816002015481526020019060030154905260010160e9565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - } - } - }, - "coinbase": "0x0000000000000000000000000000000000000000", - "difficulty": "0x0", - "extraData": "", - "gasLimit": hex(int(data['genesis_gaslimit'] if 'genesis_gaslimit' in data and data['genesis_gaslimit'] is not None else 25000000)), - "nonce": "0x1234", - "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "timestamp": str(data['genesis_timestamp']) - } - - for key, value in data['el_premine'].items(): - acct = w3.eth.account.from_mnemonic(data['mnemonic'], account_path=key, passphrase='') - weival = value.replace('ETH', '0' * 18) - out["alloc"][acct.address] = {"balance": weival} - - # Some hardcoded addrs - def add_alloc_entry(addr, account): - # Convert balance format - if isinstance(account, dict) and 'balance' in account: - balance_value = account['balance'].replace('ETH', '0' * 18) - else: - # If it's not a dictionary, assume it's a single value for backward compatibility - balance_value = account.replace('ETH', '0' * 18) - - # Create alloc dictionary entry - alloc_entry = {"balance": balance_value} - - # Optionally add code - if 'code' in account: - alloc_entry['code'] = account['code'] - - # Optionally add storage - if 'storage' in account: - alloc_entry['storage'] = account['storage'] - - # Optionally set nonce - if 'nonce' in account: - alloc_entry['nonce'] = account['nonce'] - - # Optionally set private key - if 'secretKey' in account: - alloc_entry['secretKey'] = account['secretKey'] - - # Add alloc entry to output's alloc field - out["alloc"][addr] = alloc_entry - - for addr, account in data['el_premine_addrs'].items(): - add_alloc_entry(addr, account) - - for addr, account in data['additional_preloaded_contracts'].items(): - add_alloc_entry(addr, account) - -# Add fork timestamps for each fork -# Altair and Bellatrix have no EL implication in terms of timestamp and hence are not included here -if 'terminal_total_difficulty' in data and not isNamedTestnet: - if data['terminal_total_difficulty'] != 0: - out['config']['terminalTotalDifficulty'] = data['terminal_total_difficulty'] - else: - out['config']['terminalTotalDifficulty'] = 0 - out['config']['terminalTotalDifficultyPassed'] = True - -if 'capella_fork_epoch' in data and not isNamedTestnet: - if data['capella_fork_epoch'] != 0: - out['config']['shanghaiTime'] = \ - int(data['genesis_timestamp']) + \ - int(data['genesis_delay']) + \ - int(data['capella_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds']) - else: - out['config']['shanghaiTime'] = 0 - - -if 'deneb_fork_epoch' in data and not isNamedTestnet: - if data['deneb_fork_epoch'] != 0: - out['config']['cancunTime'] = \ - int(data['genesis_timestamp']) + \ - int(data['genesis_delay']) + \ - int(data['deneb_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds']) - else: - out['config']['cancunTime'] = 0 - - out['config']['blobSchedule'] = {} - out['config']['blobSchedule']['cancun'] = { - "target": data['target_blobs_per_block_cancun'], - "max": data['max_blobs_per_block_cancun'] - } - -if 'electra_fork_epoch' in data: - if data['electra_fork_epoch'] != 0: - out['config']['pragueTime'] = \ - int(data['genesis_timestamp']) + \ - int(data['genesis_delay']) + \ - int(data['electra_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds']) - else: - out['config']['pragueTime'] = 0 - - out['config']['blobSchedule']['prague'] = { - "target": data['target_blobs_per_block_prague'], - "max": data['max_blobs_per_block_prague'] - } - -if 'fulu_fork_epoch' in data: - if data['fulu_fork_epoch'] != 0: - out['config']['osakaTime'] = \ - int(data['genesis_timestamp']) + \ - int(data['genesis_delay']) + \ - int(data['fulu_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds']) - else: - out['config']['osakaTime'] = 0 - - out['config']['blobSchedule']['osaka'] = { - "target": data['target_blobs_per_block_osaka'], - "max": data['max_blobs_per_block_osaka'] - } - -print(json.dumps(out, indent=' ')) diff --git a/apps/el-gen/precompile-allocs.yaml b/apps/el-gen/precompile-allocs.yaml new file mode 100644 index 0000000..e5910c3 --- /dev/null +++ b/apps/el-gen/precompile-allocs.yaml @@ -0,0 +1,258 @@ +{ + "0x0000000000000000000000000000000000000000": { "balance": "1" }, + "0x0000000000000000000000000000000000000001": { "balance": "1" }, + "0x0000000000000000000000000000000000000002": { "balance": "1" }, + "0x0000000000000000000000000000000000000003": { "balance": "1" }, + "0x0000000000000000000000000000000000000004": { "balance": "1" }, + "0x0000000000000000000000000000000000000005": { "balance": "1" }, + "0x0000000000000000000000000000000000000006": { "balance": "1" }, + "0x0000000000000000000000000000000000000007": { "balance": "1" }, + "0x0000000000000000000000000000000000000008": { "balance": "1" }, + "0x0000000000000000000000000000000000000009": { "balance": "1" }, + "0x000000000000000000000000000000000000000a": { "balance": "1" }, + "0x000000000000000000000000000000000000000b": { "balance": "1" }, + "0x000000000000000000000000000000000000000c": { "balance": "1" }, + "0x000000000000000000000000000000000000000d": { "balance": "1" }, + "0x000000000000000000000000000000000000000e": { "balance": "1" }, + "0x000000000000000000000000000000000000000f": { "balance": "1" }, + "0x0000000000000000000000000000000000000010": { "balance": "1" }, + "0x0000000000000000000000000000000000000011": { "balance": "1" }, + "0x0000000000000000000000000000000000000012": { "balance": "1" }, + "0x0000000000000000000000000000000000000013": { "balance": "1" }, + "0x0000000000000000000000000000000000000014": { "balance": "1" }, + "0x0000000000000000000000000000000000000015": { "balance": "1" }, + "0x0000000000000000000000000000000000000016": { "balance": "1" }, + "0x0000000000000000000000000000000000000017": { "balance": "1" }, + "0x0000000000000000000000000000000000000018": { "balance": "1" }, + "0x0000000000000000000000000000000000000019": { "balance": "1" }, + "0x000000000000000000000000000000000000001a": { "balance": "1" }, + "0x000000000000000000000000000000000000001b": { "balance": "1" }, + "0x000000000000000000000000000000000000001c": { "balance": "1" }, + "0x000000000000000000000000000000000000001d": { "balance": "1" }, + "0x000000000000000000000000000000000000001e": { "balance": "1" }, + "0x000000000000000000000000000000000000001f": { "balance": "1" }, + "0x0000000000000000000000000000000000000020": { "balance": "1" }, + "0x0000000000000000000000000000000000000021": { "balance": "1" }, + "0x0000000000000000000000000000000000000022": { "balance": "1" }, + "0x0000000000000000000000000000000000000023": { "balance": "1" }, + "0x0000000000000000000000000000000000000024": { "balance": "1" }, + "0x0000000000000000000000000000000000000025": { "balance": "1" }, + "0x0000000000000000000000000000000000000026": { "balance": "1" }, + "0x0000000000000000000000000000000000000027": { "balance": "1" }, + "0x0000000000000000000000000000000000000028": { "balance": "1" }, + "0x0000000000000000000000000000000000000029": { "balance": "1" }, + "0x000000000000000000000000000000000000002a": { "balance": "1" }, + "0x000000000000000000000000000000000000002b": { "balance": "1" }, + "0x000000000000000000000000000000000000002c": { "balance": "1" }, + "0x000000000000000000000000000000000000002d": { "balance": "1" }, + "0x000000000000000000000000000000000000002e": { "balance": "1" }, + "0x000000000000000000000000000000000000002f": { "balance": "1" }, + "0x0000000000000000000000000000000000000030": { "balance": "1" }, + "0x0000000000000000000000000000000000000031": { "balance": "1" }, + "0x0000000000000000000000000000000000000032": { "balance": "1" }, + "0x0000000000000000000000000000000000000033": { "balance": "1" }, + "0x0000000000000000000000000000000000000034": { "balance": "1" }, + "0x0000000000000000000000000000000000000035": { "balance": "1" }, + "0x0000000000000000000000000000000000000036": { "balance": "1" }, + "0x0000000000000000000000000000000000000037": { "balance": "1" }, + "0x0000000000000000000000000000000000000038": { "balance": "1" }, + "0x0000000000000000000000000000000000000039": { "balance": "1" }, + "0x000000000000000000000000000000000000003a": { "balance": "1" }, + "0x000000000000000000000000000000000000003b": { "balance": "1" }, + "0x000000000000000000000000000000000000003c": { "balance": "1" }, + "0x000000000000000000000000000000000000003d": { "balance": "1" }, + "0x000000000000000000000000000000000000003e": { "balance": "1" }, + "0x000000000000000000000000000000000000003f": { "balance": "1" }, + "0x0000000000000000000000000000000000000040": { "balance": "1" }, + "0x0000000000000000000000000000000000000041": { "balance": "1" }, + "0x0000000000000000000000000000000000000042": { "balance": "1" }, + "0x0000000000000000000000000000000000000043": { "balance": "1" }, + "0x0000000000000000000000000000000000000044": { "balance": "1" }, + "0x0000000000000000000000000000000000000045": { "balance": "1" }, + "0x0000000000000000000000000000000000000046": { "balance": "1" }, + "0x0000000000000000000000000000000000000047": { "balance": "1" }, + "0x0000000000000000000000000000000000000048": { "balance": "1" }, + "0x0000000000000000000000000000000000000049": { "balance": "1" }, + "0x000000000000000000000000000000000000004a": { "balance": "1" }, + "0x000000000000000000000000000000000000004b": { "balance": "1" }, + "0x000000000000000000000000000000000000004c": { "balance": "1" }, + "0x000000000000000000000000000000000000004d": { "balance": "1" }, + "0x000000000000000000000000000000000000004e": { "balance": "1" }, + "0x000000000000000000000000000000000000004f": { "balance": "1" }, + "0x0000000000000000000000000000000000000050": { "balance": "1" }, + "0x0000000000000000000000000000000000000051": { "balance": "1" }, + "0x0000000000000000000000000000000000000052": { "balance": "1" }, + "0x0000000000000000000000000000000000000053": { "balance": "1" }, + "0x0000000000000000000000000000000000000054": { "balance": "1" }, + "0x0000000000000000000000000000000000000055": { "balance": "1" }, + "0x0000000000000000000000000000000000000056": { "balance": "1" }, + "0x0000000000000000000000000000000000000057": { "balance": "1" }, + "0x0000000000000000000000000000000000000058": { "balance": "1" }, + "0x0000000000000000000000000000000000000059": { "balance": "1" }, + "0x000000000000000000000000000000000000005a": { "balance": "1" }, + "0x000000000000000000000000000000000000005b": { "balance": "1" }, + "0x000000000000000000000000000000000000005c": { "balance": "1" }, + "0x000000000000000000000000000000000000005d": { "balance": "1" }, + "0x000000000000000000000000000000000000005e": { "balance": "1" }, + "0x000000000000000000000000000000000000005f": { "balance": "1" }, + "0x0000000000000000000000000000000000000060": { "balance": "1" }, + "0x0000000000000000000000000000000000000061": { "balance": "1" }, + "0x0000000000000000000000000000000000000062": { "balance": "1" }, + "0x0000000000000000000000000000000000000063": { "balance": "1" }, + "0x0000000000000000000000000000000000000064": { "balance": "1" }, + "0x0000000000000000000000000000000000000065": { "balance": "1" }, + "0x0000000000000000000000000000000000000066": { "balance": "1" }, + "0x0000000000000000000000000000000000000067": { "balance": "1" }, + "0x0000000000000000000000000000000000000068": { "balance": "1" }, + "0x0000000000000000000000000000000000000069": { "balance": "1" }, + "0x000000000000000000000000000000000000006a": { "balance": "1" }, + "0x000000000000000000000000000000000000006b": { "balance": "1" }, + "0x000000000000000000000000000000000000006c": { "balance": "1" }, + "0x000000000000000000000000000000000000006d": { "balance": "1" }, + "0x000000000000000000000000000000000000006e": { "balance": "1" }, + "0x000000000000000000000000000000000000006f": { "balance": "1" }, + "0x0000000000000000000000000000000000000070": { "balance": "1" }, + "0x0000000000000000000000000000000000000071": { "balance": "1" }, + "0x0000000000000000000000000000000000000072": { "balance": "1" }, + "0x0000000000000000000000000000000000000073": { "balance": "1" }, + "0x0000000000000000000000000000000000000074": { "balance": "1" }, + "0x0000000000000000000000000000000000000075": { "balance": "1" }, + "0x0000000000000000000000000000000000000076": { "balance": "1" }, + "0x0000000000000000000000000000000000000077": { "balance": "1" }, + "0x0000000000000000000000000000000000000078": { "balance": "1" }, + "0x0000000000000000000000000000000000000079": { "balance": "1" }, + "0x000000000000000000000000000000000000007a": { "balance": "1" }, + "0x000000000000000000000000000000000000007b": { "balance": "1" }, + "0x000000000000000000000000000000000000007c": { "balance": "1" }, + "0x000000000000000000000000000000000000007d": { "balance": "1" }, + "0x000000000000000000000000000000000000007e": { "balance": "1" }, + "0x000000000000000000000000000000000000007f": { "balance": "1" }, + "0x0000000000000000000000000000000000000080": { "balance": "1" }, + "0x0000000000000000000000000000000000000081": { "balance": "1" }, + "0x0000000000000000000000000000000000000082": { "balance": "1" }, + "0x0000000000000000000000000000000000000083": { "balance": "1" }, + "0x0000000000000000000000000000000000000084": { "balance": "1" }, + "0x0000000000000000000000000000000000000085": { "balance": "1" }, + "0x0000000000000000000000000000000000000086": { "balance": "1" }, + "0x0000000000000000000000000000000000000087": { "balance": "1" }, + "0x0000000000000000000000000000000000000088": { "balance": "1" }, + "0x0000000000000000000000000000000000000089": { "balance": "1" }, + "0x000000000000000000000000000000000000008a": { "balance": "1" }, + "0x000000000000000000000000000000000000008b": { "balance": "1" }, + "0x000000000000000000000000000000000000008c": { "balance": "1" }, + "0x000000000000000000000000000000000000008d": { "balance": "1" }, + "0x000000000000000000000000000000000000008e": { "balance": "1" }, + "0x000000000000000000000000000000000000008f": { "balance": "1" }, + "0x0000000000000000000000000000000000000090": { "balance": "1" }, + "0x0000000000000000000000000000000000000091": { "balance": "1" }, + "0x0000000000000000000000000000000000000092": { "balance": "1" }, + "0x0000000000000000000000000000000000000093": { "balance": "1" }, + "0x0000000000000000000000000000000000000094": { "balance": "1" }, + "0x0000000000000000000000000000000000000095": { "balance": "1" }, + "0x0000000000000000000000000000000000000096": { "balance": "1" }, + "0x0000000000000000000000000000000000000097": { "balance": "1" }, + "0x0000000000000000000000000000000000000098": { "balance": "1" }, + "0x0000000000000000000000000000000000000099": { "balance": "1" }, + "0x000000000000000000000000000000000000009a": { "balance": "1" }, + "0x000000000000000000000000000000000000009b": { "balance": "1" }, + "0x000000000000000000000000000000000000009c": { "balance": "1" }, + "0x000000000000000000000000000000000000009d": { "balance": "1" }, + "0x000000000000000000000000000000000000009e": { "balance": "1" }, + "0x000000000000000000000000000000000000009f": { "balance": "1" }, + "0x00000000000000000000000000000000000000a0": { "balance": "1" }, + "0x00000000000000000000000000000000000000a1": { "balance": "1" }, + "0x00000000000000000000000000000000000000a2": { "balance": "1" }, + "0x00000000000000000000000000000000000000a3": { "balance": "1" }, + "0x00000000000000000000000000000000000000a4": { "balance": "1" }, + "0x00000000000000000000000000000000000000a5": { "balance": "1" }, + "0x00000000000000000000000000000000000000a6": { "balance": "1" }, + "0x00000000000000000000000000000000000000a7": { "balance": "1" }, + "0x00000000000000000000000000000000000000a8": { "balance": "1" }, + "0x00000000000000000000000000000000000000a9": { "balance": "1" }, + "0x00000000000000000000000000000000000000aa": { "balance": "1" }, + "0x00000000000000000000000000000000000000ab": { "balance": "1" }, + "0x00000000000000000000000000000000000000ac": { "balance": "1" }, + "0x00000000000000000000000000000000000000ad": { "balance": "1" }, + "0x00000000000000000000000000000000000000ae": { "balance": "1" }, + "0x00000000000000000000000000000000000000af": { "balance": "1" }, + "0x00000000000000000000000000000000000000b0": { "balance": "1" }, + "0x00000000000000000000000000000000000000b1": { "balance": "1" }, + "0x00000000000000000000000000000000000000b2": { "balance": "1" }, + "0x00000000000000000000000000000000000000b3": { "balance": "1" }, + "0x00000000000000000000000000000000000000b4": { "balance": "1" }, + "0x00000000000000000000000000000000000000b5": { "balance": "1" }, + "0x00000000000000000000000000000000000000b6": { "balance": "1" }, + "0x00000000000000000000000000000000000000b7": { "balance": "1" }, + "0x00000000000000000000000000000000000000b8": { "balance": "1" }, + "0x00000000000000000000000000000000000000b9": { "balance": "1" }, + "0x00000000000000000000000000000000000000ba": { "balance": "1" }, + "0x00000000000000000000000000000000000000bb": { "balance": "1" }, + "0x00000000000000000000000000000000000000bc": { "balance": "1" }, + "0x00000000000000000000000000000000000000bd": { "balance": "1" }, + "0x00000000000000000000000000000000000000be": { "balance": "1" }, + "0x00000000000000000000000000000000000000bf": { "balance": "1" }, + "0x00000000000000000000000000000000000000c0": { "balance": "1" }, + "0x00000000000000000000000000000000000000c1": { "balance": "1" }, + "0x00000000000000000000000000000000000000c2": { "balance": "1" }, + "0x00000000000000000000000000000000000000c3": { "balance": "1" }, + "0x00000000000000000000000000000000000000c4": { "balance": "1" }, + "0x00000000000000000000000000000000000000c5": { "balance": "1" }, + "0x00000000000000000000000000000000000000c6": { "balance": "1" }, + "0x00000000000000000000000000000000000000c7": { "balance": "1" }, + "0x00000000000000000000000000000000000000c8": { "balance": "1" }, + "0x00000000000000000000000000000000000000c9": { "balance": "1" }, + "0x00000000000000000000000000000000000000ca": { "balance": "1" }, + "0x00000000000000000000000000000000000000cb": { "balance": "1" }, + "0x00000000000000000000000000000000000000cc": { "balance": "1" }, + "0x00000000000000000000000000000000000000cd": { "balance": "1" }, + "0x00000000000000000000000000000000000000ce": { "balance": "1" }, + "0x00000000000000000000000000000000000000cf": { "balance": "1" }, + "0x00000000000000000000000000000000000000d0": { "balance": "1" }, + "0x00000000000000000000000000000000000000d1": { "balance": "1" }, + "0x00000000000000000000000000000000000000d2": { "balance": "1" }, + "0x00000000000000000000000000000000000000d3": { "balance": "1" }, + "0x00000000000000000000000000000000000000d4": { "balance": "1" }, + "0x00000000000000000000000000000000000000d5": { "balance": "1" }, + "0x00000000000000000000000000000000000000d6": { "balance": "1" }, + "0x00000000000000000000000000000000000000d7": { "balance": "1" }, + "0x00000000000000000000000000000000000000d8": { "balance": "1" }, + "0x00000000000000000000000000000000000000d9": { "balance": "1" }, + "0x00000000000000000000000000000000000000da": { "balance": "1" }, + "0x00000000000000000000000000000000000000db": { "balance": "1" }, + "0x00000000000000000000000000000000000000dc": { "balance": "1" }, + "0x00000000000000000000000000000000000000dd": { "balance": "1" }, + "0x00000000000000000000000000000000000000de": { "balance": "1" }, + "0x00000000000000000000000000000000000000df": { "balance": "1" }, + "0x00000000000000000000000000000000000000e0": { "balance": "1" }, + "0x00000000000000000000000000000000000000e1": { "balance": "1" }, + "0x00000000000000000000000000000000000000e2": { "balance": "1" }, + "0x00000000000000000000000000000000000000e3": { "balance": "1" }, + "0x00000000000000000000000000000000000000e4": { "balance": "1" }, + "0x00000000000000000000000000000000000000e5": { "balance": "1" }, + "0x00000000000000000000000000000000000000e6": { "balance": "1" }, + "0x00000000000000000000000000000000000000e7": { "balance": "1" }, + "0x00000000000000000000000000000000000000e8": { "balance": "1" }, + "0x00000000000000000000000000000000000000e9": { "balance": "1" }, + "0x00000000000000000000000000000000000000ea": { "balance": "1" }, + "0x00000000000000000000000000000000000000eb": { "balance": "1" }, + "0x00000000000000000000000000000000000000ec": { "balance": "1" }, + "0x00000000000000000000000000000000000000ed": { "balance": "1" }, + "0x00000000000000000000000000000000000000ee": { "balance": "1" }, + "0x00000000000000000000000000000000000000ef": { "balance": "1" }, + "0x00000000000000000000000000000000000000f0": { "balance": "1" }, + "0x00000000000000000000000000000000000000f1": { "balance": "1" }, + "0x00000000000000000000000000000000000000f2": { "balance": "1" }, + "0x00000000000000000000000000000000000000f3": { "balance": "1" }, + "0x00000000000000000000000000000000000000f4": { "balance": "1" }, + "0x00000000000000000000000000000000000000f5": { "balance": "1" }, + "0x00000000000000000000000000000000000000f6": { "balance": "1" }, + "0x00000000000000000000000000000000000000f7": { "balance": "1" }, + "0x00000000000000000000000000000000000000f8": { "balance": "1" }, + "0x00000000000000000000000000000000000000f9": { "balance": "1" }, + "0x00000000000000000000000000000000000000fa": { "balance": "1" }, + "0x00000000000000000000000000000000000000fb": { "balance": "1" }, + "0x00000000000000000000000000000000000000fc": { "balance": "1" }, + "0x00000000000000000000000000000000000000fd": { "balance": "1" }, + "0x00000000000000000000000000000000000000fe": { "balance": "1" }, + "0x00000000000000000000000000000000000000ff": { "balance": "1" } +} \ No newline at end of file diff --git a/apps/el-gen/requirements.txt b/apps/el-gen/requirements.txt deleted file mode 100644 index 68cb490..0000000 --- a/apps/el-gen/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -ruamel.yaml==0.17.16 -web3>=6.15.0 -setuptools>=69.1.0 -python-dotenv==1.0.1 \ No newline at end of file diff --git a/apps/el-gen/system-contracts.yaml b/apps/el-gen/system-contracts.yaml new file mode 100644 index 0000000..ab80494 --- /dev/null +++ b/apps/el-gen/system-contracts.yaml @@ -0,0 +1,76 @@ +# deposit contract +deposit: { + "balance": "0", + "code": "0x60806040526004361061003f5760003560e01c806301ffc9a71461004457806322895118146100a4578063621fd130146101ba578063c5f2892f14610244575b600080fd5b34801561005057600080fd5b506100906004803603602081101561006757600080fd5b50357fffffffff000000000000000000000000000000000000000000000000000000001661026b565b604080519115158252519081900360200190f35b6101b8600480360360808110156100ba57600080fd5b8101906020810181356401000000008111156100d557600080fd5b8201836020820111156100e757600080fd5b8035906020019184600183028401116401000000008311171561010957600080fd5b91939092909160208101903564010000000081111561012757600080fd5b82018360208201111561013957600080fd5b8035906020019184600183028401116401000000008311171561015b57600080fd5b91939092909160208101903564010000000081111561017957600080fd5b82018360208201111561018b57600080fd5b803590602001918460018302840111640100000000831117156101ad57600080fd5b919350915035610304565b005b3480156101c657600080fd5b506101cf6110b5565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102095781810151838201526020016101f1565b50505050905090810190601f1680156102365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025057600080fd5b506102596110c7565b60408051918252519081900360200190f35b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102fe57507fffffffff0000000000000000000000000000000000000000000000000000000082167f8564090700000000000000000000000000000000000000000000000000000000145b92915050565b6030861461035d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118056026913960400191505060405180910390fd5b602084146103b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061179c6036913960400191505060405180910390fd5b6060821461040f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806118786029913960400191505060405180910390fd5b670de0b6b3a7640000341015610470576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118526026913960400191505060405180910390fd5b633b9aca003406156104cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260338152602001806117d26033913960400191505060405180910390fd5b633b9aca00340467ffffffffffffffff811115610535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602781526020018061182b6027913960400191505060405180910390fd5b6060610540826114ba565b90507f649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c589898989858a8a6105756020546114ba565b6040805160a0808252810189905290819060208201908201606083016080840160c085018e8e80828437600083820152601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690910187810386528c815260200190508c8c808284376000838201819052601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920188810386528c5181528c51602091820193918e019250908190849084905b83811015610648578181015183820152602001610630565b50505050905090810190601f1680156106755780820380516001836020036101000a031916815260200191505b5086810383528881526020018989808284376000838201819052601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169092018881038452895181528951602091820193918b019250908190849084905b838110156106ef5781810151838201526020016106d7565b50505050905090810190601f16801561071c5780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390a1600060028a8a600060801b604051602001808484808284377fffffffffffffffffffffffffffffffff0000000000000000000000000000000090941691909301908152604080517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0818403018152601090920190819052815191955093508392506020850191508083835b602083106107fc57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016107bf565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610859573d6000803e3d6000fd5b5050506040513d602081101561086e57600080fd5b5051905060006002806108846040848a8c6116fe565b6040516020018083838082843780830192505050925050506040516020818303038152906040526040518082805190602001908083835b602083106108f857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016108bb565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610955573d6000803e3d6000fd5b5050506040513d602081101561096a57600080fd5b5051600261097b896040818d6116fe565b60405160009060200180848480828437919091019283525050604080518083038152602092830191829052805190945090925082918401908083835b602083106109f457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016109b7565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610a51573d6000803e3d6000fd5b5050506040513d6020811015610a6657600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610ada57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610a9d565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610b37573d6000803e3d6000fd5b5050506040513d6020811015610b4c57600080fd5b50516040805160208101858152929350600092600292839287928f928f92018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b60208310610bd957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610b9c565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610c36573d6000803e3d6000fd5b5050506040513d6020811015610c4b57600080fd5b50516040518651600291889160009188916020918201918291908601908083835b60208310610ca957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610c6c565b6001836020036101000a0380198251168184511680821785525050505050509050018367ffffffffffffffff191667ffffffffffffffff1916815260180182815260200193505050506040516020818303038152906040526040518082805190602001908083835b60208310610d4e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610d11565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610dab573d6000803e3d6000fd5b5050506040513d6020811015610dc057600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610e3457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610df7565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610e91573d6000803e3d6000fd5b5050506040513d6020811015610ea657600080fd5b50519050858114610f02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260548152602001806117486054913960600191505060405180910390fd5b60205463ffffffff11610f60576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117276021913960400191505060405180910390fd5b602080546001019081905560005b60208110156110a9578160011660011415610fa0578260008260208110610f9157fe5b0155506110ac95505050505050565b600260008260208110610faf57fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061102557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610fe8565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015611082573d6000803e3d6000fd5b5050506040513d602081101561109757600080fd5b50519250600282049150600101610f6e565b50fe5b50505050505050565b60606110c26020546114ba565b905090565b6020546000908190815b60208110156112f05781600116600114156111e6576002600082602081106110f557fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061116b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161112e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa1580156111c8573d6000803e3d6000fd5b5050506040513d60208110156111dd57600080fd5b505192506112e2565b600283602183602081106111f657fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061126b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161122e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa1580156112c8573d6000803e3d6000fd5b5050506040513d60208110156112dd57600080fd5b505192505b6002820491506001016110d1565b506002826112ff6020546114ba565b600060401b6040516020018084815260200183805190602001908083835b6020831061135a57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161131d565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000095909516920191825250604080518083037ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8018152601890920190819052815191955093508392850191508083835b6020831061143f57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611402565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa15801561149c573d6000803e3d6000fd5b5050506040513d60208110156114b157600080fd5b50519250505090565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b826000815181106114f457fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060061a60f81b8260018151811061153757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060051a60f81b8260028151811061157a57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060041a60f81b826003815181106115bd57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060031a60f81b8260048151811061160057fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060021a60f81b8260058151811061164357fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060011a60f81b8260068151811061168657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060001a60f81b826007815181106116c957fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050919050565b6000808585111561170d578182fd5b83861115611719578182fd5b505082019391909203915056fe4465706f736974436f6e74726163743a206d65726b6c6520747265652066756c6c4465706f736974436f6e74726163743a207265636f6e7374727563746564204465706f7369744461746120646f6573206e6f74206d6174636820737570706c696564206465706f7369745f646174615f726f6f744465706f736974436f6e74726163743a20696e76616c6964207769746864726177616c5f63726564656e7469616c73206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c7565206e6f74206d756c7469706c65206f6620677765694465706f736974436f6e74726163743a20696e76616c6964207075626b6579206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f20686967684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f206c6f774465706f736974436f6e74726163743a20696e76616c6964207369676e6174757265206c656e677468a2646970667358221220dceca8706b29e917dacf25fceef95acac8d90d765ac926663ce4096195952b6164736f6c634300060b0033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000022": "0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b", + "0x0000000000000000000000000000000000000000000000000000000000000023": "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0x0000000000000000000000000000000000000000000000000000000000000024": "0xc78009fdf07fc56a11f122370658a353aaa542ed63e44c4bc15ff4cd105ab33c", + "0x0000000000000000000000000000000000000000000000000000000000000025": "0x536d98837f2dd165a55d5eeae91485954472d56f246df256bf3cae19352a123c", + "0x0000000000000000000000000000000000000000000000000000000000000026": "0x9efde052aa15429fae05bad4d0b1d7c64da64d03d7a1854a588c2cb8430c0d30", + "0x0000000000000000000000000000000000000000000000000000000000000027": "0xd88ddfeed400a8755596b21942c1497e114c302e6118290f91e6772976041fa1", + "0x0000000000000000000000000000000000000000000000000000000000000028": "0x87eb0ddba57e35f6d286673802a4af5975e22506c7cf4c64bb6be5ee11527f2c", + "0x0000000000000000000000000000000000000000000000000000000000000029": "0x26846476fd5fc54a5d43385167c95144f2643f533cc85bb9d16b782f8d7db193", + "0x000000000000000000000000000000000000000000000000000000000000002a": "0x506d86582d252405b840018792cad2bf1259f1ef5aa5f887e13cb2f0094f51e1", + "0x000000000000000000000000000000000000000000000000000000000000002b": "0xffff0ad7e659772f9534c195c815efc4014ef1e1daed4404c06385d11192e92b", + "0x000000000000000000000000000000000000000000000000000000000000002c": "0x6cf04127db05441cd833107a52be852868890e4317e6a02ab47683aa75964220", + "0x000000000000000000000000000000000000000000000000000000000000002d": "0xb7d05f875f140027ef5118a2247bbb84ce8f2f0f1123623085daf7960c329f5f", + "0x000000000000000000000000000000000000000000000000000000000000002e": "0xdf6af5f5bbdb6be9ef8aa618e4bf8073960867171e29676f8b284dea6a08a85e", + "0x000000000000000000000000000000000000000000000000000000000000002f": "0xb58d900f5e182e3c50ef74969ea16c7726c549757cc23523c369587da7293784", + "0x0000000000000000000000000000000000000000000000000000000000000030": "0xd49a7502ffcfb0340b1d7885688500ca308161a7f96b62df9d083b71fcc8f2bb", + "0x0000000000000000000000000000000000000000000000000000000000000031": "0x8fe6b1689256c0d385f42f5bbe2027a22c1996e110ba97c171d3e5948de92beb", + "0x0000000000000000000000000000000000000000000000000000000000000032": "0x8d0d63c39ebade8509e0ae3c9c3876fb5fa112be18f905ecacfecb92057603ab", + "0x0000000000000000000000000000000000000000000000000000000000000033": "0x95eec8b2e541cad4e91de38385f2e046619f54496c2382cb6cacd5b98c26f5a4", + "0x0000000000000000000000000000000000000000000000000000000000000034": "0xf893e908917775b62bff23294dbbe3a1cd8e6cc1c35b4801887b646a6f81f17f", + "0x0000000000000000000000000000000000000000000000000000000000000035": "0xcddba7b592e3133393c16194fac7431abf2f5485ed711db282183c819e08ebaa", + "0x0000000000000000000000000000000000000000000000000000000000000036": "0x8a8d7fe3af8caa085a7639a832001457dfb9128a8061142ad0335629ff23ff9c", + "0x0000000000000000000000000000000000000000000000000000000000000037": "0xfeb3c337d7a51a6fbf00b9e34c52e1c9195c969bd4e7a0bfd51d5c5bed9c1167", + "0x0000000000000000000000000000000000000000000000000000000000000038": "0xe71f0aa83cc32edfbefa9f4d3e0174ca85182eec9f3a09f6a6c0df6377a510d7", + "0x0000000000000000000000000000000000000000000000000000000000000039": "0x31206fa80a50bb6abe29085058f16212212a60eec8f049fecb92d8c8e0a84bc0", + "0x000000000000000000000000000000000000000000000000000000000000003a": "0x21352bfecbeddde993839f614c3dac0a3ee37543f9b412b16199dc158e23b544", + "0x000000000000000000000000000000000000000000000000000000000000003b": "0x619e312724bb6d7c3153ed9de791d764a366b389af13c58bf8a8d90481a46765", + "0x000000000000000000000000000000000000000000000000000000000000003c": "0x7cdd2986268250628d0c10e385c58c6191e6fbe05191bcc04f133f2cea72c1c4", + "0x000000000000000000000000000000000000000000000000000000000000003d": "0x848930bd7ba8cac54661072113fb278869e07bb8587f91392933374d017bcbe1", + "0x000000000000000000000000000000000000000000000000000000000000003e": "0x8869ff2c22b28cc10510d9853292803328be4fb0e80495e8bb8d271f5b889636", + "0x000000000000000000000000000000000000000000000000000000000000003f": "0xb5fe28e79f1b850f8658246ce9b6a1e7b49fc06db7143e8fe0b4f2b0c5523a5c", + "0x0000000000000000000000000000000000000000000000000000000000000040": "0x985e929f70af28d0bdd1a90a808f977f597c7c778c489e98d3bd8910d31ac0f7" + } +} + +# EIP-4788: Beacon block root in the EVM +eip4788_address: "0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02" +eip4788: { + "balance": "0", + "nonce": "1", + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500" +} + +# EIP-2935: Serve historical block hashes from state +eip2935_address: "0x0F792be4B0c0cb4DAE440Ef133E90C0eCD48CCCC" +eip2935: { + "balance": "0", + "nonce": "1", + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500" +} + +# EIP-7002: Execution layer triggerable withdrawals +eip7002_address: "0x0c15F14308530b7CDB8460094BbB9cC28b9AaaAA" +eip7002: { + "balance": "0", + "nonce": "1", + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460cb5760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f457600182026001905f5b5f82111560685781019083028483029004916001019190604d565b909390049250505036603814608857366101f457346101f4575f5260205ff35b34106101f457600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060101160df575060105b5f5b8181146101835782810160030260040181604c02815460601b8152601401816001015481526020019060020154807fffffffffffffffffffffffffffffffff00000000000000000000000000000000168252906010019060401c908160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160e1565b910180921461019557906002556101a0565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101cd57505f5b6001546002828201116101e25750505f6101e8565b01600290035b5f555f600155604c025ff35b5f5ffd", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } +} + +# EIP-7251: Increase the MAX_EFFECTIVE_BALANCE +eip7251_address: "0x00431F263cE400f4455c2dCf564e53007Ca4bbBb" +eip7251: { + "balance": "0", + "nonce": "1", + "code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460d35760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f82111560685781019083028483029004916001019190604d565b9093900492505050366060146088573661019a573461019a575f5260205ff35b341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060021160e7575060025b5f5b8181146101295782810160040260040181607402815460601b815260140181600101548152602001816002015481526020019060030154905260010160e9565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } +} \ No newline at end of file diff --git a/apps/el-gen/tpl-besu.json b/apps/el-gen/tpl-besu.json new file mode 100644 index 0000000..c169cd2 --- /dev/null +++ b/apps/el-gen/tpl-besu.json @@ -0,0 +1,26 @@ +{ + "config": { + "chainId": ${CHAIN_ID}, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "berlinBlock": 0, + "londonBlock": 0 + }, + "alloc": {}, + "coinbase": "0x0000000000000000000000000000000000000000", + "baseFeePerGas": "0x3B9ACA00", + "difficulty": "0x01", + "extraData": "", + "gasLimit": "${GENESIS_GASLIMIT_HEX}", + "nonce": "0x1234", + "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": "${GENESIS_TIMESTAMP}" +} + \ No newline at end of file diff --git a/apps/el-gen/tpl-chainspec.json b/apps/el-gen/tpl-chainspec.json new file mode 100644 index 0000000..07fd72d --- /dev/null +++ b/apps/el-gen/tpl-chainspec.json @@ -0,0 +1,62 @@ +{ + "name": "Testnet", + "engine": { + "Ethash": {} + }, + "params": { + "gasLimitBoundDivisor": "0x400", + "registrar": "0x0000000000000000000000000000000000000000", + "accountStartNonce": "0x0", + "maximumExtraDataSize": "0xffff", + "minGasLimit": "0x1388", + "networkID": "${CHAIN_ID_HEX}", + "MergeForkIdTransition": "0x0", + "maxCodeSize": "0x6000", + "maxCodeSizeTransition": "0x0", + "eip150Transition": "0x0", + "eip158Transition": "0x0", + "eip160Transition": "0x0", + "eip161abcTransition": "0x0", + "eip161dTransition": "0x0", + "eip155Transition": "0x0", + "eip140Transition": "0x0", + "eip211Transition": "0x0", + "eip214Transition": "0x0", + "eip658Transition": "0x0", + "eip145Transition": "0x0", + "eip1014Transition": "0x0", + "eip1052Transition": "0x0", + "eip1283Transition": "0x0", + "eip1283DisableTransition": "0x0", + "eip152Transition": "0x0", + "eip1108Transition": "0x0", + "eip1344Transition": "0x0", + "eip1884Transition": "0x0", + "eip2028Transition": "0x0", + "eip2200Transition": "0x0", + "eip2565Transition": "0x0", + "eip2929Transition": "0x0", + "eip2930Transition": "0x0", + "eip1559Transition": "0x0", + "eip3198Transition": "0x0", + "eip3529Transition": "0x0", + "eip3541Transition": "0x0" + }, + "genesis": { + "seal": { + "ethereum": { + "nonce": "0x1234", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + }, + "difficulty": "0x01", + "author": "0x0000000000000000000000000000000000000000", + "timestamp": "${GENESIS_TIMESTAMP_HEX}", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "", + "gasLimit": "${GENESIS_GASLIMIT_HEX}" + }, + "accounts": {}, + "nodes": [] +} + \ No newline at end of file diff --git a/apps/el-gen/tpl-genesis.json b/apps/el-gen/tpl-genesis.json new file mode 100644 index 0000000..d34535a --- /dev/null +++ b/apps/el-gen/tpl-genesis.json @@ -0,0 +1,24 @@ +{ + "config": { + "chainId": ${CHAIN_ID}, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "berlinBlock": 0, + "londonBlock": 0 + }, + "alloc": {}, + "coinbase": "0x0000000000000000000000000000000000000000", + "difficulty": "0x01", + "extraData": "", + "gasLimit": "${GENESIS_GASLIMIT_HEX}", + "nonce": "0x1234", + "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": "${GENESIS_TIMESTAMP}" +} diff --git a/apps/envsubst.py b/apps/envsubst.py deleted file mode 100644 index 6efaae9..0000000 --- a/apps/envsubst.py +++ /dev/null @@ -1,56 +0,0 @@ -# This script substitutes environment variables in input lines using values from two .env files. -import os -import re -import sys -import json - -from dotenv import dotenv_values - -# Load default and full environment variables from specified files -# handle the case where the env file is not present -defaults = dotenv_values(os.environ['DEFAULT_ENV_FILE']) - -config_file = os.environ.get('FULL_ENV_FILE') -config = dotenv_values(config_file) if config_file and os.path.isfile(config_file) else {} - -env_vars = os.environ - -# These regular expressions are used to identify and match environment variable patterns in the input text. -# The updated regex matches variables enclosed in either curly braces or square brackets. -# It captures nested structures as well, allowing for more complex variable patterns. -bracket_sub_re = re.compile(r'\$\{([A-Z0-9_]+)\}') -basic_sub_re = re.compile(r'\$([A-Z0-9_]+)') - -def sub(m): - # Get variable name from match - var_name = m.group(1) - - # Try env vars first, then config, then defaults - cfg = env_vars.get(var_name) - - cfg = config.get(var_name) - if cfg is None: - cfg = defaults.get(var_name) - - if cfg is None: - raise Exception(f"Missing environment variable: {var_name}") - - # Handle JSON-like strings by removing trailing single quotes if present - cfg = cfg.strip().strip("'") - - # Try to parse as JSON if it looks like JSON - if cfg.startswith('{') and cfg.endswith('}'): - try: - # Validate it's proper JSON - json.loads(cfg) - return cfg # Return the original string if it's valid JSON - except json.JSONDecodeError: - pass - - return cfg - -# Read from standard input line by line -for line in sys.stdin: - out = bracket_sub_re.sub(sub, line) # Substitute bracketed variables - out = basic_sub_re.sub(sub, out) # Substitute basic variables - sys.stdout.write(out) # Output the final substituted line diff --git a/config-example/el/genesis-config.yaml b/config-example/el/genesis-config.yaml index a6ed797..72b4940 100644 --- a/config-example/el/genesis-config.yaml +++ b/config-example/el/genesis-config.yaml @@ -1,6 +1,3 @@ -preset_base: ${PRESET_BASE} -chain_id: ${CHAIN_ID} -deposit_contract_address: "${DEPOSIT_CONTRACT_ADDRESS}" mnemonic: ${EL_AND_CL_MNEMONIC} el_premine: "m/44'/60'/0'/0/0": 1000000000ETH @@ -26,20 +23,3 @@ el_premine: "m/44'/60'/0'/0/20": 1000000000ETH el_premine_addrs: ${EL_PREMINE_ADDRS} additional_preloaded_contracts: ${ADDITIONAL_PRELOADED_CONTRACTS} -genesis_timestamp: ${GENESIS_TIMESTAMP} -genesis_delay: ${GENESIS_DELAY} -genesis_gaslimit: ${GENESIS_GASLIMIT} -slot_duration_in_seconds: ${SLOT_DURATION_IN_SECONDS} -terminal_total_difficulty: ${TERMINAL_TOTAL_DIFFICULTY} -altair_fork_epoch: ${ALTAIR_FORK_EPOCH} -bellatrix_fork_epoch: ${BELLATRIX_FORK_EPOCH} -capella_fork_epoch: ${CAPELLA_FORK_EPOCH} -deneb_fork_epoch: ${DENEB_FORK_EPOCH} -electra_fork_epoch: ${ELECTRA_FORK_EPOCH} -fulu_fork_epoch: ${FULU_FORK_EPOCH} -target_blobs_per_block_cancun: 3 -max_blobs_per_block_cancun: 6 -target_blobs_per_block_prague: ${TARGET_BLOBS_PER_BLOCK_ELECTRA} -max_blobs_per_block_prague: ${MAX_BLOBS_PER_BLOCK_ELECTRA} -target_blobs_per_block_osaka: ${TARGET_BLOBS_PER_BLOCK_FULU} -max_blobs_per_block_osaka: ${MAX_BLOBS_PER_BLOCK_FULU} diff --git a/defaults/defaults.env b/defaults/defaults.env index 89d72ef..bb21998 100644 --- a/defaults/defaults.env +++ b/defaults/defaults.env @@ -18,9 +18,9 @@ export CAPELLA_FORK_EPOCH="${CAPELLA_FORK_EPOCH:-0}" export DENEB_FORK_VERSION="${DENEB_FORK_VERSION:-0x50000000}" export DENEB_FORK_EPOCH="${DENEB_FORK_EPOCH:-0}" export ELECTRA_FORK_VERSION="${ELECTRA_FORK_VERSION:-0x60000000}" -export ELECTRA_FORK_EPOCH="${ELECTRA_FORK_EPOCH:-2000}" +export ELECTRA_FORK_EPOCH="${ELECTRA_FORK_EPOCH:-18446744073709551615}" export FULU_FORK_VERSION="${FULU_FORK_VERSION:-0x70000000}" -export FULU_FORK_EPOCH="${FULU_FORK_EPOCH:-99999}" +export FULU_FORK_EPOCH="${FULU_FORK_EPOCH:-18446744073709551615}" export WITHDRAWAL_TYPE="${WITHDRAWAL_TYPE:-0x00}" export WITHDRAWAL_ADDRESS="${WITHDRAWAL_ADDRESS:-0xf97e180c050e5Ab072211Ad2C213Eb5AEE4DF134}" export BEACON_STATIC_ENR="${BEACON_STATIC_ENR:-enr:-Iq4QJk4WqRkjsX5c2CXtOra6HnxN-BMXnWhmhEQO9Bn9iABTJGdjUOurM7Btj1ouKaFkvTRoju5vz2GPmVON2dffQKGAX53x8JigmlkgnY0gmlwhLKAlv6Jc2VjcDI1NmsxoQK6S-Cii_KmfFdUJL2TANL3ksaKUnNXvTCv1tLwXs0QgIN1ZHCCIyk}" diff --git a/entrypoint.sh b/entrypoint.sh index 51f4f1c..49d21a9 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,21 +1,13 @@ #!/bin/bash -e -export DEFAULT_ENV_FILE="/defaults/defaults.env" + # Load the default env vars into the environment -source $DEFAULT_ENV_FILE +source /defaults/defaults.env +# Load the env vars entered by the user if [ -f /config/values.env ]; then - # Use user provided env vars if it exists - export FULL_ENV_FILE="/config/values.env" - # Pull these values out of the env file since they can be very large and cause - # "arguments list too long" errors in the shell. - grep -v "ADDITIONAL_PRELOADED_CONTRACTS" $FULL_ENV_FILE | grep -v "EL_PREMINE_ADDRS" > /tmp/values-short.env - # print the value of ADDITIONAL_PRELOADED_CONTRACTS -else - grep -v "ADDITIONAL_PRELOADED_CONTRACTS" $DEFAULT_ENV_FILE | grep -v "EL_PREMINE_ADDRS" > /tmp/values-short.env + source /config/values.env fi -# Load the env vars entered by the user without the larger values into the environment -source /tmp/values-short.env SERVER_ENABLED="${SERVER_ENABLED:-false}" @@ -23,7 +15,6 @@ SERVER_PORT="${SERVER_PORT:-8000}" gen_shared_files(){ - . /apps/el-gen/.venv/bin/activate set -x # Shared files mkdir -p /data/metadata @@ -38,16 +29,11 @@ gen_shared_files(){ } gen_el_config(){ - . /apps/el-gen/.venv/bin/activate set -x if ! [ -f "/data/metadata/genesis.json" ]; then - tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) mkdir -p /data/metadata - python3 /apps/envsubst.py < /config/el/genesis-config.yaml > $tmp_dir/genesis-config.yaml - cat $tmp_dir/genesis-config.yaml - python3 /apps/el-gen/genesis_geth.py $tmp_dir/genesis-config.yaml > /data/metadata/genesis.json - python3 /apps/el-gen/genesis_chainspec.py $tmp_dir/genesis-config.yaml > /data/metadata/chainspec.json - python3 /apps/el-gen/genesis_besu.py $tmp_dir/genesis-config.yaml > /data/metadata/besu.json + source /apps/el-gen/generate_genesis.sh + generate_genesis /data/metadata else echo "el genesis already exists. skipping generation..." fi @@ -69,7 +55,6 @@ gen_minimal_config() { } gen_cl_config(){ - . /apps/el-gen/.venv/bin/activate set -x # Consensus layer: Check if genesis already exists if ! [ -f "/data/metadata/genesis.ssz" ]; then @@ -80,9 +65,9 @@ gen_cl_config(){ COMMENT="# $HUMAN_READABLE_TIMESTAMP" export MAX_REQUEST_BLOB_SIDECARS_ELECTRA=$(($MAX_REQUEST_BLOCKS_DENEB * $MAX_BLOBS_PER_BLOCK_ELECTRA)) export MAX_REQUEST_BLOB_SIDECARS_FULU=$(($MAX_REQUEST_BLOCKS_DENEB * $MAX_BLOBS_PER_BLOCK_FULU)) - python3 /apps/envsubst.py < /config/cl/config.yaml > /data/metadata/config.yaml + envsubst < /config/cl/config.yaml > /data/metadata/config.yaml sed -i "s/#HUMAN_TIME_PLACEHOLDER/$COMMENT/" /data/metadata/config.yaml - python3 /apps/envsubst.py < /config/cl/mnemonics.yaml > $tmp_dir/mnemonics.yaml + envsubst < /config/cl/mnemonics.yaml > $tmp_dir/mnemonics.yaml # Conditionally override values if preset is "minimal" if [[ "$PRESET_BASE" == "minimal" ]]; then gen_minimal_config @@ -93,7 +78,7 @@ gen_cl_config(){ echo $CL_EXEC_BLOCK > /data/metadata/deposit_contract_block.txt echo $BEACON_STATIC_ENR > /data/metadata/bootstrap_nodes.txt # Envsubst mnemonics - python3 /apps/envsubst.py < /config/cl/mnemonics.yaml > $tmp_dir/mnemonics.yaml + envsubst < /config/cl/mnemonics.yaml > $tmp_dir/mnemonics.yaml # Generate genesis if [[ $ALTAIR_FORK_EPOCH != 0 ]]; then genesis_args+=(