-
Notifications
You must be signed in to change notification settings - Fork 792
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 target state to compute committees #4235
base: unstable
Are you sure you want to change the base?
Conversation
After discussions with @michaelsproul we found this isn't going to work when |
This reverts commit 9a7bcd6.
I've updated this PR to only sometimes use the target state, since we sometimes need the head block state. Now this PR doesn't full resolve #4234, but it provides a useful optimization IMO. |
I'm bumping this to v4.2.1 since it's not so important and v4.2.0 already has a decent amount of complexity. |
// There's no reason we'd want to load the shuffling for a cold | ||
// state; attestation duties will never be pre-finalized and | ||
// attestations to finalized blocks are useless. | ||
let split_slot = self.store.get_split_slot(); | ||
if split_slot > target_block.slot { | ||
return Err(Error::RequestedColdShuffling { | ||
split_slot, | ||
request_slot: target_block.slot, | ||
}); | ||
} |
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 concerned we have a race condition here that could make this error reachable, resulting in an ugly error!
here. The race is:
- Verify attestation block isn't finalized (it's not, yet)
- Check fork choice, attestation block is present
- Finalization updates, and so does the split point
- The attestation slot is now prior to the split and triggers this error
Alternatively:
- Verify attestation block isn't finalized (it's not, yet)
- Check fork choice, attestation block is present
- Check attestation slot against split slot, still fine
- Finalization migration runs and advances the split
- Try to run
get_state
and fail, because the state has been pruned. Or (today) load a freezer state at great expense ( 😱 ).
This second race is related to #4610.
My preference would be to soak #4160 in Hydra and ensure it's solid before making any changes here. Then we can add this change in maybe with the following defensive changes:
- No new
RequestedColdShuffling
error which complicates error handling (reuseAttestationStateIsFinalized
which already has its own handling). - No separate split slot check: use
get_inconsistent_state_for_attestation_verification_only
in both branches and let it do the check atomically (this change exists on the [Merged by Bors] - Remove the unusedExecutionOptimisticForkVersionedResponse
type #4160 branch).
Good points @michaelsproul. I've dropped the |
Issue Addressed
Related to #4234, but does not fully resolve it.
Proposed Changes
When we have a shuffling cache miss, sometimes compute the shuffling by loading the target state rather than the beacon block root state.
This is cheaper, because we don't need to apply blocks/skip slots to generate a mid-epoch state. It also avoids weirdness with the incomplete state advances.
Additional Info
NA