Fixes custody key reveal test bug

This commit is contained in:
Carl Beekhuizen 2019-06-06 11:04:55 +02:00
parent 58a137e81c
commit 4c1b9ef6d6
No known key found for this signature in database
GPG Key ID: D05CA176D0020646
1 changed files with 5 additions and 7 deletions

View File

@ -1,6 +1,6 @@
from eth2spec.test.helpers.custody import get_valid_early_derived_secret_reveal from eth2spec.test.helpers.custody import get_valid_early_derived_secret_reveal
from eth2spec.test.helpers.block import apply_empty_block from eth2spec.test.helpers.block import apply_empty_block
from eth2spec.test.helpers.state import next_epoch from eth2spec.test.helpers.state import next_epoch, get_balance
from eth2spec.test.context import with_phase1, spec_state_test, expect_assertion_error from eth2spec.test.context import with_phase1, spec_state_test, expect_assertion_error
@ -19,6 +19,8 @@ def run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, v
expect_assertion_error(lambda: spec.process_early_derived_secret_reveal(state, randao_key_reveal)) expect_assertion_error(lambda: spec.process_early_derived_secret_reveal(state, randao_key_reveal))
yield 'post', None yield 'post', None
return return
pre_slashed_balance = get_balance(state, randao_key_reveal.revealed_index)
spec.process_early_derived_secret_reveal(state, randao_key_reveal) spec.process_early_derived_secret_reveal(state, randao_key_reveal)
@ -28,12 +30,8 @@ def run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, v
assert slashed_validator.slashed assert slashed_validator.slashed
assert slashed_validator.exit_epoch < spec.FAR_FUTURE_EPOCH assert slashed_validator.exit_epoch < spec.FAR_FUTURE_EPOCH
assert slashed_validator.withdrawable_epoch < spec.FAR_FUTURE_EPOCH assert slashed_validator.withdrawable_epoch < spec.FAR_FUTURE_EPOCH
# lost whistleblower reward
# FIXME: Currently broken because get_base_reward in genesis epoch is 0 assert get_balance(state, randao_key_reveal.revealed_index) < pre_slashed_balance
# assert (
# state.balances[randao_key_reveal.revealed_index] <
# state.balances[randao_key_reveal.revealed_index]
# )
yield 'post', state yield 'post', state