Skip to content

Commit

Permalink
Merge pull request #125 from ethpandaops/allow-prefunded-contract-def
Browse files Browse the repository at this point in the history
Allow env var to define custom contracts
  • Loading branch information
parithosh committed May 28, 2024
2 parents 5c952b8 + fb4af6a commit 86e62f6
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
6 changes: 5 additions & 1 deletion apps/el-gen/genesis_besu.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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"
combined_allocs = {}

if len(sys.argv) > 1:
testnet_config_path = sys.argv[1]
Expand Down Expand Up @@ -132,8 +133,11 @@
out["alloc"][acct.address] = {"balance": weival}


combined_allocs = data['el_premine_addrs'].copy()
combined_allocs.update(data['additional_preloaded_contracts'])

# Some hardcoded addrs
for addr, account in data['el_premine_addrs'].items():
for addr, account in combined_allocs.items():
# Convert balance format
if isinstance(account, dict) and 'balance' in account:
balance_value = account['balance'].replace('ETH', '0' * 18)
Expand Down
7 changes: 5 additions & 2 deletions apps/el-gen/genesis_chainspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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"

combined_allocs = {}
if len(sys.argv) > 1:
testnet_config_path = sys.argv[1]

Expand Down Expand Up @@ -173,8 +173,11 @@
weival = value.replace('ETH', '0' * 18)
out["accounts"][acct.address] = {"balance": weival}

combined_allocs = data['el_premine_addrs'].copy()
combined_allocs.update(data['additional_preloaded_contracts'])

# Some hardcoded addrs
for addr, account in data['el_premine_addrs'].items():
for addr, account in combined_allocs.items():
# Convert balance format
if isinstance(account, dict) and 'balance' in account:
balance_value = account['balance'].replace('ETH', '0' * 18)
Expand Down
7 changes: 5 additions & 2 deletions apps/el-gen/genesis_geth.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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"

combined_allocs = {}
if len(sys.argv) > 1:
testnet_config_path = sys.argv[1]

Expand Down Expand Up @@ -131,8 +131,11 @@
weival = value.replace('ETH', '0' * 18)
out["alloc"][acct.address] = {"balance": weival}

combined_allocs = data['el_premine_addrs'].copy()
combined_allocs.update(data['additional_preloaded_contracts'])

# Some hardcoded addrs
for addr, account in data['el_premine_addrs'].items():
for addr, account in combined_allocs.items():
# Convert balance format
if isinstance(account, dict) and 'balance' in account:
balance_value = account['balance'].replace('ETH', '0' * 18)
Expand Down
3 changes: 2 additions & 1 deletion config-example/el/genesis-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ el_premine:
"m/44'/60'/0'/0/18": 1000000000ETH
"m/44'/60'/0'/0/19": 1000000000ETH
"m/44'/60'/0'/0/20": 1000000000ETH
el_premine_addrs: {}
el_premine_addrs: ${EL_PREMINE_ADDRS}
additional_preloaded_contracts: ${ADDITIONAL_PRELOADED_CONTRACTS}
genesis_timestamp: ${GENESIS_TIMESTAMP}
genesis_delay: ${GENESIS_DELAY}
genesis_gaslimit: ${GENESIS_GASLIMIT}
Expand Down
5 changes: 5 additions & 0 deletions config-example/values.env
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ export SAMPLES_PER_SLOT=8
export CUSTODY_REQUIREMENT=1
export DATA_COLUMN_SIDECAR_SUBNET_COUNT=32
export TARGET_NUMBER_OF_PEERS=70
export EL_PREMINE_ADDRS='{}'
export ADDITIONAL_PRELOADED_CONTRACTS='{}'
# export ADDITIONAL_PRELOADED_CONTRACTS='{"0x123463a4B065722E99115D6c222f267d9cABb524": {"balance": "1ETH","code": "0x123465","storage": {},"nonce": 0,"secretKey": "0x"}}'


0 comments on commit 86e62f6

Please sign in to comment.