Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Commit 03eec94

Browse files
committed
ref impl: return both refL1 and nextRefL1 for driver
1 parent f88f952 commit 03eec94

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

opnode/l2/sync_start.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ var WrongChainErr = errors.New("wrong chain")
1515

1616
// FindSyncStart finds nextRefL1: the L1 block needed next for sync, to derive into a L2 block on top of refL2.
1717
// If the L1 reorgs then this will find the common history to build on top of and then follow the first step of the reorg.
18-
func FindSyncStart(ctx context.Context, reference SyncReference, genesis *Genesis) (nextRefL1 eth.BlockID, refL2 eth.BlockID, err error) {
19-
var refL1 eth.BlockID // the L1 block that was derived into refL2
18+
func FindSyncStart(ctx context.Context, reference SyncReference, genesis *Genesis) (refL1, nextRefL1, refL2 eth.BlockID, err error) {
2019
var parentL2 common.Hash // the parent of refL2
2120
// Start at L2 head
2221
refL1, refL2, parentL2, err = reference.RefByL2Num(ctx, nil, genesis)

opnode/l2/sync_start_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func (c *syncStartTestCase) Run(t *testing.T) {
139139
}
140140
expectedRefL2 := mockID(c.ExpectedRefL2, expectedRefL2Num)
141141

142-
nextRefL1, refL2, err := FindSyncStart(context.Background(), msr, genesis)
142+
_, nextRefL1, refL2, err := FindSyncStart(context.Background(), msr, genesis)
143143
if c.ExpectedErr != nil {
144144
assert.Error(t, err, "got next L1 %s (%d), onto L2: %s (%d)", nextRefL1.Hash[:1], nextRefL1.Number, refL2.Hash[:1], refL2.Number)
145145
assert.ErrorIs(t, err, c.ExpectedErr)

0 commit comments

Comments
 (0)