mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
params.MaximumExtraDataSize for extraData length check
This commit is contained in:
parent
e4b8058d5a
commit
1b4879b075
2 changed files with 3 additions and 2 deletions
|
|
@ -18,6 +18,7 @@ package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
params2 "github.com/ethereum/go-ethereum/params"
|
||||||
"math/big"
|
"math/big"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
|
|
@ -199,7 +200,7 @@ func ExecutableDataToBlock(params ExecutableData, versionedHashes []common.Hash,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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))
|
return nil, fmt.Errorf("invalid extradata length: %v", len(params.ExtraData))
|
||||||
}
|
}
|
||||||
if len(params.LogsBloom) != 256 {
|
if len(params.LogsBloom) != 256 {
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ func (beacon *Beacon) VerifyUncles(chain consensus.ChainReader, block *types.Blo
|
||||||
// (c) the extradata is limited to 32 bytes
|
// (c) the extradata is limited to 32 bytes
|
||||||
func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, parent *types.Header) error {
|
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
|
// 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))
|
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.
|
// Verify the seal parts. Ensure the nonce and uncle hash are the expected value.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue