diff --git a/op-node/rollup/sync/start.go b/op-node/rollup/sync/start.go index e9a53806080c..15a811bce57f 100644 --- a/op-node/rollup/sync/start.go +++ b/op-node/rollup/sync/start.go @@ -214,6 +214,8 @@ func FindL2Heads(ctx context.Context, cfg *rollup.Config, l1 L1Chain, l2 L2Chain } if ahead { + // discard previous candidate + highestL2WithCanonicalL1Origin = eth.L2BlockRef{} // keep the unsafe head if we can't tell if its L1 origin is canonical or not yet. } else if l1Block.Hash == n.L1Origin.Hash { // if L2 matches canonical chain, even if unsafe, diff --git a/op-node/rollup/sync/start_test.go b/op-node/rollup/sync/start_test.go index 0c202543c5de..e2cfee7712cc 100644 --- a/op-node/rollup/sync/start_test.go +++ b/op-node/rollup/sync/start_test.go @@ -26,7 +26,7 @@ func (c *syncStartTestCase) generateFakeL2(t *testing.T) (*testutils.FakeChainSo log := testlog.Logger(t, log.LevelError) chain := testutils.NewFakeChainSource([]string{c.L1, c.NewL1}, []string{c.L2}, int(c.GenesisL1Num), log) chain.SetL2Head(len(c.L2) - 1) - genesis := testutils.FakeGenesis(c.GenesisL1, c.GenesisL2, int(c.GenesisL1Num)) + genesis := testutils.FakeGenesis(c.GenesisL1, c.GenesisL2, c.GenesisL1Num) chain.ReorgL1() for i := 0; i < len(c.NewL1)-1; i++ { chain.AdvanceL1() diff --git a/op-service/testutils/fake_chain.go b/op-service/testutils/fake_chain.go index 8110e37779f1..eca4de1160b6 100644 --- a/op-service/testutils/fake_chain.go +++ b/op-service/testutils/fake_chain.go @@ -14,9 +14,9 @@ import ( "github.com/ethereum-optimism/optimism/op-service/eth" ) -func FakeGenesis(l1 rune, l2 rune, l1GenesisNumber int) rollup.Genesis { +func FakeGenesis(l1 rune, l2 rune, l1GenesisNumber uint64) rollup.Genesis { return rollup.Genesis{ - L1: fakeID(l1, uint64(l1GenesisNumber)), + L1: fakeID(l1, l1GenesisNumber), L2: fakeID(l2, 0), } }