-
Notifications
You must be signed in to change notification settings - Fork 997
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2998 from ethereum/remove-withdrawn-epoch
remove withdrawn_epoch
- Loading branch information
Showing
10 changed files
with
237 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
tests/core/pyspec/eth2spec/test/capella/block_processing/test_process_deposit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from eth2spec.test.context import ( | ||
spec_state_test, | ||
with_capella_and_later, | ||
) | ||
from eth2spec.test.helpers.state import next_epoch_via_block | ||
from eth2spec.test.helpers.deposits import ( | ||
prepare_state_and_deposit, | ||
run_deposit_processing, | ||
) | ||
from eth2spec.test.helpers.withdrawals import set_validator_fully_withdrawable | ||
|
||
|
||
@with_capella_and_later | ||
@spec_state_test | ||
def test_success_top_up_to_withdrawn_validator(spec, state): | ||
validator_index = 0 | ||
|
||
# Fully withdraw validator | ||
set_validator_fully_withdrawable(spec, state, validator_index) | ||
assert state.balances[validator_index] > 0 | ||
next_epoch_via_block(spec, state) | ||
assert state.balances[validator_index] == 0 | ||
assert state.validators[validator_index].effective_balance > 0 | ||
next_epoch_via_block(spec, state) | ||
assert state.validators[validator_index].effective_balance == 0 | ||
|
||
# Make a top-up balance to validator | ||
amount = spec.MAX_EFFECTIVE_BALANCE // 4 | ||
deposit = prepare_state_and_deposit(spec, state, validator_index, amount, signed=True) | ||
|
||
yield from run_deposit_processing(spec, state, deposit, validator_index) | ||
|
||
assert state.balances[validator_index] == amount | ||
assert state.validators[validator_index].effective_balance == 0 | ||
|
||
validator = state.validators[validator_index] | ||
balance = state.balances[validator_index] | ||
current_epoch = spec.get_current_epoch(state) | ||
assert spec.is_fully_withdrawable_validator(validator, balance, current_epoch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.