Skip to content

Commit

Permalink
Merge pull request #129 from ethpandaops/pk910/fix-premine-addr-list
Browse files Browse the repository at this point in the history
fix el_premine_addrs & additional_preloaded_contracts concatenation
  • Loading branch information
pk910 committed May 28, 2024
2 parents 5373872 + b28cd3e commit 38689ff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
13 changes: 8 additions & 5 deletions apps/el-gen/genesis_besu.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,8 @@
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 combined_allocs.items():
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)
Expand Down Expand Up @@ -167,6 +163,13 @@
# 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)


if 'electra_fork_epoch' in data:
out['config']['pragueTime'] = \
int(data['genesis_timestamp']) + \
Expand Down
11 changes: 7 additions & 4 deletions apps/el-gen/genesis_chainspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,8 @@
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 combined_allocs.items():
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)
Expand Down Expand Up @@ -207,6 +204,12 @@
# 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)

if 'electra_fork_epoch' in data:
out['params']['eip2537TransitionTimestamp']= hex(
int(data['genesis_timestamp']) +
Expand Down
11 changes: 7 additions & 4 deletions apps/el-gen/genesis_geth.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,8 @@
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 combined_allocs.items():
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)
Expand Down Expand Up @@ -165,6 +162,12 @@
# 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)

if 'electra_fork_epoch' in data:
out['config']['pragueTime'] = \
int(data['genesis_timestamp']) + \
Expand Down

0 comments on commit 38689ff

Please sign in to comment.