Fix lots of typos.
This commit is contained in:
parent
b5af73d056
commit
fec7168512
@ -16,12 +16,12 @@ An open-source Ethereum 2.0 client, written in Rust and maintained by Sigma Prim
|
||||
Lighthouse is:
|
||||
|
||||
- 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.
|
||||
- Built in [Rust](https://www.rust-lang.org/), a modern language providing unique safety guarantees and
|
||||
excellent performance (comparable to C++).
|
||||
- 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.
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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![];
|
||||
|
@ -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`.
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
implemented for any data type.
|
||||
* **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
|
||||
languages. They can produce an executable or library depending on the
|
||||
project.
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! 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.
|
||||
use super::{LmdGhost, Result as SuperResult};
|
||||
@ -147,7 +147,7 @@ where
|
||||
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.
|
||||
///
|
||||
/// In effect, prunes the tree so that only decendants of `subtree_hash` exist.
|
||||
|
@ -34,7 +34,7 @@ pub struct OperationPool<T: EthSpec + Default> {
|
||||
/// Map from deposit index to deposit data.
|
||||
// NOTE: We assume that there is only one deposit per index
|
||||
// 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
|
||||
deposits: RwLock<BTreeMap<u64, Deposit>>,
|
||||
/// Map from two attestation IDs to a slashing for those IDs.
|
||||
|
@ -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."
|
||||
);
|
||||
|
||||
// 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;
|
||||
assert_eq!(
|
||||
epochs_since_finality, 4,
|
||||
|
@ -247,7 +247,7 @@ pub enum IndexedAttestationInvalid {
|
||||
MaxIndicesExceed(u64, usize),
|
||||
/// 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),
|
||||
/// The validator index is unknown. One cannot slash one who does not exist.
|
||||
UnknownValidator(u64),
|
||||
@ -413,7 +413,7 @@ pub enum TransferInvalid {
|
||||
/// The `transfer.from` validator has been activated and is not withdrawable.
|
||||
///
|
||||
/// (from_validator)
|
||||
FromValidatorIneligableForTransfer(u64),
|
||||
FromValidatorIneligibleForTransfer(u64),
|
||||
/// The validators withdrawal credentials do not match `transfer.pubkey`.
|
||||
///
|
||||
/// (state_credentials, transfer_pubkey_credentials)
|
||||
|
@ -114,7 +114,7 @@ fn verify_transfer_parametric<T: EthSpec>(
|
||||
|| sender_validator.activation_eligibility_epoch == spec.far_future_epoch
|
||||
|| sender_validator.is_withdrawable_at(epoch)
|
||||
|| 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
|
||||
|
@ -47,7 +47,7 @@ pub fn per_epoch_processing<T: EthSpec>(
|
||||
// Crosslinks.
|
||||
let winning_root_for_shards = process_crosslinks(state, spec)?;
|
||||
|
||||
// Rewards and Penalities.
|
||||
// Rewards and Penalties.
|
||||
process_rewards_and_penalties(
|
||||
state,
|
||||
&mut validator_statuses,
|
||||
|
@ -12,7 +12,7 @@ pub fn process_slashings<T: EthSpec>(
|
||||
|
||||
let total_at_start = state.get_slashed_balance(current_epoch + 1)?;
|
||||
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() {
|
||||
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 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,
|
||||
effective_balance / spec.min_slashing_penalty_quotient,
|
||||
);
|
||||
|
@ -3,7 +3,7 @@ use super::Error;
|
||||
use itertools::{Either, Itertools};
|
||||
use types::*;
|
||||
|
||||
/// Peforms a validator registry update, if required.
|
||||
/// Performs a validator registry update, if required.
|
||||
///
|
||||
/// Spec v0.6.3
|
||||
pub fn process_registry_updates<T: EthSpec>(
|
||||
|
@ -150,7 +150,7 @@ pub struct TotalBalances {
|
||||
/// some `BeaconState`.
|
||||
#[derive(Clone)]
|
||||
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>,
|
||||
/// Summed balances for various sets of validators.
|
||||
pub total_balances: TotalBalances,
|
||||
|
@ -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.
|
||||
//!
|
||||
//! `Slot` and `Epoch` have implementations which permit conversion, comparison and math operations
|
||||
|
@ -34,7 +34,7 @@ impl TestingDepositBuilder {
|
||||
///
|
||||
/// - `pubkey` 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) {
|
||||
let withdrawal_credentials = Hash256::from_slice(
|
||||
&get_withdrawal_credentials(&keypair.pk, spec.bls_withdrawal_prefix_byte)[..],
|
||||
|
@ -6,7 +6,7 @@ impl TestRandom for SecretKey {
|
||||
let mut key_bytes = vec![0; 48];
|
||||
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
|
||||
* acceptable.
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@ impl AggregateSignature {
|
||||
/// Instantiate a new AggregateSignature.
|
||||
///
|
||||
/// is_empty is false
|
||||
/// AggregateSiganture is point at infinity
|
||||
/// AggregateSignature is point at infinity
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
aggregate_signature: RawAggregateSignature::new(),
|
||||
@ -87,7 +87,7 @@ impl AggregateSignature {
|
||||
.verify_multiple(&msg[..], domain, &aggregate_public_keys[..])
|
||||
}
|
||||
|
||||
/// Return AggregateSiganture as bytes
|
||||
/// Return AggregateSignature as bytes
|
||||
pub fn as_bytes(&self) -> Vec<u8> {
|
||||
if self.is_empty {
|
||||
return vec![0; BLS_AGG_SIG_BYTE_SIZE];
|
||||
@ -95,7 +95,7 @@ impl AggregateSignature {
|
||||
self.aggregate_signature.as_bytes()
|
||||
}
|
||||
|
||||
/// Convert bytes to AggregateSiganture
|
||||
/// Convert bytes to AggregateSignature
|
||||
pub fn from_bytes(bytes: &[u8]) -> Result<Self, DecodeError> {
|
||||
for byte in bytes {
|
||||
if *byte != 0 {
|
||||
@ -114,7 +114,7 @@ impl AggregateSignature {
|
||||
Ok(Self::empty_signature())
|
||||
}
|
||||
|
||||
/// Returns if the AggregateSiganture `is_empty`
|
||||
/// Returns if the AggregateSignature `is_empty`
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.is_empty
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ pub struct 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`.
|
||||
pub fn new<T>(item: &T, initial_offset: usize, depth: usize) -> Self
|
||||
where
|
||||
|
@ -201,7 +201,7 @@ pub fn update_tree_hash_cache<T: CachedTreeHash>(
|
||||
|
||||
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.
|
||||
//
|
||||
// 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.
|
||||
(LeafNode::Padding, LeafNode::Padding) => (),
|
||||
// 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!(),
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ impl TreeHashCache {
|
||||
}
|
||||
|
||||
/// 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
|
||||
pub fn from_bytes(
|
||||
|
@ -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.
|
||||
///
|
||||
/// Returns an iterator over the original list.
|
||||
|
@ -213,7 +213,7 @@ return rawbytes[current_index+4:current_index+4+bytes_length], new_index
|
||||
|
||||
#### List
|
||||
|
||||
Deserailize each object in the list.
|
||||
Deserialize each object in the list.
|
||||
1. Get the length of the serialized list.
|
||||
2. Loop through deseralizing each item in the list until you reach the
|
||||
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
|
||||
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.
|
||||
|
||||
| Parameter | Description |
|
||||
|
@ -535,7 +535,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn awkward_fixed_lenth_portion() {
|
||||
fn awkward_fixed_length_portion() {
|
||||
assert_eq!(
|
||||
<Vec<Vec<u16>>>::from_ssz_bytes(&[10, 0, 0, 0, 10, 0, 0, 0, 0, 0]),
|
||||
Err(DecodeError::InvalidByteLength {
|
||||
|
@ -47,7 +47,7 @@ pub fn merkleize_standard(bytes: &[u8]) -> Vec<u8> {
|
||||
|
||||
j -= HASHSIZE;
|
||||
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),
|
||||
// Unable to get all the bytes.
|
||||
None => {
|
||||
|
@ -27,7 +27,7 @@ fn get_hashable_named_field_idents<'a>(struct_data: &'a syn::DataStruct) -> Vec<
|
||||
.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)]`
|
||||
fn should_skip_hashing(field: &syn::Field) -> bool {
|
||||
|
@ -59,7 +59,7 @@ pub fn update_validator_set(
|
||||
for (i, v) in validators.iter_mut().enumerate() {
|
||||
match v.status {
|
||||
/*
|
||||
* Validator is pending activiation.
|
||||
* Validator is pending activation.
|
||||
*/
|
||||
ValidatorStatus::PendingActivation => {
|
||||
let new_total_changed = total_changed
|
||||
|
@ -6,7 +6,7 @@
|
||||
// the block will be lost.
|
||||
//
|
||||
// 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";
|
||||
|
||||
@ -28,7 +28,7 @@ service BeaconBlockService {
|
||||
/// Service that provides the validator client with requisite knowledge about
|
||||
//its public keys
|
||||
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.
|
||||
rpc GetValidatorDuties(GetDutiesRequest) returns (GetDutiesResponse);
|
||||
}
|
||||
@ -79,7 +79,7 @@ message PublishBeaconBlockRequest {
|
||||
BeaconBlock block = 1;
|
||||
}
|
||||
|
||||
// Beacon node indicates a sucessfully submitted proposal.
|
||||
// Beacon node indicates a successfully submitted proposal.
|
||||
message PublishBeaconBlockResponse {
|
||||
bool success = 1;
|
||||
bytes msg = 2;
|
||||
|
@ -12,7 +12,7 @@ fn yaml_files_in_test_dir(dir: &Path) -> Vec<PathBuf> {
|
||||
assert!(
|
||||
base_path.exists(),
|
||||
format!(
|
||||
"Unable to locate {:?}. Did you init git submoules?",
|
||||
"Unable to locate {:?}. Did you init git submodules?",
|
||||
base_path
|
||||
)
|
||||
);
|
||||
|
@ -39,7 +39,7 @@ pub struct AttestationProducer<'a, B: BeaconNodeAttestation, S: Signer> {
|
||||
pub beacon_node: Arc<B>,
|
||||
/// The signer to sign the block.
|
||||
pub signer: &'a S,
|
||||
/// Used for caclulating epoch.
|
||||
/// Used for calculating epoch.
|
||||
pub slots_per_epoch: u64,
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ pub struct BlockProducer<'a, B: BeaconNodeBlock, S: Signer> {
|
||||
pub beacon_node: Arc<B>,
|
||||
/// The signer to sign the block.
|
||||
pub signer: &'a S,
|
||||
/// Used for caclulating epoch.
|
||||
/// Used for calculating epoch.
|
||||
pub slots_per_epoch: u64,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user