From 37c49ffcdcc7eba5df5a62b5b885f9618468b616 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Wed, 10 Mar 2021 13:11:03 -0700 Subject: [PATCH] ensure rewards are tested properly post altair fork --- .../test_process_rewards_and_penalties.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_rewards_and_penalties.py b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_rewards_and_penalties.py index 2de054505..6d05a498e 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_rewards_and_penalties.py +++ b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_rewards_and_penalties.py @@ -50,6 +50,18 @@ def validate_resulting_balances(spec, pre_state, post_state, attestations): assert post_state.balances[index] > pre_state.balances[index] else: assert post_state.balances[index] < pre_state.balances[index] + else: + if spec.is_in_inactivity_leak(post_state): + if index in attesting_indices: + # If not proposer but participated optimally, should have exactly neutral balance + assert post_state.balances[index] == pre_state.balances[index] + else: + assert post_state.balances[index] < pre_state.balances[index] + else: + if index in attesting_indices: + assert post_state.balances[index] > pre_state.balances[index] + else: + assert post_state.balances[index] < pre_state.balances[index] @with_all_phases