From ec20493f01f8df332acaae5b7f60f8e203a8e04a Mon Sep 17 00:00:00 2001 From: Stan Drozd Date: Fri, 28 Dec 2018 09:28:11 +0100 Subject: [PATCH] types: delete ChainConfig --- beacon_chain/types/src/chain_config.rs | 72 -------------------------- beacon_chain/types/src/lib.rs | 2 - 2 files changed, 74 deletions(-) delete mode 100644 beacon_chain/types/src/chain_config.rs diff --git a/beacon_chain/types/src/chain_config.rs b/beacon_chain/types/src/chain_config.rs deleted file mode 100644 index 8428945bb..000000000 --- a/beacon_chain/types/src/chain_config.rs +++ /dev/null @@ -1,72 +0,0 @@ -use super::ValidatorRegistration; - -#[derive(Debug, Clone, PartialEq)] -pub struct ChainConfig { - // Old, potentially outdated constants - pub cycle_length: u8, - pub deposit_size_gwei: u64, - pub shard_count: u16, - pub min_committee_size: u64, - pub max_validator_churn_quotient: u64, - pub genesis_time: u64, - pub slot_duration_millis: u64, - pub initial_validators: Vec, - - // New constants - pub epoch_length: u64, - pub min_attestation_inclusion_delay: u64, -} - -/* - * Presently this is just some arbitrary time in Sept 2018. - */ -const TEST_GENESIS_TIME: u64 = 1_537_488_655; - -impl ChainConfig { - pub fn standard() -> Self { - Self { - cycle_length: 64, - deposit_size_gwei: 32 * (10 ^ 9), - shard_count: 1024, - min_committee_size: 128, - max_validator_churn_quotient: 32, - genesis_time: TEST_GENESIS_TIME, - slot_duration_millis: 16 * 1000, - initial_validators: vec![], - - // New - epoch_length: 64, - min_attestation_inclusion_delay: 4, - } - } - - pub fn validate(&self) -> bool { - // criteria that ensure the config is valid - - // shard_count / cycle_length > 0 otherwise validator delegation - // will fail. - if self.shard_count / u16::from(self.cycle_length) == 0 { - return false; - } - - true - } - - #[cfg(test)] - pub fn super_fast_tests() -> Self { - Self { - cycle_length: 2, - deposit_size_gwei: 32 * (10 ^ 9), - shard_count: 2, - min_committee_size: 2, - max_validator_churn_quotient: 32, - genesis_time: TEST_GENESIS_TIME, // arbitrary - slot_duration_millis: 16 * 1000, - initial_validators: vec![], - - // New constants - epoch_length: 64, - min_attestation_inclusion_delay: 4, - } - } -} diff --git a/beacon_chain/types/src/lib.rs b/beacon_chain/types/src/lib.rs index 08b871c1c..b1bc03c31 100644 --- a/beacon_chain/types/src/lib.rs +++ b/beacon_chain/types/src/lib.rs @@ -13,7 +13,6 @@ pub mod beacon_block_body; pub mod beacon_state; pub mod candidate_pow_receipt_root_record; pub mod casper_slashing; -pub mod chain_config; pub mod crosslink_record; pub mod crystallized_state; pub mod deposit; @@ -41,7 +40,6 @@ pub use crate::beacon_block::BeaconBlock; pub use crate::beacon_block_body::BeaconBlockBody; pub use crate::beacon_state::BeaconState; pub use crate::casper_slashing::CasperSlashing; -pub use crate::chain_config::ChainConfig; pub use crate::crosslink_record::CrosslinkRecord; pub use crate::crystallized_state::CrystallizedState; pub use crate::deposit::Deposit;