From e07f1bc98ffe259175efd489b200606dc44fdca1 Mon Sep 17 00:00:00 2001 From: protolambda Date: Wed, 15 May 2019 18:45:25 +0200 Subject: [PATCH] update imports to new helpers + fix up imports --- .../block_processing/test_process_attestation.py | 16 ++++++++-------- .../test_process_attester_slashing.py | 6 +++--- .../test_process_block_header.py | 4 ++-- .../block_processing/test_process_deposit.py | 16 +++------------- .../test_process_proposer_slashing.py | 7 ++----- .../block_processing/test_process_transfer.py | 7 ++----- .../test_process_voluntary_exit.py | 8 ++------ .../pyspec/eth2spec/test/helpers/attestations.py | 2 -- test_libs/pyspec/eth2spec/test/helpers/block.py | 5 ++--- .../eth2spec/test/helpers/proposer_slashings.py | 1 - 10 files changed, 24 insertions(+), 48 deletions(-) diff --git a/test_libs/pyspec/eth2spec/test/block_processing/test_process_attestation.py b/test_libs/pyspec/eth2spec/test/block_processing/test_process_attestation.py index 98cb62ef7..7f8ac6e41 100644 --- a/test_libs/pyspec/eth2spec/test/block_processing/test_process_attestation.py +++ b/test_libs/pyspec/eth2spec/test/block_processing/test_process_attestation.py @@ -1,24 +1,24 @@ from copy import deepcopy import eth2spec.phase0.spec as spec - -from eth2spec.phase0.state_transition import ( - state_transition_to, -) from eth2spec.phase0.spec import ( get_current_epoch, process_attestation ) -from eth2spec.test.helpers import ( +from eth2spec.phase0.state_transition import ( + state_transition_to, +) +from eth2spec.test.context import spec_state_test, expect_assertion_error +from eth2spec.test.helpers.attestations import ( get_valid_attestation, + make_attestation_signature, +) +from eth2spec.test.helpers.state import ( apply_empty_block, next_epoch, next_slot, - make_attestation_signature, ) -from eth2spec.test.context import spec_state_test, expect_assertion_error - def run_attestation_processing(state, attestation, valid=True): """ diff --git a/test_libs/pyspec/eth2spec/test/block_processing/test_process_attester_slashing.py b/test_libs/pyspec/eth2spec/test/block_processing/test_process_attester_slashing.py index a0334c892..0bbdb7d4a 100644 --- a/test_libs/pyspec/eth2spec/test/block_processing/test_process_attester_slashing.py +++ b/test_libs/pyspec/eth2spec/test/block_processing/test_process_attester_slashing.py @@ -4,12 +4,12 @@ from eth2spec.phase0.spec import ( process_attester_slashing, ) from eth2spec.test.context import spec_state_test, expect_assertion_error -from eth2spec.test.helpers import ( +from eth2spec.test.helpers.attestations import make_indexed_attestation_signature +from eth2spec.test.helpers.attester_slashings import get_valid_attester_slashing +from eth2spec.test.helpers.state import ( get_balance, - get_valid_attester_slashing, next_epoch, apply_empty_block, - make_indexed_attestation_signature ) diff --git a/test_libs/pyspec/eth2spec/test/block_processing/test_process_block_header.py b/test_libs/pyspec/eth2spec/test/block_processing/test_process_block_header.py index f2695ad09..674f659a0 100644 --- a/test_libs/pyspec/eth2spec/test/block_processing/test_process_block_header.py +++ b/test_libs/pyspec/eth2spec/test/block_processing/test_process_block_header.py @@ -7,11 +7,11 @@ from eth2spec.phase0.spec import ( process_block_header, ) from eth2spec.test.context import spec_state_test, expect_assertion_error -from eth2spec.test.helpers import ( +from eth2spec.test.helpers.block import ( build_empty_block_for_next_slot, - next_slot, make_block_signature ) +from eth2spec.test.helpers.state import next_slot def prepare_state_for_header_processing(state): diff --git a/test_libs/pyspec/eth2spec/test/block_processing/test_process_deposit.py b/test_libs/pyspec/eth2spec/test/block_processing/test_process_deposit.py index fe2dae6a8..8f663c5c2 100644 --- a/test_libs/pyspec/eth2spec/test/block_processing/test_process_deposit.py +++ b/test_libs/pyspec/eth2spec/test/block_processing/test_process_deposit.py @@ -1,18 +1,8 @@ import eth2spec.phase0.spec as spec - -from eth2spec.phase0.spec import ( - ZERO_HASH, - process_deposit, -) -from eth2spec.test.helpers import ( - get_balance, - build_deposit, - prepare_state_and_deposit, - privkeys, - pubkeys, -) - +from eth2spec.phase0.spec import process_deposit from eth2spec.test.context import spec_state_test, expect_assertion_error +from eth2spec.test.helpers.deposits import prepare_state_and_deposit +from eth2spec.test.helpers.state import get_balance def run_deposit_processing(state, deposit, validator_index, valid=True): diff --git a/test_libs/pyspec/eth2spec/test/block_processing/test_process_proposer_slashing.py b/test_libs/pyspec/eth2spec/test/block_processing/test_process_proposer_slashing.py index 609c97ce6..6efed8685 100644 --- a/test_libs/pyspec/eth2spec/test/block_processing/test_process_proposer_slashing.py +++ b/test_libs/pyspec/eth2spec/test/block_processing/test_process_proposer_slashing.py @@ -3,12 +3,9 @@ from eth2spec.phase0.spec import ( get_current_epoch, process_proposer_slashing, ) -from eth2spec.test.helpers import ( - get_balance, - get_valid_proposer_slashing, -) - from eth2spec.test.context import spec_state_test, expect_assertion_error +from eth2spec.test.helpers.proposer_slashings import get_valid_proposer_slashing +from eth2spec.test.helpers.state import get_balance def run_proposer_slashing_processing(state, proposer_slashing, valid=True): diff --git a/test_libs/pyspec/eth2spec/test/block_processing/test_process_transfer.py b/test_libs/pyspec/eth2spec/test/block_processing/test_process_transfer.py index 64539d56e..fed948e63 100644 --- a/test_libs/pyspec/eth2spec/test/block_processing/test_process_transfer.py +++ b/test_libs/pyspec/eth2spec/test/block_processing/test_process_transfer.py @@ -6,11 +6,8 @@ from eth2spec.phase0.spec import ( process_transfer, ) from eth2spec.test.context import spec_state_test, expect_assertion_error -from eth2spec.test.helpers import ( - get_valid_transfer, - next_epoch, - apply_empty_block -) +from eth2spec.test.helpers.state import next_epoch, apply_empty_block +from eth2spec.test.helpers.transfers import get_valid_transfer def run_transfer_processing(state, transfer, valid=True): diff --git a/test_libs/pyspec/eth2spec/test/block_processing/test_process_voluntary_exit.py b/test_libs/pyspec/eth2spec/test/block_processing/test_process_voluntary_exit.py index be0ef1e7a..f842d8b07 100644 --- a/test_libs/pyspec/eth2spec/test/block_processing/test_process_voluntary_exit.py +++ b/test_libs/pyspec/eth2spec/test/block_processing/test_process_voluntary_exit.py @@ -1,17 +1,13 @@ import eth2spec.phase0.spec as spec - from eth2spec.phase0.spec import ( get_active_validator_indices, get_churn_limit, get_current_epoch, process_voluntary_exit, ) -from eth2spec.test.helpers import ( - build_voluntary_exit, - pubkey_to_privkey, -) - from eth2spec.test.context import spec_state_test, expect_assertion_error +from eth2spec.test.helpers.keys import pubkey_to_privkey +from eth2spec.test.helpers.voluntary_exits import build_voluntary_exit def run_voluntary_exit_processing(state, voluntary_exit, valid=True): diff --git a/test_libs/pyspec/eth2spec/test/helpers/attestations.py b/test_libs/pyspec/eth2spec/test/helpers/attestations.py index d7fab4c17..ebc76c27f 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/attestations.py +++ b/test_libs/pyspec/eth2spec/test/helpers/attestations.py @@ -2,14 +2,12 @@ from typing import List # Access constants from spec pkg reference. import eth2spec.phase0.spec as spec - from eth2spec.phase0.spec import ( Attestation, AttestationData, AttestationDataAndCustodyBit, get_epoch_start_slot, get_block_root, get_current_epoch, get_previous_epoch, slot_to_epoch, get_shard_delta, get_crosslink_committee, get_domain, IndexedAttestation, get_attesting_indices, BeaconState, get_block_root_at_slot) - from eth2spec.phase0.state_transition import ( state_transition, state_transition_to ) diff --git a/test_libs/pyspec/eth2spec/test/helpers/block.py b/test_libs/pyspec/eth2spec/test/helpers/block.py index 906901867..25874e75b 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/block.py +++ b/test_libs/pyspec/eth2spec/test/helpers/block.py @@ -1,8 +1,7 @@ -from eth2spec.phase0 import spec -from eth2spec.phase0.spec import get_beacon_proposer_index, slot_to_epoch, get_domain, BeaconBlock - from copy import deepcopy +from eth2spec.phase0 import spec +from eth2spec.phase0.spec import get_beacon_proposer_index, slot_to_epoch, get_domain, BeaconBlock from eth2spec.test.helpers.keys import privkeys from eth2spec.test.helpers.state import next_slot from eth2spec.utils.bls import bls_sign diff --git a/test_libs/pyspec/eth2spec/test/helpers/proposer_slashings.py b/test_libs/pyspec/eth2spec/test/helpers/proposer_slashings.py index be4f32d1c..d14621b1c 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/proposer_slashings.py +++ b/test_libs/pyspec/eth2spec/test/helpers/proposer_slashings.py @@ -2,7 +2,6 @@ from copy import deepcopy # Access constants from spec pkg reference. import eth2spec.phase0.spec as spec - from eth2spec.phase0.spec import get_current_epoch, get_active_validator_indices, BeaconBlockHeader, ZERO_HASH, \ get_domain, ProposerSlashing from eth2spec.test.helpers.keys import pubkey_to_privkey