diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acc37fe716c..708eca3eb17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 00000000000..c758abfbe1c --- /dev/null +++ b/_typos.toml @@ -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" \ No newline at end of file diff --git a/massa-api-exports/src/address.rs b/massa-api-exports/src/address.rs index 2815fb17f14..a86c4509249 100644 --- a/massa-api-exports/src/address.rs +++ b/massa-api-exports/src/address.rs @@ -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 diff --git a/massa-api-exports/src/operation.rs b/massa-api-exports/src/operation.rs index b4caadf85e3..ba2f9aba8eb 100644 --- a/massa-api-exports/src/operation.rs +++ b/massa-api-exports/src/operation.rs @@ -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 { diff --git a/massa-api/src/api.rs b/massa-api/src/api.rs index 51d10796e51..bc169c0b8ce 100644 --- a/massa-api/src/api.rs +++ b/massa-api/src/api.rs @@ -151,7 +151,7 @@ impl MassaApiServer for API { } } -// Brodcast the stream(sender) content via a WebSocket +// Broadcast the stream(sender) content via a WebSocket async fn broadcast_via_ws( sender: tokio::sync::broadcast::Sender, pending: PendingSubscriptionSink, diff --git a/massa-api/src/lib.rs b/massa-api/src/lib.rs index 8055167d489..4f721b7ac94 100644 --- a/massa-api/src/lib.rs +++ b/massa-api/src/lib.rs @@ -108,11 +108,11 @@ pub struct Private { pub struct ApiV2 { /// link to the consensus component pub consensus_controller: Box, - /// 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, - /// channels with informations broadcasted by the pool + /// channels with information broadcasted by the pool pub pool_broadcasts: PoolBroadcasts, /// API settings pub api_settings: APIConfig, diff --git a/massa-async-pool/src/changes.rs b/massa-async-pool/src/changes.rs index 22756446237..22ee4cd2700 100644 --- a/massa-async-pool/src/changes.rs +++ b/massa-async-pool/src/changes.rs @@ -334,7 +334,7 @@ mod tests { assert!(msg.can_be_executed); } _ => { - panic!("Unexpect value"); + panic!("Unexpected value"); } } diff --git a/massa-async-pool/src/pool.rs b/massa-async-pool/src/pool.rs index 403787e3388..43b2ce2564b 100644 --- a/massa-async-pool/src/pool.rs +++ b/massa-async-pool/src/pool.rs @@ -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); diff --git a/massa-bootstrap/src/client.rs b/massa-bootstrap/src/client.rs index 98d5f07616f..989f4e094a1 100644 --- a/massa-bootstrap/src/client.rs +++ b/massa-bootstrap/src/client.rs @@ -402,7 +402,7 @@ pub fn get_state( genesis_timestamp: MassaTime, end_timestamp: Option, restart_from_snapshot_at_period: Option, - interupted: Arc<(Mutex, Condvar)>, + interrupted: Arc<(Mutex, Condvar)>, massa_metrics: MassaMetrics, ) -> Result { massa_trace!("bootstrap.lib.get_state", {}); @@ -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(), )); @@ -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. @@ -562,14 +566,14 @@ pub fn get_state( // The _magic_ happens when, somewhere else, a clone of the Arc<(Mutex, 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(), diff --git a/massa-bootstrap/src/messages.rs b/massa-bootstrap/src/messages.rs index e0cc2fa5669..23e55fceea0 100644 --- a/massa-bootstrap/src/messages.rs +++ b/massa-bootstrap/src/messages.rs @@ -871,10 +871,10 @@ impl Deserializer 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| { diff --git a/massa-bootstrap/src/server.rs b/massa-bootstrap/src/server.rs index c5d462c3abb..900e7699d14 100644 --- a/massa-bootstrap/src/server.rs +++ b/massa-bootstrap/src/server.rs @@ -13,13 +13,13 @@ //! Shares an `Arc>` 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 @@ -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"); } diff --git a/massa-bootstrap/src/tests/binders.rs b/massa-bootstrap/src/tests/binders.rs index 46ef5b1c699..7b39473f18a 100644 --- a/massa-bootstrap/src/tests/binders.rs +++ b/massa-bootstrap/src/tests/binders.rs @@ -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, Vec) -// - 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, diff --git a/massa-bootstrap/src/tests/tools.rs b/massa-bootstrap/src/tests/tools.rs index f4615ebbda6..88309c84f89 100644 --- a/massa-bootstrap/src/tests/tools.rs +++ b/massa-bootstrap/src/tests/tools.rs @@ -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 { @@ -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 { @@ -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; @@ -1034,7 +1034,7 @@ impl BootstrapServerMessage { } (s1 == s2) && state_equal - && versionning_equal + && versioning_equal && consensus_equal && (co1 == co2) && (lp1 == lp2) diff --git a/massa-client/src/display.rs b/massa-client/src/display.rs index 7c4732094e5..5973228ef5b 100644 --- a/massa-client/src/display.rs +++ b/massa-client/src/display.rs @@ -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, diff --git a/massa-consensus-worker/src/lib.rs b/massa-consensus-worker/src/lib.rs index 48e617a34c2..c7e04d0a6ba 100644 --- a/massa-consensus-worker/src/lib.rs +++ b/massa-consensus-worker/src/lib.rs @@ -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. //! diff --git a/massa-consensus-worker/src/state/mod.rs b/massa-consensus-worker/src/state/mod.rs index 07dee3ce7a4..5dc9b829581 100644 --- a/massa-consensus-worker/src/state/mod.rs +++ b/massa-consensus-worker/src/state/mod.rs @@ -334,7 +334,7 @@ impl ConsensusState { &self, end_slot: Option, ) -> Result, 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)? diff --git a/massa-consensus-worker/src/state/process.rs b/massa-consensus-worker/src/state/process.rs index 64cf276a0ca..b80a4d6794f 100644 --- a/massa-consensus-worker/src/state/process.rs +++ b/massa-consensus-worker/src/state/process.rs @@ -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, diff --git a/massa-consensus-worker/src/tests/three_four_threads_scenarios.rs b/massa-consensus-worker/src/tests/three_four_threads_scenarios.rs index e0f10d0e36f..2897921e1af 100644 --- a/massa-consensus-worker/src/tests/three_four_threads_scenarios.rs +++ b/massa-consensus-worker/src/tests/three_four_threads_scenarios.rs @@ -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]], diff --git a/massa-db-worker/src/massa_db.rs b/massa-db-worker/src/massa_db.rs index a86ffd9475b..f531929ef76 100644 --- a/massa-db-worker/src/massa_db.rs +++ b/massa-db-worker/src/massa_db.rs @@ -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]); diff --git a/massa-execution-exports/src/lib.rs b/massa-execution-exports/src/lib.rs index 4238e43103c..1ae8c035587 100644 --- a/massa-execution-exports/src/lib.rs +++ b/massa-execution-exports/src/lib.rs @@ -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), diff --git a/massa-execution-exports/src/mapping_grpc.rs b/massa-execution-exports/src/mapping_grpc.rs index 828e226a0c8..5aa9875442b 100644 --- a/massa-execution-exports/src/mapping_grpc.rs +++ b/massa-execution-exports/src/mapping_grpc.rs @@ -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::, _>>()?; - 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), diff --git a/massa-execution-worker/src/active_history.rs b/massa-execution-worker/src/active_history.rs index 1b4c41ebb6b..7cf4cd737ab 100644 --- a/massa-execution-worker/src/active_history.rs +++ b/massa-execution-worker/src/active_history.rs @@ -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, diff --git a/massa-execution-worker/src/context.rs b/massa-execution-worker/src/context.rs index 9039cef4994..60e74219d6f 100644 --- a/massa-execution-worker/src/context.rs +++ b/massa-execution-worker/src/context.rs @@ -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 diff --git a/massa-execution-worker/src/lib.rs b/massa-execution-worker/src/lib.rs index 0982892a94a..66515da3101 100644 --- a/massa-execution-worker/src/lib.rs +++ b/massa-execution-worker/src/lib.rs @@ -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. diff --git a/massa-execution-worker/src/speculative_executed_ops.rs b/massa-execution-worker/src/speculative_executed_ops.rs index 638d49bf247..1c3d1037678 100644 --- a/massa-execution-worker/src/speculative_executed_ops.rs +++ b/massa-execution-worker/src/speculative_executed_ops.rs @@ -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; } diff --git a/massa-execution-worker/src/speculative_roll_state.rs b/massa-execution-worker/src/speculative_roll_state.rs index 9b6a8817500..14f7f8b2118 100644 --- a/massa-execution-worker/src/speculative_roll_state.rs +++ b/massa-execution-worker/src/speculative_roll_state.rs @@ -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); } diff --git a/massa-execution-worker/src/tests/scenarios_mandatories.rs b/massa-execution-worker/src/tests/scenarios_mandatories.rs index aa210361161..f9009270085 100644 --- a/massa-execution-worker/src/tests/scenarios_mandatories.rs +++ b/massa-execution-worker/src/tests/scenarios_mandatories.rs @@ -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); diff --git a/massa-execution-worker/src/tests/tests_active_history.rs b/massa-execution-worker/src/tests/tests_active_history.rs index 9d384b422fb..9826502b069 100644 --- a/massa-execution-worker/src/tests/tests_active_history.rs +++ b/massa-execution-worker/src/tests/tests_active_history.rs @@ -66,7 +66,7 @@ fn test_active_history_deferred_credits() { let active_history = ActiveHistory(VecDeque::from([exec_output_1])); assert_eq!( - active_history.get_adress_deferred_credit_for(&addr1, &slot2), + active_history.get_address_deferred_credit_for(&addr1, &slot2), Some(amount_a1_s2) ); diff --git a/massa-factory-worker/src/block_factory.rs b/massa-factory-worker/src/block_factory.rs index b972b29a983..ea645786a1e 100644 --- a/massa-factory-worker/src/block_factory.rs +++ b/massa-factory-worker/src/block_factory.rs @@ -183,7 +183,7 @@ impl BlockFactoryWorker { .channels .pool .get_block_endorsements(&same_thread_parent_id, &slot); - //TODO: Do we want ot populate only with endorsement id in the future ? + //TODO: Do we want of populate only with endorsement id in the future ? let endorsements: Vec = { let endo_read = endo_storage.read_endorsements(); endorsements_ids diff --git a/massa-grpc/src/server.rs b/massa-grpc/src/server.rs index 5b0b5efcd2c..76a52a28bf2 100644 --- a/massa-grpc/src/server.rs +++ b/massa-grpc/src/server.rs @@ -206,7 +206,7 @@ where } let cert = std::fs::read_to_string(config.server_certificate_path.clone()) - .expect("error, failed to read server certificat"); + .expect("error, failed to read server certificate"); let key = std::fs::read_to_string(config.server_private_key_path.clone()) .expect("error, failed to read server private key"); @@ -324,7 +324,7 @@ fn generate_self_signed_certificates(config: &GrpcConfig) { gen_signed_cert(&ca_cert, config.subject_alt_names.clone()) .expect("error, failed to generate cert"); std::fs::write(config.client_certificate_path.clone(), client_cert_pem) - .expect("error, failed to write client certificat"); + .expect("error, failed to write client certificate"); std::fs::write( config.client_private_key_path.clone(), client_private_key_pem, @@ -333,13 +333,13 @@ fn generate_self_signed_certificates(config: &GrpcConfig) { } std::fs::write(config.certificate_authority_root_path.clone(), ca_cert_pem) - .expect("error, failed to write certificat authority root"); + .expect("error, failed to write certificate authority root"); let (cert_pem, server_private_key_pem) = gen_signed_cert(&ca_cert, config.subject_alt_names.clone()) - .expect("error, failed to generate server certificat"); + .expect("error, failed to generate server certificate"); std::fs::write(config.server_certificate_path.clone(), cert_pem) - .expect("error, failed to write server certificat"); + .expect("error, failed to write server certificate"); std::fs::write( config.server_private_key_path.clone(), server_private_key_pem, diff --git a/massa-grpc/src/stream/mod.rs b/massa-grpc/src/stream/mod.rs index 8c212996e6d..d300120b8b6 100644 --- a/massa-grpc/src/stream/mod.rs +++ b/massa-grpc/src/stream/mod.rs @@ -20,5 +20,5 @@ pub mod send_blocks; pub mod send_endorsements; /// send operations pub mod send_operations; -/// subscribe tx througput +/// subscribe tx throughput pub mod tx_throughput; diff --git a/massa-grpc/src/tests/stream.rs b/massa-grpc/src/tests/stream.rs index 286900bcf54..c6a6286b0dd 100644 --- a/massa-grpc/src/tests/stream.rs +++ b/massa-grpc/src/tests/stream.rs @@ -42,14 +42,14 @@ async fn transactions_throughput_stream() { let mut exec_ctrl = Box::new(MockExecutionController::new()); exec_ctrl.expect_get_stats().returning(|| { let now = MassaTime::now(); - let futur = MassaTime::from_millis( + let future_ = MassaTime::from_millis( now.as_millis() .add(Duration::from_secs(30).as_millis() as u64), ); ExecutionStats { time_window_start: now, - time_window_end: futur, + time_window_end: future_, final_block_count: 10, final_executed_operations_count: 2000, active_cursor: massa_models::slot::Slot { @@ -69,14 +69,14 @@ async fn transactions_throughput_stream() { let mut exec_ctrl = Box::new(MockExecutionController::new()); exec_ctrl.expect_get_stats().returning(|| { let now = MassaTime::now(); - let futur = MassaTime::from_millis( + let future_ = MassaTime::from_millis( now.as_millis() .add(Duration::from_secs(30).as_millis() as u64), ); ExecutionStats { time_window_start: now, - time_window_end: futur, + time_window_end: future_, final_block_count: 10, final_executed_operations_count: 2000, active_cursor: massa_models::slot::Slot { diff --git a/massa-models/src/block.rs b/massa-models/src/block.rs index 74a536fe4c1..836f61f406f 100644 --- a/massa-models/src/block.rs +++ b/massa-models/src/block.rs @@ -62,7 +62,7 @@ pub struct FilledBlock { pub operations: Vec<(OperationId, Option)>, } -/// Block with assosciated meta-data and interfaces allowing trust of data in untrusted network +/// Block with associated meta-data and interfaces allowing trust of data in untrusted network pub type SecureShareBlock = SecureShare; impl SecureShareContent for Block { diff --git a/massa-models/src/block_id.rs b/massa-models/src/block_id.rs index 3bf85225033..ff5689df05d 100644 --- a/massa-models/src/block_id.rs +++ b/massa-models/src/block_id.rs @@ -285,7 +285,7 @@ mod test { #[test] fn test_block_id_errors() { - let actual_error = BlockId::from_str("SomeUnvalidBlockId") + let actual_error = BlockId::from_str("SomeInvalidBlockId") .unwrap_err() .to_string(); let expected_error = "block id parsing error".to_string(); diff --git a/massa-models/src/config/constants.rs b/massa-models/src/config/constants.rs index 187a61dcb67..39a832f59fe 100644 --- a/massa-models/src/config/constants.rs +++ b/massa-models/src/config/constants.rs @@ -223,9 +223,9 @@ pub const MAX_RUNTIME_MODULE_FUNCTION_NAME_LEN: usize = 256; /// Maximum length for the name of a smart contract pub const MAX_RUNTIME_MODULE_NAME_LEN: usize = 256; /// Maximum number of custom section data -pub const MAX_RUNTIME_MODULE_CUSTON_SECTION_LEN: usize = 1; +pub const MAX_RUNTIME_MODULE_CUSTOM_SECTION_LEN: usize = 1; /// Maximum length for the custom section data -pub const MAX_RUNTIME_MODULE_CUSTON_SECTION_DATA_LEN: usize = 1_000_000; +pub const MAX_RUNTIME_MODULE_CUSTOM_SECTION_DATA_LEN: usize = 1_000_000; /// Maximum number of functions a module can import const MAX_RUNTIME_MODULE_FUNCTION_IMPORTS: usize = 256; /// Maximum number of memory a module can import diff --git a/massa-models/src/endorsement.rs b/massa-models/src/endorsement.rs index 69d0840a202..1f748b8acbb 100644 --- a/massa-models/src/endorsement.rs +++ b/massa-models/src/endorsement.rs @@ -242,7 +242,7 @@ impl SecureShareEndorsement { return Err(e.into()); } if self.content.slot.thread >= crate::config::THREAD_COUNT { - Err("Endorsement slot on non-existant thread".into()) + Err("Endorsement slot on non-existent thread".into()) } else if self.content.index >= crate::config::ENDORSEMENT_COUNT { Err("Endorsement index out of range".into()) } else { @@ -660,7 +660,7 @@ mod tests { #[test] #[serial] fn test_endorsement_id_errors() { - let actual_error = EndorsementId::from_str("SomeUnvalidEndorsementId") + let actual_error = EndorsementId::from_str("SomeInvalidEndorsementId") .unwrap_err() .to_string(); let expected_error = "endorsement id parsing error".to_string(); diff --git a/massa-models/src/secure_share.rs b/massa-models/src/secure_share.rs index 2cf591102ba..440c360883b 100644 --- a/massa-models/src/secure_share.rs +++ b/massa-models/src/secure_share.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; /// Packages type T such that it can be securely sent and received in a trust-free network /// -/// If the internal content is mutated, then it must be re-wrapped, as the assosciated +/// If the internal content is mutated, then it must be re-wrapped, as the associated /// signature, serialized data, etc. would no longer be in sync #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct SecureShare @@ -23,9 +23,9 @@ where T: Display + SecureShareContent, ID: Id, { - /// Reference contents. Not required for the the security protocols. + /// Reference contents. Not required for the security protocols. /// - /// Use the Lightweight equivilant structures when you need verifiable + /// Use the Lightweight equivalent structures when you need verifiable /// serialized data, but do not need to read the values directly (such as when sending) pub content: T, #[serde(skip)] diff --git a/massa-node/base_config/config.toml b/massa-node/base_config/config.toml index 798875dd871..92510a1f783 100644 --- a/massa-node/base_config/config.toml +++ b/massa-node/base_config/config.toml @@ -273,7 +273,7 @@ message_timeout = 5000 # timeout after which a peer tester will consider the peer unreachable tester_timeout = 10000 - # timeout after whick we consider a node does not have the block we asked for + # timeout after which we consider a node does not have the block we asked for ask_block_timeout = 10000 # Max known blocks we keep during their propagation max_blocks_kept_for_propagation = 300 @@ -391,7 +391,7 @@ max_clock_delta = 5000 # [server] data is cached for cache duration milliseconds cache_duration = 15000 - # max number of simulataneous bootstraps for server + # max number of simultaneous bootstraps for server max_simultaneous_bootstraps = 2 # max size of recently bootstrapped IP cache ip_list_max_size = 10000 diff --git a/massa-node/src/main.rs b/massa-node/src/main.rs index 97edbff221b..8334bad3749 100644 --- a/massa-node/src/main.rs +++ b/massa-node/src/main.rs @@ -88,8 +88,8 @@ use massa_models::config::constants::{ use massa_models::config::{ BASE_OPERATION_GAS_COST, CHAINID, KEEP_EXECUTED_HISTORY_EXTRA_PERIODS, MAX_BOOTSTRAP_FINAL_STATE_PARTS_SIZE, MAX_BOOTSTRAP_VERSIONING_ELEMENTS_SIZE, - MAX_EVENT_DATA_SIZE, MAX_MESSAGE_SIZE, MAX_RUNTIME_MODULE_CUSTON_SECTION_DATA_LEN, - MAX_RUNTIME_MODULE_CUSTON_SECTION_LEN, MAX_RUNTIME_MODULE_EXPORTS, + MAX_EVENT_DATA_SIZE, MAX_MESSAGE_SIZE, MAX_RUNTIME_MODULE_CUSTOM_SECTION_DATA_LEN, + MAX_RUNTIME_MODULE_CUSTOM_SECTION_LEN, MAX_RUNTIME_MODULE_EXPORTS, MAX_RUNTIME_MODULE_FUNCTIONS, MAX_RUNTIME_MODULE_FUNCTION_NAME_LEN, MAX_RUNTIME_MODULE_GLOBAL_INITIALIZER, MAX_RUNTIME_MODULE_IMPORTS, MAX_RUNTIME_MODULE_MEMORIES, MAX_RUNTIME_MODULE_NAME_LEN, MAX_RUNTIME_MODULE_PASSIVE_DATA, @@ -483,8 +483,8 @@ async fn launch( max_tables_count: Some(MAX_RUNTIME_MODULE_TABLE), max_memories_len: Some(MAX_RUNTIME_MODULE_MEMORIES), max_globals_len: Some(MAX_RUNTIME_MODULE_GLOBAL_INITIALIZER), - max_custom_sections_len: Some(MAX_RUNTIME_MODULE_CUSTON_SECTION_LEN), - max_custom_sections_data_len: Some(MAX_RUNTIME_MODULE_CUSTON_SECTION_DATA_LEN), + max_custom_sections_len: Some(MAX_RUNTIME_MODULE_CUSTOM_SECTION_LEN), + max_custom_sections_data_len: Some(MAX_RUNTIME_MODULE_CUSTOM_SECTION_DATA_LEN), }; let block_dump_folder_path = SETTINGS.block_dump.block_dump_folder_path.clone(); @@ -1428,7 +1428,7 @@ async fn run(args: Args) -> anyhow::Result<()> { *sig_int_toggled_clone .0 .lock() - .expect("double-lock on interupt bool in ctrl-c handler") = true; + .expect("double-lock on interrupt bool in ctrl-c handler") = true; sig_int_toggled_clone.1.notify_all(); }) .expect("Error setting Ctrl-C handler"); @@ -1480,11 +1480,11 @@ async fn run(args: Args) -> anyhow::Result<()> { let int_sig = sig_int_toggled .0 .lock() - .expect("double-lock() on interupted signal mutex"); + .expect("double-lock() on interrupted signal mutex"); let wake = sig_int_toggled .1 .wait_timeout(int_sig, Duration::from_millis(100)) - .expect("interupt signal mutex poisoned"); + .expect("interrupt signal mutex poisoned"); if *wake.0 { info!("interrupt signal received"); break false; diff --git a/massa-protocol-worker/src/handlers/block_handler/retrieval.rs b/massa-protocol-worker/src/handlers/block_handler/retrieval.rs index 64f19961501..bbcd6caeacf 100644 --- a/massa-protocol-worker/src/handlers/block_handler/retrieval.rs +++ b/massa-protocol-worker/src/handlers/block_handler/retrieval.rs @@ -409,7 +409,7 @@ impl RetrievalThread { BlockInfoReply::Operations(operations) => { // Send operations to pool, // before performing the below checks, - // and wait for them to have been procesed(i.e. added to storage). + // and wait for them to have been processed (i.e. added to storage). self.on_block_full_operations_received(from_peer_id, block_id, operations); } BlockInfoReply::NotFound => { diff --git a/massa-protocol-worker/src/handlers/peer_handler/models.rs b/massa-protocol-worker/src/handlers/peer_handler/models.rs index 7e3c05f44c8..645868a766a 100644 --- a/massa-protocol-worker/src/handlers/peer_handler/models.rs +++ b/massa-protocol-worker/src/handlers/peer_handler/models.rs @@ -68,7 +68,7 @@ impl Ord for ConnectionMetadata { // Time since last failed peer test, more recent = less priority let test_failure_check = match (self.last_test_failure, other.last_test_failure) { - (Some(st), Some(ot)) => Some(st.cmp(&ot)), + (Some(st), Some(other_)) => Some(st.cmp(&other_)), (Some(_), None) => Some(Ordering::Greater), (None, Some(_)) => Some(Ordering::Less), (None, None) => None, @@ -79,7 +79,7 @@ impl Ord for ConnectionMetadata { // Time since last succeeded peer test, more recent = more priority let test_success_check = match (self.last_test_success, other.last_test_success) { - (Some(st), Some(ot)) => Some(st.cmp(&ot).reverse()), + (Some(st), Some(other_)) => Some(st.cmp(&other_).reverse()), (Some(_), None) => Some(Ordering::Less), (None, Some(_)) => Some(Ordering::Greater), (None, None) => None, diff --git a/massa-serialization/src/lib.rs b/massa-serialization/src/lib.rs index 79d75060879..46179b8f08c 100644 --- a/massa-serialization/src/lib.rs +++ b/massa-serialization/src/lib.rs @@ -486,7 +486,7 @@ mod tests { use num::rational::Ratio; use paste::paste; - // This macro creates a suite of tests for all types of numbers declared as parameters. Ths list of the + // This macro creates a suite of tests for all types of numbers declared as parameters. This list of the // tests for each type : // - Test with a normal case that everything works // - Test with a normal case but a more bigger number that everything works diff --git a/massa-storage/src/lib.rs b/massa-storage/src/lib.rs index 62744fb121f..ca4cd256beb 100644 --- a/massa-storage/src/lib.rs +++ b/massa-storage/src/lib.rs @@ -1,7 +1,7 @@ //! Copyright (c) 2022 MASSA LABS //! //! This crate is used to store shared objects (blocks, operations...) across different modules. -//! The clonable `Storage` structure has thread-safe shared access to the stored objects. +//! The cloneable `Storage` structure has thread-safe shared access to the stored objects. //! //! The `Storage` structure also has lists of object references held by the current instance of `Storage`. //! When no instance of `Storage` claims a reference to a given object anymore, that object is automatically removed from storage. @@ -131,7 +131,7 @@ impl Storage { /// Efficiently extends the current Storage by consuming the refs of another storage. pub fn extend(&mut self, mut other: Storage) { - // Take ownership ot `other`'s references. + // Take ownership of `other`'s references. // Objects owned by both require a counter decrement and are handled when `other` is dropped. other .local_used_ops diff --git a/massa-versioning/src/versioning_ser_der.rs b/massa-versioning/src/versioning_ser_der.rs index 463adb7c7a3..f7f73e01825 100644 --- a/massa-versioning/src/versioning_ser_der.rs +++ b/massa-versioning/src/versioning_ser_der.rs @@ -668,7 +668,7 @@ impl Deserializer for MipStoreStatsDeserializer { )) })?; - let (rem3, latest_annoucements_) = context( + let (rem3, latest_announcements_) = context( "Failed MipStoreStats latest announcements der", length_count( context("Failed latest announcements count der", |input| { @@ -714,7 +714,7 @@ impl Deserializer for MipStoreStatsDeserializer { rem4, MipStoreStats { config: self.config.clone(), - latest_announcements: latest_annoucements_.into_iter().collect(), + latest_announcements: latest_announcements_.into_iter().collect(), network_version_counters: network_version_counters.into_iter().collect(), }, )) diff --git a/tools/setup_test.rs b/tools/setup_test.rs index 3bf11fefd7e..7d17ae45d1e 100644 --- a/tools/setup_test.rs +++ b/tools/setup_test.rs @@ -80,7 +80,7 @@ fn download_src() -> Result { if Path::new(&extract_folder).exists() { println!( - "Please remove the folder: {} before runnning this script", + "Please remove the folder: {} before running this script", extract_folder ); std::process::exit(1);