Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for PTC for Duty RPC.
ptc_slot
toDutyResponse
protobufPtcSlot
toCommitteeAssignmentContainer
container for helper functionCommitteeAssignments
to populatePtcSlot
if the validator is part of the PTC of the slotGetPayloadTimelinessCommittee
helperPtcAllocation
helper to return the number of beacon committees PTC will borrow from in a slot and the number of validators PTC will borrow from in a beacon committeeTestGetAttestationData
in Beacon API RPC tests uses the mainnet config. It supplements the minimum genesis validator count (16384
) but intentionally leaves the last one inactive to test the unavailable case later. Having fewer than the minimum genesis validator count (16383
) breaks the PTC assumption with a count of512
.16383
translates to3
committees per slot and170
validators per committee. Under this case, PTC will borrow from2
committees, resulting in256
validators per committee.256
is greater than170
. To fix this, I modified the unit test to start with16385
validators instead of 16384. This way, the last validator can remain inactive while maintaining over16384
validators. Due to this change, the shuffling was affected, so I updated the assertions.TestGetDuties_OK
and others in Prysm API Duty tests use the minimal config, but they use parameters from the beacon config minimal config. PTC config is defined using the fieldparams package. I added//go:build minimal
to the top of the file to ensure the PTC config is applied. I also adjusted the PTC minimal config value from32
to2
to align with the minimal genesis validator size. The same ratio is maintained:mainnetValidatorCount/mainnetPTCCount == minimalValidatorCount/minimalPTCCount
.I separate out some of the beacon committee assignment test cases to use
minimal
but some of the beacon committee test cases are challenging due to the validator count being256
and using mainnet state. I am unsure of the best resolution. Should I rewrite the test cases from scratch?One solution to avoid revamping most existing unit tests is to accept the following condition in
CommitteeAssignments
. Instead of:We simply
continue
and skip assigning a PTC slot to theCommitteeAssignmentContainer
. This may be acceptable since that's only a duty and if we encounter this condition, the state is already bad and PTC responsibility may not matter.