Add test_proposer_in_committee_without_participation__zero_pre_balance
#3601
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.
Suggested by @dapplion, this is a spec test for proposer in sync committee with balance close to zero, and doesn't participate.
Testing target
In
process_sync_aggregate
consensus-specs/specs/altair/beacon-chain.md
Lines 549 to 559 in 2faa44b
We have implemented a for-loop designed to go through the committee sequentially. It either increases or decreases the balances in the for-loop. The sequence in which these adjustments are applied is critical, as it significantly influences the final results.
Test case description
In this test case, we have (1) proposer in sync committee, (2) only "the validator next to the proposer in committee" has participated.
The proposer balance should get decreased and hit the lower bound
0
first, and then, increased with proposer reward in the next iteration on the participant.As expected, the result doesn't match our testing helper check (
validate_sync_committee_rewards
.Note that since we use effective balance to seed the proposer, the best I can mock in the test is setting
state.balances[proposer_index]
but not settingstate.validators[proposer_index].effective_balance
.