diff --git a/beacon_chain/types/src/crosslink_record.rs b/beacon_chain/types/src/crosslink_record.rs index a28284681..2c7525fad 100644 --- a/beacon_chain/types/src/crosslink_record.rs +++ b/beacon_chain/types/src/crosslink_record.rs @@ -2,7 +2,8 @@ use super::Hash256; #[derive(Clone)] pub struct CrosslinkRecord { - pub dynasty: u64, + pub recently_changed: bool, + pub slot: u64, pub hash: Hash256, } @@ -10,7 +11,8 @@ impl CrosslinkRecord { /// Generates a new instance where `dynasty` and `hash` are both zero. pub fn zero() -> Self { Self { - dynasty: 0, + recently_changed: false, + slot: 0, hash: Hash256::zero(), } } @@ -23,7 +25,8 @@ mod tests { #[test] fn test_crosslink_record_zero() { let c = CrosslinkRecord::zero(); - assert_eq!(c.dynasty, 0); + assert_eq!(c.recently_changed, false); + assert_eq!(c.slot, 0); assert!(c.hash.is_zero()); } } diff --git a/beacon_chain/types/src/crystallized_state.rs b/beacon_chain/types/src/crystallized_state.rs index e6d901495..580fc04b0 100644 --- a/beacon_chain/types/src/crystallized_state.rs +++ b/beacon_chain/types/src/crystallized_state.rs @@ -1,65 +1,21 @@ use super::validator_record::ValidatorRecord; use super::crosslink_record::CrosslinkRecord; use super::shard_and_committee::ShardAndCommittee; -use super::ethereum_types::U256; use super::Hash256; pub struct CrystallizedState { + pub validator_set_change_slot: u64, pub validators: Vec, - pub epoch_number: u64, - pub indicies_for_heights: Vec, - pub last_justified_slot: u64, - pub justified_streak: u16, + pub crosslinks: Vec, + pub last_state_recalculation_slot: u64, pub last_finalized_slot: u64, - pub current_dynasty: u64, - pub crosslinking_shard_start: u16, - pub crosslink_records: Vec, - pub total_deposits: U256, - pub dynasty_seed: Hash256, - pub dynasty_seed_last_reset: u64, -} - -impl CrystallizedState { - /// Returns a new instance where all fields are either zero or an - /// empty vector. - pub fn zero() -> Self { - Self { - validators: vec![], - epoch_number: 0, - indicies_for_heights: vec![], - last_justified_slot: 0, - justified_streak: 0, - last_finalized_slot: 0, - current_dynasty: 0, - crosslinking_shard_start: 0, - crosslink_records: vec![], - total_deposits: U256::zero(), - dynasty_seed: Hash256::zero(), - dynasty_seed_last_reset: 0, - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_cry_state_zero() { - let c = CrystallizedState::zero(); - assert_eq!(c.validators.len(), 0); - assert_eq!(c.epoch_number, 0); - assert_eq!(c.indicies_for_heights.len(), 0); - assert_eq!(c.last_justified_slot, 0); - assert_eq!(c.justified_streak, 0); - assert_eq!(c.last_finalized_slot, 0); - assert_eq!(c.current_dynasty, 0); - assert_eq!(c.crosslinking_shard_start, 0); - assert_eq!(c.crosslink_records.len(), 0); - assert!(c.total_deposits.is_zero()); - assert!(c.dynasty_seed.is_zero()); - assert_eq!(c.dynasty_seed_last_reset, 0); - } - + pub last_justified_slot: u64, + pub justified_streak: u64, + pub shard_and_committee_for_slots: Vec>, + pub deposits_penalized_in_period: u32, + pub validator_set_delta_hash_chain: Hash256, + pub pre_fork_version: u32, + pub post_fork_version: u32, + pub fork_slot_number: u32, }