diff --git a/cmd/evm/internal/t8ntool/execution.go b/cmd/evm/internal/t8ntool/execution.go index 9cf60061557..829a3edce23 100644 --- a/cmd/evm/internal/t8ntool/execution.go +++ b/cmd/evm/internal/t8ntool/execution.go @@ -67,7 +67,7 @@ type stEnv struct { Withdrawals []*types.Withdrawal `json:"withdrawals,omitempty"` WithdrawalsHash *libcommon.Hash `json:"withdrawalsRoot,omitempty"` Requests types.Requests `json:"requests,omitempty"` - RequestsRoot *libcommon.Hash `json:"requestsRoot,omitempty"` + RequestsHash *libcommon.Hash `json:"requestsHash,omitempty"` } type stEnvMarshaling struct { diff --git a/cmd/evm/internal/t8ntool/gen_stenv.go b/cmd/evm/internal/t8ntool/gen_stenv.go index b4a60de2f13..89de04a8e08 100644 --- a/cmd/evm/internal/t8ntool/gen_stenv.go +++ b/cmd/evm/internal/t8ntool/gen_stenv.go @@ -35,7 +35,7 @@ func (s stEnv) MarshalJSON() ([]byte, error) { Withdrawals []*types.Withdrawal `json:"withdrawals,omitempty"` WithdrawalsHash *common.Hash `json:"withdrawalsRoot,omitempty"` Requests types.Requests `json:"requests,omitempty"` - RequestsRoot *common.Hash `json:"requestsRoot,omitempty"` + RequestsHash *common.Hash `json:"requestsHash,omitempty"` } var enc stEnv enc.Coinbase = common0.UnprefixedAddress(s.Coinbase) @@ -55,7 +55,7 @@ func (s stEnv) MarshalJSON() ([]byte, error) { enc.Withdrawals = s.Withdrawals enc.WithdrawalsHash = s.WithdrawalsHash enc.Requests = s.Requests - enc.RequestsRoot = s.RequestsRoot + enc.RequestsHash = s.RequestsHash return json.Marshal(&enc) } @@ -79,7 +79,7 @@ func (s *stEnv) UnmarshalJSON(input []byte) error { Withdrawals []*types.Withdrawal `json:"withdrawals,omitempty"` WithdrawalsHash *common.Hash `json:"withdrawalsRoot,omitempty"` Requests *types.Requests `json:"requests,omitempty"` - RequestsRoot *common.Hash `json:"requestsRoot,omitempty"` + RequestsHash *common.Hash `json:"requestsHash,omitempty"` } var dec stEnv if err := json.Unmarshal(input, &dec); err != nil { @@ -140,8 +140,8 @@ func (s *stEnv) UnmarshalJSON(input []byte) error { if dec.Requests != nil { s.Requests = *dec.Requests } - if dec.RequestsRoot != nil { - s.RequestsRoot = dec.RequestsRoot + if dec.RequestsHash != nil { + s.RequestsHash = dec.RequestsHash } return nil } diff --git a/cmd/evm/internal/t8ntool/transition.go b/cmd/evm/internal/t8ntool/transition.go index a20d3bd3a0c..2d4856a0f30 100644 --- a/cmd/evm/internal/t8ntool/transition.go +++ b/cmd/evm/internal/t8ntool/transition.go @@ -617,7 +617,7 @@ func NewHeader(env stEnv) *types.Header { header.UncleHash = env.UncleHash header.WithdrawalsHash = env.WithdrawalsHash - header.RequestsRoot = env.RequestsRoot + header.RequestsHash = env.RequestsHash return &header } diff --git a/consensus/clique/verifier.go b/consensus/clique/verifier.go index ebba1d5a401..fd2c300c3f1 100644 --- a/consensus/clique/verifier.go +++ b/consensus/clique/verifier.go @@ -97,7 +97,7 @@ func (c *Clique) verifyHeader(chain consensus.ChainHeaderReader, header *types.H return consensus.ErrUnexpectedWithdrawals } - if header.RequestsRoot != nil { + if header.RequestsHash != nil { return consensus.ErrUnexpectedRequests } diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index 4c75240522c..d18547d08f8 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -257,7 +257,7 @@ func VerifyHeaderBasics(chain consensus.ChainHeaderReader, header, parent *types return consensus.ErrUnexpectedWithdrawals } - if header.RequestsRoot != nil { + if header.RequestsHash != nil { return consensus.ErrUnexpectedRequests } diff --git a/consensus/merge/merge.go b/consensus/merge/merge.go index 2d0c7e12d6b..76134fbba06 100644 --- a/consensus/merge/merge.go +++ b/consensus/merge/merge.go @@ -202,10 +202,10 @@ func (s *Merge) Finalize(config *chain.Config, header *types.Header, state *stat rs = append(rs, withdrawalReqs...) consolidations := misc.DequeueConsolidationRequests7251(syscall) rs = append(rs, consolidations...) - if requestsInBlock != nil || header.RequestsRoot != nil { + if requestsInBlock != nil || header.RequestsHash != nil { rh := types.DeriveSha(rs) - if *header.RequestsRoot != rh { - return nil, nil, nil, fmt.Errorf("error: invalid requests root hash in header, expected: %v, got :%v", header.RequestsRoot, rh) + if *header.RequestsHash != rh { + return nil, nil, nil, fmt.Errorf("error: invalid requests root hash in header, expected: %v, got :%v", header.RequestsHash, rh) } if !reflect.DeepEqual(requestsInBlock.Deposits(), depositReqs.Deposits()) { return nil, nil, nil, errors.New("error: invalid EIP-6110 Deposit Requests in block") @@ -228,7 +228,7 @@ func (s *Merge) FinalizeAndAssemble(config *chain.Config, header *types.Header, if !misc.IsPoSHeader(header) { return s.eth1Engine.FinalizeAndAssemble(config, header, state, txs, uncles, receipts, withdrawals, requests, chain, syscall, call, logger) } - header.RequestsRoot = nil + header.RequestsHash = nil outTxs, outReceipts, rs, err := s.Finalize(config, header, state, txs, uncles, receipts, withdrawals, requests, chain, syscall, logger) if err != nil { return nil, nil, nil, err @@ -318,12 +318,12 @@ func (s *Merge) verifyHeader(chain consensus.ChainHeaderReader, header, parent * return fmt.Errorf("invalid excessBlobGas: have %d, want %d", *header.ExcessBlobGas, expectedExcessBlobGas) } - // Verify existence / non-existence of requestsRoot + // Verify existence / non-existence of requestsHash prague := chain.Config().IsPrague(header.Time) - if prague && header.RequestsRoot == nil { - return errors.New("missing requestsRoot") + if prague && header.RequestsHash == nil { + return errors.New("missing requestsHash") } - if !prague && header.RequestsRoot != nil { + if !prague && header.RequestsHash != nil { return consensus.ErrUnexpectedRequests } diff --git a/core/genesis_write.go b/core/genesis_write.go index b28acaace86..410844581ae 100644 --- a/core/genesis_write.go +++ b/core/genesis_write.go @@ -447,7 +447,7 @@ func GenesisToBlock(g *types.Genesis, dirs datadir.Dirs, logger log.Logger) (*ty ExcessBlobGas: g.ExcessBlobGas, AuRaStep: g.AuRaStep, AuRaSeal: g.AuRaSeal, - RequestsRoot: g.RequestsRoot, + RequestsHash: g.RequestsHash, } if g.GasLimit == 0 { head.GasLimit = params.GenesisGasLimit @@ -491,10 +491,10 @@ func GenesisToBlock(g *types.Genesis, dirs datadir.Dirs, logger log.Logger) (*ty requests = types.Requests{} // TODO @somnathb1 - if later iterations and/or tests don't need this from genesis.json, remove the following - if g.RequestsRoot != nil { - head.RequestsRoot = g.RequestsRoot + if g.RequestsHash != nil { + head.RequestsHash = g.RequestsHash } else { - head.RequestsRoot = &types.EmptyRootHash + head.RequestsHash = &types.EmptyRootHash } } diff --git a/core/types/block.go b/core/types/block.go index 16afa44fe33..e2e1753deb5 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -108,7 +108,7 @@ type Header struct { ParentBeaconBlockRoot *libcommon.Hash `json:"parentBeaconBlockRoot"` // EIP-4788 - RequestsRoot *libcommon.Hash `json:"requestsRoot"` // EIP-7685 + RequestsHash *libcommon.Hash `json:"requestsHash"` // EIP-7685 // The verkle proof is ignored in legacy headers Verkle bool @@ -179,7 +179,7 @@ func (h *Header) EncodingSize() int { encodingSize += 33 } - if h.RequestsRoot != nil { + if h.RequestsHash != nil { encodingSize += 33 } @@ -332,12 +332,12 @@ func (h *Header) EncodeRLP(w io.Writer) error { } } - if h.RequestsRoot != nil { + if h.RequestsHash != nil { b[0] = 128 + 32 if _, err := w.Write(b[:1]); err != nil { return err } - if _, err := w.Write(h.RequestsRoot.Bytes()); err != nil { + if _, err := w.Write(h.RequestsHash.Bytes()); err != nil { return err } } @@ -530,22 +530,22 @@ func (h *Header) DecodeRLP(s *rlp.Stream) error { h.ParentBeaconBlockRoot = new(libcommon.Hash) h.ParentBeaconBlockRoot.SetBytes(b) - // RequestsRoot + // RequestsHash if b, err = s.Bytes(); err != nil { if errors.Is(err, rlp.EOL) { - h.RequestsRoot = nil + h.RequestsHash = nil if err := s.ListEnd(); err != nil { - return fmt.Errorf("close header struct (no RequestsRoot): %w", err) + return fmt.Errorf("close header struct (no RequestsHash): %w", err) } return nil } - return fmt.Errorf("read RequestsRoot: %w", err) + return fmt.Errorf("read RequestsHash: %w", err) } if len(b) != 32 { - return fmt.Errorf("wrong size for RequestsRoot: %d", len(b)) + return fmt.Errorf("wrong size for RequestsHash: %d", len(b)) } - h.RequestsRoot = new(libcommon.Hash) - h.RequestsRoot.SetBytes(b) + h.RequestsHash = new(libcommon.Hash) + h.RequestsHash.SetBytes(b) if h.Verkle { if h.VerkleProof, err = s.Bytes(); err != nil { @@ -615,7 +615,7 @@ func (h *Header) Size() common.StorageSize { if h.ParentBeaconBlockRoot != nil { s += common.StorageSize(32) } - if h.RequestsRoot != nil { + if h.RequestsHash != nil { s += common.StorageSize(32) } return s @@ -1100,13 +1100,13 @@ func NewBlock(header *Header, txs []Transaction, uncles []*Header, receipts []*R b.header.ParentBeaconBlockRoot = header.ParentBeaconBlockRoot if requests == nil { - b.header.RequestsRoot = nil + b.header.RequestsHash = nil } else if len(requests) == 0 { - b.header.RequestsRoot = &EmptyRootHash + b.header.RequestsHash = &EmptyRootHash b.requests = make(Requests, len(requests)) } else { h := DeriveSha(requests) - b.header.RequestsRoot = &h + b.header.RequestsHash = &h b.requests = make(Requests, len(requests)) for i, r := range requests { rCopy := r.copy() @@ -1190,9 +1190,9 @@ func CopyHeader(h *Header) *Header { cpy.ParentBeaconBlockRoot = new(libcommon.Hash) cpy.ParentBeaconBlockRoot.SetBytes(h.ParentBeaconBlockRoot.Bytes()) } - if h.RequestsRoot != nil { - cpy.RequestsRoot = new(libcommon.Hash) - cpy.RequestsRoot.SetBytes(h.RequestsRoot.Bytes()) + if h.RequestsHash != nil { + cpy.RequestsHash = new(libcommon.Hash) + cpy.RequestsHash.SetBytes(h.RequestsHash.Bytes()) } cpy.mutable = h.mutable if hash := h.hash.Load(); hash != nil { @@ -1344,7 +1344,7 @@ func (b *Block) BaseFee() *big.Int { func (b *Block) WithdrawalsHash() *libcommon.Hash { return b.header.WithdrawalsHash } func (b *Block) Withdrawals() Withdrawals { return b.withdrawals } func (b *Block) ParentBeaconBlockRoot() *libcommon.Hash { return b.header.ParentBeaconBlockRoot } -func (b *Block) RequestsRoot() *libcommon.Hash { return b.header.RequestsRoot } +func (b *Block) RequestsHash() *libcommon.Hash { return b.header.RequestsHash } func (b *Block) Requests() Requests { return b.requests } // Header returns a deep-copy of the entire block header using CopyHeader() @@ -1448,15 +1448,15 @@ func (b *Block) HashCheck(fullCheck bool) error { return fmt.Errorf("block has invalid withdrawals hash: have %x, exp: %x", hash, b.WithdrawalsHash()) } - if b.RequestsRoot() == nil { + if b.RequestsHash() == nil { if b.Requests() != nil { - return errors.New("header missing RequestsRoot") + return errors.New("header missing RequestsHash") } return nil } - if hash := DeriveSha(b.Requests()); hash != *b.RequestsRoot() { - return fmt.Errorf("block has invalid requests root: have %x, exp: %x", hash, b.RequestsRoot()) + if hash := DeriveSha(b.Requests()); hash != *b.RequestsHash() { + return fmt.Errorf("block has invalid requests root: have %x, exp: %x", hash, b.RequestsHash()) } return nil diff --git a/core/types/gen_genesis.go b/core/types/gen_genesis.go index 53e7bc3c7fe..2f4646bbbc4 100644 --- a/core/types/gen_genesis.go +++ b/core/types/gen_genesis.go @@ -37,7 +37,7 @@ func (g Genesis) MarshalJSON() ([]byte, error) { BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed"` ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas"` ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot"` - RequestsRoot *common.Hash `json:"requestsRoot"` + RequestsHash *common.Hash `json:"requestsHash"` } var enc Genesis enc.Config = g.Config @@ -63,7 +63,7 @@ func (g Genesis) MarshalJSON() ([]byte, error) { enc.BlobGasUsed = (*math.HexOrDecimal64)(g.BlobGasUsed) enc.ExcessBlobGas = (*math.HexOrDecimal64)(g.ExcessBlobGas) enc.ParentBeaconBlockRoot = g.ParentBeaconBlockRoot - enc.RequestsRoot = g.RequestsRoot + enc.RequestsHash = g.RequestsHash return json.Marshal(&enc) } @@ -88,7 +88,7 @@ func (g *Genesis) UnmarshalJSON(input []byte) error { BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed"` ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas"` ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot"` - RequestsRoot *common.Hash `json:"requestsRoot"` + RequestsHash *common.Hash `json:"requestsHash"` } var dec Genesis if err := json.Unmarshal(input, &dec); err != nil { @@ -154,8 +154,8 @@ func (g *Genesis) UnmarshalJSON(input []byte) error { if dec.ParentBeaconBlockRoot != nil { g.ParentBeaconBlockRoot = dec.ParentBeaconBlockRoot } - if dec.RequestsRoot != nil { - g.RequestsRoot = dec.RequestsRoot + if dec.RequestsHash != nil { + g.RequestsHash = dec.RequestsHash } return nil } diff --git a/core/types/gen_header_json.go b/core/types/gen_header_json.go index 1f68a0821ea..382b8aa85c9 100644 --- a/core/types/gen_header_json.go +++ b/core/types/gen_header_json.go @@ -41,7 +41,7 @@ func (h Header) MarshalJSON() ([]byte, error) { BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed"` ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas"` ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot"` - RequestsRoot *common.Hash `json:"requestsRoot"` + RequestsHash *common.Hash `json:"requestsHash"` Verkle bool VerkleProof []byte VerkleKeyVals []verkle.KeyValuePair @@ -70,7 +70,7 @@ func (h Header) MarshalJSON() ([]byte, error) { enc.BlobGasUsed = (*hexutil.Uint64)(h.BlobGasUsed) enc.ExcessBlobGas = (*hexutil.Uint64)(h.ExcessBlobGas) enc.ParentBeaconBlockRoot = h.ParentBeaconBlockRoot - enc.RequestsRoot = h.RequestsRoot + enc.RequestsHash = h.RequestsHash enc.Verkle = h.Verkle enc.VerkleProof = h.VerkleProof enc.VerkleKeyVals = h.VerkleKeyVals @@ -103,7 +103,7 @@ func (h *Header) UnmarshalJSON(input []byte) error { BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed"` ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas"` ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot"` - RequestsRoot *common.Hash `json:"requestsRoot"` + RequestsHash *common.Hash `json:"requestsHash"` Verkle *bool VerkleProof []byte VerkleKeyVals []verkle.KeyValuePair @@ -190,8 +190,8 @@ func (h *Header) UnmarshalJSON(input []byte) error { if dec.ParentBeaconBlockRoot != nil { h.ParentBeaconBlockRoot = dec.ParentBeaconBlockRoot } - if dec.RequestsRoot != nil { - h.RequestsRoot = dec.RequestsRoot + if dec.RequestsHash != nil { + h.RequestsHash = dec.RequestsHash } if dec.Verkle != nil { h.Verkle = *dec.Verkle diff --git a/core/types/genesis.go b/core/types/genesis.go index 59895d2090e..4f4bc03f8de 100644 --- a/core/types/genesis.go +++ b/core/types/genesis.go @@ -68,7 +68,7 @@ type Genesis struct { BlobGasUsed *uint64 `json:"blobGasUsed"` // EIP-4844 ExcessBlobGas *uint64 `json:"excessBlobGas"` // EIP-4844 ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot"` // EIP-4788 - RequestsRoot *common.Hash `json:"requestsRoot"` // EIP-7685 + RequestsHash *common.Hash `json:"requestsHash"` // EIP-7685 } // GenesisAlloc specifies the initial state that is part of the genesis block. diff --git a/erigon-lib/go.mod b/erigon-lib/go.mod index 84d147e24c2..b656c8533ff 100644 --- a/erigon-lib/go.mod +++ b/erigon-lib/go.mod @@ -4,7 +4,7 @@ go 1.22.0 require ( github.com/erigontech/erigon-snapshot v1.3.1-0.20240814160410-2ce37904b978 - github.com/erigontech/interfaces v0.0.0-20241011102608-29c1d07f457d + github.com/erigontech/interfaces v0.0.0-20241018125732-814767d1b926 github.com/erigontech/mdbx-go v0.38.4 github.com/erigontech/secp256k1 v1.1.0 github.com/rs/dnscache v0.0.0-20211102005908-e0241e321417 diff --git a/erigon-lib/go.sum b/erigon-lib/go.sum index a08eb055a3a..620778bb705 100644 --- a/erigon-lib/go.sum +++ b/erigon-lib/go.sum @@ -148,8 +148,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/erigontech/erigon-snapshot v1.3.1-0.20240814160410-2ce37904b978 h1:7ECOf7Us3+/706WGZXIX84qQc6zmxQby8fGbFLiqFlU= github.com/erigontech/erigon-snapshot v1.3.1-0.20240814160410-2ce37904b978/go.mod h1:ooHlCl+eEYzebiPu+FP6Q6SpPUeMADn8Jxabv3IKb9M= -github.com/erigontech/interfaces v0.0.0-20241011102608-29c1d07f457d h1:T0xEfGinQBrv1aV2WdIQCBoCPOn2CKKH5hi35o/V0m8= -github.com/erigontech/interfaces v0.0.0-20241011102608-29c1d07f457d/go.mod h1:N7OUkhkcagp9+7yb4ycHsG2VWCOmuJ1ONBecJshxtLE= +github.com/erigontech/interfaces v0.0.0-20241018125732-814767d1b926 h1:2H5vOO4LT+P0oB82f4AEK7AK+1QJYUL9VNz2KEvqknI= +github.com/erigontech/interfaces v0.0.0-20241018125732-814767d1b926/go.mod h1:N7OUkhkcagp9+7yb4ycHsG2VWCOmuJ1ONBecJshxtLE= github.com/erigontech/mdbx-go v0.38.4 h1:S9T7mTe9KPcFe4dOoOtVdI6gPzht9y7wMnYfUBgrQLo= github.com/erigontech/mdbx-go v0.38.4/go.mod h1:IcOLQDPw3VM/asP6T5JVPPN4FHHgJtY16XfYjzWKVNI= github.com/erigontech/secp256k1 v1.1.0 h1:mO3YJMUSoASE15Ya//SoHiisptUhdXExuMUN1M0X9qY= diff --git a/erigon-lib/gointerfaces/executionproto/execution.pb.go b/erigon-lib/gointerfaces/executionproto/execution.pb.go index 26d30fa3857..0e40fdaa03a 100644 --- a/erigon-lib/gointerfaces/executionproto/execution.pb.go +++ b/erigon-lib/gointerfaces/executionproto/execution.pb.go @@ -281,7 +281,7 @@ type Header struct { BlobGasUsed *uint64 `protobuf:"varint,19,opt,name=blob_gas_used,json=blobGasUsed,proto3,oneof" json:"blob_gas_used,omitempty"` // added in Dencun (EIP-4844) ExcessBlobGas *uint64 `protobuf:"varint,20,opt,name=excess_blob_gas,json=excessBlobGas,proto3,oneof" json:"excess_blob_gas,omitempty"` // added in Dencun (EIP-4844) ParentBeaconBlockRoot *typesproto.H256 `protobuf:"bytes,21,opt,name=parent_beacon_block_root,json=parentBeaconBlockRoot,proto3,oneof" json:"parent_beacon_block_root,omitempty"` // added in Dencun (EIP-4788) - RequestsRoot *typesproto.H256 `protobuf:"bytes,22,opt,name=requests_root,json=requestsRoot,proto3,oneof" json:"requests_root,omitempty"` // added in Pectra (EIP-7685) + RequestsHash *typesproto.H256 `protobuf:"bytes,22,opt,name=requests_hash,json=requestsHash,proto3,oneof" json:"requests_hash,omitempty"` // added in Pectra (EIP-7685) // AuRa AuraStep *uint64 `protobuf:"varint,23,opt,name=aura_step,json=auraStep,proto3,oneof" json:"aura_step,omitempty"` AuraSeal []byte `protobuf:"bytes,24,opt,name=aura_seal,json=auraSeal,proto3,oneof" json:"aura_seal,omitempty"` @@ -466,9 +466,9 @@ func (x *Header) GetParentBeaconBlockRoot() *typesproto.H256 { return nil } -func (x *Header) GetRequestsRoot() *typesproto.H256 { +func (x *Header) GetRequestsHash() *typesproto.H256 { if x != nil { - return x.RequestsRoot + return x.RequestsHash } return nil } @@ -1793,9 +1793,9 @@ var file_execution_execution_proto_rawDesc = []byte{ 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x48, 0x04, 0x52, 0x15, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x6f, 0x6f, 0x74, 0x88, 0x01, 0x01, 0x12, 0x35, 0x0a, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x73, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, + 0x73, 0x74, 0x73, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x48, 0x05, 0x52, 0x0c, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x52, 0x6f, 0x6f, 0x74, 0x88, 0x01, 0x01, 0x12, 0x20, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x48, 0x61, 0x73, 0x68, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x09, 0x61, 0x75, 0x72, 0x61, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x18, 0x17, 0x20, 0x01, 0x28, 0x04, 0x48, 0x06, 0x52, 0x08, 0x61, 0x75, 0x72, 0x61, 0x53, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x09, 0x61, 0x75, 0x72, 0x61, 0x5f, 0x73, 0x65, 0x61, 0x6c, 0x18, 0x18, 0x20, @@ -1807,7 +1807,7 @@ var file_execution_execution_proto_rawDesc = []byte{ 0x10, 0x5f, 0x65, 0x78, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x62, 0x6c, 0x6f, 0x62, 0x5f, 0x67, 0x61, 0x73, 0x42, 0x1b, 0x0a, 0x19, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x42, 0x10, - 0x0a, 0x0e, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x5f, 0x72, 0x6f, 0x6f, 0x74, + 0x0a, 0x0e, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x61, 0x75, 0x72, 0x61, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x61, 0x75, 0x72, 0x61, 0x5f, 0x73, 0x65, 0x61, 0x6c, 0x22, 0xfa, 0x01, 0x0a, 0x09, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2a, 0x0a, 0x0a, 0x62, 0x6c, @@ -2123,7 +2123,7 @@ var file_execution_execution_proto_depIdxs = []int32{ 27, // 14: execution.Header.base_fee_per_gas:type_name -> types.H256 27, // 15: execution.Header.withdrawal_hash:type_name -> types.H256 27, // 16: execution.Header.parent_beacon_block_root:type_name -> types.H256 - 27, // 17: execution.Header.requests_root:type_name -> types.H256 + 27, // 17: execution.Header.requests_hash:type_name -> types.H256 27, // 18: execution.BlockBody.block_hash:type_name -> types.H256 4, // 19: execution.BlockBody.uncles:type_name -> execution.Header 30, // 20: execution.BlockBody.withdrawals:type_name -> types.Withdrawal diff --git a/polygon/bor/bor.go b/polygon/bor/bor.go index 062e9db08a5..5d3bc0ce5d1 100644 --- a/polygon/bor/bor.go +++ b/polygon/bor/bor.go @@ -612,7 +612,7 @@ func ValidateHeaderUnusedFields(header *types.Header) error { return consensus.ErrUnexpectedWithdrawals } - if header.RequestsRoot != nil { + if header.RequestsHash != nil { return consensus.ErrUnexpectedRequests } @@ -1045,7 +1045,7 @@ func (c *Bor) Finalize(config *chain.Config, header *types.Header, state *state. return nil, nil, nil, consensus.ErrUnexpectedWithdrawals } - if requests != nil || header.RequestsRoot != nil { + if requests != nil || header.RequestsHash != nil { return nil, nil, nil, consensus.ErrUnexpectedRequests } @@ -1112,7 +1112,7 @@ func (c *Bor) FinalizeAndAssemble(chainConfig *chain.Config, header *types.Heade return nil, nil, nil, consensus.ErrUnexpectedWithdrawals } - if requests != nil || header.RequestsRoot != nil { + if requests != nil || header.RequestsHash != nil { return nil, nil, nil, consensus.ErrUnexpectedRequests } diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 8c1f34d9fa2..c10b6436577 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -106,7 +106,7 @@ type btHeader struct { BlobGasUsed *uint64 ExcessBlobGas *uint64 ParentBeaconBlockRoot *libcommon.Hash - RequestsRoot *libcommon.Hash + RequestsHash *libcommon.Hash } type btHeaderMarshaling struct { @@ -179,7 +179,7 @@ func (bt *BlockTest) genesis(config *chain.Config) *types.Genesis { BlobGasUsed: bt.json.Genesis.BlobGasUsed, ExcessBlobGas: bt.json.Genesis.ExcessBlobGas, ParentBeaconBlockRoot: bt.json.Genesis.ParentBeaconBlockRoot, - RequestsRoot: bt.json.Genesis.RequestsRoot, + RequestsHash: bt.json.Genesis.RequestsHash, } } @@ -311,8 +311,8 @@ func validateHeader(h *btHeader, h2 *types.Header) error { if !reflect.DeepEqual(h.ParentBeaconBlockRoot, h2.ParentBeaconBlockRoot) { return fmt.Errorf("parentBeaconBlockRoot: want: %v have: %v", h.ParentBeaconBlockRoot, h2.ParentBeaconBlockRoot) } - if !reflect.DeepEqual(h.RequestsRoot, h2.RequestsRoot) { - return fmt.Errorf("requestsRoot: want: %v have: %v", h.RequestsRoot, h2.RequestsRoot) + if !reflect.DeepEqual(h.RequestsHash, h2.RequestsHash) { + return fmt.Errorf("requestsHash: want: %v have: %v", h.RequestsHash, h2.RequestsHash) } return nil } diff --git a/tests/gen_btheader.go b/tests/gen_btheader.go index 385526f8505..55da00bc93e 100644 --- a/tests/gen_btheader.go +++ b/tests/gen_btheader.go @@ -38,7 +38,7 @@ func (b btHeader) MarshalJSON() ([]byte, error) { BlobGasUsed *math.HexOrDecimal64 ExcessBlobGas *math.HexOrDecimal64 ParentBeaconBlockRoot *common.Hash - RequestsRoot *common.Hash + RequestsHash *common.Hash } var enc btHeader enc.Bloom = b.Bloom @@ -62,7 +62,7 @@ func (b btHeader) MarshalJSON() ([]byte, error) { enc.BlobGasUsed = (*math.HexOrDecimal64)(b.BlobGasUsed) enc.ExcessBlobGas = (*math.HexOrDecimal64)(b.ExcessBlobGas) enc.ParentBeaconBlockRoot = b.ParentBeaconBlockRoot - enc.RequestsRoot = b.RequestsRoot + enc.RequestsHash = b.RequestsHash return json.Marshal(&enc) } @@ -90,7 +90,7 @@ func (b *btHeader) UnmarshalJSON(input []byte) error { BlobGasUsed *math.HexOrDecimal64 ExcessBlobGas *math.HexOrDecimal64 ParentBeaconBlockRoot *common.Hash - RequestsRoot *common.Hash + RequestsHash *common.Hash } var dec btHeader if err := json.Unmarshal(input, &dec); err != nil { @@ -159,8 +159,8 @@ func (b *btHeader) UnmarshalJSON(input []byte) error { if dec.ParentBeaconBlockRoot != nil { b.ParentBeaconBlockRoot = dec.ParentBeaconBlockRoot } - if dec.RequestsRoot != nil { - b.RequestsRoot = dec.RequestsRoot + if dec.RequestsHash != nil { + b.RequestsHash = dec.RequestsHash } return nil } diff --git a/turbo/adapter/ethapi/api.go b/turbo/adapter/ethapi/api.go index 3f3b699f797..311e0fe730f 100644 --- a/turbo/adapter/ethapi/api.go +++ b/turbo/adapter/ethapi/api.go @@ -307,8 +307,8 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} { if head.ParentBeaconBlockRoot != nil { result["parentBeaconBlockRoot"] = head.ParentBeaconBlockRoot } - if head.RequestsRoot != nil { - result["requestsRoot"] = head.RequestsRoot + if head.RequestsHash != nil { + result["requestsHash"] = head.RequestsHash } return result diff --git a/turbo/engineapi/engine_server.go b/turbo/engineapi/engine_server.go index e0b057f75c9..854fb6c7e51 100644 --- a/turbo/engineapi/engine_server.go +++ b/turbo/engineapi/engine_server.go @@ -213,7 +213,7 @@ func (s *EngineServer) newPayload(ctx context.Context, req *engine_types.Executi requests = append(requests, req.WithdrawalRequests.Requests()...) requests = append(requests, req.ConsolidationRequests.Requests()...) rh := types.DeriveSha(requests) - header.RequestsRoot = &rh + header.RequestsHash = &rh } if version <= clparams.CapellaVersion { diff --git a/turbo/engineapi/engine_types/jsonrpc.go b/turbo/engineapi/engine_types/jsonrpc.go index 23ce006c088..7f0483aee97 100644 --- a/turbo/engineapi/engine_types/jsonrpc.go +++ b/turbo/engineapi/engine_types/jsonrpc.go @@ -171,7 +171,7 @@ func ConvertRpcBlockToExecutionPayload(payload *execution.Block) *ExecutionPaylo excessBlobGas := *header.ExcessBlobGas res.ExcessBlobGas = (*hexutil.Uint64)(&excessBlobGas) } - if header.RequestsRoot != nil { + if header.RequestsHash != nil { reqs, _ := types.UnmarshalRequestsFromBinary(body.Requests) res.DepositRequests = reqs.Deposits() res.WithdrawalRequests = reqs.Withdrawals() diff --git a/turbo/execution/eth1/eth1_utils/grpc.go b/turbo/execution/eth1/eth1_utils/grpc.go index a4479faa918..c40c50eb70e 100644 --- a/turbo/execution/eth1/eth1_utils/grpc.go +++ b/turbo/execution/eth1/eth1_utils/grpc.go @@ -74,8 +74,8 @@ func HeaderToHeaderRPC(header *types.Header) *execution.Header { h.ParentBeaconBlockRoot = gointerfaces.ConvertHashToH256(*header.ParentBeaconBlockRoot) } - if header.RequestsRoot != nil { - h.RequestsRoot = gointerfaces.ConvertHashToH256(*header.RequestsRoot) + if header.RequestsHash != nil { + h.RequestsHash = gointerfaces.ConvertHashToH256(*header.RequestsHash) } if len(header.AuRaSeal) > 0 { @@ -152,9 +152,9 @@ func HeaderRpcToHeader(header *execution.Header) (*types.Header, error) { h.ParentBeaconBlockRoot = new(libcommon.Hash) *h.ParentBeaconBlockRoot = gointerfaces.ConvertH256ToHash(header.ParentBeaconBlockRoot) } - if header.RequestsRoot != nil { - h.RequestsRoot = new(libcommon.Hash) - *h.RequestsRoot = gointerfaces.ConvertH256ToHash(header.RequestsRoot) + if header.RequestsHash != nil { + h.RequestsHash = new(libcommon.Hash) + *h.RequestsHash = gointerfaces.ConvertH256ToHash(header.RequestsHash) } blockHash := gointerfaces.ConvertH256ToHash(header.BlockHash) if blockHash != h.Hash() { diff --git a/turbo/stages/bodydownload/body_algos.go b/turbo/stages/bodydownload/body_algos.go index 86599929ff3..b95d08484db 100644 --- a/turbo/stages/bodydownload/body_algos.go +++ b/turbo/stages/bodydownload/body_algos.go @@ -167,15 +167,15 @@ func (bd *BodyDownload) RequestMoreBodies(tx kv.RwTx, blockReader services.FullB if request { if header.UncleHash == types.EmptyUncleHash && header.TxHash == types.EmptyRootHash && (header.WithdrawalsHash == nil || *header.WithdrawalsHash == types.EmptyRootHash) && - (header.RequestsRoot == nil || *header.RequestsRoot == types.EmptyRootHash) { + (header.RequestsHash == nil || *header.RequestsHash == types.EmptyRootHash) { // Empty block body body := &types.RawBody{} if header.WithdrawalsHash != nil { // implies *header.WithdrawalsHash == types.EmptyRootHash body.Withdrawals = make([]*types.Withdrawal, 0) } - if header.RequestsRoot != nil { - // implies *header.RequestsRoot == types.EmptyRootHash + if header.RequestsHash != nil { + // implies *header.RequestsHash == types.EmptyRootHash body.Requests = make(types.Requests, 0) } bd.addBodyToCache(blockNum, body) @@ -198,14 +198,14 @@ func (bd *BodyDownload) RequestMoreBodies(tx kv.RwTx, blockReader services.FullB if header.WithdrawalsHash != nil { copy(bodyHashes[2*length.Hash:], header.WithdrawalsHash.Bytes()) } - if header.RequestsRoot != nil { - copy(bodyHashes[3*length.Hash:], header.RequestsRoot.Bytes()) + if header.RequestsHash != nil { + copy(bodyHashes[3*length.Hash:], header.RequestsHash.Bytes()) } bd.requestedMap[bodyHashes] = blockNum blockNums = append(blockNums, blockNum) hashes = append(hashes, hash) } else { - // uncleHash, txHash, withdrawalsHash, and requestsRoot are all empty (or block is prefetched), no need to request + // uncleHash, txHash, withdrawalsHash, and requestsHash are all empty (or block is prefetched), no need to request bd.delivered.Add(blockNum) } } @@ -343,8 +343,8 @@ Loop: copy(bodyHashes[2*length.Hash:], withdrawalsHash.Bytes()) } if requests[i] != nil { - requestsRoot := types.DeriveSha(requests[i]) - copy(bodyHashes[3*length.Hash:], requestsRoot.Bytes()) + requestsHash := types.DeriveSha(requests[i]) + copy(bodyHashes[3*length.Hash:], requestsHash.Bytes()) } // Block numbers are added to the bd.delivered bitmap here, only for blocks for which the body has been received, and their double hashes are present in the bd.requestedMap