spec: update tags to v0.5.1

This commit is contained in:
Michael Sproul
2019-04-15 10:51:20 +10:00
parent 2914d77cd3
commit d95ae95ce8
48 changed files with 148 additions and 148 deletions

View File

@@ -9,7 +9,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
/// Details an attestation that can be slashable.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(
Debug,
Clone,

View File

@@ -9,7 +9,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
/// The data upon which an attestation is based.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(
Debug,
Clone,

View File

@@ -7,7 +7,7 @@ use tree_hash_derive::TreeHash;
/// 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)]
pub struct AttestationDataAndCustodyBit {
pub data: AttestationData,

View File

@@ -7,7 +7,7 @@ use tree_hash_derive::TreeHash;
/// Two conflicting attestations.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
pub struct AttesterSlashing {
pub slashable_attestation_1: SlashableAttestation,

View File

@@ -10,7 +10,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
/// A block of the `BeaconChain`.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(
Debug,
PartialEq,
@@ -35,7 +35,7 @@ pub struct BeaconBlock {
impl BeaconBlock {
/// Returns an empty block to be used during genesis.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn empty(spec: &ChainSpec) -> BeaconBlock {
BeaconBlock {
slot: spec.genesis_slot,
@@ -60,7 +60,7 @@ impl BeaconBlock {
/// Returns the `tree_hash_root | update` of the block.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn canonical_root(&self) -> Hash256 {
Hash256::from_slice(&self.tree_hash_root()[..])
}
@@ -72,7 +72,7 @@ impl BeaconBlock {
///
/// Note: performs a full tree-hash of `self.body`.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn block_header(&self) -> BeaconBlockHeader {
BeaconBlockHeader {
slot: self.slot,
@@ -85,7 +85,7 @@ impl BeaconBlock {
/// 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 {
BeaconBlockHeader {
state_root: spec.zero_hash,

View File

@@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
/// 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)]
pub struct BeaconBlockBody {
pub randao_reveal: Signature,

View File

@@ -10,7 +10,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
/// A header of a `BeaconBlock`.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(
Debug,
PartialEq,
@@ -35,14 +35,14 @@ pub struct BeaconBlockHeader {
impl BeaconBlockHeader {
/// Returns the `tree_hash_root` of the header.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn canonical_root(&self) -> Hash256 {
Hash256::from_slice(&self.tree_hash_root()[..])
}
/// 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 {
BeaconBlock {
slot: self.slot,

View File

@@ -46,7 +46,7 @@ pub enum Error {
/// 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)]
pub struct BeaconState {
// Misc
@@ -120,7 +120,7 @@ impl BeaconState {
/// 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`.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn genesis(genesis_time: u64, latest_eth1_data: Eth1Data, spec: &ChainSpec) -> BeaconState {
let initial_crosslink = Crosslink {
epoch: spec.genesis_epoch,
@@ -192,7 +192,7 @@ impl BeaconState {
/// Returns the `tree_hash_root` of the state.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn canonical_root(&self) -> Hash256 {
Hash256::from_slice(&self.tree_hash_root()[..])
}
@@ -221,7 +221,7 @@ impl BeaconState {
/// The epoch corresponding to `self.slot`.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn current_epoch(&self, spec: &ChainSpec) -> 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.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn previous_epoch(&self, spec: &ChainSpec) -> Epoch {
self.current_epoch(&spec) - 1
}
/// The epoch following `self.current_epoch()`.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn next_epoch(&self, spec: &ChainSpec) -> Epoch {
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.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn get_cached_active_validator_indices(
&self,
relative_epoch: RelativeEpoch,
@@ -265,7 +265,7 @@ impl BeaconState {
///
/// 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> {
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.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn get_crosslink_committees_at_slot(
&self,
slot: Slot,
@@ -299,7 +299,7 @@ impl BeaconState {
///
/// 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(
&self,
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.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn get_beacon_proposer_index(
&self,
slot: Slot,
@@ -354,7 +354,7 @@ impl BeaconState {
/// 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> {
if (slot < self.slot) && (self.slot <= slot + spec.slots_per_historical_root as u64) {
let i = slot.as_usize() % spec.slots_per_historical_root;
@@ -370,7 +370,7 @@ impl BeaconState {
/// Return the block root at a recent `slot`.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn get_block_root(
&self,
slot: Slot,
@@ -382,7 +382,7 @@ impl BeaconState {
/// Sets the block root for some given slot.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn set_block_root(
&mut self,
slot: Slot,
@@ -396,7 +396,7 @@ impl BeaconState {
/// 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> {
let current_epoch = self.current_epoch(spec);
@@ -420,7 +420,7 @@ impl BeaconState {
///
/// See `Self::get_randao_mix`.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn update_randao_mix(
&mut self,
epoch: Epoch,
@@ -438,7 +438,7 @@ impl BeaconState {
/// 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> {
let i = self.get_randao_mix_index(epoch, spec)?;
Ok(&self.latest_randao_mixes[i])
@@ -446,7 +446,7 @@ impl BeaconState {
/// Set the randao mix at a recent ``epoch``.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn set_randao_mix(
&mut self,
epoch: Epoch,
@@ -460,7 +460,7 @@ impl BeaconState {
/// 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> {
let current_epoch = self.current_epoch(spec);
@@ -482,7 +482,7 @@ impl BeaconState {
/// 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> {
let i = self.get_active_index_root_index(epoch, spec)?;
Ok(self.latest_active_index_roots[i])
@@ -490,7 +490,7 @@ impl BeaconState {
/// Set the `active_index_root` at a recent `epoch`.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn set_active_index_root(
&mut self,
epoch: Epoch,
@@ -504,7 +504,7 @@ impl BeaconState {
/// 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) {
self.latest_active_index_roots =
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`.
///
/// Spec v0.5.0
/// Spec v0.5.1
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) {
let i = slot.as_usize() % spec.slots_per_historical_root;
@@ -528,7 +528,7 @@ impl BeaconState {
/// 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> {
let i = self.get_latest_state_roots_index(slot, spec)?;
Ok(&self.latest_state_roots[i])
@@ -536,7 +536,7 @@ impl BeaconState {
/// Sets the latest state root for slot.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn set_state_root(
&mut self,
slot: Slot,
@@ -550,7 +550,7 @@ impl BeaconState {
/// 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> {
let i = epoch.as_usize() % spec.latest_slashed_exit_length;
@@ -565,7 +565,7 @@ impl BeaconState {
/// 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> {
let i = self.get_slashed_balance_index(epoch, spec)?;
Ok(self.latest_slashed_balances[i])
@@ -573,7 +573,7 @@ impl BeaconState {
/// Sets the total slashed balances for some epoch.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn set_slashed_balance(
&mut self,
epoch: Epoch,
@@ -587,7 +587,7 @@ impl BeaconState {
/// 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> {
let mut input = self
.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``.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn get_effective_balance(
&self,
validator_index: usize,
@@ -618,14 +618,14 @@ impl BeaconState {
/// 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 {
epoch + 1 + spec.activation_exit_delay
}
/// 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) {
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.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn get_attestation_duties(
&self,
validator_index: usize,
@@ -653,7 +653,7 @@ impl BeaconState {
/// Return the combined effective balance of an array of validators.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn get_total_balance(
&self,
validator_indices: &[usize],

View File

@@ -138,7 +138,7 @@ impl EpochCache {
/// Returns a list of all `validator_registry` indices where the validator is active at the given
/// `epoch`.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn get_active_validator_indices(validators: &[Validator], epoch: Epoch) -> Vec<usize> {
let mut active = Vec::with_capacity(validators.len());

View File

@@ -8,7 +8,7 @@ const GWEI: u64 = 1_000_000_000;
/// Each of the BLS signature domains.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub enum Domain {
BeaconBlock,
Randao,
@@ -20,7 +20,7 @@ pub enum Domain {
/// Holds all the "constants" for a BeaconChain.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(PartialEq, Debug, Clone, Deserialize)]
#[serde(default)]
pub struct ChainSpec {
@@ -126,7 +126,7 @@ pub struct ChainSpec {
impl ChainSpec {
/// 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 {
std::cmp::max(
1,
@@ -139,7 +139,7 @@ impl ChainSpec {
/// 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 {
let domain_constant = match domain {
Domain::BeaconBlock => self.domain_beacon_block,
@@ -161,7 +161,7 @@ impl ChainSpec {
/// Returns a `ChainSpec` compatible with the Ethereum Foundation specification.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn foundation() -> Self {
let genesis_slot = Slot::new(2_u64.pow(32));
let slots_per_epoch = 64;

View File

@@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
/// Specifies the block hash for a shard at an epoch.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(
Debug,
Clone,

View File

@@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
/// 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)]
pub struct Deposit {
pub proof: TreeHashVector<Hash256>,

View File

@@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
/// Data generated by the deposit contract.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
pub struct DepositData {
pub amount: u64,

View File

@@ -10,7 +10,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
/// The data supplied by the user to the deposit contract.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(
Debug,
PartialEq,
@@ -33,7 +33,7 @@ pub struct DepositInput {
impl DepositInput {
/// 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(
&self,
secret_key: &SecretKey,
@@ -49,7 +49,7 @@ impl DepositInput {
/// Verify that proof-of-possession is valid.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn validate_proof_of_possession(
&self,
epoch: Epoch,

View File

@@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
/// Contains data obtained from the Eth1 chain.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(
Debug, PartialEq, Clone, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]

View File

@@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
/// A summation of votes for some `Eth1Data`.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(
Debug, PartialEq, Clone, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]

View File

@@ -11,7 +11,7 @@ use tree_hash_derive::TreeHash;
/// Specifies a fork of the `BeaconChain`, to prevent replay attacks.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(
Debug, Clone, PartialEq, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
@@ -26,7 +26,7 @@ pub struct Fork {
impl Fork {
/// Initialize the `Fork` from the genesis parameters in the `spec`.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn genesis(spec: &ChainSpec) -> Self {
let mut current_version: [u8; 4] = [0; 4];
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``.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn get_fork_version(&self, epoch: Epoch) -> [u8; 4] {
if epoch < self.epoch {
return self.previous_version;

View File

@@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
/// Historical block and state roots.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
pub struct HistoricalBatch {
pub block_roots: TreeHashVector<Hash256>,

View File

@@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
/// 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)]
pub struct PendingAttestation {
pub aggregation_bitfield: Bitfield,

View File

@@ -8,7 +8,7 @@ use tree_hash_derive::TreeHash;
/// 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)]
pub struct ProposerSlashing {
pub proposer_index: u64,

View File

@@ -10,7 +10,7 @@ pub enum Error {
/// Defines the epochs relative to some epoch. Most useful when referring to the committees prior
/// to and following some epoch.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum RelativeEpoch {
/// The prior epoch.
@@ -32,7 +32,7 @@ pub enum RelativeEpoch {
impl RelativeEpoch {
/// 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 {
match self {
RelativeEpoch::Previous => base - 1,
@@ -51,7 +51,7 @@ impl RelativeEpoch {
/// - `AmbiguiousNextEpoch` whenever `other` is one after `base`, because it's unknowable if
/// 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> {
if other == base - 1 {
Ok(RelativeEpoch::Previous)

View File

@@ -10,7 +10,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
///
/// To be included in an `AttesterSlashing`.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(
Debug,
PartialEq,
@@ -35,14 +35,14 @@ pub struct SlashableAttestation {
impl SlashableAttestation {
/// 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 {
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``.
///
/// Spec v0.5.0
/// Spec v0.5.1
pub fn is_surround_vote(&self, other: &SlashableAttestation, spec: &ChainSpec) -> bool {
let source_epoch_1 = self.data.source_epoch;
let source_epoch_2 = other.data.source_epoch;

View File

@@ -11,7 +11,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
/// The data submitted to the deposit contract.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(
Debug,
Clone,

View File

@@ -7,7 +7,7 @@ use tree_hash_derive::TreeHash;
/// Information about a `BeaconChain` validator.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TestRandom, TreeHash)]
pub struct Validator {
pub pubkey: PublicKey,

View File

@@ -9,7 +9,7 @@ use tree_hash_derive::{SignedRoot, TreeHash};
/// An exit voluntarily submitted a validator who wishes to withdraw.
///
/// Spec v0.5.0
/// Spec v0.5.1
#[derive(
Debug,
PartialEq,