Skip to content

core: add validation for Requests #30428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
return errors.New("withdrawals present in block body")
}

if header.RequestsHash != nil {
if block.Requests() == nil {
return errors.New("missing requests in block body")
}
// todo: update after the #30425 is merged
if hash := types.DeriveSha(block.Requests(), trie.NewStackTrie(nil)); hash != *header.RequestsHash {
return fmt.Errorf("requests root hash mismatch (header value %x, calculated %x)", *header.RequestsHash, hash)
}
} else if block.Requests() != nil {
return errors.New("requests present in block body")
}

// Blob transactions may be present after the Cancun fork.
var blobs int
for i, tx := range block.Transactions() {
Expand Down