Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
64f2a6f
feat: set block interval to engine api (#287)
joey0612 Apr 8, 2025
133da87
fix: set vlota time from genesis
joey0612 Apr 17, 2025
1fa142d
chore: update op-geth dependency for adapt new l1 hash cal (#292)
will-2012 Apr 22, 2025
9e00f11
feat: rollup config sets volta time (#293)
sysvm Apr 30, 2025
4fde65a
fix: fix genesis volta related helper function (#295)
will-2012 May 15, 2025
6af53ad
Run as none root develop (#303)
royceroyceroyce Aug 26, 2025
a40626c
fix: arm cross platform build tool (#309)
sysvm Sep 24, 2025
58b1763
feat: support Fourier hardfork (#305)
sysvm Oct 11, 2025
81a06b5
fix: solve fourier hardfork issues (#313)
joey0612 Oct 11, 2025
613c264
fix: add testnet fourier hardfork time (#315)
sysvm Oct 28, 2025
90feff6
fix: add fourier fork check (#316)
flywukong Oct 28, 2025
9b6d532
doc: add changelog for v0.5.4 (#317)
joey0612 Oct 28, 2025
690f783
Merge branch 'main' into develop
joey0612 Oct 28, 2025
893011d
feat: replace l1 head with l1 finalized block as sequencer and deriva…
joey0612 Nov 18, 2025
6298cba
fix: support compile opbnb in golang1.24.x and Windows OS (#320)
sysvm Nov 18, 2025
a0fe7a7
fix: l1 finalized block receive blocking (#322)
joey0612 Nov 19, 2025
91d7815
opt: add confs depth for get l1 finalized block (#323)
joey0612 Nov 20, 2025
28a0acd
fix: calculate millisecond timestamp for block (#321)
sysvm Nov 20, 2025
e6b9f3d
fix: safe stop during long time stop (#324)
joey0612 Nov 20, 2025
6412a90
fix: p2p node derivation occur empty root (#325)
joey0612 Nov 21, 2025
c70f594
fix: solve ref-metrics map concurrent use (#326)
sysvm Nov 21, 2025
1f48f5d
fix: add Mainnet Fourier hardfork timestamp (#328)
sysvm Nov 26, 2025
6305c46
doc: prepare for release v0.5.5 (#329)
joey0612 Nov 26, 2025
401d491
Merge branch 'main' into develop
joey0612 Nov 26, 2025
fc964fc
doc: rewrite changelog (#331)
joey0612 Nov 26, 2025
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
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog


## v0.5.5

This release confirm the time of Mainnet Fourier Hardfork, effectively reducing the block time from 500 milliseconds to an impressive 250 milliseconds.

- Mainnet: Jan-07-2026 03:00:00 AM +UTC

All mainnet and nodes must upgrade to this release before the hardfork time.
Also note that the `op-geth` should be upgraded to v0.5.9 accordingly, check [this](https://github.com/bnb-chain/op-geth/releases/tag/v0.5.9) for more details.

### What's Changed

* [\#319](https://github.com/bnb-chain/opbnb/pull/319) feat: replace l1 head with l1 finalized block as sequencer and derivation head
* [\#320](https://github.com/bnb-chain/opbnb/pull/320) fix: support compile opbnb in golang1.24.x and Windows OS
* [\#324](https://github.com/bnb-chain/opbnb/pull/324) fix: safe stop during long time stop
* [\#325](https://github.com/bnb-chain/opbnb/pull/325) fix: p2p node derivation occur empty root
* [\#326](https://github.com/bnb-chain/opbnb/pull/326) fix: solve ref-metrics map concurrent use
* [\#328](https://github.com/bnb-chain/opbnb/pull/328) fix: add Mainnet Fourier hardfork timestamp

### Docker Images

- ghcr.io/bnb-chain/op-node:v0.5.5
- ghcr.io/bnb-chain/op-batcher:v0.5.5
- ghcr.io/bnb-chain/op-proposer:v0.5.5

**Full Changelog**: https://github.com/bnb-chain/opbnb/compare/v0.5.4...v0.5.5


## v0.5.4

This release introduces the implementation of Fourier Hardfork, effectively reducing the block time from 500 milliseconds to an impressive 250 milliseconds.
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ require (
github.com/fatih/color v1.15.0 // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/ferranbt/fastssz v0.0.0-20210905181407-59cf6761a7d5 // indirect
github.com/fjl/memsize v0.0.2 // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
Expand Down Expand Up @@ -247,7 +246,7 @@ require (
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/status-im/keycard-go v0.2.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/supranational/blst v0.3.14 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
Expand Down Expand Up @@ -277,7 +276,7 @@ require (
rsc.io/tmplfunc v0.0.3 // indirect
)

replace github.com/ethereum/go-ethereum v1.13.15 => github.com/bnb-chain/op-geth v1.101315.2-0.0.20250418091555-2b39d61b7cbf
replace github.com/ethereum/go-ethereum v1.13.15 => github.com/bnb-chain/op-geth v1.101315.2-0.0.20251118081547-f1c2b5af43c5

replace github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v1.0.0

Expand Down
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ github.com/bnb-chain/fastssz v0.1.2 h1:vTcXw5SwCtRYnl/BEclujiml7GXiVOZ74tub4GHpv
github.com/bnb-chain/fastssz v0.1.2/go.mod h1:KcabV+OEw2QwgyY8Fc88ZG79CKYkFdu0kKWyfA3dI6o=
github.com/bnb-chain/greenfield-cometbft v1.0.0 h1:0r6hOJWD/+es0gxP/exKuN/krgXAr3LCn5/XlcgDWr8=
github.com/bnb-chain/greenfield-cometbft v1.0.0/go.mod h1:f35mk/r5ab6yvzlqEWZt68LfUje68sYgMpVlt2CUYMk=
github.com/bnb-chain/op-geth v1.101315.2-0.0.20250418091555-2b39d61b7cbf h1:7Ry/NtfhCFelZRVhw5cPwveX8uVFchalL+qhUcn5CMA=
github.com/bnb-chain/op-geth v1.101315.2-0.0.20250418091555-2b39d61b7cbf/go.mod h1:hyHrrcHkUe3lRwfJs+JGrbOHp+pRdheRk+ren4TPhF8=
github.com/bnb-chain/op-geth v1.101315.2-0.0.20251118081547-f1c2b5af43c5 h1:FVG+wugCxufwMTL7HdnaxUDWa7AGAK4TkQjNTFRL/RM=
github.com/bnb-chain/op-geth v1.101315.2-0.0.20251118081547-f1c2b5af43c5/go.mod h1:T1sVGwAA96KwS72B62aRTvlM/a+byeIAx9Akh18eWDQ=
github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
Expand Down Expand Up @@ -404,8 +404,6 @@ github.com/ferranbt/fastssz v0.0.0-20210120143747-11b9eff30ea9/go.mod h1:DyEu2iu
github.com/ferranbt/fastssz v0.0.0-20210905181407-59cf6761a7d5 h1:6dVcS0LktRSyEEgldFY4N9J17WjUoiJStttH+RZj0Wo=
github.com/ferranbt/fastssz v0.0.0-20210905181407-59cf6761a7d5/go.mod h1:S8yiDeAXy8f88W4Ul+0dBMPx49S05byYbmZD6Uv94K4=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag=
github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg=
Expand Down Expand Up @@ -1621,8 +1619,8 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/supranational/blst v0.3.5/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4=
github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/supranational/blst v0.3.14 h1:xNMoHRJOTwMn63ip6qoWJ2Ymgvj7E2b9jY2FAwY+qRo=
github.com/supranational/blst v0.3.14/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs=
Expand Down
2 changes: 1 addition & 1 deletion op-batcher/batcher/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func (l *BatchSubmitter) loop() {
case <-economicDATicker.C:
newEconomicDAType, err := l.getEconomicDAType(l.shutdownCtx)
if err != nil {
l.Log.Error("getEconomicDAType failed: %w", err)
l.Log.Error("Failed to get economic DA type", "err", err)
continue
}
if newEconomicDAType != economicDAType {
Expand Down
2 changes: 1 addition & 1 deletion op-e2e/actions/l2_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func NewL2Verifier(t Testing, log log.Logger, l1 derive.L1Fetcher, blobsSrc deri
finalizer = finality.NewFinalizer(log, cfg, l1, engine)
}

attributesHandler := attributes.NewAttributesHandler(log, cfg, engine, eng)
attributesHandler := attributes.NewAttributesHandler(log, cfg, engine, eng, false)

pipeline := derive.NewDerivationPipeline(log, cfg, l1, blobsSrc, plasmaSrc, eng, engine, metrics,
syncCfg, safeHeadListener, finalizer, attributesHandler)
Expand Down
1 change: 1 addition & 0 deletions op-node/chaincfg/chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ var OPBNBMainnet = rollup.Config{
EcotoneTime: u64Ptr(1718871600), // Jun-20-2024 08:20 AM +UTC
FjordTime: u64Ptr(1727157600), // Sep-24-2024 06:00 AM +UTC
VoltaTime: u64Ptr(1745204400), // Apr-21-2025 03:00 AM +UTC
FourierTime: u64Ptr(1767754800), // Jan-07-2026 03:00 AM +UTC
}

var OPBNBTestnet = rollup.Config{
Expand Down
18 changes: 17 additions & 1 deletion op-node/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ var (
Value: 15,
Category: L1RPCCategory,
}
L1FinalizedConfDepth = &cli.BoolFlag{
Name: "l1-finalized-confs",
Usage: "Use L1 finalized block as the latest head for opBNB sequencer and derivation. When enabled, verifier.l1-confs and sequencer.l1-confs will be ignored.",
EnvVars: prefixEnvVars("L1_FINALIZED_CONFS"),
Value: false,
Category: L1RPCCategory,
}
SequencerEnabledFlag = &cli.BoolFlag{
Name: "sequencer.enabled",
Usage: "Enable sequencing of new L2 blocks. A separate batch submitter has to be deployed to publish the data for verifiers.",
Expand Down Expand Up @@ -268,7 +275,7 @@ var (
Name: "l1.epoch-poll-interval",
Usage: "Poll interval for retrieving new L1 epoch updates such as safe and finalized block changes. Disabled if 0 or negative.",
EnvVars: prefixEnvVars("L1_EPOCH_POLL_INTERVAL"),
Value: time.Second * 3 * 15,
Value: time.Second * 1,
Category: L1RPCCategory,
}
RuntimeConfigReloadIntervalFlag = &cli.DurationFlag{
Expand Down Expand Up @@ -409,6 +416,13 @@ var (
Value: time.Second * 1,
Category: SequencerCategory,
}
IsP2PNodeFlag = &cli.BoolFlag{
Name: "l2.p2p-node",
Usage: "active the op-geth a P2P node.",
EnvVars: prefixEnvVars("L2_P2P_NODE"),
Value: false,
Category: OperationsCategory,
}
)

var requiredFlags = []cli.Flag{
Expand Down Expand Up @@ -439,6 +453,8 @@ var optionalFlags = []cli.Flag{
L1BlobRpcRateLimit,
L1BlobRpcMaxBatchSize,
VerifierL1Confs,
L1FinalizedConfDepth,
IsP2PNodeFlag,
SequencerEnabledFlag,
SequencerStoppedFlag,
SequencerMaxSafeLagFlag,
Expand Down
12 changes: 11 additions & 1 deletion op-node/rollup/attributes/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,19 @@ type AttributesHandler struct {
ec Engine
l2 L2

l2P2PNode bool

attributes *derive.AttributesWithParent
}

func NewAttributesHandler(log log.Logger, cfg *rollup.Config, ec Engine, l2 L2) *AttributesHandler {
func NewAttributesHandler(log log.Logger, cfg *rollup.Config, ec Engine, l2 L2, l2P2PNode bool) *AttributesHandler {
log.Info("new attributes handler", "l2_p2p_node", l2P2PNode)
return &AttributesHandler{
log: log,
cfg: cfg,
ec: ec,
l2: l2,
l2P2PNode: l2P2PNode,
attributes: nil,
}
}
Expand Down Expand Up @@ -93,6 +97,12 @@ func (eq *AttributesHandler) Proceed(ctx context.Context) error {
eq.attributes = nil
return nil
} else if eq.ec.PendingSafeL2Head().Number == eq.ec.UnsafeL2Head().Number {
if eq.l2P2PNode {
eq.log.Warn("pending_safe_l2_head_number is equal to unsafe_l2_head_number for p2p node waiting l2 block from gossip",
"p2p_node", eq.l2P2PNode, "pending_safe_l2_head_number", eq.ec.PendingSafeL2Head().Number,
"unsafe_l2_head_number", eq.ec.UnsafeL2Head().Number)
return nil
}
if err := eq.forceNextSafeAttributes(ctx, eq.attributes); err != nil {
return err
}
Expand Down
14 changes: 7 additions & 7 deletions op-node/rollup/attributes/attributes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func TestAttributesHandler(t *testing.T) {
logger := testlog.Logger(t, log.LevelInfo)
eng := &testutils.MockEngine{}
ec := derive.NewEngineController(eng, logger, metrics.NoopMetrics, cfg, &sync.Config{SyncMode: sync.CLSync}, false)
ah := NewAttributesHandler(logger, cfg, ec, eng)
ah := NewAttributesHandler(logger, cfg, ec, eng, false)
defer eng.AssertExpectations(t)

ec.SetPendingSafeL2Head(refA1Alt)
Expand All @@ -196,7 +196,7 @@ func TestAttributesHandler(t *testing.T) {
logger := testlog.Logger(t, log.LevelInfo)
eng := &testutils.MockEngine{}
ec := derive.NewEngineController(eng, logger, metrics.NoopMetrics, cfg, &sync.Config{SyncMode: sync.CLSync}, false)
ah := NewAttributesHandler(logger, cfg, ec, eng)
ah := NewAttributesHandler(logger, cfg, ec, eng, false)
defer eng.AssertExpectations(t)

ec.SetPendingSafeL2Head(refA0Alt)
Expand All @@ -211,7 +211,7 @@ func TestAttributesHandler(t *testing.T) {
logger := testlog.Logger(t, log.LevelInfo)
eng := &testutils.MockEngine{}
ec := derive.NewEngineController(eng, logger, metrics.NoopMetrics, cfg, &sync.Config{SyncMode: sync.CLSync}, false)
ah := NewAttributesHandler(logger, cfg, ec, eng)
ah := NewAttributesHandler(logger, cfg, ec, eng, false)

ec.SetUnsafeHead(refA1)
ec.SetSafeHead(refA0)
Expand Down Expand Up @@ -265,7 +265,7 @@ func TestAttributesHandler(t *testing.T) {
logger := testlog.Logger(t, log.LevelInfo)
eng := &testutils.MockEngine{}
ec := derive.NewEngineController(eng, logger, metrics.NoopMetrics, cfg, &sync.Config{SyncMode: sync.CLSync}, false)
ah := NewAttributesHandler(logger, cfg, ec, eng)
ah := NewAttributesHandler(logger, cfg, ec, eng, false)

ec.SetUnsafeHead(refA1)
ec.SetSafeHead(refA0)
Expand Down Expand Up @@ -324,7 +324,7 @@ func TestAttributesHandler(t *testing.T) {
logger := testlog.Logger(t, log.LevelInfo)
eng := &testutils.MockEngine{}
ec := derive.NewEngineController(eng, logger, metrics.NoopMetrics, cfg, &sync.Config{SyncMode: sync.CLSync}, false)
ah := NewAttributesHandler(logger, cfg, ec, eng)
ah := NewAttributesHandler(logger, cfg, ec, eng, false)

ec.SetUnsafeHead(refA0)
ec.SetSafeHead(refA0)
Expand Down Expand Up @@ -375,7 +375,7 @@ func TestAttributesHandler(t *testing.T) {
logger := testlog.Logger(t, log.LevelInfo)
eng := &testutils.MockEngine{}
ec := derive.NewEngineController(eng, logger, metrics.NoopMetrics, cfg, &sync.Config{SyncMode: sync.CLSync}, false)
ah := NewAttributesHandler(logger, cfg, ec, eng)
ah := NewAttributesHandler(logger, cfg, ec, eng, false)

ec.SetUnsafeHead(refA0)
ec.SetSafeHead(refA0)
Expand All @@ -399,7 +399,7 @@ func TestAttributesHandler(t *testing.T) {
logger := testlog.Logger(t, log.LevelInfo)
eng := &testutils.MockEngine{}
ec := derive.NewEngineController(eng, logger, metrics.NoopMetrics, cfg, &sync.Config{SyncMode: sync.CLSync}, false)
ah := NewAttributesHandler(logger, cfg, ec, eng)
ah := NewAttributesHandler(logger, cfg, ec, eng, false)
defer eng.AssertExpectations(t)

require.Equal(t, ah.Proceed(context.Background()), io.EOF, "no attributes to process")
Expand Down
12 changes: 6 additions & 6 deletions op-node/rollup/derive/batches.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,39 +216,39 @@ func checkSpanBatch(ctx context.Context, cfg *rollup.Config, log log.Logger, l1B
if batch.GetTimestamp() < nextMilliTimestamp {
if batch.GetTimestamp() > l2SafeHead.MillisecondTimestamp() {
// batch timestamp cannot be between safe head and next timestamp
log.Warn("batch has misaligned timestamp, block time is too short")
log.Warn("batch has misaligned timestamp, block time is too short", "batch_timestamp", batch.GetTimestamp(), "next_timestamp", nextMilliTimestamp, "l2_safe_head_timestamp", l2SafeHead.MillisecondTimestamp(), "parent_block", parentBlock)
return BatchDrop
}

milliSecondsDistance := l2SafeHead.MillisecondTimestamp() - batch.GetTimestamp()
if !cfg.IsFourier(l2SafeHead.MillisecondTimestamp() / 1000) {
if milliSecondsDistance%rollup.MillisecondBlockIntervalVolta != 0 {
log.Warn("batch has misaligned timestamp, not overlapped exactly")
log.Warn("batch has misaligned timestamp, not overlapped exactly", "batch_timestamp", batch.GetTimestamp(), "next_timestamp", nextMilliTimestamp, "l2_safe_head_timestamp", l2SafeHead.MillisecondTimestamp(), "parent_block", parentBlock)
return BatchDrop
}
} else {
// block interval has changed after fourier fork
if milliSecondsDistance%rollup.MillisecondBlockIntervalFourier != 0 {
log.Warn("batch has misaligned timestamp after fourier fork, not overlapped exactly")
log.Warn("batch has misaligned timestamp after fourier fork, not overlapped exactly", "batch_timestamp", batch.GetTimestamp(), "next_timestamp", nextMilliTimestamp, "l2_safe_head_timestamp", l2SafeHead.MillisecondTimestamp(), "parent_block", parentBlock)
return BatchDrop
}
}
currentNum, err := cfg.TargetBlockNumber(batch.GetTimestamp())
if err != nil {
log.Warn("failed to computer batch number", "batch_ms_time", batch.GetTimestamp(), "err", err)
log.Warn("failed to computer batch number", "batch_ms_time", batch.GetTimestamp(), "err", err, "parent_block", parentBlock)
// unable to validate the batch for now. retry later.
return BatchUndecided
}
parentNum = currentNum - 1
parentBlock, err = l2Fetcher.L2BlockRefByNumber(ctx, parentNum)
if err != nil {
log.Warn("failed to fetch L2 block", "number", parentNum, "err", err)
log.Warn("failed to fetch L2 block", "number", parentNum, "err", err, "parent_block", parentBlock)
// unable to validate the batch for now. retry later.
return BatchUndecided
}
}
if !batch.CheckParentHash(parentBlock.Hash) {
log.Warn("ignoring batch with mismatching parent hash", "parent_block", parentBlock.Hash)
log.Warn("ignoring batch with mismatching parent hash", "parent_block", parentBlock, "l2_safe_head", l2SafeHead)
return BatchDrop
}

Expand Down
39 changes: 39 additions & 0 deletions op-node/rollup/driver/conf_depth.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/log"

"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-service/eth"
Expand Down Expand Up @@ -43,3 +44,41 @@ func (c *confDepth) L1BlockRefByNumber(ctx context.Context, num uint64) (eth.L1B
}

var _ derive.L1Fetcher = (*confDepth)(nil)

// confDepth is an util that wraps the L1 input fetcher used in the pipeline,
// and hides the part of the L1 chain with insufficient confirmations.
//
// At 0 depth the l1 head is completely ignored.
type confDepthByL1Finalized struct {
// everything fetched by hash is trusted already, so we implement those by embedding the fetcher
derive.L1Fetcher
l1Finalized func() eth.L1BlockRef
depth uint64
}

func NewConfDepthByL1Finalized(depth uint64, l1Finalized func() eth.L1BlockRef, fetcher derive.L1Fetcher) *confDepthByL1Finalized {
return &confDepthByL1Finalized{L1Fetcher: fetcher, l1Finalized: l1Finalized, depth: depth}
}

// L1BlockRefByNumber is used for L1 traversal and for finding a safe common point between the L2 engine and L1 chain.
// Any block numbers that are within confirmation depth of the L1 head are mocked to be "not found",
// effectively hiding the uncertain part of the L1 chain.
func (c *confDepthByL1Finalized) L1BlockRefByNumber(ctx context.Context, num uint64) (eth.L1BlockRef, error) {
// TODO: performance optimization: buffer the l1Unsafe, invalidate any reorged previous buffer content,
// and instantly return the origin by number from the buffer if we can.

// Don't apply the conf depth if l1Head is empty (as it is during the startup case before the l1State is initialized).
l1Finalized := c.l1Finalized()
if l1Finalized == (eth.L1BlockRef{}) {
// if l1Finalized is empty, wait for it to be set, temporarily return not found
log.Warn("Conf depth is waiting for L1 finalized block to be set")
return eth.L1BlockRef{}, ethereum.NotFound
}

if num+c.depth <= l1Finalized.Number {
return c.L1Fetcher.L1BlockRefByNumber(ctx, num)
}
return eth.L1BlockRef{}, ethereum.NotFound
}

var _ derive.L1Fetcher = (*confDepthByL1Finalized)(nil)
9 changes: 9 additions & 0 deletions op-node/rollup/driver/config.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
package driver

type Config struct {
// L1FinalizedConfDepth enables using L1 finalized block as the latest head for opBNB sequencer and derivation.
// When enabled, VerifierConfDepth and SequencerConfDepth will be ignored.
L1FinalizedConfDepth bool `json:"l1_finalized_conf_depth"`

// VerifierConfDepth is the distance to keep from the L1 head when reading L1 data for L2 derivation.
// Ignored when L1FinalizedConfDepth is enabled.
VerifierConfDepth uint64 `json:"verifier_conf_depth"`

// SequencerConfDepth is the distance to keep from the L1 head as origin when sequencing new L2 blocks.
// If this distance is too large, the sequencer may:
// - not adopt a L1 origin within the allowed time (rollup.Config.MaxSequencerDrift)
// - not adopt a L1 origin that can be included on L1 within the allowed range (rollup.Config.SeqWindowSize)
// and thus fail to produce a block with anything more than deposits.
// Ignored when L1FinalizedConfDepth is enabled.
SequencerConfDepth uint64 `json:"sequencer_conf_depth"`

// SequencerEnabled is true when the driver should sequence new blocks.
Expand All @@ -25,4 +31,7 @@ type Config struct {
SequencerPriority bool `json:"sequencer_priority"`

SequencerCombinedEngine bool `json:"sequencer_combined_engine"`

// L2P2PNode is true when the op-geth is a P2P node.
L2P2PNode bool `json:"l2_p2p_node"`
}
Loading
Loading