not signed by default
This commit is contained in:
parent
b6b5787931
commit
b12031b48d
|
@ -75,7 +75,7 @@ def test_success_previous_epoch(state):
|
|||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_attestation_signature(state):
|
||||
attestation = get_valid_attestation(state, signed=False)
|
||||
attestation = get_valid_attestation(state)
|
||||
state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY
|
||||
|
||||
yield from run_attestation_processing(state, attestation, False)
|
||||
|
@ -105,7 +105,7 @@ def test_old_source_epoch(state):
|
|||
state.finalized_epoch = 2
|
||||
state.previous_justified_epoch = 3
|
||||
state.current_justified_epoch = 4
|
||||
attestation = get_valid_attestation(state, slot=(spec.SLOTS_PER_EPOCH * 3) + 1, signed=False)
|
||||
attestation = get_valid_attestation(state, slot=(spec.SLOTS_PER_EPOCH * 3) + 1)
|
||||
|
||||
# test logic sanity check: make sure the attestation is pointing to oldest known source epoch
|
||||
assert attestation.data.source_epoch == state.previous_justified_epoch
|
||||
|
@ -120,7 +120,7 @@ def test_old_source_epoch(state):
|
|||
|
||||
@spec_state_test
|
||||
def test_wrong_shard(state):
|
||||
attestation = get_valid_attestation(state, signed=False)
|
||||
attestation = get_valid_attestation(state)
|
||||
state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY
|
||||
|
||||
attestation.data.shard += 1
|
||||
|
@ -132,7 +132,7 @@ def test_wrong_shard(state):
|
|||
|
||||
@spec_state_test
|
||||
def test_new_source_epoch(state):
|
||||
attestation = get_valid_attestation(state, signed=False)
|
||||
attestation = get_valid_attestation(state)
|
||||
state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY
|
||||
|
||||
attestation.data.source_epoch += 1
|
||||
|
@ -144,7 +144,7 @@ def test_new_source_epoch(state):
|
|||
|
||||
@spec_state_test
|
||||
def test_source_root_is_target_root(state):
|
||||
attestation = get_valid_attestation(state, signed=False)
|
||||
attestation = get_valid_attestation(state)
|
||||
state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY
|
||||
|
||||
attestation.data.source_root = attestation.data.target_root
|
||||
|
@ -165,7 +165,7 @@ def test_invalid_current_source_root(state):
|
|||
state.current_justified_epoch = 4
|
||||
state.current_justified_root = b'\xff' * 32
|
||||
|
||||
attestation = get_valid_attestation(state, slot=(spec.SLOTS_PER_EPOCH * 3) + 1, signed=False)
|
||||
attestation = get_valid_attestation(state, slot=(spec.SLOTS_PER_EPOCH * 3) + 1)
|
||||
state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY
|
||||
|
||||
# Test logic sanity checks:
|
||||
|
@ -182,7 +182,7 @@ def test_invalid_current_source_root(state):
|
|||
|
||||
@spec_state_test
|
||||
def test_bad_source_root(state):
|
||||
attestation = get_valid_attestation(state, signed=False)
|
||||
attestation = get_valid_attestation(state)
|
||||
state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY
|
||||
|
||||
attestation.data.source_root = b'\x42' * 32
|
||||
|
@ -194,7 +194,7 @@ def test_bad_source_root(state):
|
|||
|
||||
@spec_state_test
|
||||
def test_non_zero_crosslink_data_root(state):
|
||||
attestation = get_valid_attestation(state, signed=False)
|
||||
attestation = get_valid_attestation(state)
|
||||
state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY
|
||||
|
||||
attestation.data.crosslink_data_root = b'\x42' * 32
|
||||
|
@ -221,7 +221,7 @@ def test_bad_previous_crosslink(state):
|
|||
|
||||
@spec_state_test
|
||||
def test_inconsistent_bitfields(state):
|
||||
attestation = get_valid_attestation(state, signed=False)
|
||||
attestation = get_valid_attestation(state)
|
||||
state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY
|
||||
|
||||
attestation.custody_bitfield = deepcopy(attestation.aggregation_bitfield) + b'\x00'
|
||||
|
@ -233,7 +233,7 @@ def test_inconsistent_bitfields(state):
|
|||
|
||||
@spec_state_test
|
||||
def test_non_empty_custody_bitfield(state):
|
||||
attestation = get_valid_attestation(state, signed=False)
|
||||
attestation = get_valid_attestation(state)
|
||||
state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY
|
||||
|
||||
attestation.custody_bitfield = deepcopy(attestation.aggregation_bitfield)
|
||||
|
@ -245,7 +245,7 @@ def test_non_empty_custody_bitfield(state):
|
|||
|
||||
@spec_state_test
|
||||
def test_empty_aggregation_bitfield(state):
|
||||
attestation = get_valid_attestation(state, signed=False)
|
||||
attestation = get_valid_attestation(state)
|
||||
state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY
|
||||
|
||||
attestation.aggregation_bitfield = b'\x00' * len(attestation.aggregation_bitfield)
|
||||
|
|
|
@ -50,13 +50,13 @@ def test_success_block_header(state):
|
|||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_sig_block_header(state):
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
yield from run_block_header_processing(state, block, valid=False)
|
||||
|
||||
|
||||
@spec_state_test
|
||||
def test_invalid_slot_block_header(state):
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.slot = state.slot + 2 # invalid slot
|
||||
sign_block(state, block)
|
||||
|
||||
|
@ -65,7 +65,7 @@ def test_invalid_slot_block_header(state):
|
|||
|
||||
@spec_state_test
|
||||
def test_invalid_previous_block_root(state):
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.previous_block_root = b'\12' * 32 # invalid prev root
|
||||
sign_block(state, block)
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ def test_invalid_sig_new_deposit(state):
|
|||
# fresh deposit = next validator index = validator appended to registry
|
||||
validator_index = len(state.validator_registry)
|
||||
amount = spec.MAX_EFFECTIVE_BALANCE
|
||||
deposit = prepare_state_and_deposit(state, validator_index, amount, signed=False)
|
||||
deposit = prepare_state_and_deposit(state, validator_index, amount)
|
||||
yield from run_deposit_processing(state, deposit, validator_index, valid=True, effective=False)
|
||||
|
||||
|
||||
|
@ -87,7 +87,7 @@ def test_success_top_up(state):
|
|||
def test_invalid_sig_top_up(state):
|
||||
validator_index = 0
|
||||
amount = spec.MAX_EFFECTIVE_BALANCE // 4
|
||||
deposit = prepare_state_and_deposit(state, validator_index, amount, signed=False)
|
||||
deposit = prepare_state_and_deposit(state, validator_index, amount)
|
||||
|
||||
# invalid signatures, in top-ups, are allowed!
|
||||
yield from run_deposit_processing(state, deposit, validator_index, valid=True, effective=True)
|
||||
|
@ -97,7 +97,7 @@ def test_invalid_sig_top_up(state):
|
|||
def test_wrong_index(state):
|
||||
validator_index = len(state.validator_registry)
|
||||
amount = spec.MAX_EFFECTIVE_BALANCE
|
||||
deposit = prepare_state_and_deposit(state, validator_index, amount, signed=False)
|
||||
deposit = prepare_state_and_deposit(state, validator_index, amount)
|
||||
|
||||
# mess up deposit_index
|
||||
deposit.index = state.deposit_index + 1
|
||||
|
@ -114,7 +114,7 @@ def test_wrong_index(state):
|
|||
def test_bad_merkle_proof(state):
|
||||
validator_index = len(state.validator_registry)
|
||||
amount = spec.MAX_EFFECTIVE_BALANCE
|
||||
deposit = prepare_state_and_deposit(state, validator_index, amount, signed=False)
|
||||
deposit = prepare_state_and_deposit(state, validator_index, amount)
|
||||
|
||||
# mess up merkle branch
|
||||
deposit.proof[-1] = spec.ZERO_HASH
|
||||
|
|
|
@ -86,7 +86,7 @@ def test_success_active_above_max_effective_fee(state):
|
|||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_signature(state):
|
||||
transfer = get_valid_transfer(state, signed=False)
|
||||
transfer = get_valid_transfer(state)
|
||||
# un-activate so validator can transfer
|
||||
state.validator_registry[transfer.sender].activation_eligibility_epoch = spec.FAR_FUTURE_EPOCH
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ def test_invalid_signature(state):
|
|||
validator_index = get_active_validator_indices(state, current_epoch)[0]
|
||||
privkey = pubkey_to_privkey[state.validator_registry[validator_index].pubkey]
|
||||
|
||||
voluntary_exit = build_voluntary_exit(state, current_epoch, validator_index, privkey, signed=False)
|
||||
voluntary_exit = build_voluntary_exit(state, current_epoch, validator_index, privkey)
|
||||
|
||||
yield from run_voluntary_exit_processing(state, voluntary_exit, False)
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ def run_process_crosslinks(state, valid=True):
|
|||
"""
|
||||
# transition state to slot before state transition
|
||||
slot = state.slot + (spec.SLOTS_PER_EPOCH - state.slot % spec.SLOTS_PER_EPOCH) - 1
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.slot = slot
|
||||
sign_block(state, block)
|
||||
state_transition(state, block)
|
||||
|
@ -119,7 +119,7 @@ def test_double_late_crosslink(state):
|
|||
add_attestation_to_state(state, attestation_1, state.slot + 1)
|
||||
|
||||
for slot in range(spec.SLOTS_PER_EPOCH):
|
||||
attestation_2 = get_valid_attestation(state, signed=False)
|
||||
attestation_2 = get_valid_attestation(state)
|
||||
if attestation_2.data.shard == attestation_1.data.shard:
|
||||
sign_attestation(state, attestation_2)
|
||||
break
|
||||
|
|
|
@ -20,7 +20,7 @@ def run_process_registry_updates(state, valid=True):
|
|||
"""
|
||||
# transition state to slot before state transition
|
||||
slot = state.slot + (spec.SLOTS_PER_EPOCH - state.slot % spec.SLOTS_PER_EPOCH) - 1
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.slot = slot
|
||||
sign_block(state, block)
|
||||
state_transition(state, block)
|
||||
|
|
|
@ -138,7 +138,7 @@ def fill_aggregate_attestation(state, attestation):
|
|||
|
||||
|
||||
def add_attestation_to_state(state, attestation, slot):
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.slot = slot
|
||||
block.body.attestations.append(attestation)
|
||||
state_transition_to(state, block.slot)
|
||||
|
|
|
@ -53,7 +53,7 @@ def test_skipped_slots(state):
|
|||
pre_slot = state.slot
|
||||
yield 'pre', state
|
||||
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.slot += 3
|
||||
sign_block(state, block)
|
||||
yield 'blocks', [block], [spec.BeaconBlock]
|
||||
|
@ -71,7 +71,7 @@ def test_empty_epoch_transition(state):
|
|||
pre_slot = state.slot
|
||||
yield 'pre', state
|
||||
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.slot += spec.SLOTS_PER_EPOCH
|
||||
sign_block(state, block)
|
||||
yield 'blocks', [block], [spec.BeaconBlock]
|
||||
|
@ -90,7 +90,7 @@ def test_empty_epoch_transition(state):
|
|||
# pre_state = deepcopy(state)
|
||||
# yield 'pre', state
|
||||
#
|
||||
# block = build_empty_block_for_next_slot(state, signed=False)
|
||||
# block = build_empty_block_for_next_slot(state)
|
||||
# block.slot += spec.SLOTS_PER_EPOCH * 5
|
||||
# sign_block(state, block, proposer_index=0)
|
||||
# yield 'blocks', [block], [spec.BeaconBlock]
|
||||
|
@ -118,7 +118,7 @@ def test_proposer_slashing(state):
|
|||
#
|
||||
# Add to state via block transition
|
||||
#
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.body.proposer_slashings.append(proposer_slashing)
|
||||
sign_block(state, block)
|
||||
yield 'blocks', [block], [spec.BeaconBlock]
|
||||
|
@ -151,7 +151,7 @@ def test_attester_slashing(state):
|
|||
#
|
||||
# Add to state via block transition
|
||||
#
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.body.attester_slashings.append(attester_slashing)
|
||||
sign_block(state, block)
|
||||
yield 'blocks', [block], [spec.BeaconBlock]
|
||||
|
@ -187,7 +187,7 @@ def test_deposit_in_block(state):
|
|||
|
||||
yield 'pre', state
|
||||
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.body.deposits.append(deposit)
|
||||
sign_block(state, block)
|
||||
|
||||
|
@ -214,7 +214,7 @@ def test_deposit_top_up(state):
|
|||
|
||||
yield 'pre', state
|
||||
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.body.deposits.append(deposit)
|
||||
sign_block(state, block)
|
||||
|
||||
|
@ -238,7 +238,7 @@ def test_attestation(state):
|
|||
|
||||
# Add to state via block transition
|
||||
pre_current_attestations_len = len(state.current_epoch_attestations)
|
||||
attestation_block = build_empty_block_for_next_slot(state, signed=False)
|
||||
attestation_block = build_empty_block_for_next_slot(state)
|
||||
attestation_block.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY
|
||||
attestation_block.body.attestations.append(attestation)
|
||||
sign_block(state, attestation_block)
|
||||
|
@ -249,7 +249,7 @@ def test_attestation(state):
|
|||
# Epoch transition should move to previous_epoch_attestations
|
||||
pre_current_attestations_root = spec.hash_tree_root(state.current_epoch_attestations)
|
||||
|
||||
epoch_block = build_empty_block_for_next_slot(state, signed=False)
|
||||
epoch_block = build_empty_block_for_next_slot(state)
|
||||
epoch_block.slot += spec.SLOTS_PER_EPOCH
|
||||
sign_block(state, epoch_block)
|
||||
state_transition(state, epoch_block)
|
||||
|
@ -287,7 +287,7 @@ def test_voluntary_exit(state):
|
|||
)
|
||||
|
||||
# Add to state via block transition
|
||||
initiate_exit_block = build_empty_block_for_next_slot(state, signed=False)
|
||||
initiate_exit_block = build_empty_block_for_next_slot(state)
|
||||
initiate_exit_block.body.voluntary_exits.append(voluntary_exit)
|
||||
sign_block(state, initiate_exit_block)
|
||||
state_transition(state, initiate_exit_block)
|
||||
|
@ -295,7 +295,7 @@ def test_voluntary_exit(state):
|
|||
assert state.validator_registry[validator_index].exit_epoch < spec.FAR_FUTURE_EPOCH
|
||||
|
||||
# Process within epoch transition
|
||||
exit_block = build_empty_block_for_next_slot(state, signed=False)
|
||||
exit_block = build_empty_block_for_next_slot(state)
|
||||
exit_block.slot += spec.SLOTS_PER_EPOCH
|
||||
sign_block(state, exit_block)
|
||||
state_transition(state, exit_block)
|
||||
|
@ -324,7 +324,7 @@ def test_transfer(state):
|
|||
yield 'pre', state
|
||||
|
||||
# Add to state via block transition
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.body.transfers.append(transfer)
|
||||
sign_block(state, block)
|
||||
|
||||
|
@ -352,7 +352,7 @@ def test_balance_driven_status_transitions(state):
|
|||
yield 'pre', state
|
||||
|
||||
# trigger epoch transition
|
||||
block = build_empty_block_for_next_slot(state, signed=False)
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.slot += spec.SLOTS_PER_EPOCH
|
||||
sign_block(state, block)
|
||||
state_transition(state, block)
|
||||
|
@ -390,13 +390,13 @@ def test_historical_batch(state):
|
|||
#
|
||||
# blocks = []
|
||||
# for _ in range(spec.SLOTS_PER_ETH1_VOTING_PERIOD - 1):
|
||||
# block = build_empty_block_for_next_slot(state, signed=False)
|
||||
# block = build_empty_block_for_next_slot(state)
|
||||
# state_transition(state, block)
|
||||
# expected_votes += 1
|
||||
# assert len(state.eth1_data_votes) == expected_votes
|
||||
# blocks.append(block)
|
||||
#
|
||||
# block = build_empty_block_for_next_slot(state, signed=False)
|
||||
# block = build_empty_block_for_next_slot(state)
|
||||
# blocks.append(block)
|
||||
#
|
||||
# state_transition(state, block)
|
||||
|
|
Loading…
Reference in New Issue