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

Commit f5d7631

Browse files
committed
ref impl: return both refL1 and nextRefL1 for driver
1 parent 55426b4 commit f5d7631

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
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)

specs/rollup-node.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ First inputs are derived from L1 source data, then outputs are derived with L2 s
5858
The L2 block has the same format as a L1 block: a block-header and a list of transactions.
5959

6060
The list of transaction carries:
61+
6162
- A *[L1 attributes transaction]* (always first item)
6263
- L2 transactions deposited by users in the L1 block (*[deposits]*, if any)
6364

@@ -86,7 +87,6 @@ These are then encoded as a [L1 attributes deposit] to update the [L1 Attributes
8687
[L1 attributes deposit]: deposits.md#l1-attributes-deposit
8788
[L1 Attributes Predeploy]: deposits.md#l1-attributes-predeploy
8889

89-
9090
#### Transaction deposits derivation
9191

9292
A [transaction deposit][transaction deposits] is an L2 transaction that has been submitted on L1, via a call to the
@@ -115,7 +115,6 @@ The object properties must be set as follows:
115115
[EIP-2718]: https://eips.ethereum.org/EIPS/eip-2718
116116
[EIP-2930]: https://eips.ethereum.org/EIPS/eip-2930
117117

118-
119118
### Output derivation
120119

121120
Building a full block requires the earlier [derived payload attributes](#payload-attributes-derivation)

0 commit comments

Comments
 (0)