-
Notifications
You must be signed in to change notification settings - Fork 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
Use justified checkpoint from head state to build attestation #13703
Conversation
d93b452
to
e7b9e3d
Compare
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.
LGTM
@@ -401,7 +401,19 @@ func (s *Service) GetAttestationData( | |||
if err != nil { | |||
return nil, &RpcError{Reason: Internal, Err: errors.Wrap(err, "could not get target root")} | |||
} | |||
justifiedCheckpoint := s.FinalizedFetcher.CurrentJustifiedCheckpt() | |||
|
|||
headState, err := s.HeadFetcher.HeadState(ctx) |
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.
you should fetch the read only version of the head state otherwise this will do a copy and blow up the memory of nodes running with many keys.
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.
It's just one copy per slot because of the cache. But I'll change it to read-only because that's always better
if err != nil { | ||
return nil, &RpcError{Reason: Internal, Err: errors.Wrap(err, "could not get head state")} | ||
} | ||
if coreTime.CurrentEpoch(headState) < slots.ToEpoch(req.Slot) { // Ensure justified checkpoint safety by processing head state across the boundary. |
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 advance though ? Previously we did not advance either
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.
We did advance before. See #13300
e7b9e3d
to
c886aaf
Compare
Currently, the justified checkpoint for attestation is derived from the fork choice store. To ensure maximal safety, the justified checkpoint for attestation should be derived from the head state and process slots across epoch boundaries when necessary.