@@ -34,93 +34,9 @@ import (
3434 "sync/atomic"
3535
3636 "github.com/ava-labs/libevm/common"
37- "github.com/ava-labs/libevm/common/hexutil"
38- ethtypes "github.com/ava-labs/libevm/core/types"
3937 "github.com/ava-labs/libevm/rlp"
4038)
4139
42- // A BlockNonce is a 64-bit hash which proves (combined with the
43- // mix-hash) that a sufficient amount of computation has been carried
44- // out on a block.
45- type BlockNonce = ethtypes.BlockNonce
46-
47- // EncodeNonce converts the given integer to a block nonce.
48- func EncodeNonce (i uint64 ) BlockNonce {
49- var n BlockNonce
50- binary .BigEndian .PutUint64 (n [:], i )
51- return n
52- }
53-
54- //go:generate go run github.com/fjl/gencodec -type Header_ -field-override headerMarshaling -out gen_header_json.go
55- //go:generate go run github.com/ava-labs/libevm/rlp/rlpgen -type Header_ -out gen_header_rlp.go
56-
57- // Header represents a block header in the Ethereum blockchain.
58- type Header = ethtypes.Header
59-
60- type Header_ struct {
61- ParentHash common.Hash `json:"parentHash" gencodec:"required"`
62- UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"`
63- Coinbase common.Address `json:"miner" gencodec:"required"`
64- Root common.Hash `json:"stateRoot" gencodec:"required"`
65- TxHash common.Hash `json:"transactionsRoot" gencodec:"required"`
66- ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"`
67- Bloom Bloom `json:"logsBloom" gencodec:"required"`
68- Difficulty * big.Int `json:"difficulty" gencodec:"required"`
69- Number * big.Int `json:"number" gencodec:"required"`
70- GasLimit uint64 `json:"gasLimit" gencodec:"required"`
71- GasUsed uint64 `json:"gasUsed" gencodec:"required"`
72- Time uint64 `json:"timestamp" gencodec:"required"`
73- Extra []byte `json:"extraData" gencodec:"required"`
74- MixDigest common.Hash `json:"mixHash"`
75- Nonce BlockNonce `json:"nonce"`
76- ExtDataHash common.Hash `json:"extDataHash" gencodec:"required"`
77-
78- // BaseFee was added by EIP-1559 and is ignored in legacy headers.
79- BaseFee * big.Int `json:"baseFeePerGas" rlp:"optional"`
80-
81- // ExtDataGasUsed was added by Apricot Phase 4 and is ignored in legacy
82- // headers.
83- //
84- // It is not a uint64 like GasLimit or GasUsed because it is not possible to
85- // correctly encode this field optionally with uint64.
86- ExtDataGasUsed * big.Int `json:"extDataGasUsed" rlp:"optional"`
87-
88- // BlockGasCost was added by Apricot Phase 4 and is ignored in legacy
89- // headers.
90- BlockGasCost * big.Int `json:"blockGasCost" rlp:"optional"`
91-
92- // BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.
93- BlobGasUsed * uint64 `json:"blobGasUsed" rlp:"optional"`
94-
95- // ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.
96- ExcessBlobGas * uint64 `json:"excessBlobGas" rlp:"optional"`
97-
98- // ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.
99- ParentBeaconRoot * common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"`
100- }
101-
102- // field type overrides for gencodec
103- type headerMarshaling struct {
104- Difficulty * hexutil.Big
105- Number * hexutil.Big
106- GasLimit hexutil.Uint64
107- GasUsed hexutil.Uint64
108- Time hexutil.Uint64
109- Extra hexutil.Bytes
110- BaseFee * hexutil.Big
111- ExtDataGasUsed * hexutil.Big
112- BlockGasCost * hexutil.Big
113- Hash common.Hash `json:"hash"` // adds call to Hash() in MarshalJSON
114- BlobGasUsed * hexutil.Uint64
115- ExcessBlobGas * hexutil.Uint64
116- }
117-
118- // Hash returns the block hash of the header, which is simply the keccak256 hash of its
119- // RLP encoding.
120- func (h * Header_ ) Hash () common.Hash {
121- return rlpHash (h )
122- }
123-
12440// Body is a simple (mutable, non-safe) data container for storing and moving
12541// a block's data contents (transactions and uncles) together.
12642type Body struct {
@@ -213,7 +129,7 @@ func NewBlock(
213129// CopyHeader creates a deep copy of a block header.
214130func CopyHeader (h * Header ) * Header {
215131 cpy := * h
216- extras .Header .Set (& cpy , & HeaderHooks {})
132+ extras .Header .Set (& cpy , & HeaderExtra {})
217133 cpyExtra := HeaderExtras (& cpy )
218134 * cpyExtra = * HeaderExtras (h )
219135
0 commit comments