-
Notifications
You must be signed in to change notification settings - Fork 1.2k
changing ErrNotDescendantOfFinalized to ErrRootNotInForkChoice #15836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
This can't be accurate, we do not reject attestations for blocks we do not know. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very dangerous change, previously a simple check could result in an error being logged because the requested root was not in forkchoice, now the same error will also mark a block as invalid?
|
||
// ErrRootNotInForkchoice is returned when a root cannot be found in forkchoice. | ||
func ErrRootNotInForkchoice(root [fieldparams.RootLength]byte) invalidBlock { | ||
return invalidBlock{error: fmt.Errorf("root %#x not in forkchoice", root), root: root} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this? this is a very dangerous change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah, my bad, read this incorrectly, this is fine, reviewing.
// Shared validations for the entire bucket. | ||
if !s.cfg.chain.InForkchoice(bytesutil.ToBytes32(data.BeaconBlockRoot)) { | ||
log.WithError(blockchain.ErrNotDescendantOfFinalized).WithField("root", fmt.Sprintf("%#x", data.BeaconBlockRoot)).Debug("Failed forkchoice check for bucket") | ||
log.WithError(blockchain.ErrRootNotInForkchoice(bytesutil.ToBytes32(data.BeaconBlockRoot))).Debug("Failed forkchoice check for bucket") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we need to return an invalid block and a root here.
if !s.cfg.chain.InForkchoice(bytesutil.ToBytes32(data.BeaconBlockRoot)) { | ||
tracing.AnnotateError(span, blockchain.ErrNotDescendantOfFinalized) | ||
return pubsub.ValidationIgnore, blockchain.ErrNotDescendantOfFinalized | ||
tracing.AnnotateError(span, blockchain.ErrRootNotInForkchoice(bytesutil.ToBytes32(data.BeaconBlockRoot))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
if !s.cfg.chain.InForkchoice(blockRoot) { | ||
tracing.AnnotateError(span, blockchain.ErrNotDescendantOfFinalized) | ||
return pubsub.ValidationIgnore, blockchain.ErrNotDescendantOfFinalized | ||
tracing.AnnotateError(span, blockchain.ErrRootNotInForkchoice(blockRoot)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
func (s *Service) validatePhase0Block(ctx context.Context, blk interfaces.ReadOnlySignedBeaconBlock, blockRoot [32]byte) (state.BeaconState, error) { | ||
if !s.cfg.chain.InForkchoice(blk.Block().ParentRoot()) { | ||
s.setBadBlock(ctx, blockRoot) | ||
return nil, blockchain.ErrNotDescendantOfFinalized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
What type of PR is this?
Other
What does this PR do? Why is it needed?
The gossip ignored issue is likely caused by the below however the error didn't provide clarity on the underlying reason.
- Node A produces block at slot N
- Node A broadcasts block + attestations
- Node B receives attestations for block N before it finishes processing block N
- Node B's gossip validation ignores attestations because block N is not yet in forkchoice
- This is logged as "Gossip message was ignored"
Which issues(s) does this PR fix?
Fixes #5812
alternative to #15840
Other notes for review
Acknowledgements