From bf9c862f8d844b7ecf1c5a2b7eabe27c5884810b Mon Sep 17 00:00:00 2001 From: protolambda Date: Thu, 14 Jul 2022 20:38:06 +0200 Subject: [PATCH 1/2] op-batcher: improve logging --- op-batcher/batch_submitter.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/op-batcher/batch_submitter.go b/op-batcher/batch_submitter.go index b0fe53d1e66b0..9d3d7086c93c8 100644 --- a/op-batcher/batch_submitter.go +++ b/op-batcher/batch_submitter.go @@ -233,7 +233,7 @@ 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) @@ -241,7 +241,12 @@ mainLoop: 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() @@ -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 } From 0c7767313cf695d172f8de9418d7fa834e352d1a Mon Sep 17 00:00:00 2001 From: protolambda Date: Thu, 14 Jul 2022 20:38:48 +0200 Subject: [PATCH 2/2] op-e2e: increase sequence window size, and update missing-batch test with comments to clarify behavior --- op-e2e/system_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/op-e2e/system_test.go b/op-e2e/system_test.go index 783c5421b8445..7c13317bb63a1 100644 --- a/op-e2e/system_test.go +++ b/op-e2e/system_test.go @@ -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), @@ -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 @@ -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