diff --git a/core/types/block.go b/core/types/block.go index fa87ab0f76..76a4b26e26 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -134,6 +134,8 @@ type headerMarshaling struct { Extra hexutil.Bytes BaseFee *hexutil.Big Hash common.Hash `json:"hash"` // adds call to Hash() in MarshalJSON + BlobGasUsed *hexutil.Uint64 + ExcessBlobGas *hexutil.Uint64 } // Hash returns the block hash of the header, which is simply the keccak256 hash of its diff --git a/core/types/gen_header_json.go b/core/types/gen_header_json.go index 0a7a5d9b96..07f9851752 100644 --- a/core/types/gen_header_json.go +++ b/core/types/gen_header_json.go @@ -32,11 +32,15 @@ func (h Header) MarshalJSON() ([]byte, error) { MixDigest common.Hash `json:"mixHash"` Nonce BlockNonce `json:"nonce"` BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"` + BlockSignature []byte `json:"-" rlp:"-"` + IsEuclidV2 bool `json:"-" rlp:"-"` WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"optional"` - Hash common.Hash `json:"hash"` BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed" rlp:"optional"` ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas" rlp:"optional"` ParentBeaconRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"` + RequestsHash *common.Hash `json:"requestsHash" rlp:"optional"` + Requested bool `json:"-" rlp:"-"` + Hash common.Hash `json:"hash"` } var enc Header enc.ParentHash = h.ParentHash @@ -55,11 +59,15 @@ func (h Header) MarshalJSON() ([]byte, error) { enc.MixDigest = h.MixDigest enc.Nonce = h.Nonce enc.BaseFee = (*hexutil.Big)(h.BaseFee) + enc.BlockSignature = h.BlockSignature + enc.IsEuclidV2 = h.IsEuclidV2 enc.WithdrawalsHash = h.WithdrawalsHash - enc.Hash = h.Hash() enc.BlobGasUsed = (*hexutil.Uint64)(h.BlobGasUsed) enc.ExcessBlobGas = (*hexutil.Uint64)(h.ExcessBlobGas) enc.ParentBeaconRoot = h.ParentBeaconRoot + enc.RequestsHash = h.RequestsHash + enc.Requested = h.Requested + enc.Hash = h.Hash() return json.Marshal(&enc) } @@ -82,10 +90,14 @@ func (h *Header) UnmarshalJSON(input []byte) error { MixDigest *common.Hash `json:"mixHash"` Nonce *BlockNonce `json:"nonce"` BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"` + BlockSignature []byte `json:"-" rlp:"-"` + IsEuclidV2 *bool `json:"-" rlp:"-"` WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"optional"` BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed" rlp:"optional"` ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas" rlp:"optional"` ParentBeaconRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"` + RequestsHash *common.Hash `json:"requestsHash" rlp:"optional"` + Requested *bool `json:"-" rlp:"-"` } var dec Header if err := json.Unmarshal(input, &dec); err != nil { @@ -151,6 +163,12 @@ func (h *Header) UnmarshalJSON(input []byte) error { if dec.BaseFee != nil { h.BaseFee = (*big.Int)(dec.BaseFee) } + if dec.BlockSignature != nil { + h.BlockSignature = dec.BlockSignature + } + if dec.IsEuclidV2 != nil { + h.IsEuclidV2 = *dec.IsEuclidV2 + } if dec.WithdrawalsHash != nil { h.WithdrawalsHash = dec.WithdrawalsHash } @@ -163,5 +181,11 @@ func (h *Header) UnmarshalJSON(input []byte) error { if dec.ParentBeaconRoot != nil { h.ParentBeaconRoot = dec.ParentBeaconRoot } + if dec.RequestsHash != nil { + h.RequestsHash = dec.RequestsHash + } + if dec.Requested != nil { + h.Requested = *dec.Requested + } return nil }