From f35106d9eec822dd02ca768dc5bc5918a6ad05ba Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Tue, 5 May 2020 09:43:25 -0600 Subject: [PATCH] add comment for helper -- has_enouh_for_reward --- tests/core/pyspec/eth2spec/test/helpers/rewards.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/core/pyspec/eth2spec/test/helpers/rewards.py b/tests/core/pyspec/eth2spec/test/helpers/rewards.py index 09c99c3ac..1b428891b 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/rewards.py +++ b/tests/core/pyspec/eth2spec/test/helpers/rewards.py @@ -10,6 +10,12 @@ class Deltas(Container): def has_enough_for_reward(spec, state, index): + """ + Check if base_reward will be non-zero. + + At very low balances, it is possible for a validator have a positive effective_balance + but a zero base reward. + """ return ( state.validators[index].effective_balance * spec.BASE_REWARD_FACTOR > spec.integer_squareroot(spec.get_total_active_balance(state)) // spec.BASE_REWARDS_PER_EPOCH