Skip to content

Commit

Permalink
Merge pull request #168 from morph-l2/feature/block_context
Browse files Browse the repository at this point in the history
feat: refactor block contexts in batch
  • Loading branch information
FletcherMan authored Feb 14, 2025
2 parents caa200d + 3b9465a commit a26e7b1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 21 deletions.
38 changes: 25 additions & 13 deletions core/types/gen_batch.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions core/types/rollup_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,23 @@ type RollupBatch struct {
Hash common.Hash
Version uint
ParentBatchHeader []byte
BlockContexts []byte
SkippedL1MessageBitmap []byte
CurrentSequencerSetBytes []byte
PrevStateRoot common.Hash
PostStateRoot common.Hash
WithdrawRoot common.Hash
BlockContexts []byte `rlp:"optional"` // legacy field
SkippedL1MessageBitmap []byte `rlp:"optional"` // legacy field
CurrentSequencerSetBytes []byte `rlp:"optional"`
PrevStateRoot common.Hash `rlp:"optional"`
PostStateRoot common.Hash `rlp:"optional"`
WithdrawRoot common.Hash `rlp:"optional"`
LastBlockNumber uint64 `rlp:"optional"`
NumL1Messages uint16 `rlp:"optional"`

Sidecar *BlobTxSidecar `rlp:"-"`
}

type rollupBatchMarshaling struct {
Version hexutil.Uint
Index hexutil.Uint64
LastBlockNumber hexutil.Uint64
NumL1Messages hexutil.Uint
ParentBatchHeader hexutil.Bytes
BlockContexts hexutil.Bytes
SkippedL1MessageBitmap hexutil.Bytes
Expand Down
6 changes: 4 additions & 2 deletions eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,11 +583,12 @@ type RPCRollupBatch struct {
Hash common.Hash `json:"hash"`
ParentBatchHeader hexutil.Bytes `json:"parentBatchHeader"`
BlockContexts hexutil.Bytes `json:"blockContexts"`
SkippedL1MessageBitmap hexutil.Bytes `json:"skippedL1MessageBitmap"`
CurrentSequencerSetBytes hexutil.Bytes `json:"currentSequencerSetBytes"`
PrevStateRoot common.Hash `json:"prevStateRoot"`
PostStateRoot common.Hash `json:"postStateRoot"`
WithdrawRoot common.Hash `json:"withdrawRoot"`
LastBlockNumber uint64 `json:"lastBlockNumber"`
NumL1Messages uint16 `json:"numL1Messages"`

Sidecar types.BlobTxSidecar `json:"sidecar"`
Signatures []RPCBatchSignature `json:"signatures"`
Expand Down Expand Up @@ -640,10 +641,11 @@ func (api *MorphAPI) GetRollupBatchByIndex(ctx context.Context, index uint64) (*
ParentBatchHeader: rollupBatch.ParentBatchHeader,
BlockContexts: rollupBatch.BlockContexts,
CurrentSequencerSetBytes: rollupBatch.CurrentSequencerSetBytes,
SkippedL1MessageBitmap: rollupBatch.SkippedL1MessageBitmap,
PrevStateRoot: rollupBatch.PrevStateRoot,
PostStateRoot: rollupBatch.PostStateRoot,
WithdrawRoot: rollupBatch.WithdrawRoot,
LastBlockNumber: rollupBatch.LastBlockNumber,
NumL1Messages: rollupBatch.NumL1Messages,
Sidecar: sidecar,
Signatures: rpcSignatures,
CollectedL1Fee: collectedL1Fee,
Expand Down

0 comments on commit a26e7b1

Please sign in to comment.