mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-11 14:54:12 +00:00
add Altair and Merge rewards tests (#2995)
This commit is contained in:
parent
5b33783898
commit
ecf2dbbcf3
@ -385,6 +385,11 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
|
||||
+ random slot differences [Preset: mainnet] OK
|
||||
```
|
||||
OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||
## subnet tracker
|
||||
```diff
|
||||
+ should register stability subnets on attester duties OK
|
||||
```
|
||||
OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||
## underlong values
|
||||
```diff
|
||||
Overlong SSZ.decode: BitArray[32] Skip
|
||||
@ -447,4 +452,4 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||
OK: 42/56 Fail: 0/56 Skip: 14/56
|
||||
|
||||
---TOTAL---
|
||||
OK: 257/273 Fail: 0/273 Skip: 16/273
|
||||
OK: 258/274 Fail: 0/274 Skip: 16/274
|
||||
|
@ -2,6 +2,40 @@ ConsensusSpecPreset-mainnet
|
||||
===
|
||||
##
|
||||
```diff
|
||||
+ Ethereum Foundation - Altair - Rewards - all_balances_too_low_for_reward [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - empty [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - empty_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_all_correct [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_but_partial_participation [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_but_partial_participation_leak [Preset: main OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_0 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_1 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_2 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_3 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_4 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_low_balances_0 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_low_balances_1 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_misc_balances [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_seven_epoch_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_ten_epoch_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_without_leak_0 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_without_leak_and_current_exit_0 [Pres OK
|
||||
+ Ethereum Foundation - Altair - Rewards - half_full [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - half_full_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - quarter_full [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - quarter_full_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - some_very_low_effective_balances_that_attested [P OK
|
||||
+ Ethereum Foundation - Altair - Rewards - some_very_low_effective_balances_that_attested_le OK
|
||||
+ Ethereum Foundation - Altair - Rewards - some_very_low_effective_balances_that_did_not_att OK
|
||||
+ Ethereum Foundation - Altair - Rewards - some_very_low_effective_balances_that_did_not_att OK
|
||||
+ Ethereum Foundation - Altair - Rewards - with_exited_validators [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - with_exited_validators_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - with_not_yet_activated_validators [Preset: mainne OK
|
||||
+ Ethereum Foundation - Altair - Rewards - with_not_yet_activated_validators_leak [Preset: m OK
|
||||
+ Ethereum Foundation - Altair - Rewards - with_slashed_validators [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - with_slashed_validators_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Transition - normal_transition [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Altair - Transition - transition_missing_first_post_block [Preset: m OK
|
||||
+ Ethereum Foundation - Altair - Transition - transition_missing_last_pre_fork_block [Preset OK
|
||||
@ -23,55 +57,89 @@ ConsensusSpecPreset-mainnet
|
||||
+ Ethereum Foundation - Altair - Transition - transition_with_random_three_quarters_particip OK
|
||||
+ Ethereum Foundation - Altair - Transition - transition_with_voluntary_exit_right_after_for OK
|
||||
+ Ethereum Foundation - Altair - Transition - transition_with_voluntary_exit_right_before_fo OK
|
||||
+ Rewards - all_balances_too_low_for_reward [Preset: mainnet] OK
|
||||
+ Rewards - duplicate_attestations_at_later_slots [Preset: mainnet] OK
|
||||
+ Rewards - empty [Preset: mainnet] OK
|
||||
+ Rewards - empty_leak [Preset: mainnet] OK
|
||||
+ Rewards - full_all_correct [Preset: mainnet] OK
|
||||
+ Rewards - full_but_partial_participation [Preset: mainnet] OK
|
||||
+ Rewards - full_but_partial_participation_leak [Preset: mainnet] OK
|
||||
+ Rewards - full_correct_target_incorrect_head [Preset: mainnet] OK
|
||||
+ Rewards - full_correct_target_incorrect_head_leak [Preset: mainnet] OK
|
||||
+ Rewards - full_delay_max_slots [Preset: mainnet] OK
|
||||
+ Rewards - full_delay_one_slot [Preset: mainnet] OK
|
||||
+ Rewards - full_half_correct_target_incorrect_head [Preset: mainnet] OK
|
||||
+ Rewards - full_half_correct_target_incorrect_head_leak [Preset: mainnet] OK
|
||||
+ Rewards - full_half_incorrect_target_correct_head [Preset: mainnet] OK
|
||||
+ Rewards - full_half_incorrect_target_correct_head_leak [Preset: mainnet] OK
|
||||
+ Rewards - full_half_incorrect_target_incorrect_head [Preset: mainnet] OK
|
||||
+ Rewards - full_half_incorrect_target_incorrect_head_leak [Preset: mainnet] OK
|
||||
+ Rewards - full_leak [Preset: mainnet] OK
|
||||
+ Rewards - full_mixed_delay [Preset: mainnet] OK
|
||||
+ Rewards - full_random_0 [Preset: mainnet] OK
|
||||
+ Rewards - full_random_1 [Preset: mainnet] OK
|
||||
+ Rewards - full_random_2 [Preset: mainnet] OK
|
||||
+ Rewards - full_random_3 [Preset: mainnet] OK
|
||||
+ Rewards - full_random_4 [Preset: mainnet] OK
|
||||
+ Rewards - full_random_leak [Preset: mainnet] OK
|
||||
+ Rewards - full_random_low_balances_0 [Preset: mainnet] OK
|
||||
+ Rewards - full_random_low_balances_1 [Preset: mainnet] OK
|
||||
+ Rewards - full_random_misc_balances [Preset: mainnet] OK
|
||||
+ Rewards - full_random_seven_epoch_leak [Preset: mainnet] OK
|
||||
+ Rewards - full_random_ten_epoch_leak [Preset: mainnet] OK
|
||||
+ Rewards - full_random_without_leak_0 [Preset: mainnet] OK
|
||||
+ Rewards - full_random_without_leak_and_current_exit_0 [Preset: mainnet] OK
|
||||
+ Rewards - half_full [Preset: mainnet] OK
|
||||
+ Rewards - half_full_leak [Preset: mainnet] OK
|
||||
+ Rewards - one_attestation_one_correct [Preset: mainnet] OK
|
||||
+ Rewards - one_attestation_one_correct_leak [Preset: mainnet] OK
|
||||
+ Rewards - proposer_not_in_attestations [Preset: mainnet] OK
|
||||
+ Rewards - quarter_full [Preset: mainnet] OK
|
||||
+ Rewards - quarter_full_leak [Preset: mainnet] OK
|
||||
+ Rewards - some_very_low_effective_balances_that_attested [Preset: mainnet] OK
|
||||
+ Rewards - some_very_low_effective_balances_that_attested_leak [Preset: mainnet] OK
|
||||
+ Rewards - some_very_low_effective_balances_that_did_not_attest [Preset: mainnet] OK
|
||||
+ Rewards - some_very_low_effective_balances_that_did_not_attest_leak [Preset: mainnet] OK
|
||||
+ Rewards - with_exited_validators [Preset: mainnet] OK
|
||||
+ Rewards - with_exited_validators_leak [Preset: mainnet] OK
|
||||
+ Rewards - with_not_yet_activated_validators [Preset: mainnet] OK
|
||||
+ Rewards - with_not_yet_activated_validators_leak [Preset: mainnet] OK
|
||||
+ Rewards - with_slashed_validators [Preset: mainnet] OK
|
||||
+ Rewards - with_slashed_validators_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - all_balances_too_low_for_reward [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - empty [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - empty_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_all_correct [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_but_partial_participation [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_but_partial_participation_leak [Preset: mainn OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_0 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_1 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_2 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_3 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_4 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_low_balances_0 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_low_balances_1 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_misc_balances [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_seven_epoch_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_ten_epoch_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_without_leak_0 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_without_leak_and_current_exit_0 [Prese OK
|
||||
+ Ethereum Foundation - Merge - Rewards - half_full [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - half_full_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - quarter_full [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - quarter_full_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - some_very_low_effective_balances_that_attested [Pr OK
|
||||
+ Ethereum Foundation - Merge - Rewards - some_very_low_effective_balances_that_attested_lea OK
|
||||
+ Ethereum Foundation - Merge - Rewards - some_very_low_effective_balances_that_did_not_atte OK
|
||||
+ Ethereum Foundation - Merge - Rewards - some_very_low_effective_balances_that_did_not_atte OK
|
||||
+ Ethereum Foundation - Merge - Rewards - with_exited_validators [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - with_exited_validators_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - with_not_yet_activated_validators [Preset: mainnet OK
|
||||
+ Ethereum Foundation - Merge - Rewards - with_not_yet_activated_validators_leak [Preset: ma OK
|
||||
+ Ethereum Foundation - Merge - Rewards - with_slashed_validators [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - with_slashed_validators_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - all_balances_too_low_for_reward [Preset: mainnet OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - duplicate_attestations_at_later_slots [Preset: m OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - empty [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - empty_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_all_correct [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_but_partial_participation [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_but_partial_participation_leak [Preset: mai OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_correct_target_incorrect_head [Preset: main OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_correct_target_incorrect_head_leak [Preset: OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_delay_max_slots [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_delay_one_slot [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_half_correct_target_incorrect_head [Preset: OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_half_correct_target_incorrect_head_leak [Pr OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_half_incorrect_target_correct_head [Preset: OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_half_incorrect_target_correct_head_leak [Pr OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_half_incorrect_target_incorrect_head [Prese OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_half_incorrect_target_incorrect_head_leak [ OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_mixed_delay [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_0 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_1 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_2 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_3 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_4 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_low_balances_0 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_low_balances_1 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_misc_balances [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_seven_epoch_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_ten_epoch_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_without_leak_0 [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_without_leak_and_current_exit_0 [Pre OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - half_full [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - half_full_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - one_attestation_one_correct [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - one_attestation_one_correct_leak [Preset: mainne OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - proposer_not_in_attestations [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - quarter_full [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - quarter_full_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - some_very_low_effective_balances_that_attested [ OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - some_very_low_effective_balances_that_attested_l OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - some_very_low_effective_balances_that_did_not_at OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - some_very_low_effective_balances_that_did_not_at OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - with_exited_validators [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - with_exited_validators_leak [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - with_not_yet_activated_validators [Preset: mainn OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - with_not_yet_activated_validators_leak [Preset: OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - with_slashed_validators [Preset: mainnet] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - with_slashed_validators_leak [Preset: mainnet] OK
|
||||
+ Slots - double_empty_epoch OK
|
||||
+ Slots - empty_epoch OK
|
||||
+ Slots - over_epoch_boundary OK
|
||||
@ -420,7 +488,7 @@ ConsensusSpecPreset-mainnet
|
||||
+ fork_random_misc_balances OK
|
||||
+ next_sync_committee_merkle_proof OK
|
||||
```
|
||||
OK: 417/417 Fail: 0/417 Skip: 0/417
|
||||
OK: 485/485 Fail: 0/485 Skip: 0/485
|
||||
## Ethereum Foundation - Altair - Epoch Processing - Effective balance updates [Preset: mainnet]
|
||||
```diff
|
||||
+ Effective balance updates - effective_balance_hysteresis [Preset: mainnet] OK
|
||||
@ -812,4 +880,4 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||
OK: 27/27 Fail: 0/27 Skip: 0/27
|
||||
|
||||
---TOTAL---
|
||||
OK: 674/674 Fail: 0/674 Skip: 0/674
|
||||
OK: 742/742 Fail: 0/742 Skip: 0/742
|
||||
|
@ -2,6 +2,40 @@ ConsensusSpecPreset-minimal
|
||||
===
|
||||
##
|
||||
```diff
|
||||
+ Ethereum Foundation - Altair - Rewards - all_balances_too_low_for_reward [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - empty [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - empty_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_all_correct [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_but_partial_participation [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_but_partial_participation_leak [Preset: mini OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_0 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_1 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_2 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_3 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_4 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_low_balances_0 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_low_balances_1 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_misc_balances [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_seven_epoch_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_ten_epoch_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_without_leak_0 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - full_random_without_leak_and_current_exit_0 [Pres OK
|
||||
+ Ethereum Foundation - Altair - Rewards - half_full [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - half_full_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - quarter_full [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - quarter_full_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - some_very_low_effective_balances_that_attested [P OK
|
||||
+ Ethereum Foundation - Altair - Rewards - some_very_low_effective_balances_that_attested_le OK
|
||||
+ Ethereum Foundation - Altair - Rewards - some_very_low_effective_balances_that_did_not_att OK
|
||||
+ Ethereum Foundation - Altair - Rewards - some_very_low_effective_balances_that_did_not_att OK
|
||||
+ Ethereum Foundation - Altair - Rewards - with_exited_validators [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - with_exited_validators_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - with_not_yet_activated_validators [Preset: minima OK
|
||||
+ Ethereum Foundation - Altair - Rewards - with_not_yet_activated_validators_leak [Preset: m OK
|
||||
+ Ethereum Foundation - Altair - Rewards - with_slashed_validators [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Rewards - with_slashed_validators_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Transition - normal_transition [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Altair - Transition - transition_missing_first_post_block [Preset: m OK
|
||||
+ Ethereum Foundation - Altair - Transition - transition_missing_last_pre_fork_block [Preset OK
|
||||
@ -25,55 +59,89 @@ ConsensusSpecPreset-minimal
|
||||
+ Ethereum Foundation - Altair - Transition - transition_with_random_three_quarters_particip OK
|
||||
+ Ethereum Foundation - Altair - Transition - transition_with_voluntary_exit_right_after_for OK
|
||||
+ Ethereum Foundation - Altair - Transition - transition_with_voluntary_exit_right_before_fo OK
|
||||
+ Rewards - all_balances_too_low_for_reward [Preset: minimal] OK
|
||||
+ Rewards - duplicate_attestations_at_later_slots [Preset: minimal] OK
|
||||
+ Rewards - empty [Preset: minimal] OK
|
||||
+ Rewards - empty_leak [Preset: minimal] OK
|
||||
+ Rewards - full_all_correct [Preset: minimal] OK
|
||||
+ Rewards - full_but_partial_participation [Preset: minimal] OK
|
||||
+ Rewards - full_but_partial_participation_leak [Preset: minimal] OK
|
||||
+ Rewards - full_correct_target_incorrect_head [Preset: minimal] OK
|
||||
+ Rewards - full_correct_target_incorrect_head_leak [Preset: minimal] OK
|
||||
+ Rewards - full_delay_max_slots [Preset: minimal] OK
|
||||
+ Rewards - full_delay_one_slot [Preset: minimal] OK
|
||||
+ Rewards - full_half_correct_target_incorrect_head [Preset: minimal] OK
|
||||
+ Rewards - full_half_correct_target_incorrect_head_leak [Preset: minimal] OK
|
||||
+ Rewards - full_half_incorrect_target_correct_head [Preset: minimal] OK
|
||||
+ Rewards - full_half_incorrect_target_correct_head_leak [Preset: minimal] OK
|
||||
+ Rewards - full_half_incorrect_target_incorrect_head [Preset: minimal] OK
|
||||
+ Rewards - full_half_incorrect_target_incorrect_head_leak [Preset: minimal] OK
|
||||
+ Rewards - full_leak [Preset: minimal] OK
|
||||
+ Rewards - full_mixed_delay [Preset: minimal] OK
|
||||
+ Rewards - full_random_0 [Preset: minimal] OK
|
||||
+ Rewards - full_random_1 [Preset: minimal] OK
|
||||
+ Rewards - full_random_2 [Preset: minimal] OK
|
||||
+ Rewards - full_random_3 [Preset: minimal] OK
|
||||
+ Rewards - full_random_4 [Preset: minimal] OK
|
||||
+ Rewards - full_random_leak [Preset: minimal] OK
|
||||
+ Rewards - full_random_low_balances_0 [Preset: minimal] OK
|
||||
+ Rewards - full_random_low_balances_1 [Preset: minimal] OK
|
||||
+ Rewards - full_random_misc_balances [Preset: minimal] OK
|
||||
+ Rewards - full_random_seven_epoch_leak [Preset: minimal] OK
|
||||
+ Rewards - full_random_ten_epoch_leak [Preset: minimal] OK
|
||||
+ Rewards - full_random_without_leak_0 [Preset: minimal] OK
|
||||
+ Rewards - full_random_without_leak_and_current_exit_0 [Preset: minimal] OK
|
||||
+ Rewards - half_full [Preset: minimal] OK
|
||||
+ Rewards - half_full_leak [Preset: minimal] OK
|
||||
+ Rewards - one_attestation_one_correct [Preset: minimal] OK
|
||||
+ Rewards - one_attestation_one_correct_leak [Preset: minimal] OK
|
||||
+ Rewards - proposer_not_in_attestations [Preset: minimal] OK
|
||||
+ Rewards - quarter_full [Preset: minimal] OK
|
||||
+ Rewards - quarter_full_leak [Preset: minimal] OK
|
||||
+ Rewards - some_very_low_effective_balances_that_attested [Preset: minimal] OK
|
||||
+ Rewards - some_very_low_effective_balances_that_attested_leak [Preset: minimal] OK
|
||||
+ Rewards - some_very_low_effective_balances_that_did_not_attest [Preset: minimal] OK
|
||||
+ Rewards - some_very_low_effective_balances_that_did_not_attest_leak [Preset: minimal] OK
|
||||
+ Rewards - with_exited_validators [Preset: minimal] OK
|
||||
+ Rewards - with_exited_validators_leak [Preset: minimal] OK
|
||||
+ Rewards - with_not_yet_activated_validators [Preset: minimal] OK
|
||||
+ Rewards - with_not_yet_activated_validators_leak [Preset: minimal] OK
|
||||
+ Rewards - with_slashed_validators [Preset: minimal] OK
|
||||
+ Rewards - with_slashed_validators_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - all_balances_too_low_for_reward [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - empty [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - empty_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_all_correct [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_but_partial_participation [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_but_partial_participation_leak [Preset: minim OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_0 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_1 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_2 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_3 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_4 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_low_balances_0 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_low_balances_1 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_misc_balances [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_seven_epoch_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_ten_epoch_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_without_leak_0 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - full_random_without_leak_and_current_exit_0 [Prese OK
|
||||
+ Ethereum Foundation - Merge - Rewards - half_full [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - half_full_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - quarter_full [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - quarter_full_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - some_very_low_effective_balances_that_attested [Pr OK
|
||||
+ Ethereum Foundation - Merge - Rewards - some_very_low_effective_balances_that_attested_lea OK
|
||||
+ Ethereum Foundation - Merge - Rewards - some_very_low_effective_balances_that_did_not_atte OK
|
||||
+ Ethereum Foundation - Merge - Rewards - some_very_low_effective_balances_that_did_not_atte OK
|
||||
+ Ethereum Foundation - Merge - Rewards - with_exited_validators [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - with_exited_validators_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - with_not_yet_activated_validators [Preset: minimal OK
|
||||
+ Ethereum Foundation - Merge - Rewards - with_not_yet_activated_validators_leak [Preset: mi OK
|
||||
+ Ethereum Foundation - Merge - Rewards - with_slashed_validators [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Merge - Rewards - with_slashed_validators_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - all_balances_too_low_for_reward [Preset: minimal OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - duplicate_attestations_at_later_slots [Preset: m OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - empty [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - empty_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_all_correct [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_but_partial_participation [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_but_partial_participation_leak [Preset: min OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_correct_target_incorrect_head [Preset: mini OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_correct_target_incorrect_head_leak [Preset: OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_delay_max_slots [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_delay_one_slot [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_half_correct_target_incorrect_head [Preset: OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_half_correct_target_incorrect_head_leak [Pr OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_half_incorrect_target_correct_head [Preset: OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_half_incorrect_target_correct_head_leak [Pr OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_half_incorrect_target_incorrect_head [Prese OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_half_incorrect_target_incorrect_head_leak [ OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_mixed_delay [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_0 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_1 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_2 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_3 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_4 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_low_balances_0 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_low_balances_1 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_misc_balances [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_seven_epoch_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_ten_epoch_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_without_leak_0 [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - full_random_without_leak_and_current_exit_0 [Pre OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - half_full [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - half_full_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - one_attestation_one_correct [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - one_attestation_one_correct_leak [Preset: minima OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - proposer_not_in_attestations [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - quarter_full [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - quarter_full_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - some_very_low_effective_balances_that_attested [ OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - some_very_low_effective_balances_that_attested_l OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - some_very_low_effective_balances_that_did_not_at OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - some_very_low_effective_balances_that_did_not_at OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - with_exited_validators [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - with_exited_validators_leak [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - with_not_yet_activated_validators [Preset: minim OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - with_not_yet_activated_validators_leak [Preset: OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - with_slashed_validators [Preset: minimal] OK
|
||||
+ Ethereum Foundation - Phase 0 - Rewards - with_slashed_validators_leak [Preset: minimal] OK
|
||||
+ Slots - double_empty_epoch OK
|
||||
+ Slots - empty_epoch OK
|
||||
+ Slots - over_epoch_boundary OK
|
||||
@ -426,7 +494,7 @@ ConsensusSpecPreset-minimal
|
||||
+ finality_root_merkle_proof OK
|
||||
+ next_sync_committee_merkle_proof OK
|
||||
```
|
||||
OK: 423/423 Fail: 0/423 Skip: 0/423
|
||||
OK: 491/491 Fail: 0/491 Skip: 0/491
|
||||
## Ethereum Foundation - Altair - Epoch Processing - Effective balance updates [Preset: minimal]
|
||||
```diff
|
||||
+ Effective balance updates - effective_balance_hysteresis [Preset: minimal] OK
|
||||
@ -852,4 +920,4 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||
OK: 27/27 Fail: 0/27 Skip: 0/27
|
||||
|
||||
---TOTAL---
|
||||
OK: 706/706 Fail: 0/706 Skip: 0/706
|
||||
OK: 774/774 Fail: 0/774 Skip: 0/774
|
||||
|
@ -302,6 +302,11 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
|
||||
+ random slot differences [Preset: mainnet] OK
|
||||
```
|
||||
OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||
## subnet tracker
|
||||
```diff
|
||||
+ should register stability subnets on attester duties OK
|
||||
```
|
||||
OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||
## underlong values
|
||||
```diff
|
||||
Overlong SSZ.decode: BitArray[32] Skip
|
||||
@ -364,4 +369,4 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||
OK: 42/56 Fail: 0/56 Skip: 14/56
|
||||
|
||||
---TOTAL---
|
||||
OK: 202/218 Fail: 0/218 Skip: 16/218
|
||||
OK: 203/219 Fail: 0/219 Skip: 16/219
|
||||
|
@ -424,6 +424,11 @@ type
|
||||
next_fork_version*: Version
|
||||
next_fork_epoch*: Epoch
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/tree/v1.1.3/tests/formats/rewards#rewards-tests
|
||||
Deltas* = object
|
||||
rewards*: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||
penalties*: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||
|
||||
BeaconStateDiff* = object
|
||||
# Small and/or static; always include
|
||||
slot*: Slot
|
||||
|
@ -622,7 +622,7 @@ func get_base_reward_increment(
|
||||
increments * base_reward_per_increment
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/altair/beacon-chain.md#get_flag_index_deltas
|
||||
iterator get_flag_index_deltas(
|
||||
iterator get_flag_index_deltas*(
|
||||
state: altair.BeaconState | merge.BeaconState, flag_index: int,
|
||||
base_reward_per_increment: Gwei,
|
||||
info: altair.EpochInfo):
|
||||
@ -664,7 +664,7 @@ iterator get_flag_index_deltas(
|
||||
(vidx, RewardDelta(rewards: 0.Gwei, penalties: 0.Gwei))
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/altair/beacon-chain.md#modified-get_inactivity_penalty_deltas
|
||||
iterator get_inactivity_penalty_deltas(
|
||||
iterator get_inactivity_penalty_deltas*(
|
||||
cfg: RuntimeConfig, state: altair.BeaconState | merge.BeaconState,
|
||||
info: altair.EpochInfo):
|
||||
(ValidatorIndex, Gwei) =
|
||||
|
85
tests/consensus_spec/altair/test_fixture_rewards.nim
Normal file
85
tests/consensus_spec/altair/test_fixture_rewards.nim
Normal file
@ -0,0 +1,85 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2020-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
{.used.}
|
||||
|
||||
import
|
||||
# Standard library
|
||||
os,
|
||||
# Utilities
|
||||
stew/results,
|
||||
# Beacon chain internals
|
||||
../../beacon_chain/spec/[beaconstate, validator, helpers, state_transition_epoch],
|
||||
../../beacon_chain/spec/datatypes/altair,
|
||||
# Test utilities
|
||||
../../testutil,
|
||||
../fixtures_utils
|
||||
|
||||
const
|
||||
RewardsDirBase = SszTestsDir/const_preset/"altair"/"rewards"
|
||||
RewardsDirBasic = RewardsDirBase/"basic"/"pyspec_tests"
|
||||
RewardsDirLeak = RewardsDirBase/"leak"/"pyspec_tests"
|
||||
RewardsDirRandom = RewardsDirBase/"random"/"pyspec_tests"
|
||||
|
||||
func init(T: type Deltas, len: int): T =
|
||||
if not result.rewards.setLen(len):
|
||||
raiseAssert "setLen"
|
||||
if not result.penalties.setLen(len):
|
||||
raiseAssert "setLen"
|
||||
|
||||
proc runTest(rewardsDir, identifier: string) =
|
||||
let testDir = rewardsDir / identifier
|
||||
|
||||
proc `testImpl _ rewards _ identifier`() =
|
||||
test "Ethereum Foundation - Altair - Rewards - " & identifier & preset():
|
||||
var info: altair.EpochInfo
|
||||
|
||||
let
|
||||
state = newClone(
|
||||
parseTest(testDir/"pre.ssz_snappy", SSZ, altair.BeaconState))
|
||||
flagDeltas = [
|
||||
parseTest(testDir/"source_deltas.ssz_snappy", SSZ, Deltas),
|
||||
parseTest(testDir/"target_deltas.ssz_snappy", SSZ, Deltas),
|
||||
parseTest(testDir/"head_deltas.ssz_snappy", SSZ, Deltas)]
|
||||
inactivityPenaltyDeltas =
|
||||
parseTest(testDir/"inactivity_penalty_deltas.ssz_snappy", SSZ, Deltas)
|
||||
|
||||
info.init(state[])
|
||||
let
|
||||
total_balance = info.balances.current_epoch
|
||||
base_reward_per_increment = get_base_reward_per_increment(total_balance)
|
||||
|
||||
static: doAssert PARTICIPATION_FLAG_WEIGHTS.len == 3
|
||||
var
|
||||
flagDeltas2 = [
|
||||
Deltas.init(state[].validators.len),
|
||||
Deltas.init(state[].validators.len),
|
||||
Deltas.init(state[].validators.len)]
|
||||
inactivityPenaltyDeltas2 = Deltas.init(state[].validators.len)
|
||||
|
||||
for flag_index in 0 ..< PARTICIPATION_FLAG_WEIGHTS.len:
|
||||
for validator_index, delta in get_flag_index_deltas(
|
||||
state[], flag_index, base_reward_per_increment, info):
|
||||
if not is_eligible_validator(info.validators[validator_index]):
|
||||
continue
|
||||
flagDeltas2[flag_index].rewards[validator_index] = delta.rewards
|
||||
flagDeltas2[flag_index].penalties[validator_index] = delta.penalties
|
||||
|
||||
for validator_index, delta in get_inactivity_penalty_deltas(
|
||||
defaultRuntimeConfig, state[], info):
|
||||
inactivityPenaltyDeltas2.penalties[validator_index] = delta
|
||||
|
||||
check:
|
||||
flagDeltas == flagDeltas2
|
||||
inactivityPenaltyDeltas == inactivityPenaltyDeltas2
|
||||
|
||||
`testImpl _ rewards _ identifier`()
|
||||
|
||||
suite "Ethereum Foundation - Altair - Rewards " & preset():
|
||||
for rewardsDir in [RewardsDirBasic, RewardsDirLeak, RewardsDirRandom]:
|
||||
for kind, path in walkDir(rewardsDir, relative = true, checkDir = true):
|
||||
runTest(rewardsDir, path)
|
@ -17,7 +17,7 @@ import
|
||||
# Test utilities
|
||||
../../testutil,
|
||||
../fixtures_utils,
|
||||
../test_fixture_rewards,
|
||||
./test_fixture_rewards,
|
||||
../../helpers/debug_state
|
||||
|
||||
const RootDir = SszTestsDir/const_preset/"altair"/"epoch_processing"
|
||||
|
85
tests/consensus_spec/merge/test_fixture_rewards.nim
Normal file
85
tests/consensus_spec/merge/test_fixture_rewards.nim
Normal file
@ -0,0 +1,85 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2020-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
{.used.}
|
||||
|
||||
import
|
||||
# Standard library
|
||||
os,
|
||||
# Utilities
|
||||
stew/results,
|
||||
# Beacon chain internals
|
||||
../../beacon_chain/spec/[beaconstate, validator, helpers, state_transition_epoch],
|
||||
../../beacon_chain/spec/datatypes/[altair, merge],
|
||||
# Test utilities
|
||||
../../testutil,
|
||||
../fixtures_utils
|
||||
|
||||
const
|
||||
RewardsDirBase = SszTestsDir/const_preset/"merge"/"rewards"
|
||||
RewardsDirBasic = RewardsDirBase/"basic"/"pyspec_tests"
|
||||
RewardsDirLeak = RewardsDirBase/"leak"/"pyspec_tests"
|
||||
RewardsDirRandom = RewardsDirBase/"random"/"pyspec_tests"
|
||||
|
||||
func init(T: type Deltas, len: int): T =
|
||||
if not result.rewards.setLen(len):
|
||||
raiseAssert "setLen"
|
||||
if not result.penalties.setLen(len):
|
||||
raiseAssert "setLen"
|
||||
|
||||
proc runTest(rewardsDir, identifier: string) =
|
||||
let testDir = rewardsDir / identifier
|
||||
|
||||
proc `testImpl _ rewards _ identifier`() =
|
||||
test "Ethereum Foundation - Merge - Rewards - " & identifier & preset():
|
||||
var info: altair.EpochInfo
|
||||
|
||||
let
|
||||
state = newClone(
|
||||
parseTest(testDir/"pre.ssz_snappy", SSZ, merge.BeaconState))
|
||||
flagDeltas = [
|
||||
parseTest(testDir/"source_deltas.ssz_snappy", SSZ, Deltas),
|
||||
parseTest(testDir/"target_deltas.ssz_snappy", SSZ, Deltas),
|
||||
parseTest(testDir/"head_deltas.ssz_snappy", SSZ, Deltas)]
|
||||
inactivityPenaltyDeltas =
|
||||
parseTest(testDir/"inactivity_penalty_deltas.ssz_snappy", SSZ, Deltas)
|
||||
|
||||
info.init(state[])
|
||||
let
|
||||
total_balance = info.balances.current_epoch
|
||||
base_reward_per_increment = get_base_reward_per_increment(total_balance)
|
||||
|
||||
static: doAssert PARTICIPATION_FLAG_WEIGHTS.len == 3
|
||||
var
|
||||
flagDeltas2 = [
|
||||
Deltas.init(state[].validators.len),
|
||||
Deltas.init(state[].validators.len),
|
||||
Deltas.init(state[].validators.len)]
|
||||
inactivityPenaltyDeltas2 = Deltas.init(state[].validators.len)
|
||||
|
||||
for flag_index in 0 ..< PARTICIPATION_FLAG_WEIGHTS.len:
|
||||
for validator_index, delta in get_flag_index_deltas(
|
||||
state[], flag_index, base_reward_per_increment, info):
|
||||
if not is_eligible_validator(info.validators[validator_index]):
|
||||
continue
|
||||
flagDeltas2[flag_index].rewards[validator_index] = delta.rewards
|
||||
flagDeltas2[flag_index].penalties[validator_index] = delta.penalties
|
||||
|
||||
for validator_index, delta in get_inactivity_penalty_deltas(
|
||||
defaultRuntimeConfig, state[], info):
|
||||
inactivityPenaltyDeltas2.penalties[validator_index] = delta
|
||||
|
||||
check:
|
||||
flagDeltas == flagDeltas2
|
||||
inactivityPenaltyDeltas == inactivityPenaltyDeltas2
|
||||
|
||||
`testImpl _ rewards _ identifier`()
|
||||
|
||||
suite "Ethereum Foundation - Merge - Rewards " & preset():
|
||||
for rewardsDir in [RewardsDirBasic, RewardsDirLeak, RewardsDirRandom]:
|
||||
for kind, path in walkDir(rewardsDir, relative = true, checkDir = true):
|
||||
runTest(rewardsDir, path)
|
@ -17,7 +17,7 @@ import
|
||||
# Test utilities
|
||||
../../testutil,
|
||||
../fixtures_utils,
|
||||
../test_fixture_rewards,
|
||||
./test_fixture_rewards,
|
||||
../../helpers/debug_state
|
||||
|
||||
const RootDir = SszTestsDir/const_preset/"merge"/"epoch_processing"
|
||||
|
@ -16,8 +16,8 @@ import
|
||||
../../beacon_chain/spec/[validator, helpers, state_transition_epoch],
|
||||
../../beacon_chain/spec/datatypes/phase0,
|
||||
# Test utilities
|
||||
../testutil,
|
||||
./fixtures_utils
|
||||
../../testutil,
|
||||
../fixtures_utils
|
||||
|
||||
const
|
||||
RewardsDirBase = SszTestsDir/const_preset/"phase0"/"rewards"
|
||||
@ -25,11 +25,6 @@ const
|
||||
RewardsDirLeak = RewardsDirBase/"leak"/"pyspec_tests"
|
||||
RewardsDirRandom = RewardsDirBase/"random"/"pyspec_tests"
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/tree/v1.0.1/tests/formats/rewards#rewards-tests
|
||||
type Deltas = object
|
||||
rewards: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||
penalties: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||
|
||||
func add(v: var Deltas, idx: int, delta: RewardDelta) =
|
||||
v.rewards[idx] += delta.rewards
|
||||
v.penalties[idx] += delta.penalties
|
||||
@ -44,11 +39,10 @@ proc runTest(rewardsDir, identifier: string) =
|
||||
let testDir = rewardsDir / identifier
|
||||
|
||||
proc `testImpl _ rewards _ identifier`() =
|
||||
test "Rewards" & " - " & identifier & preset():
|
||||
var
|
||||
state = newClone(parseTest(testDir/"pre.ssz_snappy", SSZ, phase0.BeaconState))
|
||||
cache = StateCache()
|
||||
test "Ethereum Foundation - Phase 0 - Rewards - " & identifier & preset():
|
||||
let
|
||||
state = newClone(
|
||||
parseTest(testDir/"pre.ssz_snappy", SSZ, phase0.BeaconState))
|
||||
sourceDeltas =
|
||||
parseTest(testDir/"source_deltas.ssz_snappy", SSZ, Deltas)
|
||||
targetDeltas =
|
||||
@ -60,6 +54,7 @@ proc runTest(rewardsDir, identifier: string) =
|
||||
parseTest(testDir/"inactivity_penalty_deltas.ssz_snappy", SSZ, Deltas)
|
||||
|
||||
var
|
||||
cache = StateCache()
|
||||
info: phase0.EpochInfo
|
||||
finality_delay = (state[].get_previous_epoch() - state[].finalized_checkpoint.epoch)
|
||||
|
||||
@ -104,25 +99,15 @@ proc runTest(rewardsDir, identifier: string) =
|
||||
inclusionDelayDeltas2.add(proposer_index.int, proposer_delta.get()[1])
|
||||
|
||||
check:
|
||||
sourceDeltas.rewards.asSeq == sourceDeltas2.rewards.asSeq
|
||||
sourceDeltas.penalties.asSeq == sourceDeltas2.penalties.asSeq
|
||||
|
||||
targetDeltas.rewards.asSeq == targetDeltas2.rewards.asSeq
|
||||
targetDeltas.penalties.asSeq == targetDeltas2.penalties.asSeq
|
||||
|
||||
headDeltas.rewards.asSeq == headDeltas2.rewards.asSeq
|
||||
headDeltas.penalties.asSeq == headDeltas2.penalties.asSeq
|
||||
|
||||
inclusionDelayDeltas.rewards.asSeq == inclusionDelayDeltas2.rewards.asSeq
|
||||
inclusionDelayDeltas.penalties.asSeq == inclusionDelayDeltas2.penalties.asSeq
|
||||
|
||||
inactivityPenaltyDeltas.rewards.asSeq == inactivityPenaltyDeltas2.rewards.asSeq
|
||||
inactivityPenaltyDeltas.penalties.asSeq == inactivityPenaltyDeltas2.penalties.asSeq
|
||||
|
||||
sourceDeltas == sourceDeltas2
|
||||
targetDeltas == targetDeltas2
|
||||
headDeltas == headDeltas2
|
||||
inclusionDelayDeltas == inclusionDelayDeltas2
|
||||
inactivityPenaltyDeltas == inactivityPenaltyDeltas2
|
||||
|
||||
`testImpl _ rewards _ identifier`()
|
||||
|
||||
suite "Ethereum Foundation - Rewards " & preset():
|
||||
suite "Ethereum Foundation - Phase 0 - Rewards " & preset():
|
||||
for rewardsDir in [RewardsDirBasic, RewardsDirLeak, RewardsDirRandom]:
|
||||
for kind, path in walkDir(rewardsDir, relative = true, checkDir = true):
|
||||
runTest(rewardsDir, path)
|
@ -17,7 +17,7 @@ import
|
||||
# Test utilities
|
||||
../../testutil,
|
||||
../fixtures_utils,
|
||||
../test_fixture_rewards,
|
||||
./test_fixture_rewards,
|
||||
../../helpers/debug_state
|
||||
|
||||
const RootDir = SszTestsDir/const_preset/"phase0"/"epoch_processing"
|
||||
|
Loading…
x
Reference in New Issue
Block a user