Skip to content

Commit

Permalink
Merge pull request #44 from ethpandaops/adding-configurable-slot-time
Browse files Browse the repository at this point in the history
Adding configurible slot time
  • Loading branch information
parithosh authored Jun 29, 2023
2 parents 1945e0c + df0486c commit 6bbd7f4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions apps/el-gen/genesis_besu.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"londonBlock":0,
"preMergeForkBlock":0,
"terminalTotalDifficulty":0,
"shanghaiTime": int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['capella_fork_epoch']) * 32 * 12),
"shanghaiTime": int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['capella_fork_epoch']) * 32 * int(data['slot_duration_in_seconds'])),
},
"alloc": {
# Allocate 1 wei to all possible pre-compiles.
Expand Down Expand Up @@ -117,5 +117,5 @@
out["alloc"][key] = {"balance": weival}

out['config']['ethash'] = {}
out['config']['cancunTime'] = int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['deneb_fork_epoch']) * 32 * 12)
out['config']['cancunTime'] = int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['deneb_fork_epoch']) * 32 * int(data['slot_duration_in_seconds']))
print(json.dumps(out, indent=' '))
10 changes: 5 additions & 5 deletions apps/el-gen/genesis_chainspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
"eip3198Transition": "0x0",
"eip3529Transition": "0x0",
"eip3541Transition": "0x0",
"eip4895TransitionTimestamp": hex(int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['capella_fork_epoch']) * 32 * 12)),
"eip3855TransitionTimestamp": hex(int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['capella_fork_epoch']) * 32 * 12)),
"eip3651TransitionTimestamp": hex(int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['capella_fork_epoch']) * 32 * 12)),
"eip3860TransitionTimestamp": hex(int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['capella_fork_epoch']) * 32 * 12)),
"eip4895TransitionTimestamp": hex(int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['capella_fork_epoch']) * 32 * int(data['slot_duration_in_seconds']))),
"eip3855TransitionTimestamp": hex(int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['capella_fork_epoch']) * 32 * int(data['slot_duration_in_seconds']))),
"eip3651TransitionTimestamp": hex(int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['capella_fork_epoch']) * 32 * int(data['slot_duration_in_seconds']))),
"eip3860TransitionTimestamp": hex(int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['capella_fork_epoch']) * 32 * int(data['slot_duration_in_seconds']))),
"terminalTotalDifficulty":"0x0"
},
"genesis": {
Expand Down Expand Up @@ -153,5 +153,5 @@
weival = value.replace('ETH', '0' * 18)
out["accounts"][key] = {"balance": weival}

out['params']['eip4844TransitionTimestamp']= hex(int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['deneb_fork_epoch']) * 32 * 12))
out['params']['eip4844TransitionTimestamp']= hex(int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['deneb_fork_epoch']) * 32 * int(data['slot_duration_in_seconds'])))
print(json.dumps(out, indent=' '))
4 changes: 2 additions & 2 deletions apps/el-gen/genesis_geth.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"mergeForkBlock":0,
"terminalTotalDifficulty":0,
"terminalTotalDifficultyPassed": True,
"shanghaiTime": int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['capella_fork_epoch']) * 32 * 12),
"shanghaiTime": int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['capella_fork_epoch']) * 32 * int(data['slot_duration_in_seconds'])),
},
"alloc": {
# Allocate 1 wei to all possible pre-compiles.
Expand Down Expand Up @@ -115,5 +115,5 @@
weival = value.replace('ETH', '0' * 18)
out["alloc"][key] = {"balance": weival}

out['config']['cancunTime'] = int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['deneb_fork_epoch']) * 32 * 12)
out['config']['cancunTime'] = int(data['genesis_timestamp']) + int(data['genesis_delay']) + (int(data['deneb_fork_epoch']) * 32 * int(data['slot_duration_in_seconds']))
print(json.dumps(out, indent=' '))
4 changes: 2 additions & 2 deletions config-example/cl/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ DENEB_FORK_EPOCH: $DENEB_FORK_EPOCH
# Time parameters
# ---------------------------------------------------------------
# 12 seconds
SECONDS_PER_SLOT: 12
SECONDS_PER_SLOT: $SLOT_DURATION_IN_SECONDS
# 14 (estimate from Eth1 mainnet)
SECONDS_PER_ETH1_BLOCK: 12
SECONDS_PER_ETH1_BLOCK: $SLOT_DURATION_IN_SECONDS
# 2**0 (= 1) epochs ~1 hours
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 1
# 2**8 (= 256) epochs ~27 hours
Expand Down
1 change: 1 addition & 0 deletions config-example/el/genesis-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ el_premine:
el_premine_addrs: {}
genesis_timestamp: ${GENESIS_TIMESTAMP}
genesis_delay: ${GENESIS_DELAY}
slot_duration_in_seconds: ${SLOT_DURATION_IN_SECONDS}
capella_fork_epoch: ${CAPELLA_FORK_EPOCH}
deneb_fork_epoch: ${DENEB_FORK_EPOCH}
5 changes: 3 additions & 2 deletions config-example/values.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ export CHAIN_ID="1337"
export DEPOSIT_CONTRACT_ADDRESS="0x6f22fFbC56eFF051aECF839396DD1eD9aD6BBA9D"
export EL_AND_CL_MNEMONIC="sleep moment list remain like wall lake industry canvas wonder ecology elite duck salad naive syrup frame brass utility club odor country obey pudding"
export CL_EXEC_BLOCK="0"
export SLOT_DURATION_IN_SECONDS=12
export DEPOSIT_CONTRACT_BLOCK="0x0000000000000000000000000000000000000000000000000000000000000000"
export NUMBER_OF_VALIDATORS=320
export GENESIS_FORK_VERSION="0x10000000"
export ALTAIR_FORK_VERSION="0x20000000"
export BELLATRIX_FORK_VERSION="0x30000000"
export CAPELLA_FORK_VERSION="0x40000000"
export CAPELLA_FORK_EPOCH="10000"
export CAPELLA_FORK_EPOCH="100000"
export DENEB_FORK_VERSION="0x50000000"
export DENEB_FORK_EPOCH="18446744073709551615"
export DENEB_FORK_EPOCH="200000"
export WITHDRAWAL_TYPE="0x00"
export WITHDRAWAL_ADDRESS=0xf97e180c050e5Ab072211Ad2C213Eb5AEE4DF134
export BEACON_STATIC_ENR="enr:-Iq4QJk4WqRkjsX5c2CXtOra6HnxN-BMXnWhmhEQO9Bn9iABTJGdjUOurM7Btj1ouKaFkvTRoju5vz2GPmVON2dffQKGAX53x8JigmlkgnY0gmlwhLKAlv6Jc2VjcDI1NmsxoQK6S-Cii_KmfFdUJL2TANL3ksaKUnNXvTCv1tLwXs0QgIN1ZHCCIyk"
Expand Down

0 comments on commit 6bbd7f4

Please sign in to comment.