mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
More selective on marking block as bad (#10681)
* Starting, looking for feedbacks * Update error.go * Wrap invalid blocks to rest of the processings * More tests * More tests * Fix tests * Update process_block_test.go * Update execution_engine_test.go * Update BUILD.bazel * Nishant's feedback and Kasey's recommendation * Add comments on what an invalid block is * Update beacon-chain/blockchain/error.go Co-authored-by: Potuz <potuz@prysmaticlabs.com> * Update beacon-chain/blockchain/error.go Co-authored-by: Potuz <potuz@prysmaticlabs.com> * Rm faulty invalid conditions Co-authored-by: Potuz <potuz@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/blockchain"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||
p2ptypes "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/powchain"
|
||||
"github.com/prysmaticlabs/prysm/config/params"
|
||||
"github.com/prysmaticlabs/prysm/consensus-types/interfaces"
|
||||
types "github.com/prysmaticlabs/prysm/consensus-types/primitives"
|
||||
@@ -156,10 +155,6 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
|
||||
err = s.validateBeaconBlock(ctx, b, blkRoot)
|
||||
switch {
|
||||
case errors.Is(ErrOptimisticParent, err): // Ok to continue process block with parent that is an optimistic candidate.
|
||||
case errors.Is(blockchain.ErrUndefinedExecutionEngineError, err):
|
||||
// don't mark the block as bad with an undefined EE error.
|
||||
log.Debugf("Could not validate block due to undefined ee error %d: %v", b.Block().Slot(), err)
|
||||
continue
|
||||
case err != nil:
|
||||
log.Debugf("Could not validate block from slot %d: %v", b.Block().Slot(), err)
|
||||
s.setBadBlock(ctx, blkRoot)
|
||||
@@ -170,11 +165,12 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
|
||||
}
|
||||
|
||||
if err := s.cfg.chain.ReceiveBlock(ctx, b, blkRoot); err != nil {
|
||||
if !errors.Is(err, powchain.ErrHTTPTimeout) {
|
||||
log.Debugf("Could not process block from slot %d: %v", b.Block().Slot(), err)
|
||||
if blockchain.IsInvalidBlock(err) {
|
||||
tracing.AnnotateError(span, err)
|
||||
s.setBadBlock(ctx, blkRoot)
|
||||
}
|
||||
log.Debugf("Could not process block from slot %d: %v", b.Block().Slot(), err)
|
||||
|
||||
// In the next iteration of the queue, this block will be removed from
|
||||
// the pending queue as it has been marked as a 'bad' block.
|
||||
span.End()
|
||||
|
||||
Reference in New Issue
Block a user