mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-02 16:05:00 -05:00
Start fixing tests
This commit is contained in:
@@ -5,11 +5,9 @@ import eth2spec.phase0.spec as spec
|
||||
|
||||
from eth2spec.phase0.spec import (
|
||||
get_active_validator_indices,
|
||||
get_balance,
|
||||
get_beacon_proposer_index,
|
||||
get_current_epoch,
|
||||
process_transfer,
|
||||
set_balance,
|
||||
)
|
||||
from tests.helpers import (
|
||||
get_valid_transfer,
|
||||
@@ -75,7 +73,7 @@ def test_success_withdrawable(state):
|
||||
def test_success_active_above_max_effective(state):
|
||||
sender_index = get_active_validator_indices(state, get_current_epoch(state))[-1]
|
||||
amount = spec.MAX_EFFECTIVE_BALANCE // 32
|
||||
set_balance(state, sender_index, spec.MAX_EFFECTIVE_BALANCE + amount)
|
||||
state.validator_registry[sender_index] = spec.MAX_EFFECTIVE_BALANCE + amount
|
||||
transfer = get_valid_transfer(state, sender_index=sender_index, amount=amount, fee=0)
|
||||
|
||||
pre_state, post_state = run_transfer_processing(state, transfer)
|
||||
@@ -86,7 +84,7 @@ def test_success_active_above_max_effective(state):
|
||||
def test_active_but_transfer_past_effective_balance(state):
|
||||
sender_index = get_active_validator_indices(state, get_current_epoch(state))[-1]
|
||||
amount = spec.MAX_EFFECTIVE_BALANCE // 32
|
||||
set_balance(state, sender_index, spec.MAX_EFFECTIVE_BALANCE)
|
||||
state.validator_registry[sender_index] = spec.MAX_EFFECTIVE_BALANCE
|
||||
transfer = get_valid_transfer(state, sender_index=sender_index, amount=amount, fee=0)
|
||||
|
||||
pre_state, post_state = run_transfer_processing(state, transfer, False)
|
||||
@@ -107,7 +105,7 @@ def test_incorrect_slot(state):
|
||||
def test_insufficient_balance(state):
|
||||
sender_index = get_active_validator_indices(state, get_current_epoch(state))[-1]
|
||||
amount = spec.MAX_EFFECTIVE_BALANCE
|
||||
set_balance(state, sender_index, spec.MAX_EFFECTIVE_BALANCE)
|
||||
state.validator_registry[sender_index] = spec.MAX_EFFECTIVE_BALANCE
|
||||
transfer = get_valid_transfer(state, sender_index=sender_index, amount=amount + 1, fee=0)
|
||||
|
||||
# un-activate so validator can transfer
|
||||
@@ -140,4 +138,4 @@ def test_invalid_pubkey(state):
|
||||
|
||||
pre_state, post_state = run_transfer_processing(state, transfer, False)
|
||||
|
||||
return pre_state, transfer, post_state
|
||||
return pre_state, transfer, post_state
|
||||
|
||||
@@ -26,7 +26,6 @@ from eth2spec.phase0.spec import (
|
||||
# functions
|
||||
convert_to_indexed,
|
||||
get_active_validator_indices,
|
||||
get_balance,
|
||||
get_attesting_indices,
|
||||
get_block_root,
|
||||
get_crosslink_committees_at_slot,
|
||||
|
||||
Reference in New Issue
Block a user