Merge pull request #130 from drozdziak1/113-remove-chain-config
types: delete ChainConfig
This commit is contained in:
commit
e481b59b6d
@ -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<ValidatorRegistration>,
|
|
||||||
|
|
||||||
// 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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,7 +13,6 @@ pub mod beacon_block_body;
|
|||||||
pub mod beacon_state;
|
pub mod beacon_state;
|
||||||
pub mod candidate_pow_receipt_root_record;
|
pub mod candidate_pow_receipt_root_record;
|
||||||
pub mod casper_slashing;
|
pub mod casper_slashing;
|
||||||
pub mod chain_config;
|
|
||||||
pub mod crosslink_record;
|
pub mod crosslink_record;
|
||||||
pub mod crystallized_state;
|
pub mod crystallized_state;
|
||||||
pub mod deposit;
|
pub mod deposit;
|
||||||
@ -41,7 +40,6 @@ pub use crate::beacon_block::BeaconBlock;
|
|||||||
pub use crate::beacon_block_body::BeaconBlockBody;
|
pub use crate::beacon_block_body::BeaconBlockBody;
|
||||||
pub use crate::beacon_state::BeaconState;
|
pub use crate::beacon_state::BeaconState;
|
||||||
pub use crate::casper_slashing::CasperSlashing;
|
pub use crate::casper_slashing::CasperSlashing;
|
||||||
pub use crate::chain_config::ChainConfig;
|
|
||||||
pub use crate::crosslink_record::CrosslinkRecord;
|
pub use crate::crosslink_record::CrosslinkRecord;
|
||||||
pub use crate::crystallized_state::CrystallizedState;
|
pub use crate::crystallized_state::CrystallizedState;
|
||||||
pub use crate::deposit::Deposit;
|
pub use crate::deposit::Deposit;
|
||||||
|
Loading…
Reference in New Issue
Block a user