spec: update tags to v0.5.1
This commit is contained in:
		
							parent
							
								
									2914d77cd3
								
							
						
					
					
						commit
						d95ae95ce8
					
				@ -2,7 +2,7 @@ use types::{BeaconStateError as Error, *};
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Exit the validator of the given `index`.
 | 
					/// Exit the validator of the given `index`.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn exit_validator(
 | 
					pub fn exit_validator(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    validator_index: usize,
 | 
					    validator_index: usize,
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@ use types::{BeaconStateError as Error, *};
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Slash the validator with index ``index``.
 | 
					/// Slash the validator with index ``index``.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn slash_validator(
 | 
					pub fn slash_validator(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    validator_index: usize,
 | 
					    validator_index: usize,
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@ use types::*;
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Is title `verify_bitfield` in spec.
 | 
					/// Is title `verify_bitfield` in spec.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn verify_bitfield_length(bitfield: &Bitfield, committee_size: usize) -> bool {
 | 
					pub fn verify_bitfield_length(bitfield: &Bitfield, committee_size: usize) -> bool {
 | 
				
			||||||
    if bitfield.num_bytes() != ((committee_size + 7) / 8) {
 | 
					    if bitfield.num_bytes() != ((committee_size + 7) / 8) {
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ pub enum GenesisError {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Returns the genesis `BeaconState`
 | 
					/// Returns the genesis `BeaconState`
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn get_genesis_state(
 | 
					pub fn get_genesis_state(
 | 
				
			||||||
    genesis_validator_deposits: &[Deposit],
 | 
					    genesis_validator_deposits: &[Deposit],
 | 
				
			||||||
    genesis_time: u64,
 | 
					    genesis_time: u64,
 | 
				
			||||||
 | 
				
			|||||||
@ -39,7 +39,7 @@ const VERIFY_DEPOSIT_MERKLE_PROOFS: bool = false;
 | 
				
			|||||||
/// Returns `Ok(())` if the block is valid and the state was successfully updated. Otherwise
 | 
					/// Returns `Ok(())` if the block is valid and the state was successfully updated. Otherwise
 | 
				
			||||||
/// returns an error describing why the block was invalid or how the function failed to execute.
 | 
					/// returns an error describing why the block was invalid or how the function failed to execute.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn per_block_processing(
 | 
					pub fn per_block_processing(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    block: &BeaconBlock,
 | 
					    block: &BeaconBlock,
 | 
				
			||||||
@ -54,7 +54,7 @@ pub fn per_block_processing(
 | 
				
			|||||||
/// Returns `Ok(())` if the block is valid and the state was successfully updated. Otherwise
 | 
					/// Returns `Ok(())` if the block is valid and the state was successfully updated. Otherwise
 | 
				
			||||||
/// returns an error describing why the block was invalid or how the function failed to execute.
 | 
					/// returns an error describing why the block was invalid or how the function failed to execute.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn per_block_processing_without_verifying_block_signature(
 | 
					pub fn per_block_processing_without_verifying_block_signature(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    block: &BeaconBlock,
 | 
					    block: &BeaconBlock,
 | 
				
			||||||
@ -69,7 +69,7 @@ pub fn per_block_processing_without_verifying_block_signature(
 | 
				
			|||||||
/// Returns `Ok(())` if the block is valid and the state was successfully updated. Otherwise
 | 
					/// Returns `Ok(())` if the block is valid and the state was successfully updated. Otherwise
 | 
				
			||||||
/// returns an error describing why the block was invalid or how the function failed to execute.
 | 
					/// returns an error describing why the block was invalid or how the function failed to execute.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn per_block_processing_signature_optional(
 | 
					fn per_block_processing_signature_optional(
 | 
				
			||||||
    mut state: &mut BeaconState,
 | 
					    mut state: &mut BeaconState,
 | 
				
			||||||
    block: &BeaconBlock,
 | 
					    block: &BeaconBlock,
 | 
				
			||||||
@ -119,7 +119,7 @@ pub fn process_block_header(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Verifies the signature of a block.
 | 
					/// Verifies the signature of a block.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn verify_block_signature(
 | 
					pub fn verify_block_signature(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    block: &BeaconBlock,
 | 
					    block: &BeaconBlock,
 | 
				
			||||||
@ -147,7 +147,7 @@ pub fn verify_block_signature(
 | 
				
			|||||||
/// Verifies the `randao_reveal` against the block's proposer pubkey and updates
 | 
					/// Verifies the `randao_reveal` against the block's proposer pubkey and updates
 | 
				
			||||||
/// `state.latest_randao_mixes`.
 | 
					/// `state.latest_randao_mixes`.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn process_randao(
 | 
					pub fn process_randao(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    block: &BeaconBlock,
 | 
					    block: &BeaconBlock,
 | 
				
			||||||
@ -178,7 +178,7 @@ pub fn process_randao(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Update the `state.eth1_data_votes` based upon the `eth1_data` provided.
 | 
					/// Update the `state.eth1_data_votes` based upon the `eth1_data` provided.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn process_eth1_data(state: &mut BeaconState, eth1_data: &Eth1Data) -> Result<(), Error> {
 | 
					pub fn process_eth1_data(state: &mut BeaconState, eth1_data: &Eth1Data) -> Result<(), Error> {
 | 
				
			||||||
    // Attempt to find a `Eth1DataVote` with matching `Eth1Data`.
 | 
					    // Attempt to find a `Eth1DataVote` with matching `Eth1Data`.
 | 
				
			||||||
    let matching_eth1_vote_index = state
 | 
					    let matching_eth1_vote_index = state
 | 
				
			||||||
@ -204,7 +204,7 @@ pub fn process_eth1_data(state: &mut BeaconState, eth1_data: &Eth1Data) -> Resul
 | 
				
			|||||||
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
 | 
					/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
 | 
				
			||||||
/// an `Err` describing the invalid object or cause of failure.
 | 
					/// an `Err` describing the invalid object or cause of failure.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn process_proposer_slashings(
 | 
					pub fn process_proposer_slashings(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    proposer_slashings: &[ProposerSlashing],
 | 
					    proposer_slashings: &[ProposerSlashing],
 | 
				
			||||||
@ -237,7 +237,7 @@ pub fn process_proposer_slashings(
 | 
				
			|||||||
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
 | 
					/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
 | 
				
			||||||
/// an `Err` describing the invalid object or cause of failure.
 | 
					/// an `Err` describing the invalid object or cause of failure.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn process_attester_slashings(
 | 
					pub fn process_attester_slashings(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    attester_slashings: &[AttesterSlashing],
 | 
					    attester_slashings: &[AttesterSlashing],
 | 
				
			||||||
@ -295,7 +295,7 @@ pub fn process_attester_slashings(
 | 
				
			|||||||
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
 | 
					/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
 | 
				
			||||||
/// an `Err` describing the invalid object or cause of failure.
 | 
					/// an `Err` describing the invalid object or cause of failure.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn process_attestations(
 | 
					pub fn process_attestations(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    attestations: &[Attestation],
 | 
					    attestations: &[Attestation],
 | 
				
			||||||
@ -337,7 +337,7 @@ pub fn process_attestations(
 | 
				
			|||||||
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
 | 
					/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
 | 
				
			||||||
/// an `Err` describing the invalid object or cause of failure.
 | 
					/// an `Err` describing the invalid object or cause of failure.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn process_deposits(
 | 
					pub fn process_deposits(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    deposits: &[Deposit],
 | 
					    deposits: &[Deposit],
 | 
				
			||||||
@ -407,7 +407,7 @@ pub fn process_deposits(
 | 
				
			|||||||
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
 | 
					/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
 | 
				
			||||||
/// an `Err` describing the invalid object or cause of failure.
 | 
					/// an `Err` describing the invalid object or cause of failure.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn process_exits(
 | 
					pub fn process_exits(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    voluntary_exits: &[VoluntaryExit],
 | 
					    voluntary_exits: &[VoluntaryExit],
 | 
				
			||||||
@ -439,7 +439,7 @@ pub fn process_exits(
 | 
				
			|||||||
/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
 | 
					/// Returns `Ok(())` if the validation and state updates completed successfully, otherwise returns
 | 
				
			||||||
/// an `Err` describing the invalid object or cause of failure.
 | 
					/// an `Err` describing the invalid object or cause of failure.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn process_transfers(
 | 
					pub fn process_transfers(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    transfers: &[Transfer],
 | 
					    transfers: &[Transfer],
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ use types::*;
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Returns `Ok(())` if the `Attestation` is valid, otherwise indicates the reason for invalidity.
 | 
					/// Returns `Ok(())` if the `Attestation` is valid, otherwise indicates the reason for invalidity.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn validate_attestation(
 | 
					pub fn validate_attestation(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    attestation: &Attestation,
 | 
					    attestation: &Attestation,
 | 
				
			||||||
@ -31,7 +31,7 @@ pub fn validate_attestation_time_independent_only(
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Returns `Ok(())` if the `Attestation` is valid, otherwise indicates the reason for invalidity.
 | 
					/// Returns `Ok(())` if the `Attestation` is valid, otherwise indicates the reason for invalidity.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn validate_attestation_without_signature(
 | 
					pub fn validate_attestation_without_signature(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    attestation: &Attestation,
 | 
					    attestation: &Attestation,
 | 
				
			||||||
@ -44,7 +44,7 @@ pub fn validate_attestation_without_signature(
 | 
				
			|||||||
/// given state, optionally validating the aggregate signature.
 | 
					/// given state, optionally validating the aggregate signature.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn validate_attestation_parametric(
 | 
					fn validate_attestation_parametric(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    attestation: &Attestation,
 | 
					    attestation: &Attestation,
 | 
				
			||||||
@ -167,7 +167,7 @@ fn validate_attestation_parametric(
 | 
				
			|||||||
/// Verify that the `source_epoch` and `source_root` of an `Attestation` correctly
 | 
					/// Verify that the `source_epoch` and `source_root` of an `Attestation` correctly
 | 
				
			||||||
/// match the current (or previous) justified epoch and root from the state.
 | 
					/// match the current (or previous) justified epoch and root from the state.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn verify_justified_epoch_and_root(
 | 
					fn verify_justified_epoch_and_root(
 | 
				
			||||||
    attestation: &Attestation,
 | 
					    attestation: &Attestation,
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
@ -222,7 +222,7 @@ fn verify_justified_epoch_and_root(
 | 
				
			|||||||
///  - `custody_bitfield` does not have a bit for each index of `committee`.
 | 
					///  - `custody_bitfield` does not have a bit for each index of `committee`.
 | 
				
			||||||
///  - A `validator_index` in `committee` is not in `state.validator_registry`.
 | 
					///  - A `validator_index` in `committee` is not in `state.validator_registry`.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn verify_attestation_signature(
 | 
					fn verify_attestation_signature(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    committee: &[usize],
 | 
					    committee: &[usize],
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ use types::*;
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Returns `Ok(())` if the `AttesterSlashing` is valid, otherwise indicates the reason for invalidity.
 | 
					/// Returns `Ok(())` if the `AttesterSlashing` is valid, otherwise indicates the reason for invalidity.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn verify_attester_slashing(
 | 
					pub fn verify_attester_slashing(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    attester_slashing: &AttesterSlashing,
 | 
					    attester_slashing: &AttesterSlashing,
 | 
				
			||||||
@ -41,7 +41,7 @@ pub fn verify_attester_slashing(
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Returns Ok(indices) if `indices.len() > 0`.
 | 
					/// Returns Ok(indices) if `indices.len() > 0`.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn gather_attester_slashing_indices(
 | 
					pub fn gather_attester_slashing_indices(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    attester_slashing: &AttesterSlashing,
 | 
					    attester_slashing: &AttesterSlashing,
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,7 @@ use types::*;
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Note: this function is incomplete.
 | 
					/// Note: this function is incomplete.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn verify_deposit(
 | 
					pub fn verify_deposit(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    deposit: &Deposit,
 | 
					    deposit: &Deposit,
 | 
				
			||||||
@ -46,7 +46,7 @@ pub fn verify_deposit(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Verify that the `Deposit` index is correct.
 | 
					/// Verify that the `Deposit` index is correct.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn verify_deposit_index(state: &BeaconState, deposit: &Deposit) -> Result<(), Error> {
 | 
					pub fn verify_deposit_index(state: &BeaconState, deposit: &Deposit) -> Result<(), Error> {
 | 
				
			||||||
    verify!(
 | 
					    verify!(
 | 
				
			||||||
        deposit.index == state.deposit_index,
 | 
					        deposit.index == state.deposit_index,
 | 
				
			||||||
@ -88,7 +88,7 @@ pub fn get_existing_validator_index(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Verify that a deposit is included in the state's eth1 deposit root.
 | 
					/// Verify that a deposit is included in the state's eth1 deposit root.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn verify_deposit_merkle_proof(state: &BeaconState, deposit: &Deposit, spec: &ChainSpec) -> bool {
 | 
					fn verify_deposit_merkle_proof(state: &BeaconState, deposit: &Deposit, spec: &ChainSpec) -> bool {
 | 
				
			||||||
    let leaf = hash(&get_serialized_deposit_data(deposit));
 | 
					    let leaf = hash(&get_serialized_deposit_data(deposit));
 | 
				
			||||||
    verify_merkle_proof(
 | 
					    verify_merkle_proof(
 | 
				
			||||||
@ -102,7 +102,7 @@ fn verify_deposit_merkle_proof(state: &BeaconState, deposit: &Deposit, spec: &Ch
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Helper struct for easily getting the serialized data generated by the deposit contract.
 | 
					/// Helper struct for easily getting the serialized data generated by the deposit contract.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(Encode)]
 | 
					#[derive(Encode)]
 | 
				
			||||||
struct SerializedDepositData {
 | 
					struct SerializedDepositData {
 | 
				
			||||||
    amount: u64,
 | 
					    amount: u64,
 | 
				
			||||||
@ -113,7 +113,7 @@ struct SerializedDepositData {
 | 
				
			|||||||
/// Return the serialized data generated by the deposit contract that is used to generate the
 | 
					/// Return the serialized data generated by the deposit contract that is used to generate the
 | 
				
			||||||
/// merkle proof.
 | 
					/// merkle proof.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn get_serialized_deposit_data(deposit: &Deposit) -> Vec<u8> {
 | 
					fn get_serialized_deposit_data(deposit: &Deposit) -> Vec<u8> {
 | 
				
			||||||
    let serialized_deposit_data = SerializedDepositData {
 | 
					    let serialized_deposit_data = SerializedDepositData {
 | 
				
			||||||
        amount: deposit.deposit_data.amount,
 | 
					        amount: deposit.deposit_data.amount,
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ use types::*;
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Returns `Ok(())` if the `Exit` is valid, otherwise indicates the reason for invalidity.
 | 
					/// Returns `Ok(())` if the `Exit` is valid, otherwise indicates the reason for invalidity.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn verify_exit(
 | 
					pub fn verify_exit(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    exit: &VoluntaryExit,
 | 
					    exit: &VoluntaryExit,
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ use types::*;
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Returns `Ok(())` if the `ProposerSlashing` is valid, otherwise indicates the reason for invalidity.
 | 
					/// Returns `Ok(())` if the `ProposerSlashing` is valid, otherwise indicates the reason for invalidity.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn verify_proposer_slashing(
 | 
					pub fn verify_proposer_slashing(
 | 
				
			||||||
    proposer_slashing: &ProposerSlashing,
 | 
					    proposer_slashing: &ProposerSlashing,
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
@ -67,7 +67,7 @@ pub fn verify_proposer_slashing(
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Returns `true` if the signature is valid.
 | 
					/// Returns `true` if the signature is valid.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn verify_header_signature(
 | 
					fn verify_header_signature(
 | 
				
			||||||
    header: &BeaconBlockHeader,
 | 
					    header: &BeaconBlockHeader,
 | 
				
			||||||
    pubkey: &PublicKey,
 | 
					    pubkey: &PublicKey,
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ use types::*;
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Returns `Ok(())` if the `SlashableAttestation` is valid, otherwise indicates the reason for invalidity.
 | 
					/// Returns `Ok(())` if the `SlashableAttestation` is valid, otherwise indicates the reason for invalidity.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn verify_slashable_attestation(
 | 
					pub fn verify_slashable_attestation(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    slashable_attestation: &SlashableAttestation,
 | 
					    slashable_attestation: &SlashableAttestation,
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ use types::*;
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Note: this function is incomplete.
 | 
					/// Note: this function is incomplete.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn verify_transfer(
 | 
					pub fn verify_transfer(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    transfer: &Transfer,
 | 
					    transfer: &Transfer,
 | 
				
			||||||
@ -122,7 +122,7 @@ fn verify_transfer_parametric(
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Does not check that the transfer is valid, however checks for overflow in all actions.
 | 
					/// Does not check that the transfer is valid, however checks for overflow in all actions.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn execute_transfer(
 | 
					pub fn execute_transfer(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    transfer: &Transfer,
 | 
					    transfer: &Transfer,
 | 
				
			||||||
 | 
				
			|||||||
@ -32,7 +32,7 @@ pub type WinningRootHashSet = HashMap<u64, WinningRoot>;
 | 
				
			|||||||
/// Mutates the given `BeaconState`, returning early if an error is encountered. If an error is
 | 
					/// Mutates the given `BeaconState`, returning early if an error is encountered. If an error is
 | 
				
			||||||
/// returned, a state might be "half-processed" and therefore in an invalid state.
 | 
					/// returned, a state might be "half-processed" and therefore in an invalid state.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn per_epoch_processing(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), Error> {
 | 
					pub fn per_epoch_processing(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), Error> {
 | 
				
			||||||
    // Ensure the previous and next epoch caches are built.
 | 
					    // Ensure the previous and next epoch caches are built.
 | 
				
			||||||
    state.build_epoch_cache(RelativeEpoch::Previous, spec)?;
 | 
					    state.build_epoch_cache(RelativeEpoch::Previous, spec)?;
 | 
				
			||||||
@ -86,7 +86,7 @@ pub fn per_epoch_processing(state: &mut BeaconState, spec: &ChainSpec) -> Result
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Maybe resets the eth1 period.
 | 
					/// Maybe resets the eth1 period.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn maybe_reset_eth1_period(state: &mut BeaconState, spec: &ChainSpec) {
 | 
					pub fn maybe_reset_eth1_period(state: &mut BeaconState, spec: &ChainSpec) {
 | 
				
			||||||
    let next_epoch = state.next_epoch(spec);
 | 
					    let next_epoch = state.next_epoch(spec);
 | 
				
			||||||
    let voting_period = spec.epochs_per_eth1_voting_period;
 | 
					    let voting_period = spec.epochs_per_eth1_voting_period;
 | 
				
			||||||
@ -108,7 +108,7 @@ pub fn maybe_reset_eth1_period(state: &mut BeaconState, spec: &ChainSpec) {
 | 
				
			|||||||
/// - `justified_epoch`
 | 
					/// - `justified_epoch`
 | 
				
			||||||
/// - `previous_justified_epoch`
 | 
					/// - `previous_justified_epoch`
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn update_justification_and_finalization(
 | 
					pub fn update_justification_and_finalization(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    total_balances: &TotalBalances,
 | 
					    total_balances: &TotalBalances,
 | 
				
			||||||
@ -178,7 +178,7 @@ pub fn update_justification_and_finalization(
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Also returns a `WinningRootHashSet` for later use during epoch processing.
 | 
					/// Also returns a `WinningRootHashSet` for later use during epoch processing.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn process_crosslinks(
 | 
					pub fn process_crosslinks(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    spec: &ChainSpec,
 | 
					    spec: &ChainSpec,
 | 
				
			||||||
@ -221,7 +221,7 @@ pub fn process_crosslinks(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Finish up an epoch update.
 | 
					/// Finish up an epoch update.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn finish_epoch_update(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), Error> {
 | 
					pub fn finish_epoch_update(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), Error> {
 | 
				
			||||||
    let current_epoch = state.current_epoch(spec);
 | 
					    let current_epoch = state.current_epoch(spec);
 | 
				
			||||||
    let next_epoch = state.next_epoch(spec);
 | 
					    let next_epoch = state.next_epoch(spec);
 | 
				
			||||||
 | 
				
			|||||||
@ -32,7 +32,7 @@ impl std::ops::AddAssign for Delta {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Apply attester and proposer rewards.
 | 
					/// Apply attester and proposer rewards.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn apply_rewards(
 | 
					pub fn apply_rewards(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    validator_statuses: &mut ValidatorStatuses,
 | 
					    validator_statuses: &mut ValidatorStatuses,
 | 
				
			||||||
@ -79,7 +79,7 @@ pub fn apply_rewards(
 | 
				
			|||||||
/// Applies the attestation inclusion reward to each proposer for every validator who included an
 | 
					/// Applies the attestation inclusion reward to each proposer for every validator who included an
 | 
				
			||||||
/// attestation in the previous epoch.
 | 
					/// attestation in the previous epoch.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn get_proposer_deltas(
 | 
					fn get_proposer_deltas(
 | 
				
			||||||
    deltas: &mut Vec<Delta>,
 | 
					    deltas: &mut Vec<Delta>,
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
@ -120,7 +120,7 @@ fn get_proposer_deltas(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Apply rewards for participation in attestations during the previous epoch.
 | 
					/// Apply rewards for participation in attestations during the previous epoch.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn get_justification_and_finalization_deltas(
 | 
					fn get_justification_and_finalization_deltas(
 | 
				
			||||||
    deltas: &mut Vec<Delta>,
 | 
					    deltas: &mut Vec<Delta>,
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
@ -163,7 +163,7 @@ fn get_justification_and_finalization_deltas(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Determine the delta for a single validator, if the chain is finalizing normally.
 | 
					/// Determine the delta for a single validator, if the chain is finalizing normally.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn compute_normal_justification_and_finalization_delta(
 | 
					fn compute_normal_justification_and_finalization_delta(
 | 
				
			||||||
    validator: &ValidatorStatus,
 | 
					    validator: &ValidatorStatus,
 | 
				
			||||||
    total_balances: &TotalBalances,
 | 
					    total_balances: &TotalBalances,
 | 
				
			||||||
@ -215,7 +215,7 @@ fn compute_normal_justification_and_finalization_delta(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Determine the delta for a single delta, assuming the chain is _not_ finalizing normally.
 | 
					/// Determine the delta for a single delta, assuming the chain is _not_ finalizing normally.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn compute_inactivity_leak_delta(
 | 
					fn compute_inactivity_leak_delta(
 | 
				
			||||||
    validator: &ValidatorStatus,
 | 
					    validator: &ValidatorStatus,
 | 
				
			||||||
    base_reward: u64,
 | 
					    base_reward: u64,
 | 
				
			||||||
@ -261,7 +261,7 @@ fn compute_inactivity_leak_delta(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Calculate the deltas based upon the winning roots for attestations during the previous epoch.
 | 
					/// Calculate the deltas based upon the winning roots for attestations during the previous epoch.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn get_crosslink_deltas(
 | 
					fn get_crosslink_deltas(
 | 
				
			||||||
    deltas: &mut Vec<Delta>,
 | 
					    deltas: &mut Vec<Delta>,
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
@ -295,7 +295,7 @@ fn get_crosslink_deltas(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Returns the base reward for some validator.
 | 
					/// Returns the base reward for some validator.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn get_base_reward(
 | 
					fn get_base_reward(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    index: usize,
 | 
					    index: usize,
 | 
				
			||||||
@ -312,7 +312,7 @@ fn get_base_reward(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Returns the inactivity penalty for some validator.
 | 
					/// Returns the inactivity penalty for some validator.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn get_inactivity_penalty(
 | 
					fn get_inactivity_penalty(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    index: usize,
 | 
					    index: usize,
 | 
				
			||||||
@ -328,7 +328,7 @@ fn get_inactivity_penalty(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Returns the epochs since the last finalized epoch.
 | 
					/// Returns the epochs since the last finalized epoch.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn epochs_since_finality(state: &BeaconState, spec: &ChainSpec) -> Epoch {
 | 
					fn epochs_since_finality(state: &BeaconState, spec: &ChainSpec) -> Epoch {
 | 
				
			||||||
    state.current_epoch(spec) + 1 - state.finalized_epoch
 | 
					    state.current_epoch(spec) + 1 - state.finalized_epoch
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@ use types::*;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Returns validator indices which participated in the attestation.
 | 
					/// Returns validator indices which participated in the attestation.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn get_attestation_participants(
 | 
					pub fn get_attestation_participants(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    attestation_data: &AttestationData,
 | 
					    attestation_data: &AttestationData,
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ use types::*;
 | 
				
			|||||||
/// Returns the distance between the first included attestation for some validator and this
 | 
					/// Returns the distance between the first included attestation for some validator and this
 | 
				
			||||||
/// slot.
 | 
					/// slot.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn inclusion_distance(
 | 
					pub fn inclusion_distance(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    attestations: &[&PendingAttestation],
 | 
					    attestations: &[&PendingAttestation],
 | 
				
			||||||
@ -18,7 +18,7 @@ pub fn inclusion_distance(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Returns the slot of the earliest included attestation for some validator.
 | 
					/// Returns the slot of the earliest included attestation for some validator.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn inclusion_slot(
 | 
					pub fn inclusion_slot(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    attestations: &[&PendingAttestation],
 | 
					    attestations: &[&PendingAttestation],
 | 
				
			||||||
@ -31,7 +31,7 @@ pub fn inclusion_slot(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Finds the earliest included attestation for some validator.
 | 
					/// Finds the earliest included attestation for some validator.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn earliest_included_attestation(
 | 
					fn earliest_included_attestation(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    attestations: &[&PendingAttestation],
 | 
					    attestations: &[&PendingAttestation],
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@ use types::{BeaconStateError as Error, *};
 | 
				
			|||||||
/// Iterate through the validator registry and eject active validators with balance below
 | 
					/// Iterate through the validator registry and eject active validators with balance below
 | 
				
			||||||
/// ``EJECTION_BALANCE``.
 | 
					/// ``EJECTION_BALANCE``.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn process_ejections(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), Error> {
 | 
					pub fn process_ejections(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), Error> {
 | 
				
			||||||
    // There is an awkward double (triple?) loop here because we can't loop across the borrowed
 | 
					    // There is an awkward double (triple?) loop here because we can't loop across the borrowed
 | 
				
			||||||
    // active validator indices and mutate state in the one loop.
 | 
					    // active validator indices and mutate state in the one loop.
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@ use types::*;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Process the exit queue.
 | 
					/// Process the exit queue.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn process_exit_queue(state: &mut BeaconState, spec: &ChainSpec) {
 | 
					pub fn process_exit_queue(state: &mut BeaconState, spec: &ChainSpec) {
 | 
				
			||||||
    let current_epoch = state.current_epoch(spec);
 | 
					    let current_epoch = state.current_epoch(spec);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -31,7 +31,7 @@ pub fn process_exit_queue(state: &mut BeaconState, spec: &ChainSpec) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Initiate an exit for the validator of the given `index`.
 | 
					/// Initiate an exit for the validator of the given `index`.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn prepare_validator_for_withdrawal(
 | 
					fn prepare_validator_for_withdrawal(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    validator_index: usize,
 | 
					    validator_index: usize,
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@ use types::{BeaconStateError as Error, *};
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Process slashings.
 | 
					/// Process slashings.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn process_slashings(
 | 
					pub fn process_slashings(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    current_total_balance: u64,
 | 
					    current_total_balance: u64,
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@ use types::*;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Peforms a validator registry update, if required.
 | 
					/// Peforms a validator registry update, if required.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn update_registry_and_shuffling_data(
 | 
					pub fn update_registry_and_shuffling_data(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    current_total_balance: u64,
 | 
					    current_total_balance: u64,
 | 
				
			||||||
@ -49,7 +49,7 @@ pub fn update_registry_and_shuffling_data(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Returns `true` if the validator registry should be updated during an epoch processing.
 | 
					/// Returns `true` if the validator registry should be updated during an epoch processing.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn should_update_validator_registry(
 | 
					pub fn should_update_validator_registry(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    spec: &ChainSpec,
 | 
					    spec: &ChainSpec,
 | 
				
			||||||
@ -78,7 +78,7 @@ pub fn should_update_validator_registry(
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// Note: Utilizes the cache and will fail if the appropriate cache is not initialized.
 | 
					/// Note: Utilizes the cache and will fail if the appropriate cache is not initialized.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn update_validator_registry(
 | 
					pub fn update_validator_registry(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    current_total_balance: u64,
 | 
					    current_total_balance: u64,
 | 
				
			||||||
@ -133,7 +133,7 @@ pub fn update_validator_registry(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Activate the validator of the given ``index``.
 | 
					/// Activate the validator of the given ``index``.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn activate_validator(
 | 
					pub fn activate_validator(
 | 
				
			||||||
    state: &mut BeaconState,
 | 
					    state: &mut BeaconState,
 | 
				
			||||||
    validator_index: usize,
 | 
					    validator_index: usize,
 | 
				
			||||||
 | 
				
			|||||||
@ -160,7 +160,7 @@ impl ValidatorStatuses {
 | 
				
			|||||||
    /// - Active validators
 | 
					    /// - Active validators
 | 
				
			||||||
    /// - Total balances for the current and previous epochs.
 | 
					    /// - Total balances for the current and previous epochs.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn new(state: &BeaconState, spec: &ChainSpec) -> Result<Self, BeaconStateError> {
 | 
					    pub fn new(state: &BeaconState, spec: &ChainSpec) -> Result<Self, BeaconStateError> {
 | 
				
			||||||
        let mut statuses = Vec::with_capacity(state.validator_registry.len());
 | 
					        let mut statuses = Vec::with_capacity(state.validator_registry.len());
 | 
				
			||||||
        let mut total_balances = TotalBalances::default();
 | 
					        let mut total_balances = TotalBalances::default();
 | 
				
			||||||
@ -195,7 +195,7 @@ impl ValidatorStatuses {
 | 
				
			|||||||
    /// Process some attestations from the given `state` updating the `statuses` and
 | 
					    /// Process some attestations from the given `state` updating the `statuses` and
 | 
				
			||||||
    /// `total_balances` fields.
 | 
					    /// `total_balances` fields.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn process_attestations(
 | 
					    pub fn process_attestations(
 | 
				
			||||||
        &mut self,
 | 
					        &mut self,
 | 
				
			||||||
        state: &BeaconState,
 | 
					        state: &BeaconState,
 | 
				
			||||||
@ -261,7 +261,7 @@ impl ValidatorStatuses {
 | 
				
			|||||||
    /// Update the `statuses` for each validator based upon whether or not they attested to the
 | 
					    /// Update the `statuses` for each validator based upon whether or not they attested to the
 | 
				
			||||||
    /// "winning" shard block root for the previous epoch.
 | 
					    /// "winning" shard block root for the previous epoch.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn process_winning_roots(
 | 
					    pub fn process_winning_roots(
 | 
				
			||||||
        &mut self,
 | 
					        &mut self,
 | 
				
			||||||
        state: &BeaconState,
 | 
					        state: &BeaconState,
 | 
				
			||||||
@ -297,14 +297,14 @@ impl ValidatorStatuses {
 | 
				
			|||||||
/// Returns the distance between when the attestation was created and when it was included in a
 | 
					/// Returns the distance between when the attestation was created and when it was included in a
 | 
				
			||||||
/// block.
 | 
					/// block.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn inclusion_distance(a: &PendingAttestation) -> Slot {
 | 
					fn inclusion_distance(a: &PendingAttestation) -> Slot {
 | 
				
			||||||
    a.inclusion_slot - a.data.slot
 | 
					    a.inclusion_slot - a.data.slot
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Returns `true` if some `PendingAttestation` is from the supplied `epoch`.
 | 
					/// Returns `true` if some `PendingAttestation` is from the supplied `epoch`.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn is_from_epoch(a: &PendingAttestation, epoch: Epoch, spec: &ChainSpec) -> bool {
 | 
					fn is_from_epoch(a: &PendingAttestation, epoch: Epoch, spec: &ChainSpec) -> bool {
 | 
				
			||||||
    a.data.slot.epoch(spec.slots_per_epoch) == epoch
 | 
					    a.data.slot.epoch(spec.slots_per_epoch) == epoch
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -312,7 +312,7 @@ fn is_from_epoch(a: &PendingAttestation, epoch: Epoch, spec: &ChainSpec) -> bool
 | 
				
			|||||||
/// Returns `true` if a `PendingAttestation` and `BeaconState` share the same beacon block hash for
 | 
					/// Returns `true` if a `PendingAttestation` and `BeaconState` share the same beacon block hash for
 | 
				
			||||||
/// the first slot of the given epoch.
 | 
					/// the first slot of the given epoch.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn has_common_epoch_boundary_root(
 | 
					fn has_common_epoch_boundary_root(
 | 
				
			||||||
    a: &PendingAttestation,
 | 
					    a: &PendingAttestation,
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
@ -328,7 +328,7 @@ fn has_common_epoch_boundary_root(
 | 
				
			|||||||
/// Returns `true` if a `PendingAttestation` and `BeaconState` share the same beacon block hash for
 | 
					/// Returns `true` if a `PendingAttestation` and `BeaconState` share the same beacon block hash for
 | 
				
			||||||
/// the current slot of the `PendingAttestation`.
 | 
					/// the current slot of the `PendingAttestation`.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn has_common_beacon_block_root(
 | 
					fn has_common_beacon_block_root(
 | 
				
			||||||
    a: &PendingAttestation,
 | 
					    a: &PendingAttestation,
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,7 @@ impl WinningRoot {
 | 
				
			|||||||
    /// A winning root is "better" than another if it has a higher `total_attesting_balance`. Ties
 | 
					    /// A winning root is "better" than another if it has a higher `total_attesting_balance`. Ties
 | 
				
			||||||
    /// are broken by favouring the higher `crosslink_data_root` value.
 | 
					    /// are broken by favouring the higher `crosslink_data_root` value.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn is_better_than(&self, other: &Self) -> bool {
 | 
					    pub fn is_better_than(&self, other: &Self) -> bool {
 | 
				
			||||||
        if self.total_attesting_balance > other.total_attesting_balance {
 | 
					        if self.total_attesting_balance > other.total_attesting_balance {
 | 
				
			||||||
            true
 | 
					            true
 | 
				
			||||||
@ -34,7 +34,7 @@ impl WinningRoot {
 | 
				
			|||||||
/// The `WinningRoot` object also contains additional fields that are useful in later stages of
 | 
					/// The `WinningRoot` object also contains additional fields that are useful in later stages of
 | 
				
			||||||
/// per-epoch processing.
 | 
					/// per-epoch processing.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn winning_root(
 | 
					pub fn winning_root(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    shard: u64,
 | 
					    shard: u64,
 | 
				
			||||||
@ -89,7 +89,7 @@ pub fn winning_root(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Returns `true` if pending attestation `a` is eligible to become a winning root.
 | 
					/// Returns `true` if pending attestation `a` is eligible to become a winning root.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn is_eligible_for_winning_root(state: &BeaconState, a: &PendingAttestation, shard: Shard) -> bool {
 | 
					fn is_eligible_for_winning_root(state: &BeaconState, a: &PendingAttestation, shard: Shard) -> bool {
 | 
				
			||||||
    if shard >= state.latest_crosslinks.len() as u64 {
 | 
					    if shard >= state.latest_crosslinks.len() as u64 {
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@ -100,7 +100,7 @@ fn is_eligible_for_winning_root(state: &BeaconState, a: &PendingAttestation, sha
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Returns all indices which voted for a given crosslink. Does not contain duplicates.
 | 
					/// Returns all indices which voted for a given crosslink. Does not contain duplicates.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
fn get_attesting_validator_indices(
 | 
					fn get_attesting_validator_indices(
 | 
				
			||||||
    state: &BeaconState,
 | 
					    state: &BeaconState,
 | 
				
			||||||
    shard: u64,
 | 
					    shard: u64,
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ pub enum Error {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Advances a state forward by one slot, performing per-epoch processing if required.
 | 
					/// Advances a state forward by one slot, performing per-epoch processing if required.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn per_slot_processing(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), Error> {
 | 
					pub fn per_slot_processing(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), Error> {
 | 
				
			||||||
    cache_state(state, spec)?;
 | 
					    cache_state(state, spec)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Details an attestation that can be slashable.
 | 
					/// Details an attestation that can be slashable.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(
 | 
					#[derive(
 | 
				
			||||||
    Debug,
 | 
					    Debug,
 | 
				
			||||||
    Clone,
 | 
					    Clone,
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// The data upon which an attestation is based.
 | 
					/// The data upon which an attestation is based.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(
 | 
					#[derive(
 | 
				
			||||||
    Debug,
 | 
					    Debug,
 | 
				
			||||||
    Clone,
 | 
					    Clone,
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Used for pairing an attestation with a proof-of-custody.
 | 
					/// Used for pairing an attestation with a proof-of-custody.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(Debug, Clone, PartialEq, Default, Serialize, Encode, Decode, TreeHash)]
 | 
					#[derive(Debug, Clone, PartialEq, Default, Serialize, Encode, Decode, TreeHash)]
 | 
				
			||||||
pub struct AttestationDataAndCustodyBit {
 | 
					pub struct AttestationDataAndCustodyBit {
 | 
				
			||||||
    pub data: AttestationData,
 | 
					    pub data: AttestationData,
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Two conflicting attestations.
 | 
					/// Two conflicting attestations.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
					#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
				
			||||||
pub struct AttesterSlashing {
 | 
					pub struct AttesterSlashing {
 | 
				
			||||||
    pub slashable_attestation_1: SlashableAttestation,
 | 
					    pub slashable_attestation_1: SlashableAttestation,
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// A block of the `BeaconChain`.
 | 
					/// A block of the `BeaconChain`.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(
 | 
					#[derive(
 | 
				
			||||||
    Debug,
 | 
					    Debug,
 | 
				
			||||||
    PartialEq,
 | 
					    PartialEq,
 | 
				
			||||||
@ -35,7 +35,7 @@ pub struct BeaconBlock {
 | 
				
			|||||||
impl BeaconBlock {
 | 
					impl BeaconBlock {
 | 
				
			||||||
    /// Returns an empty block to be used during genesis.
 | 
					    /// Returns an empty block to be used during genesis.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn empty(spec: &ChainSpec) -> BeaconBlock {
 | 
					    pub fn empty(spec: &ChainSpec) -> BeaconBlock {
 | 
				
			||||||
        BeaconBlock {
 | 
					        BeaconBlock {
 | 
				
			||||||
            slot: spec.genesis_slot,
 | 
					            slot: spec.genesis_slot,
 | 
				
			||||||
@ -60,7 +60,7 @@ impl BeaconBlock {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Returns the `tree_hash_root | update` of the block.
 | 
					    /// Returns the `tree_hash_root | update` of the block.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn canonical_root(&self) -> Hash256 {
 | 
					    pub fn canonical_root(&self) -> Hash256 {
 | 
				
			||||||
        Hash256::from_slice(&self.tree_hash_root()[..])
 | 
					        Hash256::from_slice(&self.tree_hash_root()[..])
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -72,7 +72,7 @@ impl BeaconBlock {
 | 
				
			|||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Note: performs a full tree-hash of `self.body`.
 | 
					    /// Note: performs a full tree-hash of `self.body`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn block_header(&self) -> BeaconBlockHeader {
 | 
					    pub fn block_header(&self) -> BeaconBlockHeader {
 | 
				
			||||||
        BeaconBlockHeader {
 | 
					        BeaconBlockHeader {
 | 
				
			||||||
            slot: self.slot,
 | 
					            slot: self.slot,
 | 
				
			||||||
@ -85,7 +85,7 @@ impl BeaconBlock {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Returns a "temporary" header, where the `state_root` is `spec.zero_hash`.
 | 
					    /// Returns a "temporary" header, where the `state_root` is `spec.zero_hash`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn temporary_block_header(&self, spec: &ChainSpec) -> BeaconBlockHeader {
 | 
					    pub fn temporary_block_header(&self, spec: &ChainSpec) -> BeaconBlockHeader {
 | 
				
			||||||
        BeaconBlockHeader {
 | 
					        BeaconBlockHeader {
 | 
				
			||||||
            state_root: spec.zero_hash,
 | 
					            state_root: spec.zero_hash,
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// The body of a `BeaconChain` block, containing operations.
 | 
					/// The body of a `BeaconChain` block, containing operations.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
					#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
				
			||||||
pub struct BeaconBlockBody {
 | 
					pub struct BeaconBlockBody {
 | 
				
			||||||
    pub randao_reveal: Signature,
 | 
					    pub randao_reveal: Signature,
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// A header of a `BeaconBlock`.
 | 
					/// A header of a `BeaconBlock`.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(
 | 
					#[derive(
 | 
				
			||||||
    Debug,
 | 
					    Debug,
 | 
				
			||||||
    PartialEq,
 | 
					    PartialEq,
 | 
				
			||||||
@ -35,14 +35,14 @@ pub struct BeaconBlockHeader {
 | 
				
			|||||||
impl BeaconBlockHeader {
 | 
					impl BeaconBlockHeader {
 | 
				
			||||||
    /// Returns the `tree_hash_root` of the header.
 | 
					    /// Returns the `tree_hash_root` of the header.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn canonical_root(&self) -> Hash256 {
 | 
					    pub fn canonical_root(&self) -> Hash256 {
 | 
				
			||||||
        Hash256::from_slice(&self.tree_hash_root()[..])
 | 
					        Hash256::from_slice(&self.tree_hash_root()[..])
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Given a `body`, consumes `self` and returns a complete `BeaconBlock`.
 | 
					    /// Given a `body`, consumes `self` and returns a complete `BeaconBlock`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn into_block(self, body: BeaconBlockBody) -> BeaconBlock {
 | 
					    pub fn into_block(self, body: BeaconBlockBody) -> BeaconBlock {
 | 
				
			||||||
        BeaconBlock {
 | 
					        BeaconBlock {
 | 
				
			||||||
            slot: self.slot,
 | 
					            slot: self.slot,
 | 
				
			||||||
 | 
				
			|||||||
@ -46,7 +46,7 @@ pub enum Error {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// The state of the `BeaconChain` at some slot.
 | 
					/// The state of the `BeaconChain` at some slot.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, TestRandom, Encode, Decode, TreeHash)]
 | 
					#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, TestRandom, Encode, Decode, TreeHash)]
 | 
				
			||||||
pub struct BeaconState {
 | 
					pub struct BeaconState {
 | 
				
			||||||
    // Misc
 | 
					    // Misc
 | 
				
			||||||
@ -120,7 +120,7 @@ impl BeaconState {
 | 
				
			|||||||
    /// This does not fully build a genesis beacon state, it omits processing of initial validator
 | 
					    /// This does not fully build a genesis beacon state, it omits processing of initial validator
 | 
				
			||||||
    /// deposits. To obtain a full genesis beacon state, use the `BeaconStateBuilder`.
 | 
					    /// deposits. To obtain a full genesis beacon state, use the `BeaconStateBuilder`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn genesis(genesis_time: u64, latest_eth1_data: Eth1Data, spec: &ChainSpec) -> BeaconState {
 | 
					    pub fn genesis(genesis_time: u64, latest_eth1_data: Eth1Data, spec: &ChainSpec) -> BeaconState {
 | 
				
			||||||
        let initial_crosslink = Crosslink {
 | 
					        let initial_crosslink = Crosslink {
 | 
				
			||||||
            epoch: spec.genesis_epoch,
 | 
					            epoch: spec.genesis_epoch,
 | 
				
			||||||
@ -192,7 +192,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Returns the `tree_hash_root` of the state.
 | 
					    /// Returns the `tree_hash_root` of the state.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn canonical_root(&self) -> Hash256 {
 | 
					    pub fn canonical_root(&self) -> Hash256 {
 | 
				
			||||||
        Hash256::from_slice(&self.tree_hash_root()[..])
 | 
					        Hash256::from_slice(&self.tree_hash_root()[..])
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -221,7 +221,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// The epoch corresponding to `self.slot`.
 | 
					    /// The epoch corresponding to `self.slot`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn current_epoch(&self, spec: &ChainSpec) -> Epoch {
 | 
					    pub fn current_epoch(&self, spec: &ChainSpec) -> Epoch {
 | 
				
			||||||
        self.slot.epoch(spec.slots_per_epoch)
 | 
					        self.slot.epoch(spec.slots_per_epoch)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -230,14 +230,14 @@ impl BeaconState {
 | 
				
			|||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// If the current epoch is the genesis epoch, the genesis_epoch is returned.
 | 
					    /// If the current epoch is the genesis epoch, the genesis_epoch is returned.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn previous_epoch(&self, spec: &ChainSpec) -> Epoch {
 | 
					    pub fn previous_epoch(&self, spec: &ChainSpec) -> Epoch {
 | 
				
			||||||
        self.current_epoch(&spec) - 1
 | 
					        self.current_epoch(&spec) - 1
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// The epoch following `self.current_epoch()`.
 | 
					    /// The epoch following `self.current_epoch()`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn next_epoch(&self, spec: &ChainSpec) -> Epoch {
 | 
					    pub fn next_epoch(&self, spec: &ChainSpec) -> Epoch {
 | 
				
			||||||
        self.current_epoch(spec) + 1
 | 
					        self.current_epoch(spec) + 1
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -250,7 +250,7 @@ impl BeaconState {
 | 
				
			|||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Note: Utilizes the cache and will fail if the appropriate cache is not initialized.
 | 
					    /// Note: Utilizes the cache and will fail if the appropriate cache is not initialized.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_cached_active_validator_indices(
 | 
					    pub fn get_cached_active_validator_indices(
 | 
				
			||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        relative_epoch: RelativeEpoch,
 | 
					        relative_epoch: RelativeEpoch,
 | 
				
			||||||
@ -265,7 +265,7 @@ impl BeaconState {
 | 
				
			|||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Does not utilize the cache, performs a full iteration over the validator registry.
 | 
					    /// Does not utilize the cache, performs a full iteration over the validator registry.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_active_validator_indices(&self, epoch: Epoch) -> Vec<usize> {
 | 
					    pub fn get_active_validator_indices(&self, epoch: Epoch) -> Vec<usize> {
 | 
				
			||||||
        get_active_validator_indices(&self.validator_registry, epoch)
 | 
					        get_active_validator_indices(&self.validator_registry, epoch)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -274,7 +274,7 @@ impl BeaconState {
 | 
				
			|||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Note: Utilizes the cache and will fail if the appropriate cache is not initialized.
 | 
					    /// Note: Utilizes the cache and will fail if the appropriate cache is not initialized.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_crosslink_committees_at_slot(
 | 
					    pub fn get_crosslink_committees_at_slot(
 | 
				
			||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        slot: Slot,
 | 
					        slot: Slot,
 | 
				
			||||||
@ -299,7 +299,7 @@ impl BeaconState {
 | 
				
			|||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Note: Utilizes the cache and will fail if the appropriate cache is not initialized.
 | 
					    /// Note: Utilizes the cache and will fail if the appropriate cache is not initialized.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_crosslink_committee_for_shard(
 | 
					    pub fn get_crosslink_committee_for_shard(
 | 
				
			||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        epoch: Epoch,
 | 
					        epoch: Epoch,
 | 
				
			||||||
@ -325,7 +325,7 @@ impl BeaconState {
 | 
				
			|||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// If the state does not contain an index for a beacon proposer at the requested `slot`, then `None` is returned.
 | 
					    /// If the state does not contain an index for a beacon proposer at the requested `slot`, then `None` is returned.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_beacon_proposer_index(
 | 
					    pub fn get_beacon_proposer_index(
 | 
				
			||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        slot: Slot,
 | 
					        slot: Slot,
 | 
				
			||||||
@ -354,7 +354,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Safely obtains the index for latest block roots, given some `slot`.
 | 
					    /// Safely obtains the index for latest block roots, given some `slot`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    fn get_latest_block_roots_index(&self, slot: Slot, spec: &ChainSpec) -> Result<usize, Error> {
 | 
					    fn get_latest_block_roots_index(&self, slot: Slot, spec: &ChainSpec) -> Result<usize, Error> {
 | 
				
			||||||
        if (slot < self.slot) && (self.slot <= slot + spec.slots_per_historical_root as u64) {
 | 
					        if (slot < self.slot) && (self.slot <= slot + spec.slots_per_historical_root as u64) {
 | 
				
			||||||
            let i = slot.as_usize() % spec.slots_per_historical_root;
 | 
					            let i = slot.as_usize() % spec.slots_per_historical_root;
 | 
				
			||||||
@ -370,7 +370,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Return the block root at a recent `slot`.
 | 
					    /// Return the block root at a recent `slot`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_block_root(
 | 
					    pub fn get_block_root(
 | 
				
			||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        slot: Slot,
 | 
					        slot: Slot,
 | 
				
			||||||
@ -382,7 +382,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Sets the block root for some given slot.
 | 
					    /// Sets the block root for some given slot.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn set_block_root(
 | 
					    pub fn set_block_root(
 | 
				
			||||||
        &mut self,
 | 
					        &mut self,
 | 
				
			||||||
        slot: Slot,
 | 
					        slot: Slot,
 | 
				
			||||||
@ -396,7 +396,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Safely obtains the index for `latest_randao_mixes`
 | 
					    /// Safely obtains the index for `latest_randao_mixes`
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    fn get_randao_mix_index(&self, epoch: Epoch, spec: &ChainSpec) -> Result<usize, Error> {
 | 
					    fn get_randao_mix_index(&self, epoch: Epoch, spec: &ChainSpec) -> Result<usize, Error> {
 | 
				
			||||||
        let current_epoch = self.current_epoch(spec);
 | 
					        let current_epoch = self.current_epoch(spec);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -420,7 +420,7 @@ impl BeaconState {
 | 
				
			|||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// See `Self::get_randao_mix`.
 | 
					    /// See `Self::get_randao_mix`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn update_randao_mix(
 | 
					    pub fn update_randao_mix(
 | 
				
			||||||
        &mut self,
 | 
					        &mut self,
 | 
				
			||||||
        epoch: Epoch,
 | 
					        epoch: Epoch,
 | 
				
			||||||
@ -438,7 +438,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Return the randao mix at a recent ``epoch``.
 | 
					    /// Return the randao mix at a recent ``epoch``.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_randao_mix(&self, epoch: Epoch, spec: &ChainSpec) -> Result<&Hash256, Error> {
 | 
					    pub fn get_randao_mix(&self, epoch: Epoch, spec: &ChainSpec) -> Result<&Hash256, Error> {
 | 
				
			||||||
        let i = self.get_randao_mix_index(epoch, spec)?;
 | 
					        let i = self.get_randao_mix_index(epoch, spec)?;
 | 
				
			||||||
        Ok(&self.latest_randao_mixes[i])
 | 
					        Ok(&self.latest_randao_mixes[i])
 | 
				
			||||||
@ -446,7 +446,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Set the randao mix at a recent ``epoch``.
 | 
					    /// Set the randao mix at a recent ``epoch``.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn set_randao_mix(
 | 
					    pub fn set_randao_mix(
 | 
				
			||||||
        &mut self,
 | 
					        &mut self,
 | 
				
			||||||
        epoch: Epoch,
 | 
					        epoch: Epoch,
 | 
				
			||||||
@ -460,7 +460,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Safely obtains the index for `latest_active_index_roots`, given some `epoch`.
 | 
					    /// Safely obtains the index for `latest_active_index_roots`, given some `epoch`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    fn get_active_index_root_index(&self, epoch: Epoch, spec: &ChainSpec) -> Result<usize, Error> {
 | 
					    fn get_active_index_root_index(&self, epoch: Epoch, spec: &ChainSpec) -> Result<usize, Error> {
 | 
				
			||||||
        let current_epoch = self.current_epoch(spec);
 | 
					        let current_epoch = self.current_epoch(spec);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -482,7 +482,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Return the `active_index_root` at a recent `epoch`.
 | 
					    /// Return the `active_index_root` at a recent `epoch`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_active_index_root(&self, epoch: Epoch, spec: &ChainSpec) -> Result<Hash256, Error> {
 | 
					    pub fn get_active_index_root(&self, epoch: Epoch, spec: &ChainSpec) -> Result<Hash256, Error> {
 | 
				
			||||||
        let i = self.get_active_index_root_index(epoch, spec)?;
 | 
					        let i = self.get_active_index_root_index(epoch, spec)?;
 | 
				
			||||||
        Ok(self.latest_active_index_roots[i])
 | 
					        Ok(self.latest_active_index_roots[i])
 | 
				
			||||||
@ -490,7 +490,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Set the `active_index_root` at a recent `epoch`.
 | 
					    /// Set the `active_index_root` at a recent `epoch`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn set_active_index_root(
 | 
					    pub fn set_active_index_root(
 | 
				
			||||||
        &mut self,
 | 
					        &mut self,
 | 
				
			||||||
        epoch: Epoch,
 | 
					        epoch: Epoch,
 | 
				
			||||||
@ -504,7 +504,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Replace `active_index_roots` with clones of `index_root`.
 | 
					    /// Replace `active_index_roots` with clones of `index_root`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn fill_active_index_roots_with(&mut self, index_root: Hash256, spec: &ChainSpec) {
 | 
					    pub fn fill_active_index_roots_with(&mut self, index_root: Hash256, spec: &ChainSpec) {
 | 
				
			||||||
        self.latest_active_index_roots =
 | 
					        self.latest_active_index_roots =
 | 
				
			||||||
            vec![index_root; spec.latest_active_index_roots_length as usize].into()
 | 
					            vec![index_root; spec.latest_active_index_roots_length as usize].into()
 | 
				
			||||||
@ -512,7 +512,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Safely obtains the index for latest state roots, given some `slot`.
 | 
					    /// Safely obtains the index for latest state roots, given some `slot`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    fn get_latest_state_roots_index(&self, slot: Slot, spec: &ChainSpec) -> Result<usize, Error> {
 | 
					    fn get_latest_state_roots_index(&self, slot: Slot, spec: &ChainSpec) -> Result<usize, Error> {
 | 
				
			||||||
        if (slot < self.slot) && (self.slot <= slot + spec.slots_per_historical_root as u64) {
 | 
					        if (slot < self.slot) && (self.slot <= slot + spec.slots_per_historical_root as u64) {
 | 
				
			||||||
            let i = slot.as_usize() % spec.slots_per_historical_root;
 | 
					            let i = slot.as_usize() % spec.slots_per_historical_root;
 | 
				
			||||||
@ -528,7 +528,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Gets the state root for some slot.
 | 
					    /// Gets the state root for some slot.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_state_root(&mut self, slot: Slot, spec: &ChainSpec) -> Result<&Hash256, Error> {
 | 
					    pub fn get_state_root(&mut self, slot: Slot, spec: &ChainSpec) -> Result<&Hash256, Error> {
 | 
				
			||||||
        let i = self.get_latest_state_roots_index(slot, spec)?;
 | 
					        let i = self.get_latest_state_roots_index(slot, spec)?;
 | 
				
			||||||
        Ok(&self.latest_state_roots[i])
 | 
					        Ok(&self.latest_state_roots[i])
 | 
				
			||||||
@ -536,7 +536,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Sets the latest state root for slot.
 | 
					    /// Sets the latest state root for slot.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn set_state_root(
 | 
					    pub fn set_state_root(
 | 
				
			||||||
        &mut self,
 | 
					        &mut self,
 | 
				
			||||||
        slot: Slot,
 | 
					        slot: Slot,
 | 
				
			||||||
@ -550,7 +550,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Safely obtains the index for `latest_slashed_balances`, given some `epoch`.
 | 
					    /// Safely obtains the index for `latest_slashed_balances`, given some `epoch`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    fn get_slashed_balance_index(&self, epoch: Epoch, spec: &ChainSpec) -> Result<usize, Error> {
 | 
					    fn get_slashed_balance_index(&self, epoch: Epoch, spec: &ChainSpec) -> Result<usize, Error> {
 | 
				
			||||||
        let i = epoch.as_usize() % spec.latest_slashed_exit_length;
 | 
					        let i = epoch.as_usize() % spec.latest_slashed_exit_length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -565,7 +565,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Gets the total slashed balances for some epoch.
 | 
					    /// Gets the total slashed balances for some epoch.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_slashed_balance(&self, epoch: Epoch, spec: &ChainSpec) -> Result<u64, Error> {
 | 
					    pub fn get_slashed_balance(&self, epoch: Epoch, spec: &ChainSpec) -> Result<u64, Error> {
 | 
				
			||||||
        let i = self.get_slashed_balance_index(epoch, spec)?;
 | 
					        let i = self.get_slashed_balance_index(epoch, spec)?;
 | 
				
			||||||
        Ok(self.latest_slashed_balances[i])
 | 
					        Ok(self.latest_slashed_balances[i])
 | 
				
			||||||
@ -573,7 +573,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Sets the total slashed balances for some epoch.
 | 
					    /// Sets the total slashed balances for some epoch.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn set_slashed_balance(
 | 
					    pub fn set_slashed_balance(
 | 
				
			||||||
        &mut self,
 | 
					        &mut self,
 | 
				
			||||||
        epoch: Epoch,
 | 
					        epoch: Epoch,
 | 
				
			||||||
@ -587,7 +587,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Generate a seed for the given `epoch`.
 | 
					    /// Generate a seed for the given `epoch`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn generate_seed(&self, epoch: Epoch, spec: &ChainSpec) -> Result<Hash256, Error> {
 | 
					    pub fn generate_seed(&self, epoch: Epoch, spec: &ChainSpec) -> Result<Hash256, Error> {
 | 
				
			||||||
        let mut input = self
 | 
					        let mut input = self
 | 
				
			||||||
            .get_randao_mix(epoch - spec.min_seed_lookahead, spec)?
 | 
					            .get_randao_mix(epoch - spec.min_seed_lookahead, spec)?
 | 
				
			||||||
@ -603,7 +603,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Return the effective balance (also known as "balance at stake") for a validator with the given ``index``.
 | 
					    /// Return the effective balance (also known as "balance at stake") for a validator with the given ``index``.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_effective_balance(
 | 
					    pub fn get_effective_balance(
 | 
				
			||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        validator_index: usize,
 | 
					        validator_index: usize,
 | 
				
			||||||
@ -618,14 +618,14 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ///  Return the epoch at which an activation or exit triggered in ``epoch`` takes effect.
 | 
					    ///  Return the epoch at which an activation or exit triggered in ``epoch`` takes effect.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    ///  Spec v0.5.0
 | 
					    ///  Spec v0.5.1
 | 
				
			||||||
    pub fn get_delayed_activation_exit_epoch(&self, epoch: Epoch, spec: &ChainSpec) -> Epoch {
 | 
					    pub fn get_delayed_activation_exit_epoch(&self, epoch: Epoch, spec: &ChainSpec) -> Epoch {
 | 
				
			||||||
        epoch + 1 + spec.activation_exit_delay
 | 
					        epoch + 1 + spec.activation_exit_delay
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Initiate an exit for the validator of the given `index`.
 | 
					    /// Initiate an exit for the validator of the given `index`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn initiate_validator_exit(&mut self, validator_index: usize) {
 | 
					    pub fn initiate_validator_exit(&mut self, validator_index: usize) {
 | 
				
			||||||
        self.validator_registry[validator_index].initiated_exit = true;
 | 
					        self.validator_registry[validator_index].initiated_exit = true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -637,7 +637,7 @@ impl BeaconState {
 | 
				
			|||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Note: Utilizes the cache and will fail if the appropriate cache is not initialized.
 | 
					    /// Note: Utilizes the cache and will fail if the appropriate cache is not initialized.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_attestation_duties(
 | 
					    pub fn get_attestation_duties(
 | 
				
			||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        validator_index: usize,
 | 
					        validator_index: usize,
 | 
				
			||||||
@ -653,7 +653,7 @@ impl BeaconState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Return the combined effective balance of an array of validators.
 | 
					    /// Return the combined effective balance of an array of validators.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_total_balance(
 | 
					    pub fn get_total_balance(
 | 
				
			||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        validator_indices: &[usize],
 | 
					        validator_indices: &[usize],
 | 
				
			||||||
 | 
				
			|||||||
@ -138,7 +138,7 @@ impl EpochCache {
 | 
				
			|||||||
/// Returns a list of all `validator_registry` indices where the validator is active at the given
 | 
					/// Returns a list of all `validator_registry` indices where the validator is active at the given
 | 
				
			||||||
/// `epoch`.
 | 
					/// `epoch`.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub fn get_active_validator_indices(validators: &[Validator], epoch: Epoch) -> Vec<usize> {
 | 
					pub fn get_active_validator_indices(validators: &[Validator], epoch: Epoch) -> Vec<usize> {
 | 
				
			||||||
    let mut active = Vec::with_capacity(validators.len());
 | 
					    let mut active = Vec::with_capacity(validators.len());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ const GWEI: u64 = 1_000_000_000;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Each of the BLS signature domains.
 | 
					/// Each of the BLS signature domains.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
pub enum Domain {
 | 
					pub enum Domain {
 | 
				
			||||||
    BeaconBlock,
 | 
					    BeaconBlock,
 | 
				
			||||||
    Randao,
 | 
					    Randao,
 | 
				
			||||||
@ -20,7 +20,7 @@ pub enum Domain {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Holds all the "constants" for a BeaconChain.
 | 
					/// Holds all the "constants" for a BeaconChain.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(PartialEq, Debug, Clone, Deserialize)]
 | 
					#[derive(PartialEq, Debug, Clone, Deserialize)]
 | 
				
			||||||
#[serde(default)]
 | 
					#[serde(default)]
 | 
				
			||||||
pub struct ChainSpec {
 | 
					pub struct ChainSpec {
 | 
				
			||||||
@ -126,7 +126,7 @@ pub struct ChainSpec {
 | 
				
			|||||||
impl ChainSpec {
 | 
					impl ChainSpec {
 | 
				
			||||||
    /// Return the number of committees in one epoch.
 | 
					    /// Return the number of committees in one epoch.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_epoch_committee_count(&self, active_validator_count: usize) -> u64 {
 | 
					    pub fn get_epoch_committee_count(&self, active_validator_count: usize) -> u64 {
 | 
				
			||||||
        std::cmp::max(
 | 
					        std::cmp::max(
 | 
				
			||||||
            1,
 | 
					            1,
 | 
				
			||||||
@ -139,7 +139,7 @@ impl ChainSpec {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Get the domain number that represents the fork meta and signature domain.
 | 
					    /// Get the domain number that represents the fork meta and signature domain.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_domain(&self, epoch: Epoch, domain: Domain, fork: &Fork) -> u64 {
 | 
					    pub fn get_domain(&self, epoch: Epoch, domain: Domain, fork: &Fork) -> u64 {
 | 
				
			||||||
        let domain_constant = match domain {
 | 
					        let domain_constant = match domain {
 | 
				
			||||||
            Domain::BeaconBlock => self.domain_beacon_block,
 | 
					            Domain::BeaconBlock => self.domain_beacon_block,
 | 
				
			||||||
@ -161,7 +161,7 @@ impl ChainSpec {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Returns a `ChainSpec` compatible with the Ethereum Foundation specification.
 | 
					    /// Returns a `ChainSpec` compatible with the Ethereum Foundation specification.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn foundation() -> Self {
 | 
					    pub fn foundation() -> Self {
 | 
				
			||||||
        let genesis_slot = Slot::new(2_u64.pow(32));
 | 
					        let genesis_slot = Slot::new(2_u64.pow(32));
 | 
				
			||||||
        let slots_per_epoch = 64;
 | 
					        let slots_per_epoch = 64;
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Specifies the block hash for a shard at an epoch.
 | 
					/// Specifies the block hash for a shard at an epoch.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(
 | 
					#[derive(
 | 
				
			||||||
    Debug,
 | 
					    Debug,
 | 
				
			||||||
    Clone,
 | 
					    Clone,
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// A deposit to potentially become a beacon chain validator.
 | 
					/// A deposit to potentially become a beacon chain validator.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
					#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
				
			||||||
pub struct Deposit {
 | 
					pub struct Deposit {
 | 
				
			||||||
    pub proof: TreeHashVector<Hash256>,
 | 
					    pub proof: TreeHashVector<Hash256>,
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Data generated by the deposit contract.
 | 
					/// Data generated by the deposit contract.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
					#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
				
			||||||
pub struct DepositData {
 | 
					pub struct DepositData {
 | 
				
			||||||
    pub amount: u64,
 | 
					    pub amount: u64,
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// The data supplied by the user to the deposit contract.
 | 
					/// The data supplied by the user to the deposit contract.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(
 | 
					#[derive(
 | 
				
			||||||
    Debug,
 | 
					    Debug,
 | 
				
			||||||
    PartialEq,
 | 
					    PartialEq,
 | 
				
			||||||
@ -33,7 +33,7 @@ pub struct DepositInput {
 | 
				
			|||||||
impl DepositInput {
 | 
					impl DepositInput {
 | 
				
			||||||
    /// Generate the 'proof_of_posession' signature for a given DepositInput details.
 | 
					    /// Generate the 'proof_of_posession' signature for a given DepositInput details.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn create_proof_of_possession(
 | 
					    pub fn create_proof_of_possession(
 | 
				
			||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        secret_key: &SecretKey,
 | 
					        secret_key: &SecretKey,
 | 
				
			||||||
@ -49,7 +49,7 @@ impl DepositInput {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Verify that proof-of-possession is valid.
 | 
					    /// Verify that proof-of-possession is valid.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn validate_proof_of_possession(
 | 
					    pub fn validate_proof_of_possession(
 | 
				
			||||||
        &self,
 | 
					        &self,
 | 
				
			||||||
        epoch: Epoch,
 | 
					        epoch: Epoch,
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Contains data obtained from the Eth1 chain.
 | 
					/// Contains data obtained from the Eth1 chain.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(
 | 
					#[derive(
 | 
				
			||||||
    Debug, PartialEq, Clone, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
 | 
					    Debug, PartialEq, Clone, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
 | 
				
			||||||
)]
 | 
					)]
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// A summation of votes for some `Eth1Data`.
 | 
					/// A summation of votes for some `Eth1Data`.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(
 | 
					#[derive(
 | 
				
			||||||
    Debug, PartialEq, Clone, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
 | 
					    Debug, PartialEq, Clone, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
 | 
				
			||||||
)]
 | 
					)]
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Specifies a fork of the `BeaconChain`, to prevent replay attacks.
 | 
					/// Specifies a fork of the `BeaconChain`, to prevent replay attacks.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(
 | 
					#[derive(
 | 
				
			||||||
    Debug, Clone, PartialEq, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
 | 
					    Debug, Clone, PartialEq, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
 | 
				
			||||||
)]
 | 
					)]
 | 
				
			||||||
@ -26,7 +26,7 @@ pub struct Fork {
 | 
				
			|||||||
impl Fork {
 | 
					impl Fork {
 | 
				
			||||||
    /// Initialize the `Fork` from the genesis parameters in the `spec`.
 | 
					    /// Initialize the `Fork` from the genesis parameters in the `spec`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn genesis(spec: &ChainSpec) -> Self {
 | 
					    pub fn genesis(spec: &ChainSpec) -> Self {
 | 
				
			||||||
        let mut current_version: [u8; 4] = [0; 4];
 | 
					        let mut current_version: [u8; 4] = [0; 4];
 | 
				
			||||||
        current_version.copy_from_slice(&int_to_bytes4(spec.genesis_fork_version));
 | 
					        current_version.copy_from_slice(&int_to_bytes4(spec.genesis_fork_version));
 | 
				
			||||||
@ -40,7 +40,7 @@ impl Fork {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /// Return the fork version of the given ``epoch``.
 | 
					    /// Return the fork version of the given ``epoch``.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn get_fork_version(&self, epoch: Epoch) -> [u8; 4] {
 | 
					    pub fn get_fork_version(&self, epoch: Epoch) -> [u8; 4] {
 | 
				
			||||||
        if epoch < self.epoch {
 | 
					        if epoch < self.epoch {
 | 
				
			||||||
            return self.previous_version;
 | 
					            return self.previous_version;
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Historical block and state roots.
 | 
					/// Historical block and state roots.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
					#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
				
			||||||
pub struct HistoricalBatch {
 | 
					pub struct HistoricalBatch {
 | 
				
			||||||
    pub block_roots: TreeHashVector<Hash256>,
 | 
					    pub block_roots: TreeHashVector<Hash256>,
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// An attestation that has been included in the state but not yet fully processed.
 | 
					/// An attestation that has been included in the state but not yet fully processed.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
					#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
				
			||||||
pub struct PendingAttestation {
 | 
					pub struct PendingAttestation {
 | 
				
			||||||
    pub aggregation_bitfield: Bitfield,
 | 
					    pub aggregation_bitfield: Bitfield,
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Two conflicting proposals from the same proposer (validator).
 | 
					/// Two conflicting proposals from the same proposer (validator).
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
					#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
 | 
				
			||||||
pub struct ProposerSlashing {
 | 
					pub struct ProposerSlashing {
 | 
				
			||||||
    pub proposer_index: u64,
 | 
					    pub proposer_index: u64,
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ pub enum Error {
 | 
				
			|||||||
/// Defines the epochs relative to some epoch. Most useful when referring to the committees prior
 | 
					/// Defines the epochs relative to some epoch. Most useful when referring to the committees prior
 | 
				
			||||||
/// to and following some epoch.
 | 
					/// to and following some epoch.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(Debug, PartialEq, Clone, Copy)]
 | 
					#[derive(Debug, PartialEq, Clone, Copy)]
 | 
				
			||||||
pub enum RelativeEpoch {
 | 
					pub enum RelativeEpoch {
 | 
				
			||||||
    /// The prior epoch.
 | 
					    /// The prior epoch.
 | 
				
			||||||
@ -32,7 +32,7 @@ pub enum RelativeEpoch {
 | 
				
			|||||||
impl RelativeEpoch {
 | 
					impl RelativeEpoch {
 | 
				
			||||||
    /// Returns the `epoch` that `self` refers to, with respect to the `base` epoch.
 | 
					    /// Returns the `epoch` that `self` refers to, with respect to the `base` epoch.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn into_epoch(self, base: Epoch) -> Epoch {
 | 
					    pub fn into_epoch(self, base: Epoch) -> Epoch {
 | 
				
			||||||
        match self {
 | 
					        match self {
 | 
				
			||||||
            RelativeEpoch::Previous => base - 1,
 | 
					            RelativeEpoch::Previous => base - 1,
 | 
				
			||||||
@ -51,7 +51,7 @@ impl RelativeEpoch {
 | 
				
			|||||||
    /// - `AmbiguiousNextEpoch` whenever `other` is one after `base`, because it's unknowable if
 | 
					    /// - `AmbiguiousNextEpoch` whenever `other` is one after `base`, because it's unknowable if
 | 
				
			||||||
    ///   there will be a registry change.
 | 
					    ///   there will be a registry change.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn from_epoch(base: Epoch, other: Epoch) -> Result<Self, Error> {
 | 
					    pub fn from_epoch(base: Epoch, other: Epoch) -> Result<Self, Error> {
 | 
				
			||||||
        if other == base - 1 {
 | 
					        if other == base - 1 {
 | 
				
			||||||
            Ok(RelativeEpoch::Previous)
 | 
					            Ok(RelativeEpoch::Previous)
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// To be included in an `AttesterSlashing`.
 | 
					/// To be included in an `AttesterSlashing`.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(
 | 
					#[derive(
 | 
				
			||||||
    Debug,
 | 
					    Debug,
 | 
				
			||||||
    PartialEq,
 | 
					    PartialEq,
 | 
				
			||||||
@ -35,14 +35,14 @@ pub struct SlashableAttestation {
 | 
				
			|||||||
impl SlashableAttestation {
 | 
					impl SlashableAttestation {
 | 
				
			||||||
    /// Check if ``attestation_data_1`` and ``attestation_data_2`` have the same target.
 | 
					    /// Check if ``attestation_data_1`` and ``attestation_data_2`` have the same target.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn is_double_vote(&self, other: &SlashableAttestation, spec: &ChainSpec) -> bool {
 | 
					    pub fn is_double_vote(&self, other: &SlashableAttestation, spec: &ChainSpec) -> bool {
 | 
				
			||||||
        self.data.slot.epoch(spec.slots_per_epoch) == other.data.slot.epoch(spec.slots_per_epoch)
 | 
					        self.data.slot.epoch(spec.slots_per_epoch) == other.data.slot.epoch(spec.slots_per_epoch)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Check if ``attestation_data_1`` surrounds ``attestation_data_2``.
 | 
					    /// Check if ``attestation_data_1`` surrounds ``attestation_data_2``.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Spec v0.5.0
 | 
					    /// Spec v0.5.1
 | 
				
			||||||
    pub fn is_surround_vote(&self, other: &SlashableAttestation, spec: &ChainSpec) -> bool {
 | 
					    pub fn is_surround_vote(&self, other: &SlashableAttestation, spec: &ChainSpec) -> bool {
 | 
				
			||||||
        let source_epoch_1 = self.data.source_epoch;
 | 
					        let source_epoch_1 = self.data.source_epoch;
 | 
				
			||||||
        let source_epoch_2 = other.data.source_epoch;
 | 
					        let source_epoch_2 = other.data.source_epoch;
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// The data submitted to the deposit contract.
 | 
					/// The data submitted to the deposit contract.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(
 | 
					#[derive(
 | 
				
			||||||
    Debug,
 | 
					    Debug,
 | 
				
			||||||
    Clone,
 | 
					    Clone,
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ use tree_hash_derive::TreeHash;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Information about a `BeaconChain` validator.
 | 
					/// Information about a `BeaconChain` validator.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TestRandom, TreeHash)]
 | 
					#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TestRandom, TreeHash)]
 | 
				
			||||||
pub struct Validator {
 | 
					pub struct Validator {
 | 
				
			||||||
    pub pubkey: PublicKey,
 | 
					    pub pubkey: PublicKey,
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// An exit voluntarily submitted a validator who wishes to withdraw.
 | 
					/// An exit voluntarily submitted a validator who wishes to withdraw.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Spec v0.5.0
 | 
					/// Spec v0.5.1
 | 
				
			||||||
#[derive(
 | 
					#[derive(
 | 
				
			||||||
    Debug,
 | 
					    Debug,
 | 
				
			||||||
    PartialEq,
 | 
					    PartialEq,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user