From 1b4879b0753448a7ba2cda315a77e047b3cf7771 Mon Sep 17 00:00:00 2001 From: art Date: Tue, 7 May 2024 13:51:56 +0300 Subject: [PATCH 1/2] params.MaximumExtraDataSize for extraData length check --- beacon/engine/types.go | 3 ++- consensus/beacon/consensus.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/beacon/engine/types.go b/beacon/engine/types.go index a73691ca05..6ef8862c72 100644 --- a/beacon/engine/types.go +++ b/beacon/engine/types.go @@ -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 { diff --git a/consensus/beacon/consensus.go b/consensus/beacon/consensus.go index b8946e0c71..19763ed303 100644 --- a/consensus/beacon/consensus.go +++ b/consensus/beacon/consensus.go @@ -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. From 76a901a77b34dc011dca142358250e9c9174e1dd Mon Sep 17 00:00:00 2001 From: art Date: Tue, 7 May 2024 14:02:42 +0300 Subject: [PATCH 2/2] renamed params2 to ethparams --- beacon/engine/types.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beacon/engine/types.go b/beacon/engine/types.go index 6ef8862c72..3be1e484e9 100644 --- a/beacon/engine/types.go +++ b/beacon/engine/types.go @@ -18,7 +18,7 @@ package engine import ( "fmt" - params2 "github.com/ethereum/go-ethereum/params" + ethparams "github.com/ethereum/go-ethereum/params" "math/big" "slices" @@ -200,7 +200,7 @@ func ExecutableDataToBlock(params ExecutableData, versionedHashes []common.Hash, if err != nil { return nil, err } - if len(params.ExtraData) > int(params2.MaximumExtraDataSize) { + if len(params.ExtraData) > int(ethparams.MaximumExtraDataSize) { return nil, fmt.Errorf("invalid extradata length: %v", len(params.ExtraData)) } if len(params.LogsBloom) != 256 {