Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor block contexts in batch #168

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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