Fix lots of typos.

This commit is contained in:
John Adler 2019-07-26 15:26:06 -04:00
parent b5af73d056
commit fec7168512
No known key found for this signature in database
GPG Key ID: B25AB670E915E2DA
41 changed files with 68 additions and 68 deletions

View File

@ -16,12 +16,12 @@ An open-source Ethereum 2.0 client, written in Rust and maintained by Sigma Prim
Lighthouse is: Lighthouse is:
- Fully open-source, licensed under Apache 2.0. - Fully open-source, licensed under Apache 2.0.
- Security-focussed, fuzzing has begun and security reviews are planned - Security-focused, fuzzing has begun and security reviews are planned
for late-2019. for late-2019.
- Built in [Rust](https://www.rust-lang.org/), a modern language providing unique safety guarantees and - Built in [Rust](https://www.rust-lang.org/), a modern language providing unique safety guarantees and
excellent performance (comparable to C++). excellent performance (comparable to C++).
- Funded by various organisations, including Sigma Prime, the - Funded by various organisations, including Sigma Prime, the
Ethereum Foundation, Consensys and private individuals. Ethereum Foundation, ConsenSys and private individuals.
- Actively working to promote an inter-operable, multi-client Ethereum 2.0. - Actively working to promote an inter-operable, multi-client Ethereum 2.0.

View File

@ -70,10 +70,10 @@ pub struct BeaconChain<T: BeaconChainTypes> {
/// Stores all operations (e.g., `Attestation`, `Deposit`, etc) that are candidates for /// Stores all operations (e.g., `Attestation`, `Deposit`, etc) that are candidates for
/// inclusion in a block. /// inclusion in a block.
pub op_pool: OperationPool<T::EthSpec>, pub op_pool: OperationPool<T::EthSpec>,
/// Stores a "snapshot" of the chain at the time the head-of-the-chain block was recieved. /// Stores a "snapshot" of the chain at the time the head-of-the-chain block was received.
canonical_head: RwLock<CheckPoint<T::EthSpec>>, canonical_head: RwLock<CheckPoint<T::EthSpec>>,
/// The same state from `self.canonical_head`, but updated at the start of each slot with a /// The same state from `self.canonical_head`, but updated at the start of each slot with a
/// skip slot if no block is recieved. This is effectively a cache that avoids repeating calls /// skip slot if no block is received. This is effectively a cache that avoids repeating calls
/// to `per_slot_processing`. /// to `per_slot_processing`.
state: RwLock<BeaconState<T::EthSpec>>, state: RwLock<BeaconState<T::EthSpec>>,
/// The root of the genesis block. /// The root of the genesis block.
@ -391,12 +391,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
/// ///
/// Information is read from the current state, so only information from the present and prior /// Information is read from the current state, so only information from the present and prior
/// epoch is available. /// epoch is available.
pub fn validator_attestion_slot_and_shard( pub fn validator_attestation_slot_and_shard(
&self, &self,
validator_index: usize, validator_index: usize,
) -> Result<Option<(Slot, u64)>, BeaconStateError> { ) -> Result<Option<(Slot, u64)>, BeaconStateError> {
trace!( trace!(
"BeaconChain::validator_attestion_slot_and_shard: validator_index: {}", "BeaconChain::validator_attestation_slot_and_shard: validator_index: {}",
validator_index validator_index
); );
if let Some(attestation_duty) = self if let Some(attestation_duty) = self

View File

@ -145,7 +145,7 @@ impl<T: BeaconChainTypes> ForkChoice<T> {
// 2. Ignore all attestations to the zero hash. // 2. Ignore all attestations to the zero hash.
// //
// (1) becomes weird once we hit finality and fork choice drops the genesis block. (2) is // (1) becomes weird once we hit finality and fork choice drops the genesis block. (2) is
// fine becuase votes to the genesis block are not useful; all validators implicitly attest // fine because votes to the genesis block are not useful; all validators implicitly attest
// to genesis just by being present in the chain. // to genesis just by being present in the chain.
if block_hash != Hash256::zero() { if block_hash != Hash256::zero() {
let block_slot = attestation let block_slot = attestation

View File

@ -54,7 +54,7 @@ impl Default for Config {
network_dir.push("network"); network_dir.push("network");
Config { Config {
network_dir, network_dir,
listen_address: "127.0.0.1".parse().expect("vaild ip address"), listen_address: "127.0.0.1".parse().expect("valid ip address"),
libp2p_port: 9000, libp2p_port: 9000,
discovery_address: "127.0.0.1".parse().expect("valid ip address"), discovery_address: "127.0.0.1".parse().expect("valid ip address"),
discovery_port: 9000, discovery_port: 9000,

View File

@ -43,7 +43,7 @@ pub enum GoodbyeReason {
ClientShutdown = 1, ClientShutdown = 1,
/// Incompatible networks. /// Incompatible networks.
IrreleventNetwork = 2, IrrelevantNetwork = 2,
/// Error/fault in the RPC. /// Error/fault in the RPC.
Fault = 3, Fault = 3,
@ -56,7 +56,7 @@ impl From<u64> for GoodbyeReason {
fn from(id: u64) -> GoodbyeReason { fn from(id: u64) -> GoodbyeReason {
match id { match id {
1 => GoodbyeReason::ClientShutdown, 1 => GoodbyeReason::ClientShutdown,
2 => GoodbyeReason::IrreleventNetwork, 2 => GoodbyeReason::IrrelevantNetwork,
3 => GoodbyeReason::Fault, 3 => GoodbyeReason::Fault,
_ => GoodbyeReason::Unknown, _ => GoodbyeReason::Unknown,
} }

View File

@ -252,7 +252,7 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
fn handle_gossip(&mut self, peer_id: PeerId, gossip_message: PubsubMessage) { fn handle_gossip(&mut self, peer_id: PeerId, gossip_message: PubsubMessage) {
match gossip_message { match gossip_message {
PubsubMessage::Block(message) => { PubsubMessage::Block(message) => {
let _should_foward_on = let _should_forward_on =
self.sync self.sync
.on_block_gossip(peer_id, message, &mut self.network_context); .on_block_gossip(peer_id, message, &mut self.network_context);
} }

View File

@ -270,7 +270,7 @@ pub struct PartialBeaconBlock {
impl PartialBeaconBlock { impl PartialBeaconBlock {
/// Attempts to build a block. /// Attempts to build a block.
/// ///
/// Does not comsume the `PartialBeaconBlock`. /// Does not consume the `PartialBeaconBlock`.
pub fn attempt_complete(&self) -> PartialBeaconBlockCompletion { pub fn attempt_complete(&self) -> PartialBeaconBlockCompletion {
if self.header.is_none() { if self.header.is_none() {
PartialBeaconBlockCompletion::MissingHeader(self.slot) PartialBeaconBlockCompletion::MissingHeader(self.slot)

View File

@ -186,7 +186,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
"reason" => "network_id" "reason" => "network_id"
); );
network.disconnect(peer_id.clone(), GoodbyeReason::IrreleventNetwork); network.disconnect(peer_id.clone(), GoodbyeReason::IrrelevantNetwork);
} else if remote.latest_finalized_epoch <= local.latest_finalized_epoch } else if remote.latest_finalized_epoch <= local.latest_finalized_epoch
&& remote.latest_finalized_root != self.chain.spec.zero_hash && remote.latest_finalized_root != self.chain.spec.zero_hash
&& local.latest_finalized_root != self.chain.spec.zero_hash && local.latest_finalized_root != self.chain.spec.zero_hash
@ -202,7 +202,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
"peer" => format!("{:?}", peer_id), "peer" => format!("{:?}", peer_id),
"reason" => "different finalized chain" "reason" => "different finalized chain"
); );
network.disconnect(peer_id.clone(), GoodbyeReason::IrreleventNetwork); network.disconnect(peer_id.clone(), GoodbyeReason::IrrelevantNetwork);
} else if remote.latest_finalized_epoch < local.latest_finalized_epoch { } else if remote.latest_finalized_epoch < local.latest_finalized_epoch {
// The node has a lower finalized epoch, their chain is not useful to us. There are two // The node has a lower finalized epoch, their chain is not useful to us. There are two
// cases where a node can have a lower finalized epoch: // cases where a node can have a lower finalized epoch:
@ -529,7 +529,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
.import_queue .import_queue
.enqueue_bodies(res.block_bodies, peer_id.clone()); .enqueue_bodies(res.block_bodies, peer_id.clone());
// Attempt to process all recieved bodies by recursively processing the latest block // Attempt to process all received bodies by recursively processing the latest block
if let Some(root) = last_root { if let Some(root) = last_root {
match self.attempt_process_partial_block(peer_id, root, network, &"rpc") { match self.attempt_process_partial_block(peer_id, root, network, &"rpc") {
Some(BlockProcessingOutcome::Processed { block_root: _ }) => { Some(BlockProcessingOutcome::Processed { block_root: _ }) => {
@ -606,7 +606,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
} }
// Note: known blocks are forwarded on the gossip network. // Note: known blocks are forwarded on the gossip network.
// //
// We rely upon the lower layers (libp2p) to stop loops occuring from re-gossiped // We rely upon the lower layers (libp2p) to stop loops occurring from re-gossiped
// blocks. // blocks.
BlockProcessingOutcome::BlockIsAlreadyKnown => SHOULD_FORWARD_GOSSIP_BLOCK, BlockProcessingOutcome::BlockIsAlreadyKnown => SHOULD_FORWARD_GOSSIP_BLOCK,
_ => SHOULD_NOT_FORWARD_GOSSIP_BLOCK, _ => SHOULD_NOT_FORWARD_GOSSIP_BLOCK,
@ -837,7 +837,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
// If the parent is in the `import_queue` attempt to complete it then process it. // If the parent is in the `import_queue` attempt to complete it then process it.
match self.attempt_process_partial_block(peer_id, parent, network, source) { match self.attempt_process_partial_block(peer_id, parent, network, source) {
// If processing parent is sucessful, re-process block and remove parent from queue // If processing parent is successful, re-process block and remove parent from queue
Some(BlockProcessingOutcome::Processed { block_root: _ }) => { Some(BlockProcessingOutcome::Processed { block_root: _ }) => {
self.import_queue.remove(parent); self.import_queue.remove(parent);

View File

@ -43,7 +43,7 @@ impl<T: BeaconChainTypes> AttestationService for AttestationServiceInstance<T> {
let state = &self.chain.current_state(); let state = &self.chain.current_state();
// Start by performing some checks // Start by performing some checks
// Check that the AttestionData is for the current slot (otherwise it will not be valid) // Check that the AttestationData is for the current slot (otherwise it will not be valid)
if slot_requested > state.slot.as_u64() { if slot_requested > state.slot.as_u64() {
let log_clone = self.log.clone(); let log_clone = self.log.clone();
let f = sink let f = sink

View File

@ -116,7 +116,7 @@ where
ctrlc_send.send(()).expect("Error sending ctrl-c message"); ctrlc_send.send(()).expect("Error sending ctrl-c message");
} }
}) })
.map_err(|e| format!("Could not set ctrlc hander: {:?}", e))?; .map_err(|e| format!("Could not set ctrlc handler: {:?}", e))?;
let (exit_signal, exit) = exit_future::signal(); let (exit_signal, exit) = exit_future::signal();

View File

@ -20,18 +20,18 @@ fn read_previous_block_root_from_block_bytes(bytes: &[u8]) -> Result<Hash256, De
Hash256::from_ssz_bytes(slice) Hash256::from_ssz_bytes(slice)
} }
pub fn get_block_at_preceeding_slot<T: Store>( pub fn get_block_at_preceding_slot<T: Store>(
store: &T, store: &T,
slot: Slot, slot: Slot,
start_root: Hash256, start_root: Hash256,
) -> Result<Option<(Hash256, BeaconBlock)>, Error> { ) -> Result<Option<(Hash256, BeaconBlock)>, Error> {
Ok(match get_at_preceeding_slot(store, slot, start_root)? { Ok(match get_at_preceding_slot(store, slot, start_root)? {
Some((hash, bytes)) => Some((hash, BeaconBlock::from_ssz_bytes(&bytes)?)), Some((hash, bytes)) => Some((hash, BeaconBlock::from_ssz_bytes(&bytes)?)),
None => None, None => None,
}) })
} }
fn get_at_preceeding_slot<T: Store>( fn get_at_preceding_slot<T: Store>(
store: &T, store: &T,
slot: Slot, slot: Slot,
mut root: Hash256, mut root: Hash256,
@ -141,7 +141,7 @@ mod tests {
let (target_root, target_block) = &blocks_and_roots[target]; let (target_root, target_block) = &blocks_and_roots[target];
let (found_root, found_block) = store let (found_root, found_block) = store
.get_block_at_preceeding_slot(*source_root, target_block.slot) .get_block_at_preceding_slot(*source_root, target_block.slot)
.unwrap() .unwrap()
.unwrap(); .unwrap();
@ -166,7 +166,7 @@ mod tests {
let (target_root, target_block) = &blocks_and_roots[target]; let (target_root, target_block) = &blocks_and_roots[target];
let (found_root, found_block) = store let (found_root, found_block) = store
.get_block_at_preceeding_slot(*source_root, target_block.slot) .get_block_at_preceding_slot(*source_root, target_block.slot)
.unwrap() .unwrap()
.unwrap(); .unwrap();
@ -177,14 +177,14 @@ mod tests {
// Slot that doesn't exist // Slot that doesn't exist
let (source_root, _source_block) = &blocks_and_roots[3]; let (source_root, _source_block) = &blocks_and_roots[3];
assert!(store assert!(store
.get_block_at_preceeding_slot(*source_root, Slot::new(3)) .get_block_at_preceding_slot(*source_root, Slot::new(3))
.unwrap() .unwrap()
.is_none()); .is_none());
// Slot too high // Slot too high
let (source_root, _source_block) = &blocks_and_roots[3]; let (source_root, _source_block) = &blocks_and_roots[3];
assert!(store assert!(store
.get_block_at_preceeding_slot(*source_root, Slot::new(3)) .get_block_at_preceding_slot(*source_root, Slot::new(3))
.unwrap() .unwrap()
.is_none()); .is_none());
} }

View File

@ -106,7 +106,7 @@ impl ClientDB for DiskStore {
fn exists(&self, col: &str, key: &[u8]) -> Result<bool, DBError> { fn exists(&self, col: &str, key: &[u8]) -> Result<bool, DBError> {
/* /*
* I'm not sure if this is the correct way to read if some * I'm not sure if this is the correct way to read if some
* block exists. Naively I would expect this to unncessarily * block exists. Naively I would expect this to unnecessarily
* copy some data, but I could be wrong. * copy some data, but I could be wrong.
*/ */
match self.db.cf_handle(col) { match self.db.cf_handle(col) {
@ -164,7 +164,7 @@ mod tests {
let thread_count = 10; let thread_count = 10;
let write_count = 10; let write_count = 10;
// We're execting the product of these numbers to fit in one byte. // We're expecting the product of these numbers to fit in one byte.
assert!(thread_count * write_count <= 255); assert!(thread_count * write_count <= 255);
let mut handles = vec![]; let mut handles = vec![];

View File

@ -52,12 +52,12 @@ pub trait Store: Sync + Send + Sized {
/// ///
/// Returns `None` if no parent block exists at that slot, or if `slot` is greater than the /// Returns `None` if no parent block exists at that slot, or if `slot` is greater than the
/// slot of `start_block_root`. /// slot of `start_block_root`.
fn get_block_at_preceeding_slot( fn get_block_at_preceding_slot(
&self, &self,
start_block_root: Hash256, start_block_root: Hash256,
slot: Slot, slot: Slot,
) -> Result<Option<(Hash256, BeaconBlock)>, Error> { ) -> Result<Option<(Hash256, BeaconBlock)>, Error> {
block_at_slot::get_block_at_preceeding_slot(self, slot, start_block_root) block_at_slot::get_block_at_preceding_slot(self, slot, start_block_root)
} }
/// Retrieve some bytes in `column` with `key`. /// Retrieve some bytes in `column` with `key`.

View File

@ -19,7 +19,7 @@ pub trait Store: Sync + Send + Sized {
I::db_delete(self, key) I::db_delete(self, key)
} }
fn get_block_at_preceeding_slot( fn get_block_at_preceding_slot(
&self, &self,
start_block_root: Hash256, start_block_root: Hash256,
slot: Slot, slot: Slot,

View File

@ -115,7 +115,7 @@ other programming languages you may have used.
* **Trait**: A trait is a collection of methods defined for a type, they can be * **Trait**: A trait is a collection of methods defined for a type, they can be
implemented for any data type. implemented for any data type.
* **Struct**: A custom data type that lets us name and package together * **Struct**: A custom data type that lets us name and package together
multiple related values that make a meaninguful group. multiple related values that make a meaningful group.
* **Crate**: A crate is synonymous with a *library* or *package* in other * **Crate**: A crate is synonymous with a *library* or *package* in other
languages. They can produce an executable or library depending on the languages. They can produce an executable or library depending on the
project. project.

View File

@ -1,6 +1,6 @@
//! An implementation of "reduced tree" LMD GHOST fork choice. //! An implementation of "reduced tree" LMD GHOST fork choice.
//! //!
//! This algorithm was concieved at IC3 Cornell, 2019. //! This algorithm was conceived at IC3 Cornell, 2019.
//! //!
//! This implementation is incomplete and has known bugs. Do not use in production. //! This implementation is incomplete and has known bugs. Do not use in production.
use super::{LmdGhost, Result as SuperResult}; use super::{LmdGhost, Result as SuperResult};
@ -147,7 +147,7 @@ where
Ok(()) Ok(())
} }
/// Removes `current_hash` and all decendants, except `subtree_hash` and all nodes /// Removes `current_hash` and all descendants, except `subtree_hash` and all nodes
/// which have `subtree_hash` as an ancestor. /// which have `subtree_hash` as an ancestor.
/// ///
/// In effect, prunes the tree so that only decendants of `subtree_hash` exist. /// In effect, prunes the tree so that only decendants of `subtree_hash` exist.

View File

@ -34,7 +34,7 @@ pub struct OperationPool<T: EthSpec + Default> {
/// Map from deposit index to deposit data. /// Map from deposit index to deposit data.
// NOTE: We assume that there is only one deposit per index // NOTE: We assume that there is only one deposit per index
// because the Eth1 data is updated (at most) once per epoch, // because the Eth1 data is updated (at most) once per epoch,
// and the spec doesn't seem to accomodate for re-orgs on a time-frame // and the spec doesn't seem to accommodate for re-orgs on a time-frame
// longer than an epoch // longer than an epoch
deposits: RwLock<BTreeMap<u64, Deposit>>, deposits: RwLock<BTreeMap<u64, Deposit>>,
/// Map from two attestation IDs to a slashing for those IDs. /// Map from two attestation IDs to a slashing for those IDs.

View File

@ -48,7 +48,7 @@ pub fn bench_epoch_processing_n_validators(c: &mut Criterion, validator_count: u
"The state should have an attestation for each committee." "The state should have an attestation for each committee."
); );
// Assert that we will run the first arm of process_rewards_and_penalities // Assert that we will run the first arm of process_rewards_and_penalties
let epochs_since_finality = state.next_epoch(&spec) - state.finalized_epoch; let epochs_since_finality = state.next_epoch(&spec) - state.finalized_epoch;
assert_eq!( assert_eq!(
epochs_since_finality, 4, epochs_since_finality, 4,

View File

@ -247,7 +247,7 @@ pub enum IndexedAttestationInvalid {
MaxIndicesExceed(u64, usize), MaxIndicesExceed(u64, usize),
/// The validator indices were not in increasing order. /// The validator indices were not in increasing order.
/// ///
/// The error occured between the given `index` and `index + 1` /// The error occurred between the given `index` and `index + 1`
BadValidatorIndicesOrdering(usize), BadValidatorIndicesOrdering(usize),
/// The validator index is unknown. One cannot slash one who does not exist. /// The validator index is unknown. One cannot slash one who does not exist.
UnknownValidator(u64), UnknownValidator(u64),
@ -413,7 +413,7 @@ pub enum TransferInvalid {
/// The `transfer.from` validator has been activated and is not withdrawable. /// The `transfer.from` validator has been activated and is not withdrawable.
/// ///
/// (from_validator) /// (from_validator)
FromValidatorIneligableForTransfer(u64), FromValidatorIneligibleForTransfer(u64),
/// The validators withdrawal credentials do not match `transfer.pubkey`. /// The validators withdrawal credentials do not match `transfer.pubkey`.
/// ///
/// (state_credentials, transfer_pubkey_credentials) /// (state_credentials, transfer_pubkey_credentials)

View File

@ -114,7 +114,7 @@ fn verify_transfer_parametric<T: EthSpec>(
|| sender_validator.activation_eligibility_epoch == spec.far_future_epoch || sender_validator.activation_eligibility_epoch == spec.far_future_epoch
|| sender_validator.is_withdrawable_at(epoch) || sender_validator.is_withdrawable_at(epoch)
|| total_amount + spec.max_effective_balance <= sender_balance, || total_amount + spec.max_effective_balance <= sender_balance,
Invalid::FromValidatorIneligableForTransfer(transfer.sender) Invalid::FromValidatorIneligibleForTransfer(transfer.sender)
); );
// Ensure the withdrawal credentials generated from the sender's pubkey match those stored in // Ensure the withdrawal credentials generated from the sender's pubkey match those stored in

View File

@ -47,7 +47,7 @@ pub fn per_epoch_processing<T: EthSpec>(
// Crosslinks. // Crosslinks.
let winning_root_for_shards = process_crosslinks(state, spec)?; let winning_root_for_shards = process_crosslinks(state, spec)?;
// Rewards and Penalities. // Rewards and Penalties.
process_rewards_and_penalties( process_rewards_and_penalties(
state, state,
&mut validator_statuses, &mut validator_statuses,

View File

@ -12,7 +12,7 @@ pub fn process_slashings<T: EthSpec>(
let total_at_start = state.get_slashed_balance(current_epoch + 1)?; let total_at_start = state.get_slashed_balance(current_epoch + 1)?;
let total_at_end = state.get_slashed_balance(current_epoch)?; let total_at_end = state.get_slashed_balance(current_epoch)?;
let total_penalities = total_at_end - total_at_start; let total_penalties = total_at_end - total_at_start;
for (index, validator) in state.validator_registry.iter().enumerate() { for (index, validator) in state.validator_registry.iter().enumerate() {
let should_penalize = current_epoch.as_usize() + T::LatestSlashedExitLength::to_usize() / 2 let should_penalize = current_epoch.as_usize() + T::LatestSlashedExitLength::to_usize() / 2
@ -22,7 +22,7 @@ pub fn process_slashings<T: EthSpec>(
let effective_balance = state.get_effective_balance(index, spec)?; let effective_balance = state.get_effective_balance(index, spec)?;
let penalty = std::cmp::max( let penalty = std::cmp::max(
effective_balance * std::cmp::min(total_penalities * 3, current_total_balance) effective_balance * std::cmp::min(total_penalties * 3, current_total_balance)
/ current_total_balance, / current_total_balance,
effective_balance / spec.min_slashing_penalty_quotient, effective_balance / spec.min_slashing_penalty_quotient,
); );

View File

@ -3,7 +3,7 @@ use super::Error;
use itertools::{Either, Itertools}; use itertools::{Either, Itertools};
use types::*; use types::*;
/// Peforms a validator registry update, if required. /// Performs a validator registry update, if required.
/// ///
/// Spec v0.6.3 /// Spec v0.6.3
pub fn process_registry_updates<T: EthSpec>( pub fn process_registry_updates<T: EthSpec>(

View File

@ -150,7 +150,7 @@ pub struct TotalBalances {
/// some `BeaconState`. /// some `BeaconState`.
#[derive(Clone)] #[derive(Clone)]
pub struct ValidatorStatuses { pub struct ValidatorStatuses {
/// Information about each individual validator from the state's validator registy. /// Information about each individual validator from the state's validator registry.
pub statuses: Vec<ValidatorStatus>, pub statuses: Vec<ValidatorStatus>,
/// Summed balances for various sets of validators. /// Summed balances for various sets of validators.
pub total_balances: TotalBalances, pub total_balances: TotalBalances,

View File

@ -1,4 +1,4 @@
//! The `Slot` and `Epoch` types are defined as newtypes over u64 to enforce type-safety between //! The `Slot` and `Epoch` types are defined as new types over u64 to enforce type-safety between
//! the two types. //! the two types.
//! //!
//! `Slot` and `Epoch` have implementations which permit conversion, comparison and math operations //! `Slot` and `Epoch` have implementations which permit conversion, comparison and math operations

View File

@ -34,7 +34,7 @@ impl TestingDepositBuilder {
/// ///
/// - `pubkey` to the signing pubkey. /// - `pubkey` to the signing pubkey.
/// - `withdrawal_credentials` to the signing pubkey. /// - `withdrawal_credentials` to the signing pubkey.
/// - `proof_of_possesssion` /// - `proof_of_possession`
pub fn sign(&mut self, keypair: &Keypair, epoch: Epoch, fork: &Fork, spec: &ChainSpec) { pub fn sign(&mut self, keypair: &Keypair, epoch: Epoch, fork: &Fork, spec: &ChainSpec) {
let withdrawal_credentials = Hash256::from_slice( let withdrawal_credentials = Hash256::from_slice(
&get_withdrawal_credentials(&keypair.pk, spec.bls_withdrawal_prefix_byte)[..], &get_withdrawal_credentials(&keypair.pk, spec.bls_withdrawal_prefix_byte)[..],

View File

@ -6,7 +6,7 @@ impl TestRandom for SecretKey {
let mut key_bytes = vec![0; 48]; let mut key_bytes = vec![0; 48];
rng.fill_bytes(&mut key_bytes); rng.fill_bytes(&mut key_bytes);
/* /*
* An `unreachable!` is used here as there's no reason why you cannot constuct a key from a * An `unreachable!` is used here as there's no reason why you cannot construct a key from a
* fixed-length byte slice. Also, this should only be used during testing so a panic is * fixed-length byte slice. Also, this should only be used during testing so a panic is
* acceptable. * acceptable.
*/ */

View File

@ -23,7 +23,7 @@ impl AggregateSignature {
/// Instantiate a new AggregateSignature. /// Instantiate a new AggregateSignature.
/// ///
/// is_empty is false /// is_empty is false
/// AggregateSiganture is point at infinity /// AggregateSignature is point at infinity
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
aggregate_signature: RawAggregateSignature::new(), aggregate_signature: RawAggregateSignature::new(),
@ -87,7 +87,7 @@ impl AggregateSignature {
.verify_multiple(&msg[..], domain, &aggregate_public_keys[..]) .verify_multiple(&msg[..], domain, &aggregate_public_keys[..])
} }
/// Return AggregateSiganture as bytes /// Return AggregateSignature as bytes
pub fn as_bytes(&self) -> Vec<u8> { pub fn as_bytes(&self) -> Vec<u8> {
if self.is_empty { if self.is_empty {
return vec![0; BLS_AGG_SIG_BYTE_SIZE]; return vec![0; BLS_AGG_SIG_BYTE_SIZE];
@ -95,7 +95,7 @@ impl AggregateSignature {
self.aggregate_signature.as_bytes() self.aggregate_signature.as_bytes()
} }
/// Convert bytes to AggregateSiganture /// Convert bytes to AggregateSignature
pub fn from_bytes(bytes: &[u8]) -> Result<Self, DecodeError> { pub fn from_bytes(bytes: &[u8]) -> Result<Self, DecodeError> {
for byte in bytes { for byte in bytes {
if *byte != 0 { if *byte != 0 {
@ -114,7 +114,7 @@ impl AggregateSignature {
Ok(Self::empty_signature()) Ok(Self::empty_signature())
} }
/// Returns if the AggregateSiganture `is_empty` /// Returns if the AggregateSignature `is_empty`
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
self.is_empty self.is_empty
} }

View File

@ -64,7 +64,7 @@ pub struct BTreeOverlay {
} }
impl BTreeOverlay { impl BTreeOverlay {
/// Instantiates a new instance for `item`, where it's first chunk is `inital_offset` and has /// Instantiates a new instance for `item`, where it's first chunk is `initial_offset` and has
/// the specified `depth`. /// the specified `depth`.
pub fn new<T>(item: &T, initial_offset: usize, depth: usize) -> Self pub fn new<T>(item: &T, initial_offset: usize, depth: usize) -> Self
where where

View File

@ -201,7 +201,7 @@ pub fn update_tree_hash_cache<T: CachedTreeHash>(
cache.chunk_index = new.end; cache.chunk_index = new.end;
} }
// The list has been lengthened and this is a new item that was prevously a // The list has been lengthened and this is a new item that was previously a
// padding item. // padding item.
// //
// Splice the tree for the new item over the padding chunk. // Splice the tree for the new item over the padding chunk.
@ -268,7 +268,7 @@ pub fn update_tree_hash_cache<T: CachedTreeHash>(
// This leaf was padding in both lists, there's nothing to do. // This leaf was padding in both lists, there's nothing to do.
(LeafNode::Padding, LeafNode::Padding) => (), (LeafNode::Padding, LeafNode::Padding) => (),
// As we are looping through the larger of the lists of leaf nodes, it should // As we are looping through the larger of the lists of leaf nodes, it should
// be impossible for either leaf to be non-existant. // be impossible for either leaf to be non-existent.
(LeafNode::DoesNotExist, LeafNode::DoesNotExist) => unreachable!(), (LeafNode::DoesNotExist, LeafNode::DoesNotExist) => unreachable!(),
} }
} }

View File

@ -139,7 +139,7 @@ impl TreeHashCache {
} }
/// Instantiate a new cache from the pre-built `bytes` where each `self.chunk_modified` will be /// Instantiate a new cache from the pre-built `bytes` where each `self.chunk_modified` will be
/// set to `intitial_modified_state`. /// set to `initial_modified_state`.
/// ///
/// Note: `bytes.len()` must be a multiple of 32 /// Note: `bytes.len()` must be a multiple of 32
pub fn from_bytes( pub fn from_bytes(

View File

@ -29,7 +29,7 @@ impl<'a, T> Iterator for Split<'a, T> {
} }
} }
/// Splits a slice into chunks of size n. All postive n values are applicable, /// Splits a slice into chunks of size n. All positive n values are applicable,
/// hence the honey_badger prefix. /// hence the honey_badger prefix.
/// ///
/// Returns an iterator over the original list. /// Returns an iterator over the original list.

View File

@ -213,7 +213,7 @@ return rawbytes[current_index+4:current_index+4+bytes_length], new_index
#### List #### List
Deserailize each object in the list. Deserialize each object in the list.
1. Get the length of the serialized list. 1. Get the length of the serialized list.
2. Loop through deseralizing each item in the list until you reach the 2. Loop through deseralizing each item in the list until you reach the
entire length of the list. entire length of the list.
@ -437,7 +437,7 @@ let decoded: Result<(Vec<usize>, usize), DecodeError> = decode_ssz_list( &encode
Deserializes the "length" value in the serialized bytes from the index. The Deserializes the "length" value in the serialized bytes from the index. The
length of bytes is given (usually 4 stated in the reference implementation) and length of bytes is given (usually 4 stated in the reference implementation) and
is often the value appended to the list infront of the actual serialized is often the value appended to the list in front of the actual serialized
object. object.
| Parameter | Description | | Parameter | Description |

View File

@ -535,7 +535,7 @@ mod tests {
} }
#[test] #[test]
fn awkward_fixed_lenth_portion() { fn awkward_fixed_length_portion() {
assert_eq!( assert_eq!(
<Vec<Vec<u16>>>::from_ssz_bytes(&[10, 0, 0, 0, 10, 0, 0, 0, 0, 0]), <Vec<Vec<u16>>>::from_ssz_bytes(&[10, 0, 0, 0, 10, 0, 0, 0, 0, 0]),
Err(DecodeError::InvalidByteLength { Err(DecodeError::InvalidByteLength {

View File

@ -47,7 +47,7 @@ pub fn merkleize_standard(bytes: &[u8]) -> Vec<u8> {
j -= HASHSIZE; j -= HASHSIZE;
let hash = match o.get(i..i + MERKLE_HASH_CHUNK) { let hash = match o.get(i..i + MERKLE_HASH_CHUNK) {
// All bytes are available, hash as ususal. // All bytes are available, hash as usual.
Some(slice) => hash(slice), Some(slice) => hash(slice),
// Unable to get all the bytes. // Unable to get all the bytes.
None => { None => {

View File

@ -27,7 +27,7 @@ fn get_hashable_named_field_idents<'a>(struct_data: &'a syn::DataStruct) -> Vec<
.collect() .collect()
} }
/// Returns true if some field has an attribute declaring it should not be hashedd. /// Returns true if some field has an attribute declaring it should not be hashed.
/// ///
/// The field attribute is: `#[tree_hash(skip_hashing)]` /// The field attribute is: `#[tree_hash(skip_hashing)]`
fn should_skip_hashing(field: &syn::Field) -> bool { fn should_skip_hashing(field: &syn::Field) -> bool {

View File

@ -59,7 +59,7 @@ pub fn update_validator_set(
for (i, v) in validators.iter_mut().enumerate() { for (i, v) in validators.iter_mut().enumerate() {
match v.status { match v.status {
/* /*
* Validator is pending activiation. * Validator is pending activation.
*/ */
ValidatorStatus::PendingActivation => { ValidatorStatus::PendingActivation => {
let new_total_changed = total_changed let new_total_changed = total_changed

View File

@ -6,7 +6,7 @@
// the block will be lost. // the block will be lost.
// //
// This "stateful" method is being used presently because it's easier and // This "stateful" method is being used presently because it's easier and
// requires less maintainence as the `BeaconBlock` definition changes. // requires less maintenance as the `BeaconBlock` definition changes.
syntax = "proto3"; syntax = "proto3";
@ -28,7 +28,7 @@ service BeaconBlockService {
/// Service that provides the validator client with requisite knowledge about /// Service that provides the validator client with requisite knowledge about
//its public keys //its public keys
service ValidatorService { service ValidatorService {
// Gets the block proposer slot and comittee slot that a validator needs to // Gets the block proposer slot and committee slot that a validator needs to
// perform work on. // perform work on.
rpc GetValidatorDuties(GetDutiesRequest) returns (GetDutiesResponse); rpc GetValidatorDuties(GetDutiesRequest) returns (GetDutiesResponse);
} }
@ -79,7 +79,7 @@ message PublishBeaconBlockRequest {
BeaconBlock block = 1; BeaconBlock block = 1;
} }
// Beacon node indicates a sucessfully submitted proposal. // Beacon node indicates a successfully submitted proposal.
message PublishBeaconBlockResponse { message PublishBeaconBlockResponse {
bool success = 1; bool success = 1;
bytes msg = 2; bytes msg = 2;

View File

@ -12,7 +12,7 @@ fn yaml_files_in_test_dir(dir: &Path) -> Vec<PathBuf> {
assert!( assert!(
base_path.exists(), base_path.exists(),
format!( format!(
"Unable to locate {:?}. Did you init git submoules?", "Unable to locate {:?}. Did you init git submodules?",
base_path base_path
) )
); );

View File

@ -39,7 +39,7 @@ pub struct AttestationProducer<'a, B: BeaconNodeAttestation, S: Signer> {
pub beacon_node: Arc<B>, pub beacon_node: Arc<B>,
/// The signer to sign the block. /// The signer to sign the block.
pub signer: &'a S, pub signer: &'a S,
/// Used for caclulating epoch. /// Used for calculating epoch.
pub slots_per_epoch: u64, pub slots_per_epoch: u64,
} }

View File

@ -48,7 +48,7 @@ pub struct BlockProducer<'a, B: BeaconNodeBlock, S: Signer> {
pub beacon_node: Arc<B>, pub beacon_node: Arc<B>,
/// The signer to sign the block. /// The signer to sign the block.
pub signer: &'a S, pub signer: &'a S,
/// Used for caclulating epoch. /// Used for calculating epoch.
pub slots_per_epoch: u64, pub slots_per_epoch: u64,
} }