core/types: rename to CalcRequestsHash

This commit is contained in:
Felix Lange 2024-09-12 18:13:09 +02:00
parent a2abb4b3a3
commit b3cff4ee5f
5 changed files with 6 additions and 6 deletions

View file

@ -260,7 +260,7 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H
// Compute requestsHash if any requests are non-nil.
var requestsHash *common.Hash
if data.Requests != nil {
h := types.CalcRequestHash(data.Requests)
h := types.CalcRequestsHash(data.Requests)
requestsHash = &h
}
header := &types.Header{

View file

@ -390,7 +390,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
return nil, nil, nil, NewError(ErrorEVM, fmt.Errorf("could not parse requests logs: %v", err))
}
// Calculate the requests root
h := types.CalcRequestHash(requests)
h := types.CalcRequestsHash(requests)
execRs.RequestsHash = &h
execRs.Requests = requests
}

View file

@ -145,7 +145,7 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
}
// Validate the parsed requests match the expected header value.
if header.RequestsHash != nil {
reqhash := types.CalcRequestHash(res.Requests)
reqhash := types.CalcRequestsHash(res.Requests)
if reqhash != *header.RequestsHash {
return fmt.Errorf("invalid deposit root hash (remote: %x local: %x)", *header.RequestsHash, reqhash)
}

View file

@ -294,7 +294,7 @@ func NewBlock(header *Header, body *Body, receipts []*Receipt, hasher TrieHasher
b.header.RequestsHash = &EmptyRequestsHash
b.requests = [][]byte{}
} else {
h := CalcRequestHash(requests)
h := CalcRequestsHash(requests)
b.header.RequestsHash = &h
b.requests = slices.Clone(requests)
}
@ -474,7 +474,7 @@ func CalcUncleHash(uncles []*Header) common.Hash {
return rlpHash(uncles)
}
func CalcRequestHash(requests [][]byte) common.Hash {
func CalcRequestsHash(requests [][]byte) common.Hash {
if len(requests) == 0 {
return EmptyRequestsHash
}

View file

@ -326,7 +326,7 @@ func handleBlockBodies(backend Backend, msg Decoder, peer *Peer) error {
withdrawalHashes[i] = types.DeriveSha(types.Withdrawals(body.Withdrawals), hasher)
}
if body.Requests != nil {
requestsHashes[i] = types.CalcRequestHash(body.Requests)
requestsHashes[i] = types.CalcRequestsHash(body.Requests)
}
}
return [][]common.Hash{txsHashes, uncleHashes, withdrawalHashes, requestsHashes}