From 4e47905884bda2d13678d6704887a7196aa33839 Mon Sep 17 00:00:00 2001 From: Potuz Date: Fri, 10 Oct 2025 17:55:29 -0300 Subject: [PATCH] Do not mark blocks as invalid unnecessarily (#15846) --- beacon-chain/blockchain/error.go | 2 +- beacon-chain/blockchain/receive_block.go | 3 +++ changelog/potuz_invalid_not_descendant.md | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog/potuz_invalid_not_descendant.md diff --git a/beacon-chain/blockchain/error.go b/beacon-chain/blockchain/error.go index 50f535f387..35630eb139 100644 --- a/beacon-chain/blockchain/error.go +++ b/beacon-chain/blockchain/error.go @@ -30,7 +30,7 @@ var ( // errWSBlockNotFoundInEpoch is returned when a block is not found in the WS cache or DB within epoch. errWSBlockNotFoundInEpoch = errors.New("weak subjectivity root not found in db within epoch") // ErrNotDescendantOfFinalized is returned when a block is not a descendant of the finalized checkpoint - ErrNotDescendantOfFinalized = invalidBlock{error: errors.New("not descendant of finalized checkpoint")} + ErrNotDescendantOfFinalized = errors.New("not descendant of finalized checkpoint") // ErrNotCheckpoint is returned when a given checkpoint is not a // checkpoint in any chain known to forkchoice ErrNotCheckpoint = errors.New("not a checkpoint in forkchoice") diff --git a/beacon-chain/blockchain/receive_block.go b/beacon-chain/blockchain/receive_block.go index 9326812295..00064234b7 100644 --- a/beacon-chain/blockchain/receive_block.go +++ b/beacon-chain/blockchain/receive_block.go @@ -219,6 +219,9 @@ func (s *Service) validateExecutionAndConsensus( eg.Go(func() error { var err error postState, err = s.validateStateTransition(ctx, preState, block) + if errors.Is(err, ErrNotDescendantOfFinalized) { + return invalidBlock{error: err, root: block.Root()} + } if err != nil { return errors.Wrap(err, "failed to validate consensus state transition function") } diff --git a/changelog/potuz_invalid_not_descendant.md b/changelog/potuz_invalid_not_descendant.md new file mode 100644 index 0000000000..5a647d2f48 --- /dev/null +++ b/changelog/potuz_invalid_not_descendant.md @@ -0,0 +1,3 @@ +### Fixed + +- Do not mark blocks as invalid from ErrNotDescendantOfFinalized