Fix lots of typos.

This commit is contained in:
John Adler
2019-07-26 15:26:06 -04:00
parent b5af73d056
commit fec7168512
41 changed files with 68 additions and 68 deletions

View File

@@ -70,10 +70,10 @@ pub struct BeaconChain<T: BeaconChainTypes> {
/// Stores all operations (e.g., `Attestation`, `Deposit`, etc) that are candidates for
/// inclusion in a block.
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>>,
/// 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`.
state: RwLock<BeaconState<T::EthSpec>>,
/// 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
/// epoch is available.
pub fn validator_attestion_slot_and_shard(
pub fn validator_attestation_slot_and_shard(
&self,
validator_index: usize,
) -> Result<Option<(Slot, u64)>, BeaconStateError> {
trace!(
"BeaconChain::validator_attestion_slot_and_shard: validator_index: {}",
"BeaconChain::validator_attestation_slot_and_shard: validator_index: {}",
validator_index
);
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.
//
// (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.
if block_hash != Hash256::zero() {
let block_slot = attestation

View File

@@ -54,7 +54,7 @@ impl Default for Config {
network_dir.push("network");
Config {
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,
discovery_address: "127.0.0.1".parse().expect("valid ip address"),
discovery_port: 9000,

View File

@@ -43,7 +43,7 @@ pub enum GoodbyeReason {
ClientShutdown = 1,
/// Incompatible networks.
IrreleventNetwork = 2,
IrrelevantNetwork = 2,
/// Error/fault in the RPC.
Fault = 3,
@@ -56,7 +56,7 @@ impl From<u64> for GoodbyeReason {
fn from(id: u64) -> GoodbyeReason {
match id {
1 => GoodbyeReason::ClientShutdown,
2 => GoodbyeReason::IrreleventNetwork,
2 => GoodbyeReason::IrrelevantNetwork,
3 => GoodbyeReason::Fault,
_ => 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) {
match gossip_message {
PubsubMessage::Block(message) => {
let _should_foward_on =
let _should_forward_on =
self.sync
.on_block_gossip(peer_id, message, &mut self.network_context);
}

View File

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

View File

@@ -186,7 +186,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
"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
&& remote.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),
"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 {
// 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:
@@ -529,7 +529,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
.import_queue
.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 {
match self.attempt_process_partial_block(peer_id, root, network, &"rpc") {
Some(BlockProcessingOutcome::Processed { block_root: _ }) => {
@@ -606,7 +606,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
}
// 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.
BlockProcessingOutcome::BlockIsAlreadyKnown => SHOULD_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.
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: _ }) => {
self.import_queue.remove(parent);

View File

@@ -43,7 +43,7 @@ impl<T: BeaconChainTypes> AttestationService for AttestationServiceInstance<T> {
let state = &self.chain.current_state();
// 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() {
let log_clone = self.log.clone();
let f = sink

View File

@@ -116,7 +116,7 @@ where
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();

View File

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

View File

@@ -106,7 +106,7 @@ impl ClientDB for DiskStore {
fn exists(&self, col: &str, key: &[u8]) -> Result<bool, DBError> {
/*
* 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.
*/
match self.db.cf_handle(col) {
@@ -164,7 +164,7 @@ mod tests {
let thread_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);
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
/// slot of `start_block_root`.
fn get_block_at_preceeding_slot(
fn get_block_at_preceding_slot(
&self,
start_block_root: Hash256,
slot: Slot,
) -> 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`.

View File

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