Skip to content

Commit

Permalink
Merge pull request #247 from kroma-network/fix/add-blob-header
Browse files Browse the repository at this point in the history
fix: add blob related things to rpc header
  • Loading branch information
0xHansLee authored Jan 31, 2024
2 parents 0dfa632 + 87b18ec commit 526fc48
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion op-service/sources/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,16 @@ type rpcHeader struct {
BaseFee *hexutil.Big `json:"baseFeePerGas"`

// WithdrawalsRoot was added by EIP-4895 and is ignored in legacy headers.
WithdrawalsRoot *common.Hash `json:"withdrawalsRoot"`
WithdrawalsRoot *common.Hash `json:"withdrawalsRoot,omitempty"`

// BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.
BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed,omitempty"`

// ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.
ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas,omitempty"`

// ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.
ParentBeaconRoot *common.Hash `json:"parentBeaconBlockRoot,omitempty"`

// untrusted info included by RPC, may have to be checked
Hash common.Hash `json:"hash"`
Expand Down Expand Up @@ -189,6 +198,10 @@ func (hdr *rpcHeader) createGethHeader() *types.Header {
Nonce: hdr.Nonce,
BaseFee: (*big.Int)(hdr.BaseFee),
WithdrawalsHash: hdr.WithdrawalsRoot,
// Cancun
BlobGasUsed: (*uint64)(hdr.BlobGasUsed),
ExcessBlobGas: (*uint64)(hdr.ExcessBlobGas),
ParentBeaconRoot: hdr.ParentBeaconRoot,
}
}

Expand Down

0 comments on commit 526fc48

Please sign in to comment.