Fixes custody key reveal test bug
This commit is contained in:
parent
58a137e81c
commit
4c1b9ef6d6
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ def run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, v
|
||||||
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)
|
||||||
|
|
||||||
slashed_validator = state.validator_registry[randao_key_reveal.revealed_index]
|
slashed_validator = state.validator_registry[randao_key_reveal.revealed_index]
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue