Skip to content

Commit

Permalink
feat: add 7840 - custom blob max/target for el (#166)
Browse files Browse the repository at this point in the history
Co-authored-by: parithosh <[email protected]>
  • Loading branch information
barnabasbusa and parithosh authored Dec 18, 2024
1 parent 4f1d607 commit 4a8850c
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
19 changes: 18 additions & 1 deletion apps/el-gen/genesis_besu.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ def add_alloc_entry(addr, account):
else:
out['config']['cancunTime'] = 0

if 'blobSchedule' not in out['config']:
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'] = \
Expand All @@ -219,6 +226,11 @@ def add_alloc_entry(addr, account):
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'] = \
Expand All @@ -227,6 +239,11 @@ def add_alloc_entry(addr, account):
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=' '))
20 changes: 20 additions & 0 deletions apps/el-gen/genesis_chainspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,15 @@ def add_alloc_entry(addr, account):
out['params']['eip1153TransitionTimestamp'] = 0
out['params']['eip5656TransitionTimestamp'] = 0
out['params']['eip6780TransitionTimestamp'] = 0
# If blobSchedule is not in the config, add it
if 'blobSchedule' not in out['config']:
out['params']['blobSchedule'] = {}

# if blobSchedule is in the config, add the cancun 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:
Expand All @@ -283,6 +292,12 @@ def add_alloc_entry(addr, account):
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(
Expand All @@ -293,4 +308,9 @@ def add_alloc_entry(addr, account):
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=' '))
21 changes: 19 additions & 2 deletions apps/el-gen/genesis_geth.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def add_alloc_entry(addr, account):
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:
Expand All @@ -208,6 +208,13 @@ def add_alloc_entry(addr, account):
int(data['deneb_fork_epoch']) * ( 32 if data['preset_base']=='mainnet' else 8 ) * int(data['slot_duration_in_seconds'])
else:
out['config']['cancunTime'] = 0

if 'blobSchedule' not in out['config']:
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:
Expand All @@ -218,13 +225,23 @@ def add_alloc_entry(addr, account):
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:
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=' '))
6 changes: 6 additions & 0 deletions config-example/el/genesis-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ 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}

0 comments on commit 4a8850c

Please sign in to comment.