Commit 7a3a4812 authored by Diederik Loerakker's avatar Diederik Loerakker Committed by GitHub

op-e2e: stabilize CI testing (#3046)

* op-batcher: improve logging

* op-e2e: increase sequence window size, and update missing-batch test with comments to clarify behavior
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 30d7d19f
...@@ -233,7 +233,7 @@ mainLoop: ...@@ -233,7 +233,7 @@ mainLoop:
syncStatus, err := l.cfg.RollupNode.SyncStatus(ctx) syncStatus, err := l.cfg.RollupNode.SyncStatus(ctx)
cancel() cancel()
if err != nil { if err != nil {
l.log.Error("issue fetching L2 head", "err", err) l.log.Warn("issue fetching L2 head", "err", err)
continue continue
} }
l.log.Info("Got new L2 sync status", "safe_head", syncStatus.SafeL2, "unsafe_head", syncStatus.UnsafeL2, "last_submitted", l.lastSubmittedBlock) 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: ...@@ -241,7 +241,12 @@ mainLoop:
l.log.Trace("No unsubmitted blocks from sequencer") l.log.Trace("No unsubmitted blocks from sequencer")
continue 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 { 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.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() l.lastSubmittedBlock = syncStatus.SafeL2.ID()
...@@ -324,7 +329,7 @@ mainLoop: ...@@ -324,7 +329,7 @@ mainLoop:
receipt, err := l.txMgr.Send(ctx, updateGasPrice, l.cfg.L1Client.SendTransaction) receipt, err := l.txMgr.Send(ctx, updateGasPrice, l.cfg.L1Client.SendTransaction)
cancel() cancel()
if err != nil { if err != nil {
l.log.Error("unable to publish tx", "err", err) l.log.Warn("unable to publish tx", "err", err)
continue mainLoop continue mainLoop
} }
......
...@@ -135,7 +135,7 @@ func defaultSystemConfig(t *testing.T) SystemConfig { ...@@ -135,7 +135,7 @@ func defaultSystemConfig(t *testing.T) SystemConfig {
RollupConfig: rollup.Config{ RollupConfig: rollup.Config{
BlockTime: 1, BlockTime: 1,
MaxSequencerDrift: 10, MaxSequencerDrift: 10,
SeqWindowSize: 2, SeqWindowSize: 30,
ChannelTimeout: 20, ChannelTimeout: 20,
L1ChainID: big.NewInt(900), L1ChainID: big.NewInt(900),
L2ChainID: big.NewInt(901), L2ChainID: big.NewInt(901),
...@@ -464,7 +464,14 @@ func TestMissingBatchE2E(t *testing.T) { ...@@ -464,7 +464,14 @@ func TestMissingBatchE2E(t *testing.T) {
if !verboseGethNodes { if !verboseGethNodes {
log.Root().SetHandler(log.DiscardHandler()) 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) 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 // Specifically set batch submitter balance to stop batches from being included
cfg.Premine[bssHDPath] = 0 cfg.Premine[bssHDPath] = 0
...@@ -502,7 +509,7 @@ func TestMissingBatchE2E(t *testing.T) { ...@@ -502,7 +509,7 @@ func TestMissingBatchE2E(t *testing.T) {
require.Nil(t, err, "Waiting for L2 tx on sequencer") 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 // 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") require.Nil(t, err, "Waiting for block on verifier")
// Assert that the transaction is not found on the verifier // Assert that the transaction is not found on the verifier
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment