Update BeaconState
rename ShardCommittee
Both structs are now consistent with the spec. Addresses #100
This commit is contained in:
parent
7808835f1c
commit
89bea5b5e8
@ -2,33 +2,44 @@ use super::candidate_pow_receipt_root_record::CandidatePoWReceiptRootRecord;
|
||||
use super::crosslink_record::CrosslinkRecord;
|
||||
use super::fork_data::ForkData;
|
||||
use super::pending_attestation_record::PendingAttestationRecord;
|
||||
use super::shard_and_committee::ShardAndCommittee;
|
||||
use super::shard_committee::ShardCommittee;
|
||||
use super::shard_reassignment_record::ShardReassignmentRecord;
|
||||
use super::validator_record::ValidatorRecord;
|
||||
use super::Hash256;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct BeaconState {
|
||||
// Misc
|
||||
pub slot: u64,
|
||||
pub genesis_time: u64,
|
||||
pub fork_data: ForkData,
|
||||
|
||||
// Validator registry
|
||||
pub validator_registry: Vec<ValidatorRecord>,
|
||||
pub validator_registry_latest_change_slot: u64,
|
||||
pub validator_registry_exit_count: u64,
|
||||
pub validator_registry_delta_chain_tip: Hash256,
|
||||
|
||||
// Randomness and committees
|
||||
pub randao_mix: Hash256,
|
||||
pub next_seed: Hash256,
|
||||
pub shard_and_committee_for_slots: Vec<Vec<ShardAndCommittee>>,
|
||||
pub shard_committees_at_slots: Vec<Vec<ShardCommittee>>,
|
||||
pub persistent_committees: Vec<Vec<u32>>,
|
||||
pub persistent_committee_reassignments: Vec<ShardReassignmentRecord>,
|
||||
|
||||
// Finality
|
||||
pub previous_justified_slot: u64,
|
||||
pub justified_slot: u64,
|
||||
pub justified_slot_bitfield: u64,
|
||||
pub justification_bitfield: u64,
|
||||
pub finalized_slot: u64,
|
||||
|
||||
// Recent state
|
||||
pub latest_crosslinks: Vec<CrosslinkRecord>,
|
||||
pub latest_state_recalculation_slot: u64,
|
||||
pub latest_block_hashes: Vec<Hash256>,
|
||||
pub latest_block_roots: Vec<Hash256>,
|
||||
pub latest_penalized_exit_balances: Vec<u64>,
|
||||
pub latest_attestations: Vec<PendingAttestationRecord>,
|
||||
|
||||
// PoW receipt root
|
||||
pub processed_pow_receipt_root: Hash256,
|
||||
pub candidate_pow_receipt_roots: Vec<CandidatePoWReceiptRootRecord>,
|
||||
pub genesis_time: u64,
|
||||
pub fork_data: ForkData,
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ pub mod crosslink_record;
|
||||
pub mod crystallized_state;
|
||||
pub mod fork_data;
|
||||
pub mod pending_attestation_record;
|
||||
pub mod shard_and_committee;
|
||||
pub mod shard_committee;
|
||||
pub mod shard_reassignment_record;
|
||||
pub mod special_record;
|
||||
pub mod validator_record;
|
||||
@ -33,7 +33,7 @@ pub use crosslink_record::CrosslinkRecord;
|
||||
pub use crystallized_state::CrystallizedState;
|
||||
pub use fork_data::ForkData;
|
||||
pub use pending_attestation_record::PendingAttestationRecord;
|
||||
pub use shard_and_committee::ShardAndCommittee;
|
||||
pub use shard_committee::ShardCommittee;
|
||||
pub use special_record::{SpecialRecord, SpecialRecordKind};
|
||||
pub use validator_record::{ValidatorRecord, ValidatorStatus};
|
||||
pub use validator_registration::ValidatorRegistration;
|
||||
|
@ -1,10 +1,10 @@
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct ShardAndCommittee {
|
||||
pub struct ShardCommittee {
|
||||
pub shard: u16,
|
||||
pub committee: Vec<usize>,
|
||||
}
|
||||
|
||||
impl ShardAndCommittee {
|
||||
impl ShardCommittee {
|
||||
/// Returns a new instance where the `shard_id` is zero and the
|
||||
/// committee is an empty vector.
|
||||
pub fn zero() -> Self {
|
Loading…
Reference in New Issue
Block a user