Skip to content

Commit

Permalink
Merge branch 'fix_typos_in_execution_code' into 'master'
Browse files Browse the repository at this point in the history
Chore: Fix typos in execution code

Fixes typos in 'execution code', i.e. in all folders in `ic/rs` that have at least one file belonging to the execution team (according to CODEOWNERS).

Only what [this spellchecker](https://github.com/crate-ci/typos) was able to find. 

See merge request dfinity-lab/public/ic!14717
  • Loading branch information
stiegerc committed Sep 13, 2023
2 parents da6a81f + 3d27447 commit 5dbf937
Show file tree
Hide file tree
Showing 59 changed files with 95 additions and 95 deletions.
8 changes: 4 additions & 4 deletions rs/bitcoin/adapter/src/blockchainmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub struct BlockchainManager {

/// Records outstanding getHeader requests. Used for:
/// - Check if a header response is solicited.
/// - Check if peer is not responding to GetHeader reuqest. In that case remove peer after timeout.
/// - Check if peer is not responding to GetHeader request. In that case remove peer after timeout.
getheaders_requests: HashMap<SocketAddr, GetHeadersRequest>,

/// A flag that is set for each peer when we receive a `inv` message while we have an outstanding `getheaders` request to the same peer.
Expand Down Expand Up @@ -287,7 +287,7 @@ impl BlockchainManager {
};

if let Some(locators) = maybe_locators {
// An entry in `getheaders_requets` indicates that we have an outstanding request. If this is
// An entry in `getheaders_requests` indicates that we have an outstanding request. If this is
// the case we set the catch-up flag to indicate that we need missed some `inv` from this peer.
if self.getheaders_requests.contains_key(addr) {
self.catchup_headers.insert(*addr);
Expand Down Expand Up @@ -621,7 +621,7 @@ impl BlockchainManager {
}

/// This function is called by the adapter when a new event takes place.
/// The event could be receiving "getheaders", "getdata", "inv" messages from bitcion peers.
/// The event could be receiving "getheaders", "getdata", "inv" messages from bitcoin peers.
/// The event could be change in connection status with a bitcoin peer.
pub async fn process_bitcoin_network_message(
&mut self,
Expand Down Expand Up @@ -1605,7 +1605,7 @@ pub mod test {
.last()
.expect("next_hashes should contain 1 block hash")
);
// Block 5 shoul still be in the cache.
// Block 5 should still be in the cache.
assert!(blockchain_manager
.blockchain
.lock()
Expand Down
4 changes: 2 additions & 2 deletions rs/bitcoin/adapter/src/blockchainstate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! The module is reponsible for keeping track of the blockchain state.
//! The module is responsible for keeping track of the blockchain state.
//!
use crate::{common::BlockHeight, config::Config, metrics::BlockchainStateMetrics};
use bitcoin::{blockdata::constants::genesis_block, Block, BlockHash, BlockHeader, Network};
Expand Down Expand Up @@ -143,7 +143,7 @@ pub struct BlockchainState {
/// The starting point of the blockchain
genesis_block_header: BlockHeader,

/// This field stores all the Bitcoin headers using a HashMap containining BlockHash and the corresponding header.
/// This field stores all the Bitcoin headers using a HashMap containing BlockHash and the corresponding header.
header_cache: HeaderCache,

/// This field stores a hashmap containing BlockHash and the corresponding Block.
Expand Down
2 changes: 1 addition & 1 deletion rs/bitcoin/adapter/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub enum IncomingSource {
/// We use systemd's created socket.
#[default]
Systemd,
/// We use the corresponing path as socket.
/// We use the corresponding path as socket.
Path(PathBuf),
}

Expand Down
2 changes: 1 addition & 1 deletion rs/bitcoin/adapter/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub enum ConnectionState {
},
}

/// This enum is used to track the status of wether or not
/// This enum is used to track the status of whether or not
/// a ping needs to be sent to the connected BTC node.
/// The ping is used to maintain whether or not the connection is stable.
#[derive(Clone, Debug)]
Expand Down
6 changes: 3 additions & 3 deletions rs/bitcoin/adapter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub trait ProcessEvent {
) -> Result<(), ProcessBitcoinNetworkMessageError>;
}

/// This trait provides an interface for processing messages comming from
/// This trait provides an interface for processing messages coming from
/// bitcoin peers.
/// [StreamEvent](crate::stream::StreamEvent).
pub trait ProcessBitcoinNetworkMessage {
Expand Down Expand Up @@ -160,8 +160,8 @@ pub struct AdapterState {
/// to unnecessary download bitcoin data.
/// In a previous iteration we set this value to at least 'idle_seconds' in the past on startup.
/// This way the adapter would always be in idle when starting since 'elapsed()' is greater than 'idle_seconds'.
/// On MacOS this approach caused issues since on MacOS Instant::now() is time since boot and when substracting
/// 'idle_seconds' we encountered an underflow and paniced.
/// On MacOS this approach caused issues since on MacOS Instant::now() is time since boot and when subtracting
/// 'idle_seconds' we encountered an underflow and panicked.
last_received_at: Arc<RwLock<Option<Instant>>>,
/// The field contains how long the adapter should wait to before becoming idle.
idle_seconds: u64,
Expand Down
4 changes: 2 additions & 2 deletions rs/bitcoin/adapter/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use tokio::{
};

/// The function starts a Tokio task that awaits messages from the ConnectionManager.
/// After receiving a message, it is dispached to _all_ relevant components for processing.
/// After receiving a message, it is dispatched to _all_ relevant components for processing.
/// Having a design where we have a separate task that awaits on messages from the
/// ConnectionManager, we keep the ConnectionManager free of dependencies like the
/// TransactionStore or the BlockchainManager.
Expand Down Expand Up @@ -57,7 +57,7 @@ pub fn start_main_event_loop(
if adapter_state.is_idle() {
connection_manager.make_idle();
blockchain_manager.make_idle().await;
// TODO: instead of sleeping here add some async synchonization.
// TODO: instead of sleeping here add some async synchronization.
sleep(sleep_idle_interval).await;
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion rs/bitcoin/adapter/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const CONNECTION_TIMEOUT_SECS: u64 = 5;
/// from the Bitcoin node.
const STREAM_BUFFER_SIZE: usize = 64 * 1024;

/// This constant represents the maxiumum raw network message size we accept.
/// This constant represents the maximum raw network message size we accept.
const MAX_RAW_MESSAGE_SIZE: usize = 40 * 1024 * 1024;

/// This enum is used to represent the possible errors that could occur while a stream
Expand Down
10 changes: 5 additions & 5 deletions rs/bitcoin/adapter/src/transaction_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{Channel, Command};
/// How long should the transaction manager hold on to a transaction.
const TX_CACHE_TIMEOUT_PERIOD_SECS: u64 = 10 * 60; // 10 minutes

/// Maxmimum number of transaction to advertise.
/// Maximum number of transaction to advertise.
// https://developer.bitcoin.org/reference/p2p_networking.html#inv
const MAXIMUM_TRANSACTION_PER_INV: usize = 50_000;

Expand Down Expand Up @@ -325,7 +325,7 @@ mod test {
/// 1. Add transaction to manager.
/// 2. Advertise that transaction and create requests from peer.
/// 3. Check that this transaction does not get advertised again during manager tick.
/// 3. Check transaction advertisment is correctly tracked.
/// 3. Check transaction advertisement is correctly tracked.
#[test]
fn test_adapter_dont_readvertise() {
let address = SocketAddr::from_str("127.0.0.1:8333").expect("invalid address");
Expand Down Expand Up @@ -374,7 +374,7 @@ mod test {
);
}

/// This function tests that we advertise to muliple peers and don't readvertise after
/// This function tests that we advertise to multiple peers and don't readvertise after
/// first adverisment.
/// Test Steps:
/// 1. Add transaction to manager.
Expand All @@ -392,7 +392,7 @@ mod test {
let raw_tx = serialize(&transaction);
manager.enqueue_transaction(&raw_tx);
manager.advertise_txids(&mut channel);
// Transaction advertisment to both peers.
// Transaction advertisement to both peers.
assert_eq!(channel.command_count(), 2);
channel.pop_front().unwrap();
channel.pop_front().unwrap();
Expand Down Expand Up @@ -420,7 +420,7 @@ mod test {
/// 2. Advertise that transaction and request it.
/// 3. Check that this transaction does not get readvertised to peer 1.
/// 4. Add new peer to available connections.
/// 5. Check that new peer get advertisment.
/// 5. Check that new peer get advertisement.
#[test]
fn test_adapter_advertise_new_peer() {
let address1 = SocketAddr::from_str("127.0.0.1:8333").expect("invalid address");
Expand Down
2 changes: 1 addition & 1 deletion rs/bitcoin/ckbtc/minter/ckbtc_minter.did
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type UtxoStatus = variant {
// the KYT fees. This state is final, retrying [update_balance] call will
// have no effect on this UTXO.
ValueTooSmall : Utxo;
// The KYT provider considered this UTXO to be tained. This UTXO state is
// The KYT provider considered this UTXO to be tainted. This UTXO state is
// final, retrying [update_balance] call will have no effect on this UTXO.
Tainted : Utxo;
// The UTXO passed the KYT check, but the minter failed to mint ckBTC
Expand Down
2 changes: 1 addition & 1 deletion rs/bitcoin/ckbtc/minter/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl fmt::Display for ParseAddressError {
Self::NoData => write!(fmt, "the address contains no data"),
Self::InvalidBech32Variant { expected, found } => write!(
fmt,
"invalied bech32 variant, expected: {:?}, found: {:?}",
"invalid bech32 variant, expected: {:?}, found: {:?}",
expected, found
),
}
Expand Down
2 changes: 1 addition & 1 deletion rs/bitcoin/ckbtc/minter/src/memo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub enum MintMemo<'a> {
/// The minter minted accumulated KYT fees to the KYT provider.
Kyt,
#[n(2)]
/// The minter failed to check retireve btc destination address
/// The minter failed to check retrieve btc destination address
/// or the destination address is tainted.
KytFail {
#[n(0)]
Expand Down
2 changes: 1 addition & 1 deletion rs/bitcoin/ckbtc/minter/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pub fn encode_metrics(
metrics.encode_gauge(
"ckbtc_minter_concurrent_update_balance_count",
state::read_state(|s| s.update_balance_principals.len()) as f64,
"Total number of concurrent update_blanace requests.",
"Total number of concurrent update_balance requests.",
)?;

metrics.encode_gauge(
Expand Down
4 changes: 2 additions & 2 deletions rs/bitcoin/ckbtc/minter/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ thread_local! {
#[derive(candid::CandidType, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct RetrieveBtcRequest {
/// The amount to convert to BTC.
/// The minter withdraws BTC tranfer fees from this amount.
/// The minter withdraws BTC transfer fees from this amount.
pub amount: u64,
/// The destination BTC address.
pub address: BitcoinAddress,
Expand Down Expand Up @@ -791,7 +791,7 @@ impl CkBtcMinterState {
Some(last)
}

/// Removes a pending retrive_btc request with the specified block index.
/// Removes a pending retrieve_btc request with the specified block index.
fn remove_pending_request(&mut self, block_index: u64) -> Option<RetrieveBtcRequest> {
match self
.pending_retrieve_btc_requests
Expand Down
2 changes: 1 addition & 1 deletion rs/bitcoin/ckbtc/minter/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ fn test_min_change_amount() {
&[
tx::TxOut {
address: out1_addr,
value: 100_000 - fee_share - 1, // Substract the remainder
value: 100_000 - fee_share - 1, // Subtract the remainder
},
tx::TxOut {
address: out2_addr,
Expand Down
4 changes: 2 additions & 2 deletions rs/bitcoin/ckbtc/minter/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ pub struct TxOut {
}

/// Encodes the scriptPubkey required to unlock an output for the specified address.
pub fn encode_address_scipt_pubkey(btc_address: &BitcoinAddress, buf: &mut impl Buffer) {
pub fn encode_address_script_pubkey(btc_address: &BitcoinAddress, buf: &mut impl Buffer) {
match btc_address {
BitcoinAddress::P2wpkhV0(pkhash) => encode_p2wpkh_script_pubkey(pkhash, buf),
BitcoinAddress::P2wshV0(pkhash) => encode_p2wsh_script(pkhash, buf),
Expand Down Expand Up @@ -512,7 +512,7 @@ impl Encode for SignedInput {
impl Encode for TxOut {
fn encode(&self, buf: &mut impl Buffer) {
self.value.encode(buf);
encode_address_scipt_pubkey(&self.address, buf);
encode_address_script_pubkey(&self.address, buf);
}
}

Expand Down
2 changes: 1 addition & 1 deletion rs/bitcoin/ckbtc/spec/Ck_BTC.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CONSTANTS
\* These are just there to introduce model values
USER_BTC_ADDRESS = USER_BTC
MINTER_BTC_ADDRESS = M_ADDR
\* TODO: is there going to be an initial minter balance, an inital supply of ckBTC?
\* TODO: is there going to be an initial minter balance, an initial supply of ckBTC?
\* If yes, should the ckBTC supply stay constant?
INGEST_BTC_STATE_PROCESS_ID = PID_INGEST
BTC_PROCESS_ID = PID_BTC
Expand Down
4 changes: 2 additions & 2 deletions rs/bitcoin/ckbtc/spec/Ck_BTC.tla
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ CONSTANTS
BTC_TO_WITHDRAWAL(_)

\**********************************************************************************************
\* Constants used when runing the analysis using the TLC tool
\* Constants used when running the analysis using the TLC tool
\**********************************************************************************************

\* The version of BTC_TO_WITHDRAWAL used with TLC for analysis, as TLC doesn't care about types
Expand Down Expand Up @@ -147,7 +147,7 @@ Symmetry_Permutations == UNION { Permutations(S) : S \in Symmetry_Sets }
Sum_Utxos(S) == Sum_F(LAMBDA x: x.amount, S)
Utxos_Owned_By(utxos, S) == { utxo \in utxos: utxo.owner \in S }

\* Utility definitions to deal with the fields in utxos_states_adresses values
\* Utility definitions to deal with the fields in utxos_states_addresses values
New_Address_State == [discovered_utxos |-> {}, processed_utxos |-> {}, spent_utxos |-> {}]
Discovered_Utxos(addr_to_state, addr) == With_Default(addr_to_state, addr, New_Address_State).discovered_utxos
Processed_Utxos(addr_to_state, addr) == With_Default(addr_to_state, addr, New_Address_State).processed_utxos
Expand Down
2 changes: 1 addition & 1 deletion rs/config/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ mod tests {
fn should_set_correct_path_permissions() {
CryptoConfig::run_with_temp_config(|config| {
CryptoConfig::check_dir_has_required_permissions(&config.crypto_root)
.expect("Wrong direcotry permissions");
.expect("Wrong directory permissions");
})
}

Expand Down
4 changes: 2 additions & 2 deletions rs/config/src/execution_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const SUBNET_MEMORY_CAPACITY: NumBytes = NumBytes::new(450 * GIB);
const SUBNET_MESSAGE_MEMORY_CAPACITY: NumBytes = NumBytes::new(25 * GIB);

/// This is the upper limit on how much memory can be used by the ingress
/// history on a given subnet. It is lower than the subnet messsage memory
/// history on a given subnet. It is lower than the subnet message memory
/// capacity because here we count actual memory consumption as opposed to
/// memory plus reservations.
const INGRESS_HISTORY_MEMORY_CAPACITY: NumBytes = NumBytes::new(4 * GIB);
Expand Down Expand Up @@ -182,7 +182,7 @@ pub struct Config {
/// The maximum number of instructions allowed for a query call graph.
pub max_query_call_graph_instructions: NumInstructions,

/// The maxmimum time a query call in non-replicated mode is allowed to run.
/// The maximum time a query call in non-replicated mode is allowed to run.
/// In replicated code we cannot rely on the walltime, since that is not
/// deterministic.
pub max_query_call_walltime: Duration,
Expand Down
8 changes: 4 additions & 4 deletions rs/cycles_account_manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ impl CyclesAccountManager {
| CyclesUseCase::NonConsumed => system_state.balance(),
};

self.verify_cycles_balance_with_treshold(
self.verify_cycles_balance_with_threshold(
system_state.canister_id,
effective_cycles_balance,
cycles,
Expand All @@ -842,7 +842,7 @@ impl CyclesAccountManager {
Ok(())
}

fn verify_cycles_balance_with_treshold(
fn verify_cycles_balance_with_threshold(
&self,
canister_id: CanisterId,
cycles_balance: Cycles,
Expand Down Expand Up @@ -882,7 +882,7 @@ impl CyclesAccountManager {
cycles: Cycles,
threshold: Cycles,
) -> Result<(), CanisterOutOfCyclesError> {
self.verify_cycles_balance_with_treshold(canister_id, *cycles_balance, cycles, threshold)?;
self.verify_cycles_balance_with_threshold(canister_id, *cycles_balance, cycles, threshold)?;

*cycles_balance -= cycles;
Ok(())
Expand Down Expand Up @@ -1105,7 +1105,7 @@ mod tests {
}

#[test]
fn http_requets_fee_scale() {
fn http_requests_fee_scale() {
let subnet_size: u64 = 34;
let reference_subnet_size: u64 = 13;
let request_size = NumBytes::from(17);
Expand Down
2 changes: 1 addition & 1 deletion rs/drun/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub fn run_drun(uo: DrunOptions) -> Result<(), String> {
// Hardcoded magic values to create a ReplicaConfig that parses.
let mut subnet_config = SubnetConfig::new(subnet_type);

// If an intruction limit was specified, update the config with the provided instruction limit.
// If an instruction limit was specified, update the config with the provided instruction limit.
if let Some(instruction_limit) = instruction_limit {
subnet_config.scheduler_config.max_instructions_per_message =
NumInstructions::new(instruction_limit);
Expand Down
2 changes: 1 addition & 1 deletion rs/execution_environment/benches/diff-old-vs-new.sh
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ calculate_average_speedup() {
count++;
printf "| %-42s | %8s | %8s | %+6d% |", $2, $3, $4, speedup;
}
# Print round time ony for throughput
# Print round time only for throughput
# Throughput must be >= 100 elem/s, time must be < 100 s
if (new < 100) {
printf "\n"; # skip round time for time table
Expand Down
2 changes: 1 addition & 1 deletion rs/execution_environment/src/canister_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub(crate) struct InstallCodeResult {
/// canister state with all the changes done during execution.
/// * If execution has failed, then the result contains the old canister state
/// with some changes such charging of execution cycles.
/// * If exection did not complete, then the result contains the old canister state,
/// * If execution did not complete, then the result contains the old canister state,
/// with some changes such reservation of execution cycles and a continuation.
#[derive(Debug)]
pub(crate) enum DtsInstallCodeResult {
Expand Down
2 changes: 1 addition & 1 deletion rs/execution_environment/src/canister_manager/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4389,7 +4389,7 @@ fn unfreezing_of_frozen_canister() {
.universal_canister_with_cycles(Cycles::new(1_000_000_000_000))
.unwrap();

// Set the freezing theshold high to freeze the canister.
// Set the freezing threshold high to freeze the canister.
let payload = UpdateSettingsArgs {
canister_id: canister_id.get(),
settings: CanisterSettingsArgsBuilder::new()
Expand Down
2 changes: 1 addition & 1 deletion rs/execution_environment/src/execution/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ mod test {
use ic_types::Time;

#[test]
fn test_wasm_result_to_query_response_refunds_correclty() {
fn test_wasm_result_to_query_response_refunds_correctly() {
let scheduler_state = SchedulerState::default();
let system_state = SystemState::new_running(
CanisterId::from_u64(42),
Expand Down
2 changes: 1 addition & 1 deletion rs/execution_environment/src/execution/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ impl ResponseHelper {
}
}

/// Completes execution of the respose and cleanup callbacks without
/// Completes execution of the response and cleanup callbacks without
/// consuming any instructions and without producing any heap delta.
fn early_finish(
self,
Expand Down

0 comments on commit 5dbf937

Please sign in to comment.