-
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
Correct duties calculation for old slots #11723
Conversation
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.
Makes sense to me but might want terence to look since it is reverting his changes.
This needs more careful thought. Marking as draft for now. |
@@ -268,21 +267,38 @@ func TestGetProposerDuties(t *testing.T) { | |||
} | |||
vid, _, has := vs.ProposerSlotIndexCache.GetProposerPayloadIDs(11, [32]byte{}) | |||
require.Equal(t, true, has) | |||
require.Equal(t, types.ValidatorIndex(12289), vid) | |||
require.Equal(t, types.ValidatorIndex(9982), vid) |
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 changed because state's slot changed from 5
to params.BeaconConfig().SlotsPerEpoch
. The implementation will always fetch a slot at an epoch boundary, which is why I modified the slot in the test.
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!
* initial code * update proposalDependentRoot * convert method to function * decouple tests Co-authored-by: terencechain <terence@prysmaticlabs.com>
This reverts commit 9efc89f.
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
All our duties' calculation are based on the head state, which means that fetching duties older than
SLOTS_PER_HISTORICAL_ROOT
produces wrong results. This is because the state does not contain block roots older thanSLOTS_PER_HISTORICAL_ROOT
and these roots are used when:This PR also reverts some changes from #11015. Because we use
dependentRootSlot = epochStartSlot.Sub(1)
as the slot, the initial dependent root calculation originally worked fine for the next epoch. The update from 11015 stops working with the current changes becausedependentRootSlot >= s.Slot()
no longer checks for future slots (at least not always) when we don't use the head state.Which issues(s) does this PR fix?
Fixes #11628