diff --git a/beacon_node/beacon_chain/test_harness/src/test_case.rs b/beacon_node/beacon_chain/test_harness/src/test_case.rs index a18b4688b..b6b1ea5cc 100644 --- a/beacon_node/beacon_chain/test_harness/src/test_case.rs +++ b/beacon_node/beacon_chain/test_harness/src/test_case.rs @@ -9,9 +9,7 @@ use ssz::SignedRoot; use std::path::Path; use types::*; -use types::{ - attester_slashing::AttesterSlashingBuilder, proposer_slashing::ProposerSlashingBuilder, -}; +use types::test_utils::{TestingAttesterSlashingBuilder, TestingProposerSlashingBuilder}; use yaml_rust::Yaml; mod config; @@ -331,7 +329,7 @@ fn build_double_vote_attester_slashing( .expect("Unable to sign AttesterSlashing") }; - AttesterSlashingBuilder::double_vote(validator_indices, signer) + TestingAttesterSlashingBuilder::double_vote(validator_indices, signer) } /// Builds an `ProposerSlashing` for some `validator_index`. @@ -344,5 +342,5 @@ fn build_proposer_slashing(harness: &BeaconChainHarness, validator_index: u64) - .expect("Unable to sign AttesterSlashing") }; - ProposerSlashingBuilder::double_vote(validator_index, signer, &harness.spec) + TestingProposerSlashingBuilder::double_vote(validator_index, signer, &harness.spec) } diff --git a/eth2/types/src/attester_slashing.rs b/eth2/types/src/attester_slashing.rs index 1cb671960..7a0752b6a 100644 --- a/eth2/types/src/attester_slashing.rs +++ b/eth2/types/src/attester_slashing.rs @@ -4,10 +4,6 @@ use serde_derive::Serialize; use ssz_derive::{Decode, Encode, TreeHash}; use test_random_derive::TestRandom; -mod builder; - -pub use builder::AttesterSlashingBuilder; - /// Two conflicting attestations. /// /// Spec v0.4.0 diff --git a/eth2/types/src/proposer_slashing.rs b/eth2/types/src/proposer_slashing.rs index f86e7f3a8..394c55a01 100644 --- a/eth2/types/src/proposer_slashing.rs +++ b/eth2/types/src/proposer_slashing.rs @@ -5,10 +5,6 @@ use serde_derive::Serialize; use ssz_derive::{Decode, Encode, TreeHash}; use test_random_derive::TestRandom; -mod builder; - -pub use builder::ProposerSlashingBuilder; - /// Two conflicting proposals from the same proposer (validator). /// /// Spec v0.4.0 diff --git a/eth2/types/src/test_utils/mod.rs b/eth2/types/src/test_utils/mod.rs index 26d340e7d..6fdbe53ad 100644 --- a/eth2/types/src/test_utils/mod.rs +++ b/eth2/types/src/test_utils/mod.rs @@ -2,9 +2,11 @@ mod generate_deterministic_keypairs; mod keypairs_file; mod test_random; mod testing_attestation_builder; +mod testing_attester_slashing_builder; mod testing_beacon_block_builder; mod testing_beacon_state_builder; mod testing_deposit_builder; +mod testing_proposer_slashing_builder; mod testing_transfer_builder; mod testing_voluntary_exit_builder; @@ -13,8 +15,10 @@ pub use keypairs_file::KeypairsFile; pub use rand::{prng::XorShiftRng, SeedableRng}; pub use test_random::TestRandom; pub use testing_attestation_builder::TestingAttestationBuilder; +pub use testing_attester_slashing_builder::TestingAttesterSlashingBuilder; pub use testing_beacon_block_builder::TestingBeaconBlockBuilder; pub use testing_beacon_state_builder::{keypairs_path, TestingBeaconStateBuilder}; pub use testing_deposit_builder::TestingDepositBuilder; +pub use testing_proposer_slashing_builder::TestingProposerSlashingBuilder; pub use testing_transfer_builder::TestingTransferBuilder; pub use testing_voluntary_exit_builder::TestingVoluntaryExitBuilder; diff --git a/eth2/types/src/attester_slashing/builder.rs b/eth2/types/src/test_utils/testing_attester_slashing_builder.rs similarity index 97% rename from eth2/types/src/attester_slashing/builder.rs rename to eth2/types/src/test_utils/testing_attester_slashing_builder.rs index 8edf4ed65..d9da3db2d 100644 --- a/eth2/types/src/attester_slashing/builder.rs +++ b/eth2/types/src/test_utils/testing_attester_slashing_builder.rs @@ -2,9 +2,9 @@ use crate::*; use ssz::TreeHash; /// Builds an `AttesterSlashing`. -pub struct AttesterSlashingBuilder(); +pub struct TestingAttesterSlashingBuilder(); -impl AttesterSlashingBuilder { +impl TestingAttesterSlashingBuilder { /// Builds an `AttesterSlashing` that is a double vote. /// /// The `signer` function is used to sign the double-vote and accepts: diff --git a/eth2/types/src/test_utils/testing_beacon_block_builder.rs b/eth2/types/src/test_utils/testing_beacon_block_builder.rs index bbdc5046b..3ebd24b0a 100644 --- a/eth2/types/src/test_utils/testing_beacon_block_builder.rs +++ b/eth2/types/src/test_utils/testing_beacon_block_builder.rs @@ -1,9 +1,7 @@ use crate::{ - attester_slashing::AttesterSlashingBuilder, - proposer_slashing::ProposerSlashingBuilder, test_utils::{ - TestingAttestationBuilder, TestingDepositBuilder, TestingTransferBuilder, - TestingVoluntaryExitBuilder, + TestingAttestationBuilder, TestingAttesterSlashingBuilder, TestingDepositBuilder, + TestingProposerSlashingBuilder, TestingTransferBuilder, TestingVoluntaryExitBuilder, }, *, }; @@ -232,7 +230,7 @@ fn build_proposer_slashing( Signature::new(message, domain, secret_key) }; - ProposerSlashingBuilder::double_vote(validator_index, signer, spec) + TestingProposerSlashingBuilder::double_vote(validator_index, signer, spec) } /// Builds an `AttesterSlashing` for some `validator_indices`. @@ -253,5 +251,5 @@ fn build_double_vote_attester_slashing( Signature::new(message, domain, secret_keys[key_index]) }; - AttesterSlashingBuilder::double_vote(validator_indices, signer) + TestingAttesterSlashingBuilder::double_vote(validator_indices, signer) } diff --git a/eth2/types/src/proposer_slashing/builder.rs b/eth2/types/src/test_utils/testing_proposer_slashing_builder.rs similarity index 95% rename from eth2/types/src/proposer_slashing/builder.rs rename to eth2/types/src/test_utils/testing_proposer_slashing_builder.rs index 472a76ec1..43ff3d0b7 100644 --- a/eth2/types/src/proposer_slashing/builder.rs +++ b/eth2/types/src/test_utils/testing_proposer_slashing_builder.rs @@ -2,9 +2,9 @@ use crate::*; use ssz::SignedRoot; /// Builds a `ProposerSlashing`. -pub struct ProposerSlashingBuilder(); +pub struct TestingProposerSlashingBuilder(); -impl ProposerSlashingBuilder { +impl TestingProposerSlashingBuilder { /// Builds a `ProposerSlashing` that is a double vote. /// /// The `signer` function is used to sign the double-vote and accepts: