From 6b0e1b202123440ed8e1777ea594f4c1ae855a04 Mon Sep 17 00:00:00 2001 From: Goran Rojovic Date: Fri, 24 Jan 2025 09:42:42 +0100 Subject: [PATCH] feat: cherry pick --- cmd/run.go | 7 +-- l1infotreesync/e2e_test.go | 4 +- .../migrations/l1infotreesync0003.sql | 5 +++ l1infotreesync/migrations/migrations.go | 7 +++ l1infotreesync/processor.go | 45 +++++++++++-------- reorgdetector/reorgdetector.go | 18 +++++++- reorgdetector/reorgdetector_db.go | 3 ++ reorgdetector/reorgdetector_sub.go | 1 + reorgdetector/reorgdetector_test.go | 12 ++--- sync/driver.go | 3 ++ sync/evmdownloader.go | 2 +- sync/evmdriver.go | 1 + sync/evmdriver_test.go | 14 +++--- test/helpers/e2e.go | 6 ++- 14 files changed, 88 insertions(+), 40 deletions(-) create mode 100644 l1infotreesync/migrations/l1infotreesync0003.sql diff --git a/cmd/run.go b/cmd/run.go index b53260d6..982c2af5 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -480,8 +480,9 @@ func waitSignal(cancelFuncs []context.CancelFunc) { func newReorgDetector( cfg *reorgdetector.Config, client *ethclient.Client, + network reorgdetector.Network, ) *reorgdetector.ReorgDetector { - rd, err := reorgdetector.New(client, *cfg) + rd, err := reorgdetector.New(client, *cfg, network) if err != nil { log.Fatal(err) } @@ -595,7 +596,7 @@ func runReorgDetectorL1IfNeeded( components) { return nil, nil } - rd := newReorgDetector(cfg, l1Client) + rd := newReorgDetector(cfg, l1Client, reorgdetector.L1) errChan := make(chan error) go func() { @@ -617,7 +618,7 @@ func runReorgDetectorL2IfNeeded( if !isNeeded([]string{cdkcommon.AGGORACLE, cdkcommon.BRIDGE, cdkcommon.AGGSENDER}, components) { return nil, nil } - rd := newReorgDetector(cfg, l2Client) + rd := newReorgDetector(cfg, l2Client, reorgdetector.L2) errChan := make(chan error) go func() { diff --git a/l1infotreesync/e2e_test.go b/l1infotreesync/e2e_test.go index ff5c40e8..ea3db7ca 100644 --- a/l1infotreesync/e2e_test.go +++ b/l1infotreesync/e2e_test.go @@ -154,7 +154,7 @@ func TestWithReorgs(t *testing.T) { client, auth, gerAddr, verifyAddr, gerSc, verifySC := newSimulatedClient(t) - rd, err := reorgdetector.New(client.Client(), reorgdetector.Config{DBPath: dbPathReorg, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 30)}) + rd, err := reorgdetector.New(client.Client(), reorgdetector.Config{DBPath: dbPathReorg, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 30)}, reorgdetector.L1) require.NoError(t, err) require.NoError(t, rd.Start(ctx)) @@ -267,7 +267,7 @@ func TestStressAndReorgs(t *testing.T) { client, auth, gerAddr, verifyAddr, gerSc, verifySC := newSimulatedClient(t) - rd, err := reorgdetector.New(client.Client(), reorgdetector.Config{DBPath: dbPathReorg, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}) + rd, err := reorgdetector.New(client.Client(), reorgdetector.Config{DBPath: dbPathReorg, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}, reorgdetector.L1) require.NoError(t, err) require.NoError(t, rd.Start(ctx)) diff --git a/l1infotreesync/migrations/l1infotreesync0003.sql b/l1infotreesync/migrations/l1infotreesync0003.sql new file mode 100644 index 00000000..0453081d --- /dev/null +++ b/l1infotreesync/migrations/l1infotreesync0003.sql @@ -0,0 +1,5 @@ +-- +migrate Down +ALTER TABLE block DROP COLUMN hash; + +-- +migrate Up +ALTER TABLE block ADD COLUMN hash VARCHAR; \ No newline at end of file diff --git a/l1infotreesync/migrations/migrations.go b/l1infotreesync/migrations/migrations.go index 47fac070..6de76014 100644 --- a/l1infotreesync/migrations/migrations.go +++ b/l1infotreesync/migrations/migrations.go @@ -19,6 +19,9 @@ var mig001 string //go:embed l1infotreesync0002.sql var mig002 string +//go:embed l1infotreesync0003.sql +var mig003 string + func RunMigrations(dbPath string) error { migrations := []types.Migration{ { @@ -29,6 +32,10 @@ func RunMigrations(dbPath string) error { ID: "l1infotreesync0002", SQL: mig002, }, + { + ID: "l1infotreesync0003", + SQL: mig003, + }, } for _, tm := range treeMigrations.Migrations { migrations = append(migrations, types.Migration{ diff --git a/l1infotreesync/processor.go b/l1infotreesync/processor.go index 75f73524..e0cc1959 100644 --- a/l1infotreesync/processor.go +++ b/l1infotreesync/processor.go @@ -32,6 +32,7 @@ type processor struct { mu mutex.RWMutex halted bool haltedReason string + log *log.Logger } // UpdateL1InfoTree representation of the UpdateL1InfoTree event @@ -151,6 +152,7 @@ func newProcessor(dbPath string) (*processor, error) { db: db, l1InfoTree: tree.NewAppendOnlyTree(db, migrations.L1InfoTreePrefix), rollupExitTree: tree.NewUpdatableTree(db, migrations.RollupExitTreePrefix), + log: log.WithFields("processor", "l1infotreesync"), }, nil } @@ -178,7 +180,7 @@ func (p *processor) GetLatestInfoUntilBlock(ctx context.Context, blockNum uint64 } defer func() { if err := tx.Rollback(); err != nil { - log.Warnf("error rolling back tx: %v", err) + p.log.Warnf("error rolling back tx: %v", err) } }() @@ -235,6 +237,8 @@ func (p *processor) getLastProcessedBlockWithTx(tx db.Querier) (uint64, error) { // Reorg triggers a purge and reset process on the processor to leaf it on a state // as if the last block processed was firstReorgedBlock-1 func (p *processor) Reorg(ctx context.Context, firstReorgedBlock uint64) error { + p.log.Infof("reorging to block %d", firstReorgedBlock) + tx, err := db.NewTx(ctx, p.db) if err != nil { return err @@ -243,7 +247,7 @@ func (p *processor) Reorg(ctx context.Context, firstReorgedBlock uint64) error { defer func() { if shouldRollback { if errRllbck := tx.Rollback(); errRllbck != nil { - log.Errorf("error while rolling back tx %v", errRllbck) + p.log.Errorf("error while rolling back tx %v", errRllbck) } } }() @@ -269,6 +273,8 @@ func (p *processor) Reorg(ctx context.Context, firstReorgedBlock uint64) error { return err } + p.log.Infof("reorged to block %d, %d rows affected", firstReorgedBlock, rowsAffected) + shouldRollback = false sync.UnhaltIfAffectedRows(&p.halted, &p.haltedReason, &p.mu, rowsAffected) @@ -279,25 +285,25 @@ func (p *processor) Reorg(ctx context.Context, firstReorgedBlock uint64) error { // and updates the last processed block (can be called without events for that purpose) func (p *processor) ProcessBlock(ctx context.Context, block sync.Block) error { if p.isHalted() { - log.Errorf("processor is halted due to: %s", p.haltedReason) + p.log.Errorf("processor is halted due to: %s", p.haltedReason) return sync.ErrInconsistentState } tx, err := db.NewTx(ctx, p.db) if err != nil { return err } - log.Debugf("init block processing for block %d", block.Num) + p.log.Debugf("init block processing for block %d", block.Num) shouldRollback := true defer func() { if shouldRollback { - log.Debugf("rolling back block processing for block %d", block.Num) + p.log.Debugf("rolling back block processing for block %d", block.Num) if errRllbck := tx.Rollback(); errRllbck != nil { - log.Errorf("error while rolling back tx %v", errRllbck) + p.log.Errorf("error while rolling back tx %v", errRllbck) } } }() - if _, err := tx.Exec(`INSERT INTO block (num) VALUES ($1)`, block.Num); err != nil { + if _, err := tx.Exec(`INSERT INTO block (num, hash) VALUES ($1, $2)`, block.Num, block.Hash.String()); err != nil { return fmt.Errorf("insert Block. err: %w", err) } @@ -343,10 +349,13 @@ func (p *processor) ProcessBlock(ctx context.Context, block sync.Block) error { if err != nil { return fmt.Errorf("AddLeaf(%s). err: %w", info.String(), err) } - log.Infof("inserted L1InfoTreeLeaf %s", info.String()) + p.log.Infof("inserted L1InfoTreeLeaf %s", info.String()) l1InfoLeavesAdded++ } if event.UpdateL1InfoTreeV2 != nil { + p.log.Infof("handle UpdateL1InfoTreeV2 event. Block: %d, block hash: %s. Event root: %s. Event leaf count: %d.", + block.Num, block.Hash, event.UpdateL1InfoTreeV2.CurrentL1InfoRoot.String(), event.UpdateL1InfoTreeV2.LeafCount) + root, err := p.l1InfoTree.GetLastRoot(tx) if err != nil { return fmt.Errorf("GetLastRoot(). err: %w", err) @@ -357,13 +366,13 @@ func (p *processor) ProcessBlock(ctx context.Context, block sync.Block) error { // compared to the contracts, and this will need manual intervention. if root.Hash != event.UpdateL1InfoTreeV2.CurrentL1InfoRoot || root.Index+1 != event.UpdateL1InfoTreeV2.LeafCount { errStr := fmt.Sprintf( - "failed to check UpdateL1InfoTreeV2. Root: %s vs event:%s. "+ - "Index: : %d vs event.LeafCount:%d. Happened on block %d", - root.Hash, common.Bytes2Hex(event.UpdateL1InfoTreeV2.CurrentL1InfoRoot[:]), + "failed to check UpdateL1InfoTreeV2. Root: %s vs event: %s. "+ + "Index: %d vs event.LeafCount: %d. Happened on block %d", + root.Hash, event.UpdateL1InfoTreeV2.CurrentL1InfoRoot.String(), root.Index, event.UpdateL1InfoTreeV2.LeafCount, block.Num, ) - log.Error(errStr) + p.log.Error(errStr) p.mu.Lock() p.haltedReason = errStr p.halted = true @@ -372,21 +381,21 @@ func (p *processor) ProcessBlock(ctx context.Context, block sync.Block) error { } } if event.VerifyBatches != nil { - log.Debugf("handle VerifyBatches event %s", event.VerifyBatches.String()) + p.log.Debugf("handle VerifyBatches event %s", event.VerifyBatches.String()) err = p.processVerifyBatches(tx, block.Num, event.VerifyBatches) if err != nil { err = fmt.Errorf("processVerifyBatches. err: %w", err) - log.Errorf("error processing VerifyBatches: %v", err) + p.log.Errorf("error processing VerifyBatches: %v", err) return err } } if event.InitL1InfoRootMap != nil { - log.Debugf("handle InitL1InfoRootMap event %s", event.InitL1InfoRootMap.String()) + p.log.Debugf("handle InitL1InfoRootMap event %s", event.InitL1InfoRootMap.String()) err = processEventInitL1InfoRootMap(tx, block.Num, event.InitL1InfoRootMap) if err != nil { err = fmt.Errorf("initL1InfoRootMap. Err: %w", err) - log.Errorf("error processing InitL1InfoRootMap: %v", err) + p.log.Errorf("error processing InitL1InfoRootMap: %v", err) return err } } @@ -396,9 +405,9 @@ func (p *processor) ProcessBlock(ctx context.Context, block sync.Block) error { return fmt.Errorf("err: %w", err) } shouldRollback = false - logFunc := log.Debugf + logFunc := p.log.Debugf if len(block.Events) > 0 { - logFunc = log.Infof + logFunc = p.log.Infof } logFunc("block %d processed with %d events", block.Num, len(block.Events)) return nil diff --git a/reorgdetector/reorgdetector.go b/reorgdetector/reorgdetector.go index b8876fc4..a2549591 100644 --- a/reorgdetector/reorgdetector.go +++ b/reorgdetector/reorgdetector.go @@ -18,6 +18,17 @@ import ( "golang.org/x/sync/errgroup" ) +type Network string + +const ( + L1 Network = "l1" + L2 Network = "l2" +) + +func (n Network) String() string { + return string(n) +} + type EthClient interface { SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) @@ -34,9 +45,11 @@ type ReorgDetector struct { subscriptionsLock sync.RWMutex subscriptions map[string]*Subscription + + log *log.Logger } -func New(client EthClient, cfg Config) (*ReorgDetector, error) { +func New(client EthClient, cfg Config, network Network) (*ReorgDetector, error) { err := migrations.RunMigrations(cfg.DBPath) if err != nil { return nil, err @@ -52,6 +65,7 @@ func New(client EthClient, cfg Config) (*ReorgDetector, error) { checkReorgInterval: cfg.GetCheckReorgsInterval(), trackedBlocks: make(map[string]*headersList), subscriptions: make(map[string]*Subscription), + log: log.WithFields("reorg-detector", network.String()), }, nil } @@ -137,6 +151,8 @@ func (rd *ReorgDetector) detectReorgInTrackedList(ctx context.Context) error { continue } + rd.log.Debugf("Checking reorgs in tracked blocks up to block %d", lastFinalisedBlock.Number.Uint64()) + errGroup.Go(func() error { headers := hdrs.getSorted() for _, hdr := range headers { diff --git a/reorgdetector/reorgdetector_db.go b/reorgdetector/reorgdetector_db.go index d21d4032..72bc40a7 100644 --- a/reorgdetector/reorgdetector_db.go +++ b/reorgdetector/reorgdetector_db.go @@ -59,6 +59,9 @@ func (rd *ReorgDetector) saveTrackedBlock(id string, b header) error { } else { hdrs.add(b) } + + rd.log.Debugf("Tracking block %d for subscriber %s", b.Num, id) + rd.trackedBlocksLock.Unlock() return meddler.Insert(rd.db, "tracked_block", &headerWithSubscriberID{ SubscriberID: id, diff --git a/reorgdetector/reorgdetector_sub.go b/reorgdetector/reorgdetector_sub.go index c5002a2b..7ff04aea 100644 --- a/reorgdetector/reorgdetector_sub.go +++ b/reorgdetector/reorgdetector_sub.go @@ -38,6 +38,7 @@ func (rd *ReorgDetector) notifySubscriber(id string, startingBlock header) { rd.subscriptionsLock.RUnlock() if ok { + rd.log.Infof("Reorg detected for subscriber %s at block %d", id, startingBlock.Num) sub.ReorgedBlock <- startingBlock.Num <-sub.ReorgProcessed } diff --git a/reorgdetector/reorgdetector_test.go b/reorgdetector/reorgdetector_test.go index 722dec72..788cf85a 100644 --- a/reorgdetector/reorgdetector_test.go +++ b/reorgdetector/reorgdetector_test.go @@ -28,7 +28,7 @@ func Test_ReorgDetector(t *testing.T) { // Create test DB dir testDir := path.Join(t.TempDir(), "reorgdetectorTest_ReorgDetector.sqlite") - reorgDetector, err := New(clientL1.Client(), Config{DBPath: testDir, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}) + reorgDetector, err := New(clientL1.Client(), Config{DBPath: testDir, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}, L1) require.NoError(t, err) err = reorgDetector.Start(ctx) @@ -103,7 +103,7 @@ func Test_ReorgDetector(t *testing.T) { func TestGetTrackedBlocks(t *testing.T) { clientL1 := simulated.NewBackend(nil, simulated.WithBlockGasLimit(10000000)) testDir := path.Join(t.TempDir(), "reorgdetector_TestGetTrackedBlocks.sqlite") - reorgDetector, err := New(clientL1.Client(), Config{DBPath: testDir, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}) + reorgDetector, err := New(clientL1.Client(), Config{DBPath: testDir, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}, L1) require.NoError(t, err) list, err := reorgDetector.getTrackedBlocks() require.NoError(t, err) @@ -157,7 +157,7 @@ func TestGetTrackedBlocks(t *testing.T) { func TestNotSubscribed(t *testing.T) { clientL1 := simulated.NewBackend(nil, simulated.WithBlockGasLimit(10000000)) testDir := path.Join(t.TempDir(), "reorgdetectorTestNotSubscribed.sqlite") - reorgDetector, err := New(clientL1.Client(), Config{DBPath: testDir, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}) + reorgDetector, err := New(clientL1.Client(), Config{DBPath: testDir, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}, L1) require.NoError(t, err) err = reorgDetector.AddBlockToTrack(context.Background(), "foo", 1, common.Hash{}) require.True(t, strings.Contains(err.Error(), "is not subscribed")) @@ -179,7 +179,7 @@ func TestDetectReorgs(t *testing.T) { client.On("HeaderByNumber", ctx, trackedBlock.Number).Return(trackedBlock, nil) testDir := path.Join(t.TempDir(), "reorgdetectorTestDetectReorgs.sqlite") - reorgDetector, err := New(client, Config{DBPath: testDir, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}) + reorgDetector, err := New(client, Config{DBPath: testDir, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}, L1) require.NoError(t, err) _, err = reorgDetector.Subscribe(syncerID) @@ -205,7 +205,7 @@ func TestDetectReorgs(t *testing.T) { client.On("HeaderByNumber", ctx, big.NewInt(int64(rpc.FinalizedBlockNumber))).Return(lastFinalizedBlock, nil) testDir := path.Join(t.TempDir(), "reorgdetectorTestDetectReorgs.sqlite") - reorgDetector, err := New(client, Config{DBPath: testDir, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}) + reorgDetector, err := New(client, Config{DBPath: testDir, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}, L1) require.NoError(t, err) _, err = reorgDetector.Subscribe(syncerID) @@ -230,7 +230,7 @@ func TestDetectReorgs(t *testing.T) { client.On("HeaderByNumber", ctx, trackedBlock.Number).Return(reorgedTrackedBlock, nil) testDir := path.Join(t.TempDir(), "reorgdetectorTestDetectReorgs.sqlite") - reorgDetector, err := New(client, Config{DBPath: testDir, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}) + reorgDetector, err := New(client, Config{DBPath: testDir, CheckReorgsInterval: cdktypes.NewDuration(time.Millisecond * 100)}, L1) require.NoError(t, err) subscription, err := reorgDetector.Subscribe(syncerID) diff --git a/sync/driver.go b/sync/driver.go index f85c04fb..7d3068fb 100644 --- a/sync/driver.go +++ b/sync/driver.go @@ -3,6 +3,8 @@ package sync import ( "context" "errors" + + "github.com/ethereum/go-ethereum/common" ) var ErrInconsistentState = errors.New("state is inconsistent, try again later once the state is consolidated") @@ -10,6 +12,7 @@ var ErrInconsistentState = errors.New("state is inconsistent, try again later on type Block struct { Num uint64 Events []interface{} + Hash common.Hash } type ProcessorInterface interface { diff --git a/sync/evmdownloader.go b/sync/evmdownloader.go index d4fbbdf6..1de2be73 100644 --- a/sync/evmdownloader.go +++ b/sync/evmdownloader.go @@ -107,7 +107,7 @@ func (d *EVMDownloader) Download(ctx context.Context, fromBlock uint64, download for { select { case <-ctx.Done(): - d.log.Debug("closing channel") + d.log.Info("closing evm downloader channel") close(downloadedCh) return default: diff --git a/sync/evmdriver.go b/sync/evmdriver.go index 7b7dba74..4ac4c9cb 100644 --- a/sync/evmdriver.go +++ b/sync/evmdriver.go @@ -146,6 +146,7 @@ func (d *EVMDriver) handleNewBlock(ctx context.Context, cancel context.CancelFun blockToProcess := Block{ Num: b.Num, Events: b.Events, + Hash: b.Hash, } err := d.processor.ProcessBlock(ctx, blockToProcess) if err != nil { diff --git a/sync/evmdriver_test.go b/sync/evmdriver_test.go index ef551d0f..9edbf0b2 100644 --- a/sync/evmdriver_test.go +++ b/sync/evmdriver_test.go @@ -91,11 +91,11 @@ func TestSync(t *testing.T) { Return(uint64(3), nil) rdm.On("AddBlockToTrack", ctx, reorgDetectorID, expectedBlock1.Num, expectedBlock1.Hash). Return(nil) - pm.On("ProcessBlock", ctx, Block{Num: expectedBlock1.Num, Events: expectedBlock1.Events}). + pm.On("ProcessBlock", ctx, Block{Num: expectedBlock1.Num, Events: expectedBlock1.Events, Hash: expectedBlock1.Hash}). Return(nil) rdm.On("AddBlockToTrack", ctx, reorgDetectorID, expectedBlock2.Num, expectedBlock2.Hash). Return(nil) - pm.On("ProcessBlock", ctx, Block{Num: expectedBlock2.Num, Events: expectedBlock2.Events}). + pm.On("ProcessBlock", ctx, Block{Num: expectedBlock2.Num, Events: expectedBlock2.Events, Hash: expectedBlock2.Hash}). Return(nil) go driver.Sync(ctx) time.Sleep(time.Millisecond * 200) // time to download expectedBlock1 @@ -142,7 +142,7 @@ func TestHandleNewBlock(t *testing.T) { rdm. On("AddBlockToTrack", ctx, reorgDetectorID, b1.Num, b1.Hash). Return(nil) - pm.On("ProcessBlock", ctx, Block{Num: b1.Num, Events: b1.Events}). + pm.On("ProcessBlock", ctx, Block{Num: b1.Num, Events: b1.Events, Hash: b1.Hash}). Return(nil) driver.handleNewBlock(ctx, nil, b1) @@ -159,7 +159,7 @@ func TestHandleNewBlock(t *testing.T) { rdm. On("AddBlockToTrack", ctx, reorgDetectorID, b2.Num, b2.Hash). Return(nil).Once() - pm.On("ProcessBlock", ctx, Block{Num: b2.Num, Events: b2.Events}). + pm.On("ProcessBlock", ctx, Block{Num: b2.Num, Events: b2.Events, Hash: b2.Hash}). Return(nil) driver.handleNewBlock(ctx, nil, b2) @@ -173,9 +173,9 @@ func TestHandleNewBlock(t *testing.T) { rdm. On("AddBlockToTrack", ctx, reorgDetectorID, b3.Num, b3.Hash). Return(nil) - pm.On("ProcessBlock", ctx, Block{Num: b3.Num, Events: b3.Events}). + pm.On("ProcessBlock", ctx, Block{Num: b3.Num, Events: b3.Events, Hash: b3.Hash}). Return(errors.New("foo")).Once() - pm.On("ProcessBlock", ctx, Block{Num: b3.Num, Events: b3.Events}). + pm.On("ProcessBlock", ctx, Block{Num: b3.Num, Events: b3.Events, Hash: b3.Hash}). Return(nil).Once() driver.handleNewBlock(ctx, nil, b3) @@ -189,7 +189,7 @@ func TestHandleNewBlock(t *testing.T) { rdm. On("AddBlockToTrack", ctx, reorgDetectorID, b4.Num, b4.Hash). Return(nil) - pm.On("ProcessBlock", ctx, Block{Num: b4.Num, Events: b4.Events}). + pm.On("ProcessBlock", ctx, Block{Num: b4.Num, Events: b4.Events, Hash: b4.Hash}). Return(ErrInconsistentState) cancelIsCalled := false cancel := func() { diff --git a/test/helpers/e2e.go b/test/helpers/e2e.go index d8c32546..106f4171 100644 --- a/test/helpers/e2e.go +++ b/test/helpers/e2e.go @@ -108,7 +108,7 @@ func L1Setup(t *testing.T) *L1Environment { rdL1, err := reorgdetector.New(l1Client.Client(), reorgdetector.Config{ DBPath: dbPathReorgDetectorL1, CheckReorgsInterval: cfgTypes.Duration{Duration: time.Millisecond * 100}, //nolint:mnd - }) + }, reorgdetector.L1) require.NoError(t, err) go rdL1.Start(ctx) //nolint:errcheck @@ -184,7 +184,9 @@ func L2Setup(t *testing.T) *L2Environment { dbPathReorgL2 := path.Join(t.TempDir(), "ReorgDetectorL2.sqlite") rdL2, err := reorgdetector.New(l2Client.Client(), reorgdetector.Config{ DBPath: dbPathReorgL2, - CheckReorgsInterval: cfgTypes.Duration{Duration: time.Millisecond * 100}}) //nolint:mnd + CheckReorgsInterval: cfgTypes.Duration{Duration: time.Millisecond * 100}}, + reorgdetector.L2, + ) //nolint:mnd require.NoError(t, err) go rdL2.Start(ctx) //nolint:errcheck