Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typos checker #79

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/typos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# A Github action that typos to check spelling.
#
# _typos.toml is a config file of typos.
# More details about typos is https://github.com/crate-ci/typos

name: Typos

on: pull_request

jobs:

typos:
runs-on: ubuntu-latest

steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Check for typos
uses: crate-ci/typos@master
6 changes: 6 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[files]
extend-exclude = [
]

[default.extend-words]

4 changes: 2 additions & 2 deletions node/actors/network/src/noise/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn params() -> snow::params::NoiseParams {
pattern: snow::params::HandshakePattern::NN,
modifiers: snow::params::HandshakeModifierList { list: vec![] },
},
// We use curve25519 diffie-hellmann protocol to establish a common secret.
// We use Curve25519 Diffie-Hellman protocol to establish a common secret.
dh: snow::params::DHChoice::Curve25519,
// We use ChaChaPoly symmetric encryption for communication.
cipher: snow::params::CipherChoice::ChaChaPoly,
Expand Down Expand Up @@ -83,7 +83,7 @@ pub(crate) struct Stream<S = MeteredStream> {
noise: snow::TransportState,
/// Buffers used for the read half of the stream.
read_buf: Box<Buffer>,
/// Buffers used for the write hald of the stream.
/// Buffers used for the write half of the stream.
write_buf: Box<Buffer>,
}

Expand Down
2 changes: 1 addition & 1 deletion node/actors/sync_blocks/src/peers/tests/basics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ impl Test for LimitingGetBlockConcurrency {
message_responses.keys().copied().collect::<HashSet<_>>(),
setup.blocks[0..3].iter().map(|b| b.number()).collect(),
);
tracing::info!("blocks requrested");
tracing::info!("blocks requested");

// Send a correct response.
let response = message_responses.remove(&setup.blocks[0].number()).unwrap();
Expand Down
6 changes: 3 additions & 3 deletions node/actors/sync_blocks/src/peers/tests/multiple_peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Test for RequestingBlocksFromTwoPeers {
assert!(setup.blocks[0..=1]
.iter()
.any(|b| b.number() == second_peer_block_number));
tracing::info!(%second_peer_block_number, "received requrest");
tracing::info!(%second_peer_block_number, "received request");

first_peer_response
.send(make_response(setup.block(first_peer_block_number)))
Expand Down Expand Up @@ -90,7 +90,7 @@ impl Test for RequestingBlocksFromTwoPeers {
assert!(setup.blocks[2..=3]
.iter()
.any(|b| b.number() == first_peer_block_number));
tracing::info!(%first_peer_block_number, "received requrest");
tracing::info!(%first_peer_block_number, "received request");

first_peer_response
.send(make_response(setup.block(first_peer_block_number)))
Expand All @@ -113,7 +113,7 @@ impl Test for RequestingBlocksFromTwoPeers {
assert!(setup.blocks[2..=3]
.iter()
.any(|b| b.number() == first_peer_block_number));
tracing::info!(%first_peer_block_number, "received requrest");
tracing::info!(%first_peer_block_number, "received request");

second_peer_response
.send(make_response(setup.block(second_peer_block_number)))
Expand Down
8 changes: 4 additions & 4 deletions node/libs/concurrency/src/ctx/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! This
//! * simplifies the channel interface
//! * prevents users from relying on send/recv failure
//! for terminating their tasks - context cancelation
//! for terminating their tasks - context cancellation
//! should be used instead
//! * avoids a race condition which arises naturally when 2 tasks in a scope
//! are communicating which each other - if one of them terminates due to context
Expand Down Expand Up @@ -97,7 +97,7 @@ impl<T> Sender<T> {
v: T,
) -> ctx::CtxAware<impl 'a + Future<Output = ctx::OrCanceled<()>>> {
ctx::CtxAware(async move {
// Context cancelation is forwarded,
// Context cancellation is forwarded,
// but Disconnected error is ignored.
let _ = ctx.wait(self.0.send(v)).await?;
Ok(())
Expand Down Expand Up @@ -129,7 +129,7 @@ impl<T> Sender<T> {

impl<T> Receiver<T> {
/// Awaits for a message from the channel.
/// Waits for cancelation if the channel has been disconnected.
/// Waits for cancellation if the channel has been disconnected.
pub fn recv<'a>(
&'a mut self,
ctx: &'a ctx::Ctx,
Expand Down Expand Up @@ -172,7 +172,7 @@ impl<T> UnboundedSender<T> {

impl<T> UnboundedReceiver<T> {
/// Awaits a message from the channel.
/// Waits for cancelation if the channel has been disconnected.
/// Waits for cancellation if the channel has been disconnected.
pub fn recv<'a>(
&'a mut self,
ctx: &'a ctx::Ctx,
Expand Down
2 changes: 1 addition & 1 deletion node/libs/concurrency/src/net/tcp/listener_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(super) static RESERVED_LISTENER_ADDRS: Lazy<
/// In tests it additionally allows to "reserve" a random unused TCP port:
/// * it allows to avoid race conditions in tests which require a dedicated TCP port to spawn a
/// node on (and potentially restart it every now and then).
/// * it is implemented by usign SO_REUSEPORT socket option (do not confuse with SO_REUSEADDR),
/// * it is implemented by using SO_REUSEPORT socket option (do not confuse with SO_REUSEADDR),
/// which allows multiple sockets to share a port. reserve_for_test() creates a socket and binds
/// it to a random unused local port (without starting a TCP listener).
/// This socket won't be used for anything but telling the OS that the given TCP port is in use.
Expand Down
2 changes: 1 addition & 1 deletion node/libs/concurrency/src/scope/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl<E: 'static> TerminateGuard<E> {

/// Wrapper of `State` which cancels the scope when dropped.
/// Each "main" scope task must keep a reference to it to prevent
/// scope premature cancelation. Note that the scope might get canceled
/// scope premature cancellation. Note that the scope might get canceled
/// earlier anyway via `TerminateGuard::set_err`.
pub(super) struct CancelGuard<E: 'static>(Arc<TerminateGuard<E>>);

Expand Down
2 changes: 1 addition & 1 deletion node/libs/protobuf/src/proto_fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Wire {
}
}

/// Converts wire type to the raw wite type value.
/// Converts wire type to the raw wire type value.
pub(crate) const fn raw(self) -> u32 {
match self {
Self::Varint => VARINT,
Expand Down
2 changes: 1 addition & 1 deletion node/libs/roles/src/validator/messages/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl FinalBlock {
}
}

/// Header fo the block.
/// Header of the block.
pub fn header(&self) -> &BlockHeader {
&self.justification.message.proposal
}
Expand Down
2 changes: 1 addition & 1 deletion node/tools/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Running Test Consensus Nodes

These instructions guide you through the process of setting up and running a test consensus node in both local and Clusterized environments.
These instructions guide you through the process of setting up and running a test consensus node in both local and Clustered environments.

## Local Setup

Expand Down
2 changes: 1 addition & 1 deletion node/tools/src/k8s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl ConsensusNode {
.await
}

/// Fetchs the pod's IP address and assignts to self.node_addr
/// Fetches the pod's IP address and assigns to self.node_addr
pub async fn fetch_and_assign_pod_ip(
&mut self,
client: &Client,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ use zksync_consensus_storage::BlockStore;
pub fn callback(node_storage: Arc<BlockStore>) -> RpcResult<serde_json::Value> {
let sub = &mut node_storage.subscribe();
let state = sub.borrow().clone();
let last_commited_block_header = state
let last_committed_block_header = state
.last
.context("Failed to get last state")
.map_err(|_| ErrorObjectOwned::from(ErrorCode::InternalError))?
.header()
.number
.0;
Ok(serde_json::json!({
"last_commited_block": last_commited_block_header
"last_committed_block": last_committed_block_header
}))
}

/// Last view method name.
pub fn method() -> &'static str {
"last_commited_block"
"last_committed_block"
}

/// Method path for GET requests.
pub fn path() -> &'static str {
"/last_commited_block"
"/last_committed_block"
}
2 changes: 1 addition & 1 deletion node/tools/src/rpc/methods/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod health_check;
pub mod last_commited_block;
pub mod last_committed_block;
pub mod last_view;
10 changes: 5 additions & 5 deletions node/tools/src/rpc/server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::methods::{health_check, last_commited_block, last_view};
use super::methods::{health_check, last_committed_block, last_view};
use jsonrpsee::server::{middleware::http::ProxyGetRequestLayer, RpcModule, Server};
use std::{net::SocketAddr, sync::Arc};
use zksync_concurrency::{ctx, scope};
Expand Down Expand Up @@ -34,8 +34,8 @@ impl RPCServer {
last_view::method(),
)?)
.layer(ProxyGetRequestLayer::new(
last_commited_block::path(),
last_commited_block::method(),
last_committed_block::path(),
last_committed_block::method(),
)?);

let mut module = RpcModule::new(());
Expand All @@ -49,8 +49,8 @@ impl RPCServer {
})?;

let node_storage = self.node_storage.clone();
module.register_method(last_commited_block::method(), move |_params, _| {
last_commited_block::callback(node_storage.clone())
module.register_method(last_committed_block::method(), move |_params, _| {
last_committed_block::callback(node_storage.clone())
})?;

let server = Server::builder()
Expand Down
Loading