Skip to content

Commit

Permalink
Add typos config file (#4753)
Browse files Browse the repository at this point in the history
* Add typos config file

* Fix typo errors

* Add typos to github CI

* Cargo fmt pass

* More typo fixes
  • Loading branch information
sydhds authored Oct 1, 2024
1 parent 6990fe6 commit 10e439a
Show file tree
Hide file tree
Showing 45 changed files with 129 additions and 85 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ concurrency:
# Swatinem/rust-cache: https://github.com/Swatinem/rust-cache
# dtolnay/rust-toolchain: https://github.com/dtolnay/rust-toolchain
# codecov/codecov-action: https://github.com/codecov/codecov-action
# JamesIves/github-pages-deploy-action: https://github.com/JamesIves/github-pages-deploy-action
# typos: https://github.com/crate-ci/typos/blob/master/docs/github-action.md

jobs:
# Quick tests on each commit/PR
Expand Down Expand Up @@ -103,6 +105,17 @@ jobs:
# - uses: actions-rust-lang/audit@v1
# name: Audit Rust Dependencies

typos:
if: github.ref != 'refs/heads/staging'
needs: sanity
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- uses: crate-ci/typos@master

# Full cross-platform tests required to merge on main branch
full:
name: full
Expand Down
27 changes: 27 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[files]
extend-exclude = [
"lcov.info",
"massa-node/base_config/*.json",
"massa-node/src/tests/config.toml",
"*.patch"
]

[default]
extend-ignore-re = [
# Note:
# Address (AU, AS): 32 - 62 characters
# Secret key (S): 18 - 62 characters
# Public key (P): 18 - 62 characters
# NodeId (N)
"(AU|AS|N|S|P)\\d\\w{18,62}",
]

[default.extend-words]
# short: serialize
ser = "ser"
# short: deserialize
der = "der"
# short: numerator
numer = "numer"
# WONTFIX: grpc_model::operation_type::Type::ExecutSc
Execut = "Execut"
2 changes: 1 addition & 1 deletion massa-api-exports/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl std::fmt::Display for CompactAddressInfo {
}
}

/// filter used when retrieving address informations
/// filter used when retrieving address information
#[derive(Debug, Deserialize, Clone, Serialize)]
pub struct AddressFilter {
/// Address
Expand Down
2 changes: 1 addition & 1 deletion massa-api-exports/src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl std::fmt::Display for OperationInfo {
"operation is not final",
"finality unknown"
),
display_option_bool(self.op_exec_status, "succes", "failed", "status unknown")
display_option_bool(self.op_exec_status, "success", "failed", "status unknown")
)?;
writeln!(f, "In blocks:")?;
for block_id in &self.in_blocks {
Expand Down
2 changes: 1 addition & 1 deletion massa-api/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl MassaApiServer for API<ApiV2> {
}
}

// Brodcast the stream(sender) content via a WebSocket
// Broadcast the stream(sender) content via a WebSocket
async fn broadcast_via_ws<T: Serialize + Send + Clone + 'static>(
sender: tokio::sync::broadcast::Sender<T>,
pending: PendingSubscriptionSink,
Expand Down
4 changes: 2 additions & 2 deletions massa-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ pub struct Private {
pub struct ApiV2 {
/// link to the consensus component
pub consensus_controller: Box<dyn ConsensusController>,
/// channels with informations broadcasted by the consensus
/// channels with information broadcasted by the consensus
pub consensus_broadcasts: ConsensusBroadcasts,
/// link to the execution component
pub execution_controller: Box<dyn ExecutionController>,
/// channels with informations broadcasted by the pool
/// channels with information broadcasted by the pool
pub pool_broadcasts: PoolBroadcasts,
/// API settings
pub api_settings: APIConfig,
Expand Down
2 changes: 1 addition & 1 deletion massa-async-pool/src/changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ mod tests {
assert!(msg.can_be_executed);
}
_ => {
panic!("Unexpect value");
panic!("Unexpected value");
}
}

Expand Down
2 changes: 1 addition & 1 deletion massa-async-pool/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ mod tests {
.write_batch(batch, versioning_batch, Some(slot_1));

let content = dump_column(pool.db.clone(), "state");
assert_eq!(content.len(), 26); // 2 entries added, splitted in 13 prefix
assert_eq!(content.len(), 26); // 2 entries added, split in 13 prefix

let mut batch2 = DBBatch::new();
pool.delete_entry(&message_id, &mut batch2);
Expand Down
24 changes: 14 additions & 10 deletions massa-bootstrap/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ pub fn get_state(
genesis_timestamp: MassaTime,
end_timestamp: Option<MassaTime>,
restart_from_snapshot_at_period: Option<u64>,
interupted: Arc<(Mutex<bool>, Condvar)>,
interrupted: Arc<(Mutex<bool>, Condvar)>,
massa_metrics: MassaMetrics,
) -> Result<GlobalBootstrapState, BootstrapError> {
massa_trace!("bootstrap.lib.get_state", {});
Expand Down Expand Up @@ -490,8 +490,12 @@ pub fn get_state(

let limit = bootstrap_config.rate_limit;
loop {
// check for interuption
if *interupted.0.lock().expect("double-lock on interupt-mutex") {
// check for interruption
if *interrupted
.0
.lock()
.expect("double-lock on interrupt-mutex")
{
return Err(BootstrapError::Interrupted(
"Sig INT received while getting state".to_string(),
));
Expand Down Expand Up @@ -547,11 +551,11 @@ pub fn get_state(

// Before, we would use a simple sleep(...), and that was fine
// in a cancellable async context: the runtime could
// catch the interupt signal, and just cancel this thread:
// catch the interrupt signal, and just cancel this thread:
//
// let state = tokio::select!{
// /* detect interupt */ => /* return, cancelling the async get_state */
// get_state(...) => well, we got the state, and it didn't have to worry about interupts
// /* detect interrupt */ => /* return, cancelling the async get_state */
// get_state(...) => well, we got the state, and it didn't have to worry about interrupts
// };
//
// Without an external system to preempt this context, we use a condvar to manage the sleep.
Expand All @@ -562,14 +566,14 @@ pub fn get_state(
// The _magic_ happens when, somewhere else, a clone of the Arc<(Mutex<bool>, Condvar)>\
// calls Condvar::notify_[one | all], which prompts this thread to wake up. Assuming that
// the mutex-wrapped variable has been set appropriately before the notify, this thread
let int_sig = interupted
let int_sig = interrupted
.0
.lock()
.expect("double-lock() on interupted signal mutex");
let wake = interupted
.expect("double-lock() on interrupted signal mutex");
let wake = interrupted
.1
.wait_timeout(int_sig, bootstrap_config.retry_delay.to_duration())
.expect("interupt signal mutex poisoned");
.expect("interrupt signal mutex poisoned");
if *wake.0 {
return Err(BootstrapError::Interrupted(
"Sig INT during bootstrap retry-wait".to_string(),
Expand Down
4 changes: 2 additions & 2 deletions massa-bootstrap/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,10 +871,10 @@ impl Deserializer<BootstrapClientMessage> for BootstrapClientMessageDeserializer
context("Failed last_slot deserialization", |input| {
self.slot_deserializer.deserialize(input)
}),
context("Faild last_state_step deserialization", |input| {
context("Failed last_state_step deserialization", |input| {
self.state_step_deserializer.deserialize(input)
}),
context("Faild last_versioning_step deserialization", |input| {
context("Failed last_versioning_step deserialization", |input| {
self.state_step_deserializer.deserialize(input)
}),
context("Failed last_consensus_step deserialization", |input| {
Expand Down
8 changes: 4 additions & 4 deletions massa-bootstrap/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
//! Shares an `Arc<RwLock>>` guarded list of white and blacklists with the main worker.
//! Periodically does a read-only check to see if list needs updating.
//! Creates an updated list then swaps it out with write-locked list
//! Assuming no errors in code, this is the only write occurance, and is only a pointer-swap
//! under the hood, making write contention virtually non-existant.
//! Assuming no errors in code, this is the only write occurrence, and is only a pointer-swap
//! under the hood, making write contention virtually non-existent.
//!
//! # Worker loop
//!
//! 1. Checks if the stopper has been invoked.
//! 2. Checks if the client is permited under the white/black list rules
//! 2. Checks if the client is permitted under the white/black list rules
//! 3. Checks if there are not too many active sessions already
//! 4. Checks if the client has attempted too recently
//! 5. All checks have passed: spawn a thread on which to run the bootstrap session
Expand Down Expand Up @@ -101,7 +101,7 @@ impl BootstrapManager {
/// stop the bootstrap server
pub fn stop(self) -> Result<(), BootstrapError> {
massa_trace!("bootstrap.lib.stop", {});
// TODO: Refactor the waker so that its existance is tied to the life of the event-loop
// TODO: Refactor the waker so that its existence is tied to the life of the event-loop
if self.listener_stopper.stop().is_err() {
warn!("bootstrap server already dropped");
}
Expand Down
2 changes: 1 addition & 1 deletion massa-bootstrap/src/tests/binders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ fn test_binders_simple() {
// This test uses exactly the same principle as the `test_binders_simple` one
// Except instead of passing a pair of (ServerMessage, ClientMessage), it will pass a
// (bool, Vec<ServerMessage>, Vec<ClientMessage>)
// - The boolean defines wether the server or the client will transmit data first, or receive first
// - The boolean defines whether the server or the client will transmit data first, or receive first
// - The first vector is a list of server messages generated that the server has to send
// - The second vector is a list of client messages generated that the client has to send
// Because the direction of the first message is randomly assigned, and the number of messages are random,
Expand Down
8 changes: 4 additions & 4 deletions massa-bootstrap/src/tests/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ impl BootstrapServerMessage {
"Error in the code of the test for faulty_part 4"
);
}
// No limit on the size of this except the u64 boundery
// No limit on the size of this except the u64 boundary
let updates_on_previous_elements = BTreeMap::new();
let mut change_id = gen_random_slot(rng);
if faulty_part == BootstrapServerMessageFaultyPart::StateChangeIdThreadOverflow {
Expand Down Expand Up @@ -830,7 +830,7 @@ impl BootstrapServerMessage {
new_elements.insert(key, value);
new_elements_size += key_len + value_len;
}
// No limit on the size of this except the u64 boundery
// No limit on the size of this except the u64 boundary
let updates_on_previous_elements = BTreeMap::new();
let mut change_id = gen_random_slot(rng);
if faulty_part == BootstrapServerMessageFaultyPart::VersioningChangeIdThreadOverflow {
Expand Down Expand Up @@ -1020,7 +1020,7 @@ impl BootstrapServerMessage {
},
) => {
let state_equal = stream_batch_equal(state1, state2);
let versionning_equal = stream_batch_equal(v1, v2);
let versioning_equal = stream_batch_equal(v1, v2);
let mut consensus_equal = true;
if c1.final_blocks.len() != c2.final_blocks.len() {
return false;
Expand All @@ -1034,7 +1034,7 @@ impl BootstrapServerMessage {
}
(s1 == s2)
&& state_equal
&& versionning_equal
&& versioning_equal
&& consensus_equal
&& (co1 == co2)
&& (lp1 == lp2)
Expand Down
2 changes: 1 addition & 1 deletion massa-client/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub enum Style {
Wallet,
/// For any secret information
Secret,
/// To separate some informations on the screen by barely visible characters
/// To separate some information on the screen by barely visible characters
Separator,
/// When displaying a timestamp or date
Time,
Expand Down
4 changes: 2 additions & 2 deletions massa-consensus-worker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
//! The consensus worker launches a persistent thread that will run in the background.
//! This thread has a `run` function that triggers the consensus algorithm each slot. It can be interrupted by commands
//! that are managed on the fly. The consensus worker share a state with a controller. This controller can be called by the others modules.
//! It avoid sending message to the thread just for getting informations on the consensus.
//! It avoids sending message to the thread just for getting information on the consensus.
//!
//! Communications with execution is blocking. Communications with protocol blocks on sending information to protocol but not blocking
//! when protocol sends informations to this module.
//! when protocol sends information to this module.
//!
//! This module doesn't use asynchronous code.
//!
Expand Down
2 changes: 1 addition & 1 deletion massa-consensus-worker/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ impl ConsensusState {
&self,
end_slot: Option<Slot>,
) -> Result<PreHashSet<BlockId>, ConsensusError> {
// if an end_slot is provided compute the lastest final block for that given slot
// if an end_slot is provided compute the latest final block for that given slot
// if not use the latest_final_blocks_periods
let effective_latest_finals: Vec<(BlockId, u64)> = if let Some(slot) = end_slot {
self.list_latest_final_blocks_at(slot)?
Expand Down
2 changes: 1 addition & 1 deletion massa-consensus-worker/src/state/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use crate::state::{

use super::ConsensusState;

/// All informations necessary to add a block to the graph
/// All information necessary to add a block to the graph
pub(crate) struct BlockInfos {
/// The block creator
pub creator: PublicKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ fn test_fts_multiple_max_cliques_2() {
register_block(&consensus_controller, block_1_3.clone(), storage.clone());

// Period 2.
// Thread incompatibilies with every blocks of period 1
// Thread incompatibilities with every block of period 1
let block_2_0 = create_block(
Slot::new(2, 0),
vec![genesis[0], genesis[1], genesis[2], genesis[3]],
Expand Down
2 changes: 1 addition & 1 deletion massa-db-worker/src/massa_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ mod test {
// assert!(dump_column(db_.clone(), "versioning").is_empty());
assert!(dump_column(db.clone(), "versioning").is_empty());

// Add some datas then remove using prefix
// Add some data then remove using prefix
batch.clear();
db.read()
.put_or_update_entry_value(&mut batch, vec![97, 98, 1], &[1]);
Expand Down
4 changes: 2 additions & 2 deletions massa-execution-exports/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
//! an instance of `ExecutionManager` is returned (see the documentation of `start_execution_worker` in `massa-execution-worker`),
//! as well as an instance of `ExecutionController`.
//!
//! The non-clonable `ExecutionManager` allows stopping the execution worker thread.
//! The non-cloneable `ExecutionManager` allows stopping the execution worker thread.
//!
//! The clonable `ExecutionController` allows sending updates on the latest blockclique changes to the execution worker
//! The cloneable `ExecutionController` allows sending updates on the latest blockclique changes to the execution worker
//! for it to keep track of them and execute the operations present in blocks.
//! It also allows various read-only queries such as executing bytecode
//! while ignoring all the changes it would cause to the consensus state (read-only execution),
Expand Down
6 changes: 3 additions & 3 deletions massa-execution-exports/src/mapping_grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ pub fn to_querystate_filter(
}
//TODO to be checked
exec::RequestItem::CycleInfos(value) => {
let addreses = value
let addresses = value
.restrict_to_addresses
.into_iter()
.map(|address| Address::from_str(&address))
.collect::<Result<Vec<_>, _>>()?;
let mut addresses_set = PreHashSet::with_capacity(addreses.len());
addresses_set.extend(addreses);
let mut addresses_set = PreHashSet::with_capacity(addresses.len());
addresses_set.extend(addresses);
Ok(ExecutionQueryRequestItem::CycleInfos {
cycle: value.cycle,
restrict_to_addresses: Some(addresses_set),
Expand Down
2 changes: 1 addition & 1 deletion massa-execution-worker/src/active_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl ActiveHistory {
}

/// Gets the deferred credits for a given address that will be credited at a given slot
pub(crate) fn get_adress_deferred_credit_for(
pub(crate) fn get_address_deferred_credit_for(
&self,
addr: &Address,
slot: &Slot,
Expand Down
2 changes: 1 addition & 1 deletion massa-execution-worker/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ impl ExecutionContext {
// Set the event index
event.context.index_in_slot = self.created_event_index;

// Increment the event counter fot this slot
// Increment the event counter for this slot
self.created_event_index += 1;

// Add the event to the context store
Expand Down
2 changes: 1 addition & 1 deletion massa-execution-worker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! of operations that can contain executable bytecode and managing interactions with the ledger.
//! When the worker is launched, a `ExecutionManager` and a `ExecutionController` are returned.
//! `ExecutionManager` allows stopping the worker,
//! and `ExecutionController` is the clonable structure through which users interact with the worker.
//! and `ExecutionController` is the cloneable structure through which users interact with the worker.
//!
//! The worker is fed through the `ExecutionController` with information about blockclique changes and newly finalized blocks
//! and will execute the operations in those blocks, as well as pending asynchronous operations on empty slots.
Expand Down
2 changes: 1 addition & 1 deletion massa-execution-worker/src/speculative_executed_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl SpeculativeExecutedOps {

/// Checks if an operation was executed previously
pub fn is_op_executed(&self, op_id: &OperationId) -> bool {
// check in the curent changes
// check in the current changes
if self.executed_ops.contains_key(op_id) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion massa-execution-worker/src/speculative_roll_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ impl SpeculativeRollState {
if let Some(v) = self
.active_history
.read()
.get_adress_deferred_credit_for(addr, slot)
.get_address_deferred_credit_for(addr, slot)
{
return Some(v);
}
Expand Down
2 changes: 1 addition & 1 deletion massa-execution-worker/src/tests/scenarios_mandatories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3282,7 +3282,7 @@ fn test_dump_block() {
std::thread::sleep(Duration::from_secs(1));

// if the the storage backend for the dump-block feature is a rocksdb, this
// is mandatory (the db must be closed before we can reopen it to ckeck the
// is mandatory (the db must be closed before we can reopen it to check the
// data)
drop(universe);

Expand Down
Loading

0 comments on commit 10e439a

Please sign in to comment.