eip4844 fork and epoch transition tests; some eip4844 gossip (#4393)

This commit is contained in:
tersec 2022-12-06 16:43:11 +00:00 committed by GitHub
parent 031780b612
commit 7cf432b155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 891 additions and 149 deletions

View File

@ -167,6 +167,40 @@ ConsensusSpecPreset-mainnet
+ EF - Capella - Transition - transition_with_proposer_slashing_right_before_fork [Preset: m OK
+ EF - Capella - Transition - transition_with_random_half_participation [Preset: mainnet] OK
+ EF - Capella - Transition - transition_with_random_three_quarters_participation [Preset: m OK
+ EF - EIP4844 - Rewards - all_balances_too_low_for_reward [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - empty [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - empty_leak [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_all_correct [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_but_partial_participation [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_but_partial_participation_leak [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_leak [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_0 [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_1 [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_2 [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_3 [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_4 [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_leak [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_low_balances_0 [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_low_balances_1 [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_misc_balances [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_seven_epoch_leak [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_ten_epoch_leak [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_without_leak_0 [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - full_random_without_leak_and_current_exit_0 [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - half_full [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - half_full_leak [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - quarter_full [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - quarter_full_leak [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - some_very_low_effective_balances_that_attested [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - some_very_low_effective_balances_that_attested_leak [Preset: main OK
+ EF - EIP4844 - Rewards - some_very_low_effective_balances_that_did_not_attest [Preset: mai OK
+ EF - EIP4844 - Rewards - some_very_low_effective_balances_that_did_not_attest_leak [Preset OK
+ EF - EIP4844 - Rewards - with_exited_validators [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - with_exited_validators_leak [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - with_not_yet_activated_validators [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - with_not_yet_activated_validators_leak [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - with_slashed_validators [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - with_slashed_validators_leak [Preset: mainnet] OK
+ EF - Phase 0 - Rewards - all_balances_too_low_for_reward [Preset: mainnet] OK
+ EF - Phase 0 - Rewards - duplicate_attestations_at_later_slots [Preset: mainnet] OK
+ EF - Phase 0 - Rewards - empty [Preset: mainnet] OK
@ -600,6 +634,12 @@ ConsensusSpecPreset-mainnet
+ capella_fork_random_3 OK
+ capella_fork_random_low_balances OK
+ capella_fork_random_misc_balances OK
+ eip4844_fork_random_0 OK
+ eip4844_fork_random_1 OK
+ eip4844_fork_random_2 OK
+ eip4844_fork_random_3 OK
+ eip4844_fork_random_low_balances OK
+ eip4844_fork_random_misc_balances OK
+ fork_base_state OK
+ fork_many_next_epoch OK
+ fork_next_epoch OK
@ -607,7 +647,7 @@ ConsensusSpecPreset-mainnet
+ fork_random_low_balances OK
+ fork_random_misc_balances OK
```
OK: 596/604 Fail: 0/604 Skip: 8/604
OK: 636/644 Fail: 0/644 Skip: 8/644
## Attestation
```diff
+ [Invalid] EF - Altair - Operations - Attestation - after_epoch_slots OK
@ -1612,6 +1652,126 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
+ Testing Withdrawal OK
```
OK: 44/44 Fail: 0/44 Skip: 0/44
## EF - EIP4844 - Epoch Processing - Effective balance updates [Preset: mainnet]
```diff
+ Effective balance updates - effective_balance_hysteresis [Preset: mainnet] OK
```
OK: 1/1 Fail: 0/1 Skip: 0/1
## EF - EIP4844 - Epoch Processing - Eth1 data reset [Preset: mainnet]
```diff
+ Eth1 data reset - eth1_vote_no_reset [Preset: mainnet] OK
+ Eth1 data reset - eth1_vote_reset [Preset: mainnet] OK
```
OK: 2/2 Fail: 0/2 Skip: 0/2
## EF - EIP4844 - Epoch Processing - Historical roots update [Preset: mainnet]
```diff
+ Historical roots update - historical_root_accumulator [Preset: mainnet] OK
```
OK: 1/1 Fail: 0/1 Skip: 0/1
## EF - EIP4844 - Epoch Processing - Inactivity [Preset: mainnet]
```diff
+ Inactivity - all_zero_inactivity_scores_empty_participation [Preset: mainnet] OK
+ Inactivity - all_zero_inactivity_scores_empty_participation_leaking [Preset: mainnet] OK
+ Inactivity - all_zero_inactivity_scores_full_participation [Preset: mainnet] OK
+ Inactivity - all_zero_inactivity_scores_full_participation_leaking [Preset: mainnet] OK
+ Inactivity - all_zero_inactivity_scores_random_participation [Preset: mainnet] OK
+ Inactivity - all_zero_inactivity_scores_random_participation_leaking [Preset: mainnet] OK
+ Inactivity - genesis [Preset: mainnet] OK
+ Inactivity - genesis_random_scores [Preset: mainnet] OK
+ Inactivity - random_inactivity_scores_empty_participation [Preset: mainnet] OK
+ Inactivity - random_inactivity_scores_empty_participation_leaking [Preset: mainnet] OK
+ Inactivity - random_inactivity_scores_full_participation [Preset: mainnet] OK
+ Inactivity - random_inactivity_scores_full_participation_leaking [Preset: mainnet] OK
+ Inactivity - random_inactivity_scores_random_participation [Preset: mainnet] OK
+ Inactivity - random_inactivity_scores_random_participation_leaking [Preset: mainnet] OK
+ Inactivity - some_exited_full_random_leaking [Preset: mainnet] OK
+ Inactivity - some_slashed_full_random [Preset: mainnet] OK
+ Inactivity - some_slashed_full_random_leaking [Preset: mainnet] OK
+ Inactivity - some_slashed_zero_scores_full_participation [Preset: mainnet] OK
+ Inactivity - some_slashed_zero_scores_full_participation_leaking [Preset: mainnet] OK
```
OK: 19/19 Fail: 0/19 Skip: 0/19
## EF - EIP4844 - Epoch Processing - Justification & Finalization [Preset: mainnet]
```diff
+ Justification & Finalization - 123_ok_support [Preset: mainnet] OK
+ Justification & Finalization - 123_poor_support [Preset: mainnet] OK
+ Justification & Finalization - 12_ok_support [Preset: mainnet] OK
+ Justification & Finalization - 12_ok_support_messed_target [Preset: mainnet] OK
+ Justification & Finalization - 12_poor_support [Preset: mainnet] OK
+ Justification & Finalization - 234_ok_support [Preset: mainnet] OK
+ Justification & Finalization - 234_poor_support [Preset: mainnet] OK
+ Justification & Finalization - 23_ok_support [Preset: mainnet] OK
+ Justification & Finalization - 23_poor_support [Preset: mainnet] OK
+ Justification & Finalization - balance_threshold_with_exited_validators [Preset: mainnet] OK
```
OK: 10/10 Fail: 0/10 Skip: 0/10
## EF - EIP4844 - Epoch Processing - Participation flag updates [Preset: mainnet]
```diff
+ Participation flag updates - all_zeroed [Preset: mainnet] OK
+ Participation flag updates - current_epoch_zeroed [Preset: mainnet] OK
+ Participation flag updates - current_filled [Preset: mainnet] OK
+ Participation flag updates - filled [Preset: mainnet] OK
+ Participation flag updates - previous_epoch_zeroed [Preset: mainnet] OK
+ Participation flag updates - previous_filled [Preset: mainnet] OK
+ Participation flag updates - random_0 [Preset: mainnet] OK
+ Participation flag updates - random_1 [Preset: mainnet] OK
+ Participation flag updates - random_2 [Preset: mainnet] OK
+ Participation flag updates - random_genesis [Preset: mainnet] OK
```
OK: 10/10 Fail: 0/10 Skip: 0/10
## EF - EIP4844 - Epoch Processing - RANDAO mixes reset [Preset: mainnet]
```diff
+ RANDAO mixes reset - updated_randao_mixes [Preset: mainnet] OK
```
OK: 1/1 Fail: 0/1 Skip: 0/1
## EF - EIP4844 - Epoch Processing - Registry updates [Preset: mainnet]
```diff
+ Registry updates - activation_queue_activation_and_ejection__1 [Preset: mainnet] OK
+ Registry updates - activation_queue_activation_and_ejection__churn_limit [Preset: mainnet] OK
+ Registry updates - activation_queue_activation_and_ejection__exceed_churn_limit [Preset: m OK
+ Registry updates - activation_queue_efficiency_min [Preset: mainnet] OK
+ Registry updates - activation_queue_no_activation_no_finality [Preset: mainnet] OK
+ Registry updates - activation_queue_sorting [Preset: mainnet] OK
+ Registry updates - activation_queue_to_activated_if_finalized [Preset: mainnet] OK
+ Registry updates - add_to_activation_queue [Preset: mainnet] OK
+ Registry updates - ejection [Preset: mainnet] OK
+ Registry updates - ejection_past_churn_limit_min [Preset: mainnet] OK
+ Registry updates - invalid_large_withdrawable_epoch [Preset: mainnet] OK
```
OK: 11/11 Fail: 0/11 Skip: 0/11
## EF - EIP4844 - Epoch Processing - Rewards and penalties [Preset: mainnet]
```diff
+ Rewards and penalties - almost_empty_attestations [Preset: mainnet] OK
+ Rewards and penalties - almost_empty_attestations_with_leak [Preset: mainnet] OK
+ Rewards and penalties - almost_full_attestations [Preset: mainnet] OK
+ Rewards and penalties - almost_full_attestations_with_leak [Preset: mainnet] OK
+ Rewards and penalties - attestations_some_slashed [Preset: mainnet] OK
+ Rewards and penalties - duplicate_attestation [Preset: mainnet] OK
+ Rewards and penalties - full_attestation_participation [Preset: mainnet] OK
+ Rewards and penalties - full_attestation_participation_with_leak [Preset: mainnet] OK
+ Rewards and penalties - full_attestations_misc_balances [Preset: mainnet] OK
+ Rewards and penalties - full_attestations_one_validaor_one_gwei [Preset: mainnet] OK
+ Rewards and penalties - genesis_epoch_full_attestations_no_rewards [Preset: mainnet] OK
+ Rewards and penalties - genesis_epoch_no_attestations_no_penalties [Preset: mainnet] OK
+ Rewards and penalties - no_attestations_all_penalties [Preset: mainnet] OK
+ Rewards and penalties - random_fill_attestations [Preset: mainnet] OK
+ Rewards and penalties - random_fill_attestations_with_leak [Preset: mainnet] OK
```
OK: 15/15 Fail: 0/15 Skip: 0/15
## EF - EIP4844 - Epoch Processing - Slashings [Preset: mainnet]
```diff
+ Slashings - low_penalty [Preset: mainnet] OK
+ Slashings - max_penalties [Preset: mainnet] OK
+ Slashings - minimal_penalty [Preset: mainnet] OK
+ Slashings - scaled_penalties [Preset: mainnet] OK
+ Slashings - slashings_with_random_state [Preset: mainnet] OK
```
OK: 5/5 Fail: 0/5 Skip: 0/5
## EF - EIP4844 - Epoch Processing - Slashings reset [Preset: mainnet]
```diff
+ Slashings reset - flush_slashings [Preset: mainnet] OK
```
OK: 1/1 Fail: 0/1 Skip: 0/1
## EF - EIP4844 - SSZ consensus objects [Preset: mainnet]
```diff
+ Testing AggregateAndProof OK
@ -2162,4 +2322,4 @@ OK: 63/63 Fail: 0/63 Skip: 0/63
OK: 51/51 Fail: 0/51 Skip: 0/51
---TOTAL---
OK: 1912/1920 Fail: 0/1920 Skip: 8/1920
OK: 2028/2036 Fail: 0/2036 Skip: 8/2036

View File

@ -179,6 +179,40 @@ ConsensusSpecPreset-minimal
+ EF - Capella - Transition - transition_with_random_three_quarters_participation [Preset: m OK
+ EF - Capella - Transition - transition_with_voluntary_exit_right_after_fork [Preset: minim OK
+ EF - Capella - Transition - transition_with_voluntary_exit_right_before_fork [Preset: mini OK
+ EF - EIP4844 - Rewards - all_balances_too_low_for_reward [Preset: minimal] OK
+ EF - EIP4844 - Rewards - empty [Preset: minimal] OK
+ EF - EIP4844 - Rewards - empty_leak [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_all_correct [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_but_partial_participation [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_but_partial_participation_leak [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_leak [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_0 [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_1 [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_2 [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_3 [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_4 [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_leak [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_low_balances_0 [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_low_balances_1 [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_misc_balances [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_seven_epoch_leak [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_ten_epoch_leak [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_without_leak_0 [Preset: minimal] OK
+ EF - EIP4844 - Rewards - full_random_without_leak_and_current_exit_0 [Preset: minimal] OK
+ EF - EIP4844 - Rewards - half_full [Preset: minimal] OK
+ EF - EIP4844 - Rewards - half_full_leak [Preset: minimal] OK
+ EF - EIP4844 - Rewards - quarter_full [Preset: minimal] OK
+ EF - EIP4844 - Rewards - quarter_full_leak [Preset: minimal] OK
+ EF - EIP4844 - Rewards - some_very_low_effective_balances_that_attested [Preset: minimal] OK
+ EF - EIP4844 - Rewards - some_very_low_effective_balances_that_attested_leak [Preset: mini OK
+ EF - EIP4844 - Rewards - some_very_low_effective_balances_that_did_not_attest [Preset: min OK
+ EF - EIP4844 - Rewards - some_very_low_effective_balances_that_did_not_attest_leak [Preset OK
+ EF - EIP4844 - Rewards - with_exited_validators [Preset: minimal] OK
+ EF - EIP4844 - Rewards - with_exited_validators_leak [Preset: minimal] OK
+ EF - EIP4844 - Rewards - with_not_yet_activated_validators [Preset: minimal] OK
+ EF - EIP4844 - Rewards - with_not_yet_activated_validators_leak [Preset: minimal] OK
+ EF - EIP4844 - Rewards - with_slashed_validators [Preset: minimal] OK
+ EF - EIP4844 - Rewards - with_slashed_validators_leak [Preset: minimal] OK
+ EF - Phase 0 - Rewards - all_balances_too_low_for_reward [Preset: minimal] OK
+ EF - Phase 0 - Rewards - duplicate_attestations_at_later_slots [Preset: minimal] OK
+ EF - Phase 0 - Rewards - empty [Preset: minimal] OK
@ -680,6 +714,13 @@ ConsensusSpecPreset-minimal
+ capella_fork_random_large_validator_set OK
+ capella_fork_random_low_balances OK
+ capella_fork_random_misc_balances OK
+ eip4844_fork_random_0 OK
+ eip4844_fork_random_1 OK
+ eip4844_fork_random_2 OK
+ eip4844_fork_random_3 OK
+ eip4844_fork_random_large_validator_set OK
+ eip4844_fork_random_low_balances OK
+ eip4844_fork_random_misc_balances OK
+ fork_base_state OK
+ fork_many_next_epoch OK
+ fork_next_epoch OK
@ -688,7 +729,7 @@ ConsensusSpecPreset-minimal
+ fork_random_low_balances OK
+ fork_random_misc_balances OK
```
OK: 677/685 Fail: 0/685 Skip: 8/685
OK: 718/726 Fail: 0/726 Skip: 8/726
## Attestation
```diff
+ [Invalid] EF - Altair - Operations - Attestation - after_epoch_slots OK
@ -1738,6 +1779,141 @@ OK: 5/5 Fail: 0/5 Skip: 0/5
+ Testing Withdrawal OK
```
OK: 44/44 Fail: 0/44 Skip: 0/44
## EF - EIP4844 - Epoch Processing - Effective balance updates [Preset: minimal]
```diff
+ Effective balance updates - effective_balance_hysteresis [Preset: minimal] OK
```
OK: 1/1 Fail: 0/1 Skip: 0/1
## EF - EIP4844 - Epoch Processing - Eth1 data reset [Preset: minimal]
```diff
+ Eth1 data reset - eth1_vote_no_reset [Preset: minimal] OK
+ Eth1 data reset - eth1_vote_reset [Preset: minimal] OK
```
OK: 2/2 Fail: 0/2 Skip: 0/2
## EF - EIP4844 - Epoch Processing - Historical roots update [Preset: minimal]
```diff
+ Historical roots update - historical_root_accumulator [Preset: minimal] OK
```
OK: 1/1 Fail: 0/1 Skip: 0/1
## EF - EIP4844 - Epoch Processing - Inactivity [Preset: minimal]
```diff
+ Inactivity - all_zero_inactivity_scores_empty_participation [Preset: minimal] OK
+ Inactivity - all_zero_inactivity_scores_empty_participation_leaking [Preset: minimal] OK
+ Inactivity - all_zero_inactivity_scores_full_participation [Preset: minimal] OK
+ Inactivity - all_zero_inactivity_scores_full_participation_leaking [Preset: minimal] OK
+ Inactivity - all_zero_inactivity_scores_random_participation [Preset: minimal] OK
+ Inactivity - all_zero_inactivity_scores_random_participation_leaking [Preset: minimal] OK
+ Inactivity - genesis [Preset: minimal] OK
+ Inactivity - genesis_random_scores [Preset: minimal] OK
+ Inactivity - random_inactivity_scores_empty_participation [Preset: minimal] OK
+ Inactivity - random_inactivity_scores_empty_participation_leaking [Preset: minimal] OK
+ Inactivity - random_inactivity_scores_full_participation [Preset: minimal] OK
+ Inactivity - random_inactivity_scores_full_participation_leaking [Preset: minimal] OK
+ Inactivity - random_inactivity_scores_random_participation [Preset: minimal] OK
+ Inactivity - random_inactivity_scores_random_participation_leaking [Preset: minimal] OK
+ Inactivity - some_exited_full_random_leaking [Preset: minimal] OK
+ Inactivity - some_slashed_full_random [Preset: minimal] OK
+ Inactivity - some_slashed_full_random_leaking [Preset: minimal] OK
+ Inactivity - some_slashed_zero_scores_full_participation [Preset: minimal] OK
+ Inactivity - some_slashed_zero_scores_full_participation_leaking [Preset: minimal] OK
```
OK: 19/19 Fail: 0/19 Skip: 0/19
## EF - EIP4844 - Epoch Processing - Justification & Finalization [Preset: minimal]
```diff
+ Justification & Finalization - 123_ok_support [Preset: minimal] OK
+ Justification & Finalization - 123_poor_support [Preset: minimal] OK
+ Justification & Finalization - 12_ok_support [Preset: minimal] OK
+ Justification & Finalization - 12_ok_support_messed_target [Preset: minimal] OK
+ Justification & Finalization - 12_poor_support [Preset: minimal] OK
+ Justification & Finalization - 234_ok_support [Preset: minimal] OK
+ Justification & Finalization - 234_poor_support [Preset: minimal] OK
+ Justification & Finalization - 23_ok_support [Preset: minimal] OK
+ Justification & Finalization - 23_poor_support [Preset: minimal] OK
+ Justification & Finalization - balance_threshold_with_exited_validators [Preset: minimal] OK
```
OK: 10/10 Fail: 0/10 Skip: 0/10
## EF - EIP4844 - Epoch Processing - Participation flag updates [Preset: minimal]
```diff
+ Participation flag updates - all_zeroed [Preset: minimal] OK
+ Participation flag updates - current_epoch_zeroed [Preset: minimal] OK
+ Participation flag updates - current_filled [Preset: minimal] OK
+ Participation flag updates - filled [Preset: minimal] OK
+ Participation flag updates - large_random [Preset: minimal] OK
+ Participation flag updates - previous_epoch_zeroed [Preset: minimal] OK
+ Participation flag updates - previous_filled [Preset: minimal] OK
+ Participation flag updates - random_0 [Preset: minimal] OK
+ Participation flag updates - random_1 [Preset: minimal] OK
+ Participation flag updates - random_2 [Preset: minimal] OK
+ Participation flag updates - random_genesis [Preset: minimal] OK
+ Participation flag updates - slightly_larger_random [Preset: minimal] OK
```
OK: 12/12 Fail: 0/12 Skip: 0/12
## EF - EIP4844 - Epoch Processing - RANDAO mixes reset [Preset: minimal]
```diff
+ RANDAO mixes reset - updated_randao_mixes [Preset: minimal] OK
```
OK: 1/1 Fail: 0/1 Skip: 0/1
## EF - EIP4844 - Epoch Processing - Registry updates [Preset: minimal]
```diff
+ Registry updates - activation_queue_activation_and_ejection__1 [Preset: minimal] OK
+ Registry updates - activation_queue_activation_and_ejection__churn_limit [Preset: minimal] OK
+ Registry updates - activation_queue_activation_and_ejection__exceed_churn_limit [Preset: m OK
+ Registry updates - activation_queue_activation_and_ejection__exceed_scaled_churn_limit [Pr OK
+ Registry updates - activation_queue_activation_and_ejection__scaled_churn_limit [Preset: m OK
+ Registry updates - activation_queue_efficiency_min [Preset: minimal] OK
+ Registry updates - activation_queue_efficiency_scaled [Preset: minimal] OK
+ Registry updates - activation_queue_no_activation_no_finality [Preset: minimal] OK
+ Registry updates - activation_queue_sorting [Preset: minimal] OK
+ Registry updates - activation_queue_to_activated_if_finalized [Preset: minimal] OK
+ Registry updates - add_to_activation_queue [Preset: minimal] OK
+ Registry updates - ejection [Preset: minimal] OK
+ Registry updates - ejection_past_churn_limit_min [Preset: minimal] OK
+ Registry updates - ejection_past_churn_limit_scaled [Preset: minimal] OK
+ Registry updates - invalid_large_withdrawable_epoch [Preset: minimal] OK
```
OK: 15/15 Fail: 0/15 Skip: 0/15
## EF - EIP4844 - Epoch Processing - Rewards and penalties [Preset: minimal]
```diff
+ Rewards and penalties - almost_empty_attestations [Preset: minimal] OK
+ Rewards and penalties - almost_empty_attestations_with_leak [Preset: minimal] OK
+ Rewards and penalties - almost_full_attestations [Preset: minimal] OK
+ Rewards and penalties - almost_full_attestations_with_leak [Preset: minimal] OK
+ Rewards and penalties - attestations_some_slashed [Preset: minimal] OK
+ Rewards and penalties - duplicate_attestation [Preset: minimal] OK
+ Rewards and penalties - full_attestation_participation [Preset: minimal] OK
+ Rewards and penalties - full_attestation_participation_with_leak [Preset: minimal] OK
+ Rewards and penalties - full_attestations_misc_balances [Preset: minimal] OK
+ Rewards and penalties - full_attestations_one_validaor_one_gwei [Preset: minimal] OK
+ Rewards and penalties - genesis_epoch_full_attestations_no_rewards [Preset: minimal] OK
+ Rewards and penalties - genesis_epoch_no_attestations_no_penalties [Preset: minimal] OK
+ Rewards and penalties - no_attestations_all_penalties [Preset: minimal] OK
+ Rewards and penalties - random_fill_attestations [Preset: minimal] OK
+ Rewards and penalties - random_fill_attestations_with_leak [Preset: minimal] OK
```
OK: 15/15 Fail: 0/15 Skip: 0/15
## EF - EIP4844 - Epoch Processing - Slashings [Preset: minimal]
```diff
+ Slashings - low_penalty [Preset: minimal] OK
+ Slashings - max_penalties [Preset: minimal] OK
+ Slashings - minimal_penalty [Preset: minimal] OK
+ Slashings - scaled_penalties [Preset: minimal] OK
+ Slashings - slashings_with_random_state [Preset: minimal] OK
```
OK: 5/5 Fail: 0/5 Skip: 0/5
## EF - EIP4844 - Epoch Processing - Slashings reset [Preset: minimal]
```diff
+ Slashings reset - flush_slashings [Preset: minimal] OK
```
OK: 1/1 Fail: 0/1 Skip: 0/1
## EF - EIP4844 - Epoch Processing - Sync committee updates [Preset: minimal]
```diff
+ Sync committee updates - sync_committees_no_progress_not_boundary [Preset: minimal] OK
+ Sync committee updates - sync_committees_progress_genesis [Preset: minimal] OK
+ Sync committee updates - sync_committees_progress_misc_balances_genesis [Preset: minimal] OK
+ Sync committee updates - sync_committees_progress_misc_balances_not_genesis [Preset: minim OK
+ Sync committee updates - sync_committees_progress_not_genesis [Preset: minimal] OK
```
OK: 5/5 Fail: 0/5 Skip: 0/5
## EF - EIP4844 - SSZ consensus objects [Preset: minimal]
```diff
+ Testing AggregateAndProof OK
@ -2306,4 +2482,4 @@ OK: 68/68 Fail: 0/68 Skip: 0/68
OK: 52/52 Fail: 0/52 Skip: 0/52
---TOTAL---
OK: 2044/2052 Fail: 0/2052 Skip: 8/2052
OK: 2172/2180 Fail: 0/2180 Skip: 8/2180

View File

@ -184,8 +184,6 @@ template validateBeaconBlockBellatrix(
template validateBeaconBlockBellatrix(
signed_beacon_block: bellatrix.SignedBeaconBlock | capella.SignedBeaconBlock,
parent: BlockRef): untyped =
discard $capellaImplementationMissing & ": verify first signed_bls_to_execution_change"
# If the execution is enabled for the block -- i.e.
# is_execution_enabled(state, block.body) then validate the following:
#
@ -806,7 +804,7 @@ proc validateProposerSlashing*(
ok()
# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.2/specs/phase0/p2p-interface.md#voluntary_exit
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/phase0/p2p-interface.md#voluntary_exit
proc validateVoluntaryExit*(
pool: ExitPool, signed_voluntary_exit: SignedVoluntaryExit):
Result[void, ValidationError] =

View File

@ -292,7 +292,8 @@ proc installMessageValidators*(
let forkDigests = lightClient.forkDigests
for digest in [
forkDigests.altair, forkDigests.bellatrix, forkDigests.capella]:
forkDigests.altair, forkDigests.bellatrix, forkDigests.capella,
forkDigests.eip4844]:
lightClient.network.addValidator(
getLightClientFinalityUpdateTopic(digest),
proc(msg: altair.LightClientFinalityUpdate): ValidationResult =
@ -323,7 +324,7 @@ proc updateGossipStatus*(
currentEpochTargetGossipState = getTargetGossipState(
epoch, cfg.ALTAIR_FORK_EPOCH, cfg.BELLATRIX_FORK_EPOCH,
cfg.CAPELLA_FORK_EPOCH, isBehind)
cfg.CAPELLA_FORK_EPOCH, cfg.EIP4844_FORK_EPOCH, isBehind)
targetGossipState =
if lcBehind or epoch < 1:
currentEpochTargetGossipState
@ -333,7 +334,7 @@ proc updateGossipStatus*(
# Therefore, LC topic subscriptions are kept for 1 extra epoch.
let previousEpochTargetGossipState = getTargetGossipState(
epoch - 1, cfg.ALTAIR_FORK_EPOCH, cfg.BELLATRIX_FORK_EPOCH,
cfg.CAPELLA_FORK_EPOCH, isBehind)
cfg.CAPELLA_FORK_EPOCH, cfg.EIP4844_FORK_EPOCH, isBehind)
currentEpochTargetGossipState + previousEpochTargetGossipState
template currentGossipState(): auto = lightClient.gossipState

View File

@ -483,7 +483,7 @@ proc init*(T: type BeaconNode,
var eth1Monitor: Eth1Monitor
var genesisState =
let genesisState =
if genesisStateContents.len > 0:
try:
newClone(readSszForkedHashedBeaconState(
@ -814,7 +814,7 @@ proc updateBlocksGossipStatus*(
targetGossipState = getTargetGossipState(
slot.epoch, cfg.ALTAIR_FORK_EPOCH, cfg.BELLATRIX_FORK_EPOCH,
cfg.CAPELLA_FORK_EPOCH, isBehind)
cfg.CAPELLA_FORK_EPOCH, cfg.EIP4844_FORK_EPOCH, isBehind)
template currentGossipState(): auto = node.blocksGossipState
if currentGossipState == targetGossipState:
@ -834,6 +834,7 @@ proc updateBlocksGossipStatus*(
newGossipForks = targetGossipState - currentGossipState
oldGossipForks = currentGossipState - targetGossipState
discard $eip4844ImplementationMissing & ": for EIP4844, https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/p2p-interface.md#beacon_block notes use beacon_block_and_blobs_sidecar rather than beacon_block"
for gossipFork in oldGossipForks:
let forkDigest = node.dag.forkDigests[].atStateFork(gossipFork)
node.network.unsubscribe(getBeaconBlocksTopic(forkDigest))
@ -1026,6 +1027,7 @@ proc updateGossipStatus(node: BeaconNode, slot: Slot) {.async.} =
node.dag.cfg.ALTAIR_FORK_EPOCH,
node.dag.cfg.BELLATRIX_FORK_EPOCH,
node.dag.cfg.CAPELLA_FORK_EPOCH,
node.dag.cfg.EIP4844_FORK_EPOCH,
isBehind)
doAssert targetGossipState.card <= 2
@ -1442,6 +1444,7 @@ proc installMessageValidators(node: BeaconNode) =
installPhase0Validators(forkDigests.altair)
installPhase0Validators(forkDigests.bellatrix)
installPhase0Validators(forkDigests.capella)
installPhase0Validators(forkDigests.eip4844)
node.network.addValidator(
getBeaconBlocksTopic(forkDigests.altair),
@ -1473,6 +1476,8 @@ proc installMessageValidators(node: BeaconNode) =
toValidationResult(node.processor[].processSignedBeaconBlock(
MsgSource.gossip, signedBlock)))
discard $eip4844ImplementationMissing & ": add validation here, but per https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/p2p-interface.md#beacon_block it's not beacon_block but beacon_block_and_blobs_sidecar"
template installSyncCommitteeeValidators(digest: auto) =
for subcommitteeIdx in SyncSubcommitteeIndex:
closureScope:
@ -1495,6 +1500,7 @@ proc installMessageValidators(node: BeaconNode) =
installSyncCommitteeeValidators(forkDigests.altair)
installSyncCommitteeeValidators(forkDigests.bellatrix)
installSyncCommitteeeValidators(forkDigests.capella)
installSyncCommitteeeValidators(forkDigests.eip4844)
node.installLightClientMessageValidators()
@ -1811,7 +1817,7 @@ proc doRunBeaconNode(config: var BeaconNodeConf, rng: ref HmacDrbgContext) {.rai
# There are no managed event loops in here, to do a graceful shutdown, but
# letting the default Ctrl+C handler exit is safe, since we only read from
# the db.
var metadata = config.loadEth2Network()
let metadata = config.loadEth2Network()
# Updating the config based on the metadata certainly is not beautiful but it
# works
@ -2091,8 +2097,7 @@ when defined(windows):
reportServiceStatus(SERVICE_STOPPED, NO_ERROR, 0) # we have to report back when we stopped!
programMain:
var
config = makeBannerAndConfig(clientId, BeaconNodeConf)
var config = makeBannerAndConfig(clientId, BeaconNodeConf)
if not(checkAndCreateDataDir(string(config.dataDir))):
# We are unable to access/create data folder or data folder's

View File

@ -220,7 +220,7 @@ programMain:
targetGossipState = getTargetGossipState(
slot.epoch, cfg.ALTAIR_FORK_EPOCH, cfg.BELLATRIX_FORK_EPOCH,
cfg.CAPELLA_FORK_EPOCH, isBehind)
cfg.CAPELLA_FORK_EPOCH, cfg.EIP4844_FORK_EPOCH, isBehind)
template currentGossipState(): auto = blocksGossipState
if currentGossipState == targetGossipState:

View File

@ -763,7 +763,8 @@ proc process_attestation*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/beacon-chain.md#get_next_sync_committee_indices
func get_next_sync_committee_keys(
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState):
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
eip4844.BeaconState):
array[SYNC_COMMITTEE_SIZE, ValidatorPubKey] =
## Return the sequence of sync committee indices, with possible duplicates,
## for the next sync committee.
@ -800,7 +801,8 @@ func get_next_sync_committee_keys(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/beacon-chain.md#get_next_sync_committee
func get_next_sync_committee*(
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState):
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
eip4844.BeaconState):
SyncCommittee =
## Return the *next* sync committee for a given ``state``.
var res: SyncCommittee
@ -1040,6 +1042,86 @@ func upgrade_to_capella*(cfg: RuntimeConfig, pre: bellatrix.BeaconState):
next_withdrawal_validator_index: 0
)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/fork.md#upgrading-the-state
func upgrade_to_eip4844*(cfg: RuntimeConfig, pre: capella.BeaconState):
ref eip4844.BeaconState =
let
epoch = get_current_epoch(pre)
latest_execution_payload_header = eip4844.ExecutionPayloadHeader(
parent_hash: pre.latest_execution_payload_header.parent_hash,
fee_recipient: pre.latest_execution_payload_header.fee_recipient,
state_root: pre.latest_execution_payload_header.state_root,
receipts_root: pre.latest_execution_payload_header.receipts_root,
logs_bloom: pre.latest_execution_payload_header.logs_bloom,
prev_randao: pre.latest_execution_payload_header.prev_randao,
block_number: pre.latest_execution_payload_header.block_number,
gas_limit: pre.latest_execution_payload_header.gas_limit,
gas_used: pre.latest_execution_payload_header.gas_used,
timestamp: pre.latest_execution_payload_header.timestamp,
extra_data: pre.latest_execution_payload_header.extra_data,
base_fee_per_gas: pre.latest_execution_payload_header.base_fee_per_gas,
excess_data_gas: 0.u256, # [New in EIP-4844]
block_hash: pre.latest_execution_payload_header.block_hash,
transactions_root: pre.latest_execution_payload_header.transactions_root,
withdrawals_root: pre.latest_execution_payload_header.withdrawals_root
)
(ref eip4844.BeaconState)(
# Versioning
genesis_time: pre.genesis_time,
genesis_validators_root: pre.genesis_validators_root,
slot: pre.slot,
fork: Fork(
previous_version: pre.fork.current_version,
current_version: cfg.EIP4844_FORK_VERSION, # [Modified in EIP4844]
epoch: epoch
),
# History
latest_block_header: pre.latest_block_header,
block_roots: pre.block_roots,
state_roots: pre.state_roots,
historical_roots: pre.historical_roots,
# Eth1
eth1_data: pre.eth1_data,
eth1_data_votes: pre.eth1_data_votes,
eth1_deposit_index: pre.eth1_deposit_index,
# Registry
validators: pre.validators,
balances: pre.balances,
# Randomness
randao_mixes: pre.randao_mixes,
# Slashings
slashings: pre.slashings,
# Participation
previous_epoch_participation: pre.previous_epoch_participation,
current_epoch_participation: pre.current_epoch_participation,
# Finality
justification_bits: pre.justification_bits,
previous_justified_checkpoint: pre.previous_justified_checkpoint,
current_justified_checkpoint: pre.current_justified_checkpoint,
finalized_checkpoint: pre.finalized_checkpoint,
# Inactivity
inactivity_scores: pre.inactivity_scores,
# Sync
current_sync_committee: pre.current_sync_committee,
next_sync_committee: pre.next_sync_committee,
# Execution-layer
latest_execution_payload_header: latest_execution_payload_header, # [Modified in EIP4844]
# Withdrawals
next_withdrawal_index: pre.next_withdrawal_index,
next_withdrawal_validator_index: pre.next_withdrawal_validator_index
)
template isValidInState*(idx: ValidatorIndex, state: ForkyBeaconState): bool =
idx.uint64 < state.validators.lenu64

View File

@ -557,7 +557,10 @@ func blockForkAtEpoch*(cfg: RuntimeConfig, epoch: Epoch): BeaconBlockFork =
func stateForkForDigest*(
forkDigests: ForkDigests, forkDigest: ForkDigest): Opt[BeaconStateFork] =
if forkDigest == forkDigests.capella:
if forkDigest == forkDigests.eip4844:
discard $eip4844ImplementationMissing & ": when forkedstate appears, use it here"
ok BeaconStateFork.Capella
elif forkDigest == forkDigests.capella:
ok BeaconStateFork.Capella
elif forkDigest == forkDigests.bellatrix:
ok BeaconStateFork.Bellatrix

View File

@ -19,12 +19,14 @@ export base
const
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/phase0/p2p-interface.md#topics-and-messages
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/capella/p2p-interface.md#topics-and-messages
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/p2p-interface.md#topics-and-messages
topicBeaconBlocksSuffix* = "beacon_block/ssz_snappy"
topicVoluntaryExitsSuffix* = "voluntary_exit/ssz_snappy"
topicProposerSlashingsSuffix* = "proposer_slashing/ssz_snappy"
topicAttesterSlashingsSuffix* = "attester_slashing/ssz_snappy"
topicAggregateAndProofsSuffix* = "beacon_aggregate_and_proof/ssz_snappy"
topicBlsToExecutionChangeSuffix* = "bls_to_execution_change/ssz_snappy"
topicBeaconBlockAndBlobsSidecarTopicSuffix* = "beacon_block_and_blobs_sidecar/ssz_snappy"
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/phase0/p2p-interface.md#configuration
MAX_CHUNK_SIZE* = 1 * 1024 * 1024 # bytes
@ -69,6 +71,10 @@ func getAggregateAndProofsTopic*(forkDigest: ForkDigest): string =
func getBlsToExecutionChangeTopic*(forkDigest: ForkDigest): string =
eth2Prefix(forkDigest) & topicBlsToExecutionChangeSuffix
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/p2p-interface.md#topics-and-messages
func getBeaconBlockAndBlobsSidecarTopic*(forkDigest: ForkDigest): string =
eth2Prefix(forkDigest) & topicBeaconBlockAndBlobsSidecarTopicSuffix
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/phase0/validator.md#broadcast-attestation
func compute_subnet_for_attestation*(
committees_per_slot: uint64, slot: Slot, committee_index: CommitteeIndex):
@ -102,7 +108,7 @@ func getSyncCommitteeContributionAndProofTopic*(forkDigest: ForkDigest): string
## For subscribing and unsubscribing to/from a subnet.
eth2Prefix(forkDigest) & "sync_committee_contribution_and_proof/ssz_snappy"
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.0/specs/altair/light-client/p2p-interface.md#light_client_finality_update
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/light-client/p2p-interface.md#light_client_finality_update
func getLightClientFinalityUpdateTopic*(forkDigest: ForkDigest): string =
## For broadcasting or obtaining the latest `LightClientFinalityUpdate`.
eth2Prefix(forkDigest) & "light_client_finality_update/ssz_snappy"
@ -147,8 +153,8 @@ func getDiscoveryForkID*(cfg: RuntimeConfig,
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/p2p-interface.md#transitioning-the-gossip
type GossipState* = set[BeaconStateFork]
func getTargetGossipState*(
epoch, ALTAIR_FORK_EPOCH, BELLATRIX_FORK_EPOCH, CAPELLA_FORK_EPOCH: Epoch,
isBehind: bool): GossipState =
epoch, ALTAIR_FORK_EPOCH, BELLATRIX_FORK_EPOCH, CAPELLA_FORK_EPOCH,
EIP4844_FORK_EPOCH: Epoch, isBehind: bool): GossipState =
if isBehind:
return {}
@ -157,6 +163,7 @@ func getTargetGossipState*(
doAssert BELLATRIX_FORK_EPOCH >= ALTAIR_FORK_EPOCH
doAssert CAPELLA_FORK_EPOCH >= BELLATRIX_FORK_EPOCH
doAssert EIP4844_FORK_EPOCH >= CAPELLA_FORK_EPOCH
# https://github.com/ethereum/consensus-specs/issues/2902
# Don't care whether ALTAIR_FORK_EPOCH == BELLATRIX_FORK_EPOCH or
@ -180,7 +187,11 @@ func getTargetGossipState*(
maybeIncludeFork(
BeaconStateFork.Bellatrix, BELLATRIX_FORK_EPOCH, CAPELLA_FORK_EPOCH)
maybeIncludeFork(
BeaconStateFork.Capella, CAPELLA_FORK_EPOCH, FAR_FUTURE_EPOCH)
BeaconStateFork.Capella, CAPELLA_FORK_EPOCH, EIP4844_FORK_EPOCH)
discard $eip4844ImplementationMissing & ": should be BeaconStateFork.EIP4844"
maybeIncludeFork(
BeaconStateFork.Capella, EIP4844_FORK_EPOCH, FAR_FUTURE_EPOCH)
doAssert len(targetForks) <= 2
targetForks

View File

@ -266,7 +266,7 @@ elif const_preset == "minimal":
CAPELLA_FORK_VERSION: Version [byte 0x03, 0x00, 0x00, 0x01],
CAPELLA_FORK_EPOCH: Epoch(uint64.high),
# eip4844
EIP4844_FORK_VERSION: Version [byte 0x04, 0x00, 0x00, 0x00],
EIP4844_FORK_VERSION: Version [byte 0x04, 0x00, 0x00, 0x01],
EIP4844_FORK_EPOCH: Epoch(uint64.high),
# Sharding
SHARDING_FORK_VERSION: Version [byte 0x05, 0x00, 0x00, 0x00],

View File

@ -701,8 +701,7 @@ func is_partially_withdrawable_validator(
has_max_effective_balance and has_excess_balance
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/capella/beacon-chain.md#new-get_expected_withdrawals
func get_expected_withdrawals(
state: capella.BeaconState | eip4844.BeaconState): seq[Withdrawal] =
func get_expected_withdrawals(state: capella.BeaconState): seq[Withdrawal] =
let epoch = get_current_epoch(state)
var
withdrawal_index = state.next_withdrawal_index
@ -733,6 +732,16 @@ func get_expected_withdrawals(
validator_index = (validator_index + 1) mod lenu64(state.validators)
withdrawals
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/beacon-chain.md#disabling-withdrawals
func get_expected_withdrawals(state: eip4844.BeaconState): seq[Withdrawal] =
# During testing we avoid Capella-specific updates to the state transition.
#
# ...
#
# The `get_expected_withdrawals` function is also modified to return an empty
# withdrawals list.
@[]
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/capella/beacon-chain.md#new-process_withdrawals
func process_withdrawals*(
state: var capella.BeaconState,
@ -820,7 +829,7 @@ proc process_block*(
ok()
# https://github.com/ethereum/consensus-specs/blob/v1.2.0/specs/bellatrix/beacon-chain.md#block-processing
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/bellatrix/beacon-chain.md#block-processing
# TODO workaround for https://github.com/nim-lang/Nim/issues/18095
type SomeBellatrixBlock =
bellatrix.BeaconBlock | bellatrix.SigVerifiedBeaconBlock | bellatrix.TrustedBeaconBlock

View File

@ -172,11 +172,13 @@ func is_eligible_validator*(validator: ParticipationInfo): bool =
# Spec
# --------------------------------------------------------
from ./datatypes/eip4844 import BeaconState
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/beacon-chain.md#get_unslashed_participating_indices
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/phase0/beacon-chain.md#get_total_balance
func get_unslashed_participating_balances*(
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState
): UnslashedParticipatingBalances =
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
eip4844.BeaconState): UnslashedParticipatingBalances =
let
previous_epoch = get_previous_epoch(state)
current_epoch = get_current_epoch(state)
@ -226,7 +228,8 @@ func get_unslashed_participating_balances*(
res
func is_unslashed_participating_index(
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState,
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
eip4844.BeaconState,
flag_index: int, epoch: Epoch, validator_index: ValidatorIndex): bool =
doAssert epoch in [get_previous_epoch(state), get_current_epoch(state)]
# TODO hoist this conditional
@ -422,7 +425,8 @@ proc compute_unrealized_finality*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/beacon-chain.md#justification-and-finalization
proc process_justification_and_finalization*(
state: var (altair.BeaconState | bellatrix.BeaconState | capella.BeaconState),
state: var (altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
eip4844.BeaconState),
balances: UnslashedParticipatingBalances,
flags: UpdateFlags = {}) =
# Initial FFG checkpoint values have a `0x00` stub for `root`.
@ -627,7 +631,8 @@ func get_attestation_deltas(state: phase0.BeaconState, info: var phase0.EpochInf
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/beacon-chain.md#get_base_reward
func get_base_reward_increment*(
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState,
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
eip4844.BeaconState,
index: ValidatorIndex, base_reward_per_increment: Gwei): Gwei =
## Return the base reward for the validator defined by ``index`` with respect
## to the current ``state``.
@ -637,7 +642,8 @@ func get_base_reward_increment*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/beacon-chain.md#get_flag_index_deltas
func get_flag_index_reward*(
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState,
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
eip4844.BeaconState,
base_reward: Gwei, active_increments: Gwei,
unslashed_participating_increments: Gwei,
weight, finality_delay: uint64): Gwei =
@ -659,7 +665,8 @@ func get_active_increments*(info: altair.EpochInfo | bellatrix.BeaconState): Gwe
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/beacon-chain.md#get_flag_index_deltas
iterator get_flag_index_deltas*(
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState,
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
eip4844.BeaconState,
flag_index: int, base_reward_per_increment: Gwei,
info: var altair.EpochInfo, finality_delay: uint64):
(ValidatorIndex, RewardDelta) =
@ -725,7 +732,8 @@ iterator get_inactivity_penalty_deltas*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/bellatrix/beacon-chain.md#modified-get_inactivity_penalty_deltas
iterator get_inactivity_penalty_deltas*(
cfg: RuntimeConfig, state: bellatrix.BeaconState | capella.BeaconState,
cfg: RuntimeConfig,
state: bellatrix.BeaconState | capella.BeaconState | eip4844.BeaconState,
info: altair.EpochInfo): (ValidatorIndex, Gwei) =
## Return the inactivity penalty deltas by considering timely target
## participation flags and inactivity scores.
@ -771,7 +779,9 @@ func process_rewards_and_penalties*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/beacon-chain.md#rewards-and-penalties
func process_rewards_and_penalties*(
cfg: RuntimeConfig, state: var (altair.BeaconState | bellatrix.BeaconState | capella.BeaconState),
cfg: RuntimeConfig,
state: var (altair.BeaconState | bellatrix.BeaconState |
capella.BeaconState | eip4844.BeaconState),
info: var altair.EpochInfo)
=
if get_current_epoch(state) == GENESIS_EPOCH:
@ -869,9 +879,8 @@ func get_adjusted_total_slashing_balance*(
PROPORTIONAL_SLASHING_MULTIPLIER
elif state is altair.BeaconState:
PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR
elif state is bellatrix.BeaconState:
PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX
elif state is capella.BeaconState:
elif state is bellatrix.BeaconState or state is capella.BeaconState or
state is eip4844.BeaconState:
PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX
else:
{.fatal: "process_slashings: incorrect BeaconState type".}
@ -989,7 +998,8 @@ func process_participation_record_updates*(state: var phase0.BeaconState) =
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/beacon-chain.md#participation-flags-updates
func process_participation_flag_updates*(
state: var (altair.BeaconState | bellatrix.BeaconState | capella.BeaconState)) =
state: var (altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
eip4844.BeaconState)) =
state.previous_epoch_participation = state.current_epoch_participation
const zero = 0.ParticipationFlags
@ -1004,7 +1014,8 @@ func process_participation_flag_updates*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/beacon-chain.md#sync-committee-updates
func process_sync_committee_updates*(
state: var (altair.BeaconState | bellatrix.BeaconState | capella.BeaconState)) =
state: var (altair.BeaconState | bellatrix.BeaconState |
capella.BeaconState | eip4844.BeaconState)) =
let next_epoch = get_current_epoch(state) + 1
if next_epoch.is_sync_committee_period():
state.current_sync_committee = state.next_sync_committee
@ -1013,7 +1024,8 @@ func process_sync_committee_updates*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/beacon-chain.md#inactivity-scores
func process_inactivity_updates*(
cfg: RuntimeConfig,
state: var (altair.BeaconState | bellatrix.BeaconState | capella.BeaconState),
state: var (altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
eip4844.BeaconState),
info: altair.EpochInfo) =
# Score updates based on previous epoch participation, skip genesis epoch
if get_current_epoch(state) == GENESIS_EPOCH:
@ -1083,7 +1095,8 @@ proc process_epoch*(
func init*(
info: var altair.EpochInfo,
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState) =
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
eip4844.BeaconState) =
# init participation, overwriting the full structure
info.balances = get_unslashed_participating_balances(state)
info.validators.setLen(state.validators.len())
@ -1100,7 +1113,8 @@ func init*(
func init*(
T: type altair.EpochInfo,
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState): T =
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
eip4844.BeaconState): T =
init(result, state)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/altair/beacon-chain.md#epoch-processing

View File

@ -8,10 +8,10 @@
{.used.}
import
#./test_fixture_fork,
./test_fixture_fork,
./test_fixture_operations,
#./test_fixture_sanity_blocks,
#./test_fixture_sanity_slots,
./test_fixture_ssz_consensus_objects
#./test_fixture_state_transition_epoch,
./test_fixture_ssz_consensus_objects,
./test_fixture_state_transition_epoch
#./test_fixture_transition

View File

@ -0,0 +1,44 @@
# beacon_chain
# Copyright (c) 2021-2022 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,
# Beacon chain internals
../../../beacon_chain/spec/[beaconstate, helpers],
../../../beacon_chain/spec/datatypes/[capella, eip4844],
# Test utilities
../../testutil,
../fixtures_utils,
../../helpers/debug_state
const OpForkDir = SszTestsDir/const_preset/"eip4844"/"fork"/"fork"/"pyspec_tests"
proc runTest(identifier: string) =
let testDir = OpForkDir / identifier
proc `testImpl _ fork _ identifier`() =
test identifier:
let
preState = newClone(
parseTest(testDir/"pre.ssz_snappy", SSZ, capella.BeaconState))
postState = newClone(
parseTest(testDir/"post.ssz_snappy", SSZ, eip4844.BeaconState))
let cfg = defaultRuntimeConfig
let upgradedState = upgrade_to_eip4844(cfg, preState[])
check: upgradedState[].hash_tree_root() == postState[].hash_tree_root()
reportDiff(upgradedState, postState)
`testImpl _ fork _ identifier`()
suite "EF - EIP4844 - Fork " & preset():
for kind, path in walkDir(OpForkDir, relative = true, checkDir = true):
runTest(path)

View File

@ -0,0 +1,85 @@
# beacon_chain
# Copyright (c) 2022 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
std/os,
# Beacon chain internals
../../beacon_chain/spec/[beaconstate, validator, helpers, state_transition_epoch],
../../beacon_chain/spec/datatypes/[altair, eip4844],
# Test utilities
../../testutil,
../fixtures_utils
const
RewardsDirBase = SszTestsDir/const_preset/"eip4844"/"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 "EF - EIP4844 - Rewards - " & identifier & preset():
var info: altair.EpochInfo
let
state = newClone(
parseTest(testDir/"pre.ssz_snappy", SSZ, eip4844.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)
let finality_delay = get_finality_delay(state[])
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, finality_delay):
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 "EF - EIP4844 - Rewards " & preset():
for rewardsDir in [RewardsDirBasic, RewardsDirLeak, RewardsDirRandom]:
for kind, path in walkDir(rewardsDir, relative = true, checkDir = true):
runTest(rewardsDir, path)

View File

@ -0,0 +1,153 @@
# beacon_chain
# Copyright (c) 2022 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
# Status internals
chronicles,
# Beacon chain internals
../../../beacon_chain/spec/[beaconstate, presets, state_transition_epoch],
../../../beacon_chain/spec/datatypes/[altair, eip4844],
# Test utilities
../../testutil,
../fixtures_utils,
./test_fixture_rewards,
../../helpers/debug_state
from std/os import
DirSep, dirExists, fileExists, pcDir, walkDir, walkDirRec, `/`
from std/sequtils import mapIt, toSeq
from std/strutils import rsplit
const
RootDir = SszTestsDir/const_preset/"eip4844"/"epoch_processing"
JustificationFinalizationDir = RootDir/"justification_and_finalization"
InactivityDir = RootDir/"inactivity_updates"
RegistryUpdatesDir = RootDir/"registry_updates"
SlashingsDir = RootDir/"slashings"
Eth1DataResetDir = RootDir/"eth1_data_reset"
EffectiveBalanceUpdatesDir = RootDir/"effective_balance_updates"
SlashingsResetDir = RootDir/"slashings_reset"
RandaoMixesResetDir = RootDir/"randao_mixes_reset"
HistoricalRootsUpdateDir = RootDir/"historical_roots_update"
ParticipationFlagDir = RootDir/"participation_flag_updates"
SyncCommitteeDir = RootDir/"sync_committee_updates"
RewardsAndPenaltiesDir = RootDir/"rewards_and_penalties"
doAssert (toHashSet(mapIt(toSeq(walkDir(RootDir, relative = false)), it.path)) -
toHashSet([SyncCommitteeDir])) ==
toHashSet([
JustificationFinalizationDir, InactivityDir, RegistryUpdatesDir,
SlashingsDir, Eth1DataResetDir, EffectiveBalanceUpdatesDir,
SlashingsResetDir, RandaoMixesResetDir, HistoricalRootsUpdateDir,
ParticipationFlagDir, RewardsAndPenaltiesDir])
template runSuite(
suiteDir, testName: string, transitionProc: untyped): untyped =
suite "EF - EIP4844 - Epoch Processing - " & testName & preset():
for testDir in walkDirRec(
suiteDir / "pyspec_tests", yieldFilter = {pcDir}, checkDir = true):
let unitTestName = testDir.rsplit(DirSep, 1)[1]
test testName & " - " & unitTestName & preset():
# BeaconState objects are stored on the heap to avoid stack overflow
type T = eip4844.BeaconState
let preState {.inject.} = newClone(parseTest(testDir/"pre.ssz_snappy", SSZ, T))
var cache {.inject, used.} = StateCache()
template state: untyped {.inject, used.} = preState[]
template cfg: untyped {.inject, used.} = defaultRuntimeConfig
if transitionProc.isOk:
let postState =
newClone(parseTest(testDir/"post.ssz_snappy", SSZ, T))
check: hash_tree_root(preState[]) == hash_tree_root(postState[])
reportDiff(preState, postState)
else:
check: not fileExists(testDir/"post.ssz_snappy")
# Justification & Finalization
# ---------------------------------------------------------------
runSuite(JustificationFinalizationDir, "Justification & Finalization"):
let info = altair.EpochInfo.init(state)
process_justification_and_finalization(state, info.balances)
Result[void, cstring].ok()
# Inactivity updates
# ---------------------------------------------------------------
runSuite(InactivityDir, "Inactivity"):
let info = altair.EpochInfo.init(state)
process_inactivity_updates(cfg, state, info)
Result[void, cstring].ok()
# Rewards & Penalties
# ---------------------------------------------------------------
runSuite(RewardsAndPenaltiesDir, "Rewards and penalties"):
var info = altair.EpochInfo.init(state)
process_rewards_and_penalties(cfg, state, info)
Result[void, cstring].ok()
# rest in test_fixture_rewards
# Registry updates
# ---------------------------------------------------------------
runSuite(RegistryUpdatesDir, "Registry updates"):
process_registry_updates(cfg, state, cache)
# Slashings
# ---------------------------------------------------------------
runSuite(SlashingsDir, "Slashings"):
let info = altair.EpochInfo.init(state)
process_slashings(state, info.balances.current_epoch)
Result[void, cstring].ok()
# Eth1 data reset
# ---------------------------------------------------------------
runSuite(Eth1DataResetDir, "Eth1 data reset"):
process_eth1_data_reset(state)
Result[void, cstring].ok()
# Effective balance updates
# ---------------------------------------------------------------
runSuite(EffectiveBalanceUpdatesDir, "Effective balance updates"):
process_effective_balance_updates(state)
Result[void, cstring].ok()
# Slashings reset
# ---------------------------------------------------------------
runSuite(SlashingsResetDir, "Slashings reset"):
process_slashings_reset(state)
Result[void, cstring].ok()
# RANDAO mixes reset
# ---------------------------------------------------------------
runSuite(RandaoMixesResetDir, "RANDAO mixes reset"):
process_randao_mixes_reset(state)
Result[void, cstring].ok()
# Historical roots update
# ---------------------------------------------------------------
runSuite(HistoricalRootsUpdateDir, "Historical roots update"):
process_historical_roots_update(state)
Result[void, cstring].ok()
# Participation flag updates
# ---------------------------------------------------------------
runSuite(ParticipationFlagDir, "Participation flag updates"):
process_participation_flag_updates(state)
Result[void, cstring].ok()
# Sync committee updates
# ---------------------------------------------------------------
# These are only for minimal, not mainnet
when const_preset == "minimal":
runSuite(SyncCommitteeDir, "Sync committee updates"):
process_sync_committee_updates(state)
Result[void, cstring].ok()
else:
doAssert not dirExists(SyncCommitteeDir)

View File

@ -12,109 +12,109 @@ import
./testutil,
../beacon_chain/spec/[forks, network]
template getTargetGossipState(a, b, c, d: int, isBehind: bool): auto =
getTargetGossipState(a.Epoch, b.Epoch, c.Epoch, d.Epoch, isBehind)
template getTargetGossipState(a, b, c, d: int, e: Epoch, isBehind: bool): auto =
getTargetGossipState(a.Epoch, b.Epoch, c.Epoch, d.Epoch, e, isBehind)
suite "Gossip fork transition":
test "Gossip fork transition":
check:
getTargetGossipState(0, 1, 6, 7, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(7, 2, 5, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(5, 0, 2, 5, false) == {BeaconStateFork.Capella}
getTargetGossipState(4, 2, 4, 5, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(1, 2, 3, 7, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(9, 2, 4, 5, false) == {BeaconStateFork.Capella}
getTargetGossipState(5, 2, 3, 7, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(5, 0, 1, 7, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(7, 2, 6, 7, false) == {BeaconStateFork.Capella}
getTargetGossipState(5, 0, 5, 7, true) == {}
getTargetGossipState(8, 1, 5, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(8, 3, 4, 7, false) == {BeaconStateFork.Capella}
getTargetGossipState(4, 1, 2, 7, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(0, 1, 4, 7, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(9, 1, 4, 7, true) == {}
getTargetGossipState(9, 2, 4, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(4, 0, 1, 5, true) == {}
getTargetGossipState(1, 1, 5, 6, true) == {}
getTargetGossipState(2, 0, 0, 7, true) == {}
getTargetGossipState(7, 1, 5, 7, false) == {BeaconStateFork.Capella}
getTargetGossipState(5, 1, 3, 6, true) == {}
getTargetGossipState(8, 4, 5, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(3, 0, 4, 6, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(1, 2, 6, 7, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(1, 0, 1, 6, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(6, 0, 3, 5, false) == {BeaconStateFork.Capella}
getTargetGossipState(0, 4, 5, 6, true) == {}
getTargetGossipState(3, 0, 3, 5, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(5, 1, 3, 5, true) == {}
getTargetGossipState(4, 3, 4, 5, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(6, 1, 2, 5, true) == {}
getTargetGossipState(8, 3, 5, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(1, 4, 6, 7, false) == {BeaconStateFork.Phase0}
getTargetGossipState(2, 5, 6, 7, false) == {BeaconStateFork.Phase0}
getTargetGossipState(5, 3, 4, 5, false) == {BeaconStateFork.Capella}
getTargetGossipState(5, 1, 4, 5, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 2, 4, 7, true) == {}
getTargetGossipState(7, 3, 5, 7, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 0, 1, 7, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(0, 1, 4, 5, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(7, 0, 1, 4, true) == {}
getTargetGossipState(6, 0, 4, 5, true) == {}
getTargetGossipState(3, 0, 0, 1, true) == {}
getTargetGossipState(2, 1, 3, 5, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(8, 0, 2, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(7, 0, 1, 4, false) == {BeaconStateFork.Capella}
getTargetGossipState(8, 1, 2, 7, true) == {}
getTargetGossipState(3, 0, 2, 7, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(9, 1, 2, 5, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 1, 4, 5, false) == {BeaconStateFork.Capella}
getTargetGossipState(0, 3, 4, 5, true) == {}
getTargetGossipState(9, 1, 3, 4, false) == {BeaconStateFork.Capella}
getTargetGossipState(1, 1, 4, 7, false) == {BeaconStateFork.Altair}
getTargetGossipState(5, 1, 4, 6, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(7, 0, 5, 7, false) == {BeaconStateFork.Capella}
getTargetGossipState(9, 0, 0, 5, false) == {BeaconStateFork.Capella}
getTargetGossipState(5, 0, 0, 0, false) == {BeaconStateFork.Capella}
getTargetGossipState(9, 2, 3, 4, false) == {BeaconStateFork.Capella}
getTargetGossipState(3, 0, 0, 5, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(0, 0, 1, 6, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(4, 1, 4, 6, true) == {}
getTargetGossipState(4, 1, 2, 3, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 1, 3, 4, false) == {BeaconStateFork.Capella}
getTargetGossipState(4, 0, 0, 5, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(8, 0, 3, 7, false) == {BeaconStateFork.Capella}
getTargetGossipState(2, 2, 3, 4, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(6, 2, 5, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(3, 0, 6, 7, true) == {}
getTargetGossipState(1, 1, 2, 6, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(2, 2, 4, 5, true) == {}
getTargetGossipState(9, 0, 3, 7, true) == {}
getTargetGossipState(4, 1, 3, 7, true) == {}
getTargetGossipState(7, 0, 0, 3, false) == {BeaconStateFork.Capella}
getTargetGossipState(0, 2, 5, 6, false) == {BeaconStateFork.Phase0}
getTargetGossipState(2, 0, 1, 7, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(9, 1, 6, 7, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 3, 5, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(2, 0, 0, 3, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(3, 1, 3, 4, true) == {}
getTargetGossipState(7, 0, 1, 5, false) == {BeaconStateFork.Capella}
getTargetGossipState(2, 0, 3, 6, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(2, 0, 2, 5, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(1, 2, 4, 5, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(8, 0, 2, 5, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 1, 5, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 4, 5, 7, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(3, 0, 5, 6, true) == {}
getTargetGossipState(4, 0, 2, 7, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(4, 4, 5, 6, true) == {}
getTargetGossipState(3, 0, 4, 5, true) == {}
getTargetGossipState(6, 0, 2, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(2, 1, 2, 3, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(1, 0, 5, 6, true) == {}
getTargetGossipState(5, 2, 5, 6, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(8, 0, 1, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(4, 2, 5, 6, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(1, 1, 2, 5, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(9, 1, 4, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(1, 0, 0, 5, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(0, 0, 5, 7, false) == {BeaconStateFork.Altair}
getTargetGossipState(0, 1, 6, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(7, 2, 5, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(5, 0, 2, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(4, 2, 4, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(1, 2, 3, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(9, 2, 4, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(5, 2, 3, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(5, 0, 1, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(7, 2, 6, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(5, 0, 5, 7, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(8, 1, 5, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(8, 3, 4, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(4, 1, 2, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(0, 1, 4, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(9, 1, 4, 7, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(9, 2, 4, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(4, 0, 1, 5, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(1, 1, 5, 6, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(2, 0, 0, 7, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(7, 1, 5, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(5, 1, 3, 6, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(8, 4, 5, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(3, 0, 4, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(1, 2, 6, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(1, 0, 1, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(6, 0, 3, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(0, 4, 5, 6, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(3, 0, 3, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(5, 1, 3, 5, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(4, 3, 4, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(6, 1, 2, 5, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(8, 3, 5, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(1, 4, 6, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Phase0}
getTargetGossipState(2, 5, 6, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Phase0}
getTargetGossipState(5, 3, 4, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(5, 1, 4, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 2, 4, 7, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(7, 3, 5, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 0, 1, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(0, 1, 4, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(7, 0, 1, 4, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(6, 0, 4, 5, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(3, 0, 0, 1, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(2, 1, 3, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(8, 0, 2, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(7, 0, 1, 4, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(8, 1, 2, 7, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(3, 0, 2, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(9, 1, 2, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 1, 4, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(0, 3, 4, 5, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(9, 1, 3, 4, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(1, 1, 4, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Altair}
getTargetGossipState(5, 1, 4, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(7, 0, 5, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(9, 0, 0, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(5, 0, 0, 0, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(9, 2, 3, 4, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(3, 0, 0, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(0, 0, 1, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(4, 1, 4, 6, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(4, 1, 2, 3, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 1, 3, 4, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(4, 0, 0, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(8, 0, 3, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(2, 2, 3, 4, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(6, 2, 5, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(3, 0, 6, 7, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(1, 1, 2, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(2, 2, 4, 5, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(9, 0, 3, 7, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(4, 1, 3, 7, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(7, 0, 0, 3, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(0, 2, 5, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Phase0}
getTargetGossipState(2, 0, 1, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(9, 1, 6, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 3, 5, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(2, 0, 0, 3, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(3, 1, 3, 4, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(7, 0, 1, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(2, 0, 3, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(2, 0, 2, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(1, 2, 4, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(8, 0, 2, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 1, 5, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(6, 4, 5, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(3, 0, 5, 6, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(4, 0, 2, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(4, 4, 5, 6, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(3, 0, 4, 5, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(6, 0, 2, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(2, 1, 2, 3, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(1, 0, 5, 6, FAR_FUTURE_EPOCH, true) == {}
getTargetGossipState(5, 2, 5, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(8, 0, 1, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(4, 2, 5, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(1, 1, 2, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(9, 1, 4, 6, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Capella}
getTargetGossipState(1, 0, 0, 5, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(0, 0, 5, 7, FAR_FUTURE_EPOCH, false) == {BeaconStateFork.Altair}

View File

@ -24,6 +24,7 @@ suite "Honest validator":
getAttesterSlashingsTopic(forkDigest) == "/eth2/00000000/attester_slashing/ssz_snappy"
getAggregateAndProofsTopic(forkDigest) == "/eth2/00000000/beacon_aggregate_and_proof/ssz_snappy"
getBlsToExecutionChangeTopic(forkDigest) == "/eth2/00000000/bls_to_execution_change/ssz_snappy"
getBeaconBlockAndBlobsSidecarTopic(forkDigest) == "/eth2/00000000/beacon_block_and_blobs_sidecar/ssz_snappy"
getSyncCommitteeContributionAndProofTopic(forkDigest) == "/eth2/00000000/sync_committee_contribution_and_proof/ssz_snappy"
getLightClientFinalityUpdateTopic(forkDigest) == "/eth2/00000000/light_client_finality_update/ssz_snappy"
getLightClientOptimisticUpdateTopic(forkDigest) == "/eth2/00000000/light_client_optimistic_update/ssz_snappy"