Skip to content

Commit

Permalink
fix some comments (#10709)
Browse files Browse the repository at this point in the history
Signed-off-by: teslaedison <qingchengqiushuang@gmail.com>
  • Loading branch information
teslaedison authored Mar 6, 2024
1 parent 2a58a1e commit 8da50d7
Show file tree
Hide file tree
Showing 31 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion chain/chain-primitives/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl Error {
}

/// Some blockchain errors are reported in the prometheus metrics. In such cases a report might
/// contain a label that specifies the type of error that has occured. For example when the node
/// contain a label that specifies the type of error that has occurred. For example when the node
/// receives a block with an invalid signature this would be reported as:
/// `near_num_invalid_blocks{error="invalid_signature"}`.
/// This function returns the value of the error label for a specific instance of Error.
Expand Down
2 changes: 1 addition & 1 deletion chain/chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4459,7 +4459,7 @@ pub struct BlockCatchUpResponse {
/// 3. We've got response from sync jobs actor that block was processed. Block hash, state
/// changes from preprocessing and result of processing block are moved to processed blocks
/// 4. Results are postprocessed. If there is any error block goes back to pending to try again.
/// Otherwise results are commited, block is moved to done blocks and any blocks that
/// Otherwise results are committed, block is moved to done blocks and any blocks that
/// have this block as previous are added to pending
pub struct BlocksCatchUpState {
/// Hash of first block of an epoch
Expand Down
6 changes: 3 additions & 3 deletions chain/chunks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ impl ShardsManager {
let parts = forward.parts.into_iter().filter_map(|part| {
let part_ord = part.part_ord;
if part_ord > num_total_parts {
warn!(target: "chunks", "Received chunk part with part_ord greater than the the total number of chunks");
warn!(target: "chunks", "Received chunk part with part_ord greater than the total number of chunks");
None
} else {
Some((part_ord, part))
Expand All @@ -1195,7 +1195,7 @@ impl ShardsManager {
for part in forward.parts {
let part_ord = part.part_ord;
if part_ord > num_total_parts {
warn!(target: "chunks", "Received chunk part with part_ord greater than the the total number of chunks");
warn!(target: "chunks", "Received chunk part with part_ord greater than the total number of chunks");
continue;
}
existing_parts.insert(part_ord, part);
Expand Down Expand Up @@ -2567,7 +2567,7 @@ mod test {

#[test]
// Test that when a validator receives a chunk forward before the chunk header, and that the
// chunk header first arrives as part of a block, it should store the the forward and use it
// chunk header first arrives as part of a block, it should store the forward and use it
// when it receives the header.
fn test_receive_forward_before_chunk_header_from_block() {
let fixture = ChunkTestFixture::default();
Expand Down
4 changes: 2 additions & 2 deletions chain/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ pub struct BlockDebugStatus {
// Chunk statuses are below:
// We first sent the request to fetch the chunk
// Later we get the response from the peer and we try to reconstruct it.
// If reconstructions suceeds, the chunk will be marked as complete.
// If reconstructions succeeds, the chunk will be marked as complete.
// If it fails (or fragments are missing) - we're going to re-request the chunk again.

// Chunks that we reqeusted (sent the request to peers).
Expand Down Expand Up @@ -2595,7 +2595,7 @@ impl Client {
tracing::debug_span!(target: "client", "get_tier1_accounts(): recomputing").entered();

// What we really need are: chunk producers, block producers and block approvers for
// this epoch and the beginnig of the next epoch (so that all required connections are
// this epoch and the beginning of the next epoch (so that all required connections are
// established in advance). Note that block producers and block approvers are not
// exactly the same - last blocks of this epoch will also need to be signed by the
// block producers of the next epoch. On the other hand, block approvers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl ChunkEndorsementTracker {
)?;
// Get the chunk_endorsements for the chunk from our cache.
// Note that these chunk endorsements are already validated as part of process_chunk_endorsement.
// We can safely rely on the the following details
// We can safely rely on the following details
// 1. The chunk endorsements are from valid chunk_validator for this chunk.
// 2. The chunk endorsements signatures are valid.
let Some(chunk_endorsements) = self.chunk_endorsements.get(&chunk_header.chunk_hash())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use once_cell::sync::OnceCell;

/// `ProcessingDoneTracker` can be used in conjuction with a `ProcessingDoneWaiter`
/// `ProcessingDoneTracker` can be used in conjunction with a `ProcessingDoneWaiter`
/// to wait until some processing is finished. `ProcessingDoneTracker` should be
/// kept alive as long as the processing is ongoing, then once it's dropped,
/// the paired `ProcessingDoneWaiter` will be notified that the processing has finished.
Expand Down
2 changes: 1 addition & 1 deletion chain/client/src/sync/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ impl BlockSync {
let mut num_requests = 0;
for (height, hash) in requests {
let request_from_archival = self.archive && height < gc_stop_height;
// Assume that heads of `highest_height_peers` are are ahead of the blocks we're requesting.
// Assume that heads of `highest_height_peers` are ahead of the blocks we're requesting.
let peer = if request_from_archival {
// Normal peers are unlikely to have old blocks, request from an archival node.
let archival_peer_iter = highest_height_peers.iter().filter(|p| p.archival);
Expand Down
2 changes: 1 addition & 1 deletion chain/epoch-manager/src/validator_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ mod tests {
fn test_validator_assignment_ratio_condition() {
// There are more seats than proposals, however the
// lower proposals are too small relative to the total
// (the reason we can't choose them is because the the probability of them actually
// (the reason we can't choose them is because the probability of them actually
// being selected to make a block would be too low since it is done in
// proportion to stake).
let epoch_config = create_epoch_config(
Expand Down
2 changes: 1 addition & 1 deletion chain/indexer/src/streamer/fetchers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Streamer watches the network and collects all the blocks and related chunks
//! into one struct and pushes in in to the given queue
//! into one struct and pushes in to the given queue
use std::collections::HashMap;

use actix::Addr;
Expand Down
4 changes: 2 additions & 2 deletions chain/network/src/peer_manager/tests/snapshot_hosts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ async fn invalid_signature_not_broadcast() {
let empty_sync_msg = peer3.events.recv_until(take_sync_snapshot_msg).await;
assert_eq!(empty_sync_msg.hosts, vec![]);

tracing::info!(target:"test", "Send an invalid SyncSnapshotHosts message from from peer1. One of the host infos has an invalid signature.");
tracing::info!(target:"test", "Send an invalid SyncSnapshotHosts message from peer1. One of the host infos has an invalid signature.");
let random_secret_key = SecretKey::from_random(near_crypto::KeyType::ED25519);
let invalid_info = make_snapshot_host_info(&peer1_config.node_id(), &random_secret_key, rng);

Expand Down Expand Up @@ -249,7 +249,7 @@ async fn too_many_shards_not_broadcast() {
let empty_sync_msg = peer3.events.recv_until(take_sync_snapshot_msg).await;
assert_eq!(empty_sync_msg.hosts, vec![]);

tracing::info!(target:"test", "Send an invalid SyncSnapshotHosts message from from peer1. One of the host infos has more shard ids than allowed.");
tracing::info!(target:"test", "Send an invalid SyncSnapshotHosts message from peer1. One of the host infos has more shard ids than allowed.");
let too_many_shards: Vec<ShardId> =
(0..(MAX_SHARDS_PER_SNAPSHOT_HOST_INFO as u64 + 1)).collect();
let invalid_info = Arc::new(SnapshotHostInfo::new(
Expand Down
2 changes: 1 addition & 1 deletion chain/network/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ mod tests {
/// case fall back to sending to the account.
/// Otherwise, send to the account, unless we do not know the route, in which case send to the peer.
pub struct AccountIdOrPeerTrackingShard {
/// Target account to send the the request to
/// Target account to send the request to
pub account_id: Option<AccountId>,
/// Whether to check peers first or target account first
pub prefer_peer: bool,
Expand Down
2 changes: 1 addition & 1 deletion core/parameters/res/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ versions which generally means the default value is used to fill in the
`RuntimeConfig` object.

The latest values of parameters can be found in `parameters.snap`. This file is
automatically generated by tests and needs to be reviewed and commited whenever
automatically generated by tests and needs to be reviewed and committed whenever
any of the parameters changes.
2 changes: 1 addition & 1 deletion core/primitives/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub struct AnnounceAccount {

impl AnnounceAccount {
/// We hash only (account_id, peer_id, epoch_id). There is no need hash the signature
/// as it's uniquely determined the the triple.
/// as it's uniquely determined the triple.
pub fn build_header_hash(
account_id: &AccountId,
peer_id: &PeerId,
Expand Down
2 changes: 1 addition & 1 deletion core/primitives/src/shard_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type ShardSplitMap = Vec<Vec<ShardId>>;
pub struct ShardLayoutV1 {
/// The boundary accounts are the accounts on boundaries between shards.
/// Each shard contains a range of accounts from one boundary account to
/// another - or the the smallest or largest account possible. The total
/// another - or the smallest or largest account possible. The total
/// number of shards is equal to the number of boundary accounts plus 1.
boundary_accounts: Vec<AccountId>,
/// Maps shards from the last shard layout to shards that it splits to in this shard layout,
Expand Down
4 changes: 2 additions & 2 deletions core/store/src/db/colddb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ impl ColdDB {
format!("Reading from column missing from cold storage. {col:?}")
}

// Checks if the column is is the cold db and returns an error if not.
// Checks if the column is the cold db and returns an error if not.
fn check_is_in_colddb(col: DBCol) -> std::io::Result<()> {
if !col.is_in_colddb() {
return Err(std::io::Error::other(Self::err_msg(col)));
}
Ok(())
}

// Checks if the column is is the cold db and panics if not.
// Checks if the column is the cold db and panics if not.
fn log_assert_is_in_colddb(col: DBCol) {
log_assert!(col.is_in_colddb(), "{}", Self::err_msg(col));
}
Expand Down
2 changes: 1 addition & 1 deletion core/store/src/db/splitdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ mod test {
let cold = create_cold();
let split = SplitDB::new(hot.clone(), cold.clone());

// Block is a nice column for testing because is is a cold column but
// Block is a nice column for testing because is a cold column but
// cold doesn't do anything funny to it.
let col = DBCol::Block;

Expand Down
2 changes: 1 addition & 1 deletion core/store/src/flat/store_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pub fn set_flat_storage_status(
/// Returns iterator over flat storage entries for a given shard and range of
/// state keys. `None` means that there is no bound in respective direction.
/// It reads data only from `FlatState` column which represents the state at
/// flat storage head. Reads only commited changes.
/// flat storage head. Reads only committed changes.
pub fn iter_flat_state_entries<'a>(
shard_uid: ShardUId,
store: &'a Store,
Expand Down
2 changes: 1 addition & 1 deletion core/store/src/trie/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ impl Trie {
{
match &self.memtries {
Some(memtries) => {
// If we have in-memory tries, use it to construct the the changes entirely (for
// If we have in-memory tries, use it to construct the changes entirely (for
// both in-memory and on-disk updates) because it's much faster.
let guard = memtries.read().unwrap();
let mut trie_update = guard.update(self.root, true)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ fn test_transaction_nonce_too_large() {
/// the requirement that the block must be in the same epoch as the next block after its accepted ancestor
/// - test1 processes partial chunk responses for block 8 and 9
/// - check that test1 sends missing chunk requests for block 11 to 10+NUM_ORPHAN_ANCESTORS+CHECK,
/// since now they satisfy the the requirements for requesting chunks for orphans
/// since now they satisfy the requirements for requesting chunks for orphans
/// - process the rest of blocks
#[test]
fn test_request_chunks_for_orphan() {
Expand Down
2 changes: 1 addition & 1 deletion pytest/lib/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def linear_regression(xs, ys):
def compute_rate(timestamps):
'''
Given a list of timestamps indicating the times
some event occured, returns the average rate at
some event occurred, returns the average rate at
which the events happen. If the units of the
timestamps are seconds, then the output units will
be `events/s`.
Expand Down
2 changes: 1 addition & 1 deletion pytest/tests/sanity/rpc_finality.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_finality(self):
latest_block_hash)
logger.info("About to send payment")
# this transaction will be added to the block (probably around block 5)
# and the the receipts & transfers will happen in the next block (block 6).
# and the receipts & transfers will happen in the next block (block 6).
# This function should return as soon as block 6 arrives in node0.
logger.info(nodes[0].send_tx_rpc(tx, wait_until='INCLUDED', timeout=10))
logger.info("Done")
Expand Down
2 changes: 1 addition & 1 deletion runtime/near-vm-runner/src/instrument/stack_height/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ macro_rules! instrument_call {
mod max_height;
mod thunk;

/// Error that occured during processing the module.
/// Error that occurred during processing the module.
///
/// This means that the module is invalid.
#[derive(Debug)]
Expand Down
4 changes: 2 additions & 2 deletions runtime/near-vm/compiler/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ use crate::lib::std::string::String;
/// [compiler-error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError
#[derive(Debug, thiserror::Error)]
pub enum CompileError {
/// A Wasm translation error occured.
/// A Wasm translation error occurred.
#[error("WebAssembly translation error: {0}")]
Wasm(WasmError),

/// A compilation error occured.
/// A compilation error occurred.
#[error("Compilation error: {0}")]
Codegen(String),

Expand Down
2 changes: 1 addition & 1 deletion runtime/near-vm/engine/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub enum InstantiationError {
#[error("module compiled with CPU feature that is missing from host")]
CpuFeature(String),

/// A runtime error occured while invoking the start function
/// A runtime error occurred while invoking the start function
#[error(transparent)]
Start(RuntimeError),
}
2 changes: 1 addition & 1 deletion runtime/near-vm/test-api/src/sys/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub enum InstantiationError {
#[error(transparent)]
Link(LinkError),

/// A runtime error occured while invoking the start function
/// A runtime error occurred while invoking the start function
#[error("could not invoke the start function: {0}")]
Start(RuntimeError),

Expand Down
2 changes: 1 addition & 1 deletion runtime/near-vm/wast/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct DirectiveError {
/// A structure holding the list of all executed directives
#[derive(Error, Debug)]
pub struct DirectiveErrors {
/// The filename where the error occured
/// The filename where the error occurred
pub filename: String,
/// The list of errors
pub errors: Vec<DirectiveError>,
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime-params-estimator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ done
```
When running these command, make sure to run with `sequential` and to disable
prefetching is disabled, or else the the replaying modes that match requests to
prefetching is disabled, or else the replaying modes that match requests to
receipts will not work properly.
```js
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ impl Runtime {
gas_balance_refund = 0;
}
} else {
// Refund for the difference of the purchased gas price and the the current gas price.
// Refund for the difference of the purchased gas price and the current gas price.
gas_balance_refund = safe_add_balance(
gas_balance_refund,
safe_gas_to_balance(
Expand Down
2 changes: 1 addition & 1 deletion tools/themis/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ pub fn publishable_has_license_file(workspace: &Workspace) -> anyhow::Result<()>

const EXPECTED_LICENSE: &str = "MIT OR Apache-2.0";

/// Ensure all non-private crates use the the same expected license
/// Ensure all non-private crates use the same expected license
pub fn publishable_has_unified_license(workspace: &Workspace) -> anyhow::Result<()> {
let outliers = workspace
.members
Expand Down
2 changes: 1 addition & 1 deletion utils/near-cache/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ where
Self { inner: RefCell::new(LruCache::<K, V>::new(cap)) }
}

/// Returns the number of key-value pairs that are currently in the the cache.
/// Returns the number of key-value pairs that are currently in the cache.
pub fn len(&self) -> usize {
self.inner.borrow().len()
}
Expand Down
2 changes: 1 addition & 1 deletion utils/near-cache/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ where
Self { inner: Mutex::new(LruCache::<K, V>::new(cap)) }
}

/// Returns the number of key-value pairs that are currently in the the cache.
/// Returns the number of key-value pairs that are currently in the cache.
pub fn len(&self) -> usize {
self.inner.lock().unwrap().len()
}
Expand Down

0 comments on commit 8da50d7

Please sign in to comment.