Make attester/proposer slashing builders test-only

They didn't do anything useful or safe for production.
This commit is contained in:
Paul Hauner 2019-03-12 17:30:00 +11:00
parent 9057b436f3
commit dc221f3220
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6
7 changed files with 15 additions and 23 deletions

View File

@ -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)
}

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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:

View File

@ -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)
}

View File

@ -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: