adding no compounding test

This commit is contained in:
james-prysm 2024-08-06 12:04:46 -05:00
parent 2cf7de96cd
commit 337726cbae
2 changed files with 43 additions and 1 deletions

View File

@ -101,6 +101,48 @@ def test_apply_pending_deposit_switch_to_compounding(spec, state):
assert current_credentials == compounding_credentials
@with_electra_and_later
@spec_state_test
def test_apply_pending_deposit_switch_to_compounding_no_compounding(spec, state):
amount = 100
# choose a value public key that's in the validator set
index = 0
withdrawal_credentials = (
spec.ETH1_ADDRESS_WITHDRAWAL_PREFIX +
spec.hash(pubkeys[index])[1:]
)
# wrong compounding
compounding_credentials = (
spec.hash(b"wrong compounding address")[:]
)
# advance the state
next_epoch_via_block(spec, state)
state.validators[index].withdrawal_credentials = withdrawal_credentials
# set validator to be exited by current epoch
state.validators[index].exit_epoch = spec.get_current_epoch(state) - 1
deposit_data = build_deposit_data(spec,
pubkeys[index],
privkeys[index],
amount,
compounding_credentials,
signed=True)
deposit = spec.PendingDeposit(
pubkey=pubkeys[index],
withdrawal_credentials=compounding_credentials,
amount=amount,
slot=spec.GENESIS_SLOT,
signature=deposit_data.signature,
)
state.balances[index] = 0
# run test
spec.apply_pending_deposit(state, deposit)
# validator balance should increase
assert state.balances[index] == amount
current_credentials = state.validators[0].withdrawal_credentials
assert current_credentials == withdrawal_credentials
@with_electra_and_later
@spec_state_test
def test_apply_pending_deposit_switch_to_compounding_has_bls(spec, state):

View File

@ -137,7 +137,7 @@ def test_new_deposit_non_versioned_withdrawal_credentials(spec, state):
def test_pending_deposit_eth1_bridge_pending(spec, state):
amount = spec.MIN_ACTIVATION_BALANCE
# There are pending Eth1 bridge deposits
# state.eth1_deposit_index < state.deposit_requests_start_index
# state.eth1_deposit_index < state.deposit_requests_start_index
state.deposit_requests_start_index = state.eth1_deposit_index + 1
index = 0
withdrawal_credentials = (