Skip to content

Commit

Permalink
Merge branch 'fix_typos_in_mr_code' into 'master'
Browse files Browse the repository at this point in the history
Fix: Typos in MR code.

Gave [typos](https://github.com/crate-ci/typos) a spin. 

See merge request dfinity-lab/public/ic!14706
  • Loading branch information
stiegerc committed Sep 11, 2023
2 parents d078b3c + eea9ad6 commit c3b0d69
Show file tree
Hide file tree
Showing 24 changed files with 58 additions and 46 deletions.
2 changes: 1 addition & 1 deletion rs/execution_environment/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1796,7 +1796,7 @@ fn execute_canisters_on_thread(
canister
.system_state
.canister_metrics
.interruped_during_execution += 1;
.interrupted_during_execution += 1;
break;
}
let measurement_scope = MeasurementScope::nested(
Expand Down
24 changes: 18 additions & 6 deletions rs/execution_environment/src/scheduler/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ fn can_fully_execute_canisters_with_one_input_message_each() {
let canister_metrics = &canister.system_state.canister_metrics;
assert_eq!(canister_metrics.skipped_round_due_to_no_messages, 0);
assert_eq!(canister_metrics.executed, 1);
assert_eq!(canister_metrics.interruped_during_execution, 0);
assert_eq!(canister_metrics.interrupted_during_execution, 0);
}

assert_eq!(
Expand Down Expand Up @@ -1337,7 +1337,10 @@ fn dont_execute_any_canisters_if_not_enough_instructions_in_round() {
0
);
assert_eq!(system_state.canister_metrics.executed, 0);
assert_eq!(system_state.canister_metrics.interruped_during_execution, 0);
assert_eq!(
system_state.canister_metrics.interrupted_during_execution,
0
);
}
}

Expand Down Expand Up @@ -1486,7 +1489,10 @@ fn can_execute_messages_with_just_enough_instructions() {
0
);
assert_eq!(system_state.canister_metrics.executed, 1);
assert_eq!(system_state.canister_metrics.interruped_during_execution, 0);
assert_eq!(
system_state.canister_metrics.interrupted_during_execution,
0
);
}

assert_eq!(
Expand Down Expand Up @@ -1553,7 +1559,10 @@ fn execute_only_canisters_with_messages() {
0
);
assert_eq!(active.system_state.canister_metrics.executed, 1);
assert_eq!(system_state.canister_metrics.interruped_during_execution, 0);
assert_eq!(
system_state.canister_metrics.interrupted_during_execution,
0
);

assert_eq!(
test.state()
Expand Down Expand Up @@ -1601,7 +1610,10 @@ fn can_fully_execute_multiple_canisters_with_multiple_messages_each() {
0
);
assert_eq!(system_state.canister_metrics.executed, 1);
assert_eq!(system_state.canister_metrics.interruped_during_execution, 0);
assert_eq!(
system_state.canister_metrics.interrupted_during_execution,
0
);
}

assert_eq!(
Expand Down Expand Up @@ -1757,7 +1769,7 @@ fn can_execute_messages_from_multiple_canisters_until_out_of_instructions() {
canister
.system_state
.canister_metrics
.interruped_during_execution,
.interrupted_during_execution,
0
);
assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion rs/messaging/src/message_routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ impl BatchProcessor for FakeBatchProcessorImpl {
user_id: ingress.sender(),
time,
state: ic_types::ingress::IngressState::Completed(
// The byte content mimicks a good reply for the counter example
// The byte content mimics a good reply for the counter example
ic_types::ingress::WasmResult::Reply(vec![68, 73, 68, 76, 0, 0]),
),
},
Expand Down
4 changes: 2 additions & 2 deletions rs/messaging/src/message_routing/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ struct TestRecords<'a, const N: usize> {
ni_dkg_transcripts: [Integrity<Option<&'a NiDkgTranscript>>; N],
nns_subnet_id: Integrity<SubnetId>,
// EcdsaKeyId is used to make a key for the record. An empty `BTreeMap` therefore means no
// recrods in the registry and wrapping it in `Integrity` would be redundant.
// records in the registry and wrapping it in `Integrity` would be redundant.
ecdsa_signing_subnets: &'a BTreeMap<EcdsaKeyId, Integrity<Vec<SubnetId>>>,
provisional_whitelist: Integrity<&'a ProvisionalWhitelist>,
routing_table: Integrity<&'a RoutingTable>,
Expand Down Expand Up @@ -525,7 +525,7 @@ fn try_to_read_registry(
///
/// Two subnets are used for this, one considered the 'own subnet'.
/// The subnet records are fully specified for 'own subnet' only, whereas the other subnet uses
/// default values whereever possible. This setup ensures records are parsed correctly and also
/// default values wherever possible. This setup ensures records are parsed correctly and also
/// that different records are returned for different subnets.
///
/// Finally `BatchProcessorImpl::process_batch()` is called directly to check the
Expand Down
4 changes: 2 additions & 2 deletions rs/messaging/src/routing/stream_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ fn reject_code_for_state_error(err: &StateError) -> RejectCode {
}
}

/// Ensures that the given signals are vaild (strictly increasing, before
/// Ensures that the given signals are valid (strictly increasing, before
/// `signals_end`).
fn assert_valid_signals(
signals_end: StreamIndex,
Expand All @@ -881,7 +881,7 @@ fn assert_valid_signals(
use std::iter::once;
let shifted = reject_signals.iter().skip(1).chain(once(&signals_end));
assert!(
// Check that signals are stricly monotonic and below signals_end.
// Check that signals are strictly monotonic and below signals_end.
reject_signals.iter().zip(shifted).all(|(x, y)| x < y),
"Invalid {}: signals_end {}, signals {:?}",
stream_component,
Expand Down
2 changes: 1 addition & 1 deletion rs/messaging/src/routing/stream_handler/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,7 @@ fn induct_stream_slices_sender_subnet_mismatch() {
});
}

/// Tests that a message adressed to a canister that is not currently hosted by
/// Tests that a message addressed to a canister that is not currently hosted by
/// this subnet; and is not being migrated on a path containing both this subnet
/// and its known host; is dropped, incrementing the respective critical error
/// count.
Expand Down
2 changes: 1 addition & 1 deletion rs/messaging/tests/queue_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ fn induct_and_observe_until_stale(
/// if a response is consumed successfully or else responses that are routed to streams found on
/// `new_subnets_proxy` due to the change in the routing tables.
/// The sequence of events is therefore as follows:
/// - After the inital situation as depicted above, the XNet canisters stop generating requests.
/// - After the initial situation as depicted above, the XNet canisters stop generating requests.
/// - Bidirectional inductions are done on `old_subnets_proxy` until they stop triggering changes.
/// - Bidirectional inductions are done on `new_subnets_proxy` until they stop triggering changes.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ message CanisterStateBits {
reserved 19;
reserved "executed_and_exhausted_its_messages";
bytes certified_data = 20;
uint64 interruped_during_execution = 21;
uint64 interrupted_during_execution = 21;
types.v1.NominalCycles consumed_cycles_since_replica_started = 22;
uint64 freeze_threshold = 23;
reserved 24;
Expand Down
2 changes: 1 addition & 1 deletion rs/protobuf/src/gen/state/state.canister_state_bits.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ pub struct CanisterStateBits {
#[prost(bytes = "vec", tag = "20")]
pub certified_data: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag = "21")]
pub interruped_during_execution: u64,
pub interrupted_during_execution: u64,
#[prost(message, optional, tag = "22")]
pub consumed_cycles_since_replica_started:
::core::option::Option<super::super::super::types::v1::NominalCycles>,
Expand Down
2 changes: 1 addition & 1 deletion rs/replicated_state/src/canister_state/queues/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ fn test_garbage_collect() {
assert_eq!(CanisterQueues::default(), queues);
}

/// Tests that even when `garbage_collect()` would otherwis be a no-op, fields
/// Tests that even when `garbage_collect()` would otherwise be a no-op, fields
/// are always reset to default.
#[test]
fn test_garbage_collect_restores_defaults() {
Expand Down
6 changes: 3 additions & 3 deletions rs/replicated_state/src/canister_state/system_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub struct CanisterMetrics {
pub scheduled_as_first: u64,
pub skipped_round_due_to_no_messages: u64,
pub executed: u64,
pub interruped_during_execution: u64,
pub interrupted_during_execution: u64,
pub consumed_cycles_since_replica_started: NominalCycles,
consumed_cycles_since_replica_started_by_use_cases: BTreeMap<CyclesUseCase, NominalCycles>,
}
Expand All @@ -139,15 +139,15 @@ impl CanisterMetrics {
scheduled_as_first: u64,
skipped_round_due_to_no_messages: u64,
executed: u64,
interruped_during_execution: u64,
interrupted_during_execution: u64,
consumed_cycles_since_replica_started: NominalCycles,
consumed_cycles_since_replica_started_by_use_cases: BTreeMap<CyclesUseCase, NominalCycles>,
) -> Self {
Self {
scheduled_as_first,
skipped_round_due_to_no_messages,
executed,
interruped_during_execution,
interrupted_during_execution,
consumed_cycles_since_replica_started,
consumed_cycles_since_replica_started_by_use_cases,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct CallContext {
available_cycles: Cycles,

/// Point in time at which the `CallContext` was created. This field is only
/// optional to accomodate contexts that were created before this field was
/// optional to accommodate contexts that were created before this field was
/// added.
time: Option<Time>,
}
Expand Down
2 changes: 1 addition & 1 deletion rs/replicated_state/src/metadata_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1689,7 +1689,7 @@ impl IngressHistoryState {
if state.is_terminal() {
let timeout = time + MAX_INGRESS_TTL;

// Reset `self.next_terminal_time` in case it is after the current timout
// Reset `self.next_terminal_time` in case it is after the current timeout
// and the entry is completed or failed.
if self.next_terminal_time > timeout && state.is_terminal_with_payload() {
self.next_terminal_time = timeout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub type InstallCodeCallId = Id<InstallCodeCallIdTag, u64>;
/// Collection of install code call messages whose execution is paused at the
/// end of the round.
///
/// During a subnet split, these messages will be autmatically rejected if
/// During a subnet split, these messages will be automatically rejected if
/// the targeted canister has moved to a new subnet.
#[derive(Clone, Debug, Default, PartialEq, Eq)]
struct InstallCodeCallManager {
Expand Down Expand Up @@ -102,7 +102,7 @@ impl InstallCodeCallManager {
/// Collection of stop canister messages whose execution is paused at the
/// end of the round.
///
/// During a subnet split, these messages will be autmatically rejected if
/// During a subnet split, these messages will be automatically rejected if
/// the target canister has moved to a new subnet.
#[derive(Clone, Debug, Default, PartialEq, Eq)]
struct StopCanisterCallManager {
Expand Down
4 changes: 2 additions & 2 deletions rs/replicated_state/src/metadata_state/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1093,14 +1093,14 @@ fn ingress_history_insert_before_next_complete_time_resets_it() {
// we just inserted above.
ingress_history.forget_terminal_statuses(status_size);

let expected_fogotten = ingress_history.get(&message_test_id(11)).unwrap();
let expected_forgotten = ingress_history.get(&message_test_id(11)).unwrap();

if let IngressStatus::Known {
receiver,
user_id,
time,
state: IngressState::Done,
} = expected_fogotten
} = expected_forgotten
{
assert_eq!(receiver, &canister_test_id(11).get());
assert_eq!(user_id, &user_test_id(11));
Expand Down
2 changes: 1 addition & 1 deletion rs/replicated_state/src/page_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ impl PageMap {
}

/// Modifies this page map by adding the given dirty pages to it.
/// Returns a list of dirty page indicies and an indication of whether the
/// Returns a list of dirty page indices and an indication of whether the
/// page allocator was created or not, which is used for synchronization
/// with the sandbox process.
pub fn update(&mut self, pages: &[(PageIndex, &PageBytes)]) -> Vec<PageIndex> {
Expand Down
6 changes: 3 additions & 3 deletions rs/replicated_state/src/page_map/page_allocator/mmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl PageInner {
/// there is sufficient number of dropped pages.
/// - all virtual memory is freed at once the page allocator itself is dropped.
/// This approach works well with the checkpoints and allows us to avoid all
/// the complexity and inefficiency of maintaing a thread-safe free-list.
/// the complexity and inefficiency of maintaining a thread-safe free-list.
///
/// It is exported publicly for benchmarking.
#[derive(Debug)]
Expand Down Expand Up @@ -394,13 +394,13 @@ enum BackingFileOwner {
}

/// The actual allocator implementation. It starts with an empty file, an
/// emty set of memory-mapped `Chunk`s, and an empty allocation area.
/// empty set of memory-mapped `Chunk`s, and an empty allocation area.
/// Allocation has two paths: slow and fast.
///
/// The slow path is taken when the bump-pointer allocation area is empty. In
/// that case the file grows by N pages. Those new pages are memory-mapped into
/// a new `Chunk`. The allocation area is set to the whole extent of the new
/// `Chunk`. The number of new pages N is not constant. It grows proportionaly
/// `Chunk`. The number of new pages N is not constant. It grows proportionally
/// to the number of already allocated pages to ensure that the number of
/// expensive `mmap` operations remains low - O(log(allocated_pages)).
///
Expand Down
8 changes: 4 additions & 4 deletions rs/replicated_state/tests/replicated_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ fn split() {
expected.canister_states.remove(&CANISTER_2);
// And the split marker should be set.
expected.metadata.split_from = Some(SUBNET_A);
// Otherwise, the state shold be the same.
// Otherwise, the state should be the same.
assert_eq!(expected, state_a);

//
Expand All @@ -720,7 +720,7 @@ fn split() {
expected.canister_states.insert(CANISTER_1, canister_state);
// And the split marker should be reset.
expected.metadata.split_from = None;
// Everything else shold be the same as in phase 1.
// Everything else should be the same as in phase 1.
assert_eq!(expected, state_a);

//
Expand All @@ -743,7 +743,7 @@ fn split() {
expected.metadata.ingress_history = fixture.state.metadata.ingress_history;
// And the split marker should be set.
expected.metadata.split_from = Some(SUBNET_A);
// Otherwise, the state shold be the same.
// Otherwise, the state should be the same.
assert_eq!(expected, state_b);

//
Expand All @@ -761,7 +761,7 @@ fn split() {
expected.canister_states.insert(CANISTER_2, canister_state);
// And the split marker should be reset.
expected.metadata.split_from = None;
// Everything else shold be the same as in phase 1.
// Everything else should be the same as in phase 1.
assert_eq!(expected, state_b);
}

Expand Down
6 changes: 3 additions & 3 deletions rs/state_layout/src/state_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ pub struct CanisterStateBits {
pub scheduled_as_first: u64,
pub skipped_round_due_to_no_messages: u64,
pub executed: u64,
pub interruped_during_execution: u64,
pub interrupted_during_execution: u64,
pub certified_data: Vec<u8>,
pub consumed_cycles_since_replica_started: NominalCycles,
pub stable_memory_size: NumWasmPages,
Expand Down Expand Up @@ -1609,7 +1609,7 @@ impl From<CanisterStateBits> for pb_canister_state_bits::CanisterStateBits {
scheduled_as_first: item.scheduled_as_first,
skipped_round_due_to_no_messages: item.skipped_round_due_to_no_messages,
executed: item.executed,
interruped_during_execution: item.interruped_during_execution,
interrupted_during_execution: item.interrupted_during_execution,
certified_data: item.certified_data.clone(),
consumed_cycles_since_replica_started: Some(
(&item.consumed_cycles_since_replica_started).into(),
Expand Down Expand Up @@ -1710,7 +1710,7 @@ impl TryFrom<pb_canister_state_bits::CanisterStateBits> for CanisterStateBits {
scheduled_as_first: value.scheduled_as_first,
skipped_round_due_to_no_messages: value.skipped_round_due_to_no_messages,
executed: value.executed,
interruped_during_execution: value.interruped_during_execution,
interrupted_during_execution: value.interrupted_during_execution,
certified_data: value.certified_data,
consumed_cycles_since_replica_started,
stable_memory_size: NumWasmPages::from(value.stable_memory_size64 as usize),
Expand Down
2 changes: 1 addition & 1 deletion rs/state_layout/src/state_layout/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn default_canister_state_bits() -> CanisterStateBits {
scheduled_as_first: 0,
skipped_round_due_to_no_messages: 0,
executed: 0,
interruped_during_execution: 0,
interrupted_during_execution: 0,
certified_data: vec![],
consumed_cycles_since_replica_started: NominalCycles::from(0),
stable_memory_size: NumWasmPages::from(0),
Expand Down
4 changes: 2 additions & 2 deletions rs/state_manager/src/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub fn load_checkpoint_parallel<P: ReadPolicy + Send + Sync>(
)
}

/// loads the node state heighted with `height` using the specified
/// Loads the node state heighted with `height` using the specified
/// directory layout.
pub fn load_checkpoint<P: ReadPolicy + Send + Sync>(
checkpoint_layout: &CheckpointLayout<P>,
Expand Down Expand Up @@ -344,7 +344,7 @@ pub fn load_canister_state<P: ReadPolicy>(
canister_state_bits.scheduled_as_first,
canister_state_bits.skipped_round_due_to_no_messages,
canister_state_bits.executed,
canister_state_bits.interruped_during_execution,
canister_state_bits.interrupted_during_execution,
canister_state_bits.consumed_cycles_since_replica_started,
canister_state_bits.consumed_cycles_since_replica_started_by_use_cases,
);
Expand Down
6 changes: 3 additions & 3 deletions rs/state_manager/src/tip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,10 @@ fn serialize_canister_to_tip(
.canister_metrics
.skipped_round_due_to_no_messages,
executed: canister_state.system_state.canister_metrics.executed,
interruped_during_execution: canister_state
interrupted_during_execution: canister_state
.system_state
.canister_metrics
.interruped_during_execution,
.interrupted_during_execution,
certified_data: canister_state.system_state.certified_data.clone(),
consumed_cycles_since_replica_started: canister_state
.system_state
Expand Down Expand Up @@ -564,7 +564,7 @@ fn serialize_canister_to_tip(
/// file had a lot of writes in the past but is mostly being read now.
///
/// The current defragmentation strategy is to pseudorandomly choose a
/// chunk of size max_size among the eligble files, read it to memory,
/// chunk of size max_size among the eligible files, read it to memory,
/// and write it back to the file. The effect is that this chunk is
/// definitely unique to the tip at the end of defragmentation.
pub fn defrag_tip(
Expand Down
2 changes: 1 addition & 1 deletion rs/state_manager/src/tree_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ mod tests {
}

/// Modify the leaf at the given index. The leaves are counted according to
/// their in-order traveral.
/// their in-order traversal.
fn modify_leaf_at_index(t: &mut RoseHashTree, idx: usize, h: Digest) -> Option<(Path, Digest)> {
fn go_rec(
t: &mut RoseHashTree,
Expand Down

0 comments on commit c3b0d69

Please sign in to comment.