Skip to content

Commit a26e7b1

Browse files
authored
Merge pull request #168 from morph-l2/feature/block_context
feat: refactor block contexts in batch
2 parents caa200d + 3b9465a commit a26e7b1

File tree

3 files changed

+39
-21
lines changed

3 files changed

+39
-21
lines changed

core/types/gen_batch.go

+25-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/types/rollup_batch.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,23 @@ type RollupBatch struct {
1414
Hash common.Hash
1515
Version uint
1616
ParentBatchHeader []byte
17-
BlockContexts []byte
18-
SkippedL1MessageBitmap []byte
19-
CurrentSequencerSetBytes []byte
20-
PrevStateRoot common.Hash
21-
PostStateRoot common.Hash
22-
WithdrawRoot common.Hash
17+
BlockContexts []byte `rlp:"optional"` // legacy field
18+
SkippedL1MessageBitmap []byte `rlp:"optional"` // legacy field
19+
CurrentSequencerSetBytes []byte `rlp:"optional"`
20+
PrevStateRoot common.Hash `rlp:"optional"`
21+
PostStateRoot common.Hash `rlp:"optional"`
22+
WithdrawRoot common.Hash `rlp:"optional"`
23+
LastBlockNumber uint64 `rlp:"optional"`
24+
NumL1Messages uint16 `rlp:"optional"`
2325

2426
Sidecar *BlobTxSidecar `rlp:"-"`
2527
}
2628

2729
type rollupBatchMarshaling struct {
2830
Version hexutil.Uint
2931
Index hexutil.Uint64
32+
LastBlockNumber hexutil.Uint64
33+
NumL1Messages hexutil.Uint
3034
ParentBatchHeader hexutil.Bytes
3135
BlockContexts hexutil.Bytes
3236
SkippedL1MessageBitmap hexutil.Bytes

eth/api.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,12 @@ type RPCRollupBatch struct {
583583
Hash common.Hash `json:"hash"`
584584
ParentBatchHeader hexutil.Bytes `json:"parentBatchHeader"`
585585
BlockContexts hexutil.Bytes `json:"blockContexts"`
586-
SkippedL1MessageBitmap hexutil.Bytes `json:"skippedL1MessageBitmap"`
587586
CurrentSequencerSetBytes hexutil.Bytes `json:"currentSequencerSetBytes"`
588587
PrevStateRoot common.Hash `json:"prevStateRoot"`
589588
PostStateRoot common.Hash `json:"postStateRoot"`
590589
WithdrawRoot common.Hash `json:"withdrawRoot"`
590+
LastBlockNumber uint64 `json:"lastBlockNumber"`
591+
NumL1Messages uint16 `json:"numL1Messages"`
591592

592593
Sidecar types.BlobTxSidecar `json:"sidecar"`
593594
Signatures []RPCBatchSignature `json:"signatures"`
@@ -640,10 +641,11 @@ func (api *MorphAPI) GetRollupBatchByIndex(ctx context.Context, index uint64) (*
640641
ParentBatchHeader: rollupBatch.ParentBatchHeader,
641642
BlockContexts: rollupBatch.BlockContexts,
642643
CurrentSequencerSetBytes: rollupBatch.CurrentSequencerSetBytes,
643-
SkippedL1MessageBitmap: rollupBatch.SkippedL1MessageBitmap,
644644
PrevStateRoot: rollupBatch.PrevStateRoot,
645645
PostStateRoot: rollupBatch.PostStateRoot,
646646
WithdrawRoot: rollupBatch.WithdrawRoot,
647+
LastBlockNumber: rollupBatch.LastBlockNumber,
648+
NumL1Messages: rollupBatch.NumL1Messages,
647649
Sidecar: sidecar,
648650
Signatures: rpcSignatures,
649651
CollectedL1Fee: collectedL1Fee,

0 commit comments

Comments
 (0)