Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 34 additions & 25 deletions op-node/rollup/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ import (
"math/big"
"time"

altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"

altda "github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-service/eth"
)

var (
Expand Down Expand Up @@ -661,15 +660,9 @@ func (c *Config) Description(l2Chains map[string]string) string {
banner += fmt.Sprintf(" L1 block: %s %d\n", c.Genesis.L1.Hash, c.Genesis.L1.Number)
// Report the upgrade configuration
banner += "Post-Bedrock Network Upgrades (timestamp based):\n"
banner += fmt.Sprintf(" - Regolith: %s\n", fmtForkTimeOrUnset(c.RegolithTime))
banner += fmt.Sprintf(" - Canyon: %s\n", fmtForkTimeOrUnset(c.CanyonTime))
banner += fmt.Sprintf(" - Delta: %s\n", fmtForkTimeOrUnset(c.DeltaTime))
banner += fmt.Sprintf(" - Ecotone: %s\n", fmtForkTimeOrUnset(c.EcotoneTime))
banner += fmt.Sprintf(" - Fjord: %s\n", fmtForkTimeOrUnset(c.FjordTime))
banner += fmt.Sprintf(" - Granite: %s\n", fmtForkTimeOrUnset(c.GraniteTime))
banner += fmt.Sprintf(" - Holocene: %s\n", fmtForkTimeOrUnset(c.HoloceneTime))
banner += fmt.Sprintf(" - Isthmus: %s\n", fmtForkTimeOrUnset(c.IsthmusTime))
banner += fmt.Sprintf(" - Interop: %s\n", fmtForkTimeOrUnset(c.InteropTime))
c.forEachFork(func(name string, _ string, time *uint64) {
banner += fmt.Sprintf(" - %v: %s\n", name, fmtForkTimeOrUnset(time))
})
// Report the protocol version
banner += fmt.Sprintf("Node supports up to OP-Stack Protocol Version: %s\n", OPStackSupport)
if c.AltDAConfig != nil {
Expand All @@ -696,19 +689,19 @@ func (c *Config) LogDescription(log log.Logger, l2Chains map[string]string) {
}

ctx := []any{
"l2_chain_id", c.L2ChainID, "l2_network", networkL2, "l1_chain_id", c.L1ChainID,
"l1_network", networkL1, "l2_start_time", c.Genesis.L2Time, "l2_block_hash", c.Genesis.L2.Hash.String(),
"l2_block_number", c.Genesis.L2.Number, "l1_block_hash", c.Genesis.L1.Hash.String(),
"l1_block_number", c.Genesis.L1.Number, "regolith_time", fmtForkTimeOrUnset(c.RegolithTime),
"canyon_time", fmtForkTimeOrUnset(c.CanyonTime),
"delta_time", fmtForkTimeOrUnset(c.DeltaTime),
"ecotone_time", fmtForkTimeOrUnset(c.EcotoneTime),
"fjord_time", fmtForkTimeOrUnset(c.FjordTime),
"granite_time", fmtForkTimeOrUnset(c.GraniteTime),
"holocene_time", fmtForkTimeOrUnset(c.HoloceneTime),
"isthmus_time", fmtForkTimeOrUnset(c.IsthmusTime),
"interop_time", fmtForkTimeOrUnset(c.InteropTime),
}
"l2_chain_id", c.L2ChainID,
"l2_network", networkL2,
"l1_chain_id", c.L1ChainID,
"l1_network", networkL1,
"l2_start_time", c.Genesis.L2Time,
"l2_block_hash", c.Genesis.L2.Hash.String(),
"l2_block_number", c.Genesis.L2.Number,
"l1_block_hash", c.Genesis.L1.Hash.String(),
"l1_block_number", c.Genesis.L1.Number,
}
c.forEachFork(func(_ string, logName string, time *uint64) {
ctx = append(ctx, logName, fmtForkTimeOrUnset(time))
})
if c.AltDAConfig != nil {
ctx = append(ctx, "alt_da", *c.AltDAConfig)
}
Expand All @@ -719,6 +712,22 @@ func (c *Config) LogDescription(log log.Logger, l2Chains map[string]string) {
log.Info("Rollup Config", ctx...)
}

func (c *Config) forEachFork(callback func(name string, logName string, time *uint64)) {
callback("Regolith", "regolith_time", c.RegolithTime)
callback("Canyon", "canyon_time", c.CanyonTime)
callback("Delta", "delta_time", c.DeltaTime)
callback("Ecotone", "ecotone_time", c.EcotoneTime)
callback("Fjord", "fjord_time", c.FjordTime)
callback("Granite", "granite_time", c.GraniteTime)
callback("Holocene", "holocene_time", c.HoloceneTime)
if c.PectraBlobScheduleTime != nil {
// only report if config is set
callback("Pectra Blob Schedule", "pectra_blob_schedule_time", c.PectraBlobScheduleTime)
}
callback("Isthmus", "isthmus_time", c.IsthmusTime)
callback("Interop", "interop_time", c.InteropTime)
}

func (c *Config) ParseRollupConfig(in io.Reader) error {
dec := json.NewDecoder(in)
dec.DisallowUnknownFields()
Expand Down