Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 8 additions & 3 deletions op-batcher/batch_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,20 @@ mainLoop:
syncStatus, err := l.cfg.RollupNode.SyncStatus(ctx)
cancel()
if err != nil {
l.log.Error("issue fetching L2 head", "err", err)
l.log.Warn("issue fetching L2 head", "err", err)
continue
}
l.log.Info("Got new L2 sync status", "safe_head", syncStatus.SafeL2, "unsafe_head", syncStatus.UnsafeL2, "last_submitted", l.lastSubmittedBlock)
if syncStatus.SafeL2.Number >= syncStatus.UnsafeL2.Number {
l.log.Trace("No unsubmitted blocks from sequencer")
continue
}
// the lastSubmittedBlock may be zeroed, or just lag behind. If it's lagging behind, catch it up.
// If we just started, start at safe-head
if l.lastSubmittedBlock == (eth.BlockID{}) {
l.log.Info("Starting batch-submitter work at safe-head", "safe", syncStatus.SafeL2)
l.lastSubmittedBlock = syncStatus.SafeL2.ID()
}
// If it's lagging behind, catch it up.
if l.lastSubmittedBlock.Number < syncStatus.SafeL2.Number {
l.log.Warn("last submitted block lagged behind L2 safe head: batch submission will continue from the safe head now", "last", l.lastSubmittedBlock, "safe", syncStatus.SafeL2)
l.lastSubmittedBlock = syncStatus.SafeL2.ID()
Expand Down Expand Up @@ -324,7 +329,7 @@ mainLoop:
receipt, err := l.txMgr.Send(ctx, updateGasPrice, l.cfg.L1Client.SendTransaction)
cancel()
if err != nil {
l.log.Error("unable to publish tx", "err", err)
l.log.Warn("unable to publish tx", "err", err)
continue mainLoop
}

Expand Down
11 changes: 9 additions & 2 deletions op-e2e/system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func defaultSystemConfig(t *testing.T) SystemConfig {
RollupConfig: rollup.Config{
BlockTime: 1,
MaxSequencerDrift: 10,
SeqWindowSize: 2,
SeqWindowSize: 30,
ChannelTimeout: 20,
L1ChainID: big.NewInt(900),
L2ChainID: big.NewInt(901),
Expand Down Expand Up @@ -464,7 +464,14 @@ func TestMissingBatchE2E(t *testing.T) {
if !verboseGethNodes {
log.Root().SetHandler(log.DiscardHandler())
}
// Note this test zeroes the balance of the batch-submitter to make the batches unable to go into L1.
// The test logs may look scary, but this is expected:
// 'batcher unable to publish transaction role=batcher err="insufficient funds for gas * price + value"'

cfg := defaultSystemConfig(t)
// small sequence window size so the test does not take as long
cfg.RollupConfig.SeqWindowSize = 4

// Specifically set batch submitter balance to stop batches from being included
cfg.Premine[bssHDPath] = 0

Expand Down Expand Up @@ -502,7 +509,7 @@ func TestMissingBatchE2E(t *testing.T) {
require.Nil(t, err, "Waiting for L2 tx on sequencer")

// Wait until the block it was first included in shows up in the safe chain on the verifier
_, err = waitForBlock(receipt.BlockNumber, l2Verif, 4*time.Second)
_, err = waitForBlock(receipt.BlockNumber, l2Verif, time.Duration(cfg.RollupConfig.SeqWindowSize*cfg.L1BlockTime)*time.Second)
require.Nil(t, err, "Waiting for block on verifier")

// Assert that the transaction is not found on the verifier
Expand Down