-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Broadcast Slashing on equivocation #14693
base: develop
Are you sure you want to change the base?
Broadcast Slashing on equivocation #14693
Conversation
// Check for equivocation before inserting into fork choice | ||
slashing, slashingErr := s.detectEquivocatingBlock(cfg.ctx, cfg.roblock) | ||
if slashingErr != nil { | ||
return errors.Wrap(slashingErr, "could not detect equivocating block") |
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 should probably log instead of returning and preventing FCU? could not check for block equivocation
seems more accurate
I think this should probably be done in the gossip validation of beacon blocks for two reasons:
Fwiw I am just an interested bystander using this as a learning opportunity. Feel free to ignore or let me know if this is unhelpful |
@@ -75,6 +75,23 @@ func (s *Service) postBlockProcess(cfg *postBlockProcessConfig) error { | |||
defer reportProcessingTime(startTime) | |||
defer reportAttestationInclusion(cfg.roblock.Block()) | |||
|
|||
// Check for equivocation before inserting into fork choice | |||
slashing, slashingErr := s.detectEquivocatingBlock(cfg.ctx, cfg.roblock) |
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 the wrong spot to place this detection. An equivocation will never make it to this point since we check for s.hasSeenBlockIndexSlot
during validateBeaconBlockPubSub
.
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.
moved this to validateBeaconBlockPubSub
return errors.Wrap(slashingErr, "could not detect equivocating block") | ||
} | ||
|
||
if slashing != nil { |
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.
Better if the broadcasting logic is also handled by the helper so that it's encapsulated, the helper should call a broadcasting routine instead of returnning the slashing.
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.
Addressed this in the next commit
beacon-chain/blockchain/service.go
Outdated
if header1.Header.Slot == header2.Header.Slot && | ||
header1.Header.ProposerIndex == header2.Header.ProposerIndex { | ||
|
||
header1Root, err := header1.Header.HashTreeRoot() |
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.
No need to hash again here, you already have the root when you call this helper.
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.
fixed this in the next commit
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.
When moving this check to the right spot instead after the call to ReceiveBlock
we don't have the root yet (since we only hash after we know we haven't seen the block), we should check if the signatures are different instead, as a different root will result in a different signature.
Hey @potuz, Thanks for the review, addressed the changes that were requested |
fixes #13088
The PR implements immediate broadcasting of slashing messages when detecting equivocating blocks, helping the network react more quickly to malicious behavior without relying on the full slasher service processing.