From 90bcbd6ff49cf1b836105e2e1e5345d054699dbc Mon Sep 17 00:00:00 2001 From: protolambda Date: Fri, 17 May 2019 21:56:41 +0200 Subject: [PATCH] fix attester slashing test --- .../test_process_attester_slashing.py | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/test_libs/pyspec/eth2spec/test/block_processing/test_process_attester_slashing.py b/test_libs/pyspec/eth2spec/test/block_processing/test_process_attester_slashing.py index ea3a31aea..01861f04c 100644 --- a/test_libs/pyspec/eth2spec/test/block_processing/test_process_attester_slashing.py +++ b/test_libs/pyspec/eth2spec/test/block_processing/test_process_attester_slashing.py @@ -46,17 +46,22 @@ def run_attester_slashing_processing(state, attester_slashing, valid=True): assert slashed_validator.exit_epoch < spec.FAR_FUTURE_EPOCH assert slashed_validator.withdrawable_epoch < spec.FAR_FUTURE_EPOCH - # lost whistleblower reward - assert ( - get_balance(state, slashed_index) < - pre_slashed_balance - ) + if slashed_index != proposer_index: + # lost whistleblower reward + assert ( + get_balance(state, slashed_index) < + pre_slashed_balance + ) - # gained whistleblower reward - assert ( - get_balance(state, proposer_index) > - pre_proposer_balance - ) + # gained whistleblower reward + assert ( + get_balance(state, proposer_index) > + pre_proposer_balance + ) + else: + # gained rewards for all slashings, which may include others. And only lost that of themselves. + # Netto at least 0, if more people where slashed, a balance increase. + assert get_balance(state, slashed_index) >= pre_slashed_balance yield 'post', state