params.MaximumExtraDataSize for extraData length check

This commit is contained in:
art 2024-05-07 13:51:56 +03:00
parent e4b8058d5a
commit 1b4879b075
2 changed files with 3 additions and 2 deletions

View file

@ -18,6 +18,7 @@ package engine
import (
"fmt"
params2 "github.com/ethereum/go-ethereum/params"
"math/big"
"slices"
@ -199,7 +200,7 @@ func ExecutableDataToBlock(params ExecutableData, versionedHashes []common.Hash,
if err != nil {
return nil, err
}
if len(params.ExtraData) > 32 {
if len(params.ExtraData) > int(params2.MaximumExtraDataSize) {
return nil, fmt.Errorf("invalid extradata length: %v", len(params.ExtraData))
}
if len(params.LogsBloom) != 256 {

View file

@ -229,7 +229,7 @@ func (beacon *Beacon) VerifyUncles(chain consensus.ChainReader, block *types.Blo
// (c) the extradata is limited to 32 bytes
func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, parent *types.Header) error {
// Ensure that the header's extra-data section is of a reasonable size
if len(header.Extra) > 32 {
if len(header.Extra) > int(params.MaximumExtraDataSize) {
return fmt.Errorf("extra-data longer than 32 bytes (%d)", len(header.Extra))
}
// Verify the seal parts. Ensure the nonce and uncle hash are the expected value.