Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle noTxPool correctly #15

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
24 changes: 24 additions & 0 deletions op-node/rollup/clsync/clsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type L1OriginSelector interface {
type CLSync struct {
log log.Logger
cfg *rollup.Config
spec *rollup.ChainSpec
metrics Metrics
ec Engine
n Network
Expand All @@ -52,6 +53,7 @@ func NewCLSync(log log.Logger, cfg *rollup.Config, metrics Metrics, ec Engine, n
return &CLSync{
log: log,
cfg: cfg,
spec: rollup.NewChainSpec(cfg),
metrics: metrics,
ec: ec,
n: n,
Expand Down Expand Up @@ -162,6 +164,28 @@ func (eq *CLSync) PublishAttributes(ctx context.Context, l2head eth.L2BlockRef)
return fmt.Errorf("error preparing payload attributes: %w", err)
}

// If our next L2 block timestamp is beyond the Sequencer drift threshold, then we must produce
// empty blocks (other than the L1 info deposit and any user deposits). We handle this by
// setting NoTxPool to true, which will cause the Sequencer to not include any transactions
// from the transaction pool.
attrs.NoTxPool = uint64(attrs.Timestamp) > l1Origin.Time+eq.spec.MaxSequencerDrift(l1Origin.Time)

// For the Ecotone activation block we shouldn't include any sequencer transactions.
if eq.cfg.IsEcotoneActivationBlock(uint64(attrs.Timestamp)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so do we not add transactions for the activation block of every fork?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it seems so. here is where this snippet comes from.

attrs.NoTxPool = uint64(attrs.Timestamp) > l1Origin.Time+d.spec.MaxSequencerDrift(l1Origin.Time)

attrs.NoTxPool = true
eq.log.Info("Sequencing Ecotone upgrade block")
}

// For the Fjord activation block we shouldn't include any sequencer transactions.
if eq.cfg.IsFjordActivationBlock(uint64(attrs.Timestamp)) {
attrs.NoTxPool = true
eq.log.Info("Sequencing Fjord upgrade block")
}

eq.log.Debug("prepared attributes for new block",
"num", l2head.Number+1, "time", uint64(attrs.Timestamp),
"origin", l1Origin, "origin_time", l1Origin.Time, "noTxPool", attrs.NoTxPool)

withParent := &derive.AttributesWithParent{
Attributes: attrs,
Parent: l2head,
Expand Down
1 change: 1 addition & 0 deletions op-node/rollup/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ func NewDriver(
sequencerActive: make(chan chan bool, 10),
sequencerNotifs: sequencerStateListener,
config: cfg,
spec: rollup.NewChainSpec(cfg),
syncCfg: syncCfg,
driverConfig: driverCfg,
driverCtx: driverCtx,
Expand Down
23 changes: 23 additions & 0 deletions op-node/rollup/driver/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ type Driver struct {

// Rollup config: rollup chain configuration
config *rollup.Config
spec *rollup.ChainSpec

sequencerConductor conductor.SequencerConductor

Expand Down Expand Up @@ -493,6 +494,28 @@ func (d *Driver) PublishL2Attributes(ctx context.Context, l2head eth.L2BlockRef)
return err
}

// If our next L2 block timestamp is beyond the Sequencer drift threshold, then we must produce
// empty blocks (other than the L1 info deposit and any user deposits). We handle this by
// setting NoTxPool to true, which will cause the Sequencer to not include any transactions
// from the transaction pool.
attrs.NoTxPool = uint64(attrs.Timestamp) > l1Origin.Time+d.spec.MaxSequencerDrift(l1Origin.Time)
jinmel marked this conversation as resolved.
Show resolved Hide resolved

// For the Ecotone activation block we shouldn't include any sequencer transactions.
if d.config.IsEcotoneActivationBlock(uint64(attrs.Timestamp)) {
attrs.NoTxPool = true
d.log.Info("Sequencing Ecotone upgrade block")
}

// For the Fjord activation block we shouldn't include any sequencer transactions.
if d.config.IsFjordActivationBlock(uint64(attrs.Timestamp)) {
attrs.NoTxPool = true
d.log.Info("Sequencing Fjord upgrade block")
}

d.log.Debug("prepared attributes for new block",
"num", l2head.Number+1, "time", uint64(attrs.Timestamp),
"origin", l1Origin, "origin_time", l1Origin.Time, "noTxPool", attrs.NoTxPool)

withParent := &derive.AttributesWithParent{
Attributes: attrs,
Parent: l2head,
Expand Down