mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 04:54:05 -05:00
update interop genesis for fulu (#15948)
This commit is contained in:
2
changelog/dbxe_fulu-interop.md
Normal file
2
changelog/dbxe_fulu-interop.md
Normal file
@@ -0,0 +1,2 @@
|
||||
### Ignored
|
||||
- Add osaka fork timestamp derivation to interop genesis
|
||||
@@ -264,6 +264,7 @@ func generateGenesis(ctx context.Context) (state.BeaconState, error) {
|
||||
gen.Config.ShanghaiTime = interop.GethShanghaiTime(genesis, params.BeaconConfig())
|
||||
gen.Config.CancunTime = interop.GethCancunTime(genesis, params.BeaconConfig())
|
||||
gen.Config.PragueTime = interop.GethPragueTime(genesis, params.BeaconConfig())
|
||||
gen.Config.OsakaTime = interop.GethOsakaTime(genesis, params.BeaconConfig())
|
||||
|
||||
fields := logrus.Fields{}
|
||||
if gen.Config.ShanghaiTime != nil {
|
||||
@@ -275,6 +276,9 @@ func generateGenesis(ctx context.Context) (state.BeaconState, error) {
|
||||
if gen.Config.PragueTime != nil {
|
||||
fields["prague"] = fmt.Sprintf("%d", *gen.Config.PragueTime)
|
||||
}
|
||||
if gen.Config.OsakaTime != nil {
|
||||
fields["osaka"] = fmt.Sprintf("%d", *gen.Config.OsakaTime)
|
||||
}
|
||||
log.WithFields(fields).Info("Setting fork geth times")
|
||||
if v > version.Altair {
|
||||
// set ttd to zero so EL goes post-merge immediately
|
||||
|
||||
@@ -113,6 +113,21 @@ func GethPragueTime(genesisTime time.Time, cfg *clparams.BeaconChainConfig) *uin
|
||||
return pragueTime
|
||||
}
|
||||
|
||||
// GethOsakaTime calculates the absolute time of the osaka (aka fulu) fork block
|
||||
// by adding the relative time of the capella the fork epoch to the given genesis timestamp.
|
||||
func GethOsakaTime(genesisTime time.Time, cfg *clparams.BeaconChainConfig) *uint64 {
|
||||
var osakaTime *uint64
|
||||
if cfg.FuluForkEpoch != math.MaxUint64 {
|
||||
startSlot, err := slots.EpochStart(cfg.FuluForkEpoch)
|
||||
if err == nil {
|
||||
startTime := slots.UnsafeStartTime(genesisTime, startSlot)
|
||||
newTime := uint64(startTime.Unix())
|
||||
osakaTime = &newTime
|
||||
}
|
||||
}
|
||||
return osakaTime
|
||||
}
|
||||
|
||||
// GethTestnetGenesis creates a genesis.json for eth1 clients with a set of defaults suitable for ephemeral testnets,
|
||||
// like in an e2e test. The parameters are minimal but the full value is returned unmarshaled so that it can be
|
||||
// customized as desired.
|
||||
@@ -130,6 +145,10 @@ func GethTestnetGenesis(genesis time.Time, cfg *clparams.BeaconChainConfig) *cor
|
||||
if cfg.ElectraForkEpoch == 0 {
|
||||
pragueTime = &genesisTime
|
||||
}
|
||||
osakaTime := GethOsakaTime(genesis, cfg)
|
||||
if cfg.FuluForkEpoch == 0 {
|
||||
osakaTime = &genesisTime
|
||||
}
|
||||
cc := ¶ms.ChainConfig{
|
||||
ChainID: big.NewInt(defaultTestChainId),
|
||||
HomesteadBlock: bigz,
|
||||
@@ -151,6 +170,7 @@ func GethTestnetGenesis(genesis time.Time, cfg *clparams.BeaconChainConfig) *cor
|
||||
ShanghaiTime: shanghaiTime,
|
||||
CancunTime: cancunTime,
|
||||
PragueTime: pragueTime,
|
||||
OsakaTime: osakaTime,
|
||||
DepositContractAddress: common.HexToAddress(cfg.DepositContractAddress),
|
||||
BlobScheduleConfig: ¶ms.BlobScheduleConfig{
|
||||
Cancun: ¶ms.BlobConfig{
|
||||
|
||||
Reference in New Issue
Block a user