diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecaf75572b..b3b41095ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,6 +94,14 @@ jobs: - run: | cargo sort --check --workspace + typos: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: crate-ci/typos@v1.16.23 + with: + files: . + load_test: runs-on: ubuntu-latest steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index e1ae851ec6..520eda1a04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -400,7 +400,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- RPC accepts hex inputs for Felt without '0x' prefix. This led to confusion especially when passing in a decimal string which would get silently interpretted as hex. +- RPC accepts hex inputs for Felt without '0x' prefix. This led to confusion especially when passing in a decimal string which would get silently interpreted as hex. - using a Nethermind Ethereum endpoint occasionally causes errors such as ` could not be found` to be logged. - sync can miss new block events by getting stuck waiting for pending data. diff --git a/README.md b/README.md index c463cf71d8..59ed512ae0 100644 --- a/README.md +++ b/README.md @@ -333,7 +333,7 @@ These __will not work__: ### Build info metrics -- `pathfinder_build_info` reports curent version as a `version` property +- `pathfinder_build_info` reports current version as a `version` property ## Build from source diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 0000000000..98d93c20c7 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,2 @@ +[files] +extend-exclude = ["crates/gateway-test-fixtures/fixtures/contracts/*.json"] diff --git a/crates/common/src/header.rs b/crates/common/src/header.rs index 87dde49c25..5816514fcb 100644 --- a/crates/common/src/header.rs +++ b/crates/common/src/header.rs @@ -39,7 +39,7 @@ impl BlockHeader { .with_parent_hash(self.hash) } - /// Creates a [StateUpdate] with the block hash and state commitment fields intialized + /// Creates a [StateUpdate] with the block hash and state commitment fields initialized /// to match this header. pub fn init_state_update(&self) -> StateUpdate { StateUpdate::default() diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs index 01aa63c512..f8dd693a1c 100644 --- a/crates/common/src/lib.rs +++ b/crates/common/src/lib.rs @@ -167,7 +167,7 @@ impl TransactionVersion { self.without_query_version() == 0 } - /// Returns the transaction versin without QUERY_VERSION_BASE. + /// Returns the transaction version without QUERY_VERSION_BASE. /// /// QUERY_VERSION_BASE (2**128) is a large constant that gets /// added to the real version to make sure transactions constructed for diff --git a/crates/common/src/macros.rs b/crates/common/src/macros.rs index dbce49d5de..376ebf16c5 100644 --- a/crates/common/src/macros.rs +++ b/crates/common/src/macros.rs @@ -90,7 +90,7 @@ pub(super) mod i64_backed_u64 { /// Generates felt newtype-wrappers and the `macro_prelude` module. /// -/// Note that this is a sinlge-use macro as it generates a module. +/// Note that this is a single-use macro as it generates a module. /// /// Usage: /// `felt_newtypes!([x1, x2, ..]; [y1, y2, ..])` diff --git a/crates/gateway-types/src/class_hash.rs b/crates/gateway-types/src/class_hash.rs index 6546947839..ab6515aa6d 100644 --- a/crates/gateway-types/src/class_hash.rs +++ b/crates/gateway-types/src/class_hash.rs @@ -81,7 +81,7 @@ pub fn extract_abi_code_hash( Ok((abi, code, hash)) } json::ContractDefinition::Cairo(contract_definition) => { - // just in case we'd accidentially modify these in the compute_class_hash0 + // just in case we'd accidentally modify these in the compute_class_hash0 let abi = serde_json::to_vec(&contract_definition.abi) .context("Serialize contract_definition.abi")?; let code = serde_json::to_vec(&contract_definition.program.data) @@ -721,7 +721,7 @@ mod json { #[test] fn serde_json_has_raw_value() { - // raw value is needed for others but here for completness; this shouldn't compile if + // raw value is needed for others but here for completeness; this shouldn't compile if // you the feature wasn't enabled. #[derive(serde::Deserialize, serde::Serialize)] diff --git a/crates/gateway-types/src/reply.rs b/crates/gateway-types/src/reply.rs index 107c8ef3da..a5445f05b4 100644 --- a/crates/gateway-types/src/reply.rs +++ b/crates/gateway-types/src/reply.rs @@ -1684,7 +1684,7 @@ mod tests { #[test] fn eth_contract_addresses_ignores_extra_fields() { - // Some gateway mocks include extra addesses, check that we can still parse these. + // Some gateway mocks include extra addresses, check that we can still parse these. let json = serde_json::json!({ "Starknet": "0x12345abcd", "GpsStatementVerifier": "0xaabdde", diff --git a/crates/gateway-types/src/request.rs b/crates/gateway-types/src/request.rs index a5124806ae..6a2ffbfe65 100644 --- a/crates/gateway-types/src/request.rs +++ b/crates/gateway-types/src/request.rs @@ -253,7 +253,7 @@ pub mod add_transaction { #[serde_as] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct InvokeFunction { - // Transacion properties + // Transaction properties #[serde_as(as = "TransactionVersionAsHexStr")] pub version: TransactionVersion, @@ -277,7 +277,7 @@ pub mod add_transaction { #[serde_as] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct Declare { - // Transacion properties + // Transaction properties #[serde_as(as = "TransactionVersionAsHexStr")] pub version: TransactionVersion, diff --git a/crates/merkle-tree/src/contract_state.rs b/crates/merkle-tree/src/contract_state.rs index 5ba7e0fc2b..fee38ca097 100644 --- a/crates/merkle-tree/src/contract_state.rs +++ b/crates/merkle-tree/src/contract_state.rs @@ -42,7 +42,7 @@ impl ContractStateUpdateResult { transaction .insert_contract_state_hash(block, self.contract_address, self.state_hash) - .context("Inserting constract state hash") + .context("Inserting contract state hash") } } diff --git a/crates/merkle-tree/src/merkle_node.rs b/crates/merkle-tree/src/merkle_node.rs index fd336c5ba9..06708ec6fe 100644 --- a/crates/merkle-tree/src/merkle_node.rs +++ b/crates/merkle-tree/src/merkle_node.rs @@ -92,7 +92,7 @@ impl From for bool { impl BinaryNode { /// Maps the key's bit at the binary node's height to a [Direction]. /// - /// This can be used to check which direction the key descibes in the context + /// This can be used to check which direction the key describes in the context /// of this binary node i.e. which direction the child along the key's path would /// take. pub fn direction(&self, key: &BitSlice) -> Direction { diff --git a/crates/p2p/README.md b/crates/p2p/README.md index 56644b3ad5..7c0fda0570 100644 --- a/crates/p2p/README.md +++ b/crates/p2p/README.md @@ -31,7 +31,7 @@ Starting up the bootstrap node: RUST_LOG=info cargo run -p p2p_bootstrap -- --identity-config-file ./identity.json --listen-on /ip4/127.0.0.1/tcp/4000 ```` -And then starting three peers that initially connect to the boostrap node: +And then starting three peers that initially connect to the bootstrap node: ```shell RUST_LOG=debug cargo run -p p2p --example peer -- --listen-on /ip4/127.0.0.1/tcp/4001 --bootstrap-addresses /ip4/127.0.0.1/tcp/4000/p2p/12D3KooWFck5QPHjZ9dZkAfEz7dwVfKkcUdf6xA3Rch4wadu7MH7 diff --git a/crates/p2p/src/client/peer_agnostic/parse.rs b/crates/p2p/src/client/peer_agnostic/parse.rs index 1bb2366dca..37f5609d59 100644 --- a/crates/p2p/src/client/peer_agnostic/parse.rs +++ b/crates/p2p/src/client/peer_agnostic/parse.rs @@ -252,7 +252,7 @@ pub(crate) mod state_update { impl_take_parsed_and_should_stop!(state_updates); } - /// Merges partitoned classes if necessary + /// Merges partitioned classes if necessary fn classes_from_dto(classes: Vec) -> anyhow::Result> { #[derive(Copy, Clone, Debug, Default, PartialEq)] struct Ctx { diff --git a/crates/pathfinder/resources/fact_retrieval.py b/crates/pathfinder/resources/fact_retrieval.py index 30b7328d6c..43dddfa0b7 100644 --- a/crates/pathfinder/resources/fact_retrieval.py +++ b/crates/pathfinder/resources/fact_retrieval.py @@ -95,7 +95,7 @@ def create( """ Creates an initialized instance by reading contract logs from the given web3 provider. If is_verifier_proxied is true, then gps_statement_verifier_contract is the proxy contract - rather than the statement verifier implemantation. + rather than the statement verifier implementation. """ #last_block = web3.eth.block_number last_block = from_block + 10000 @@ -221,7 +221,7 @@ def main(): parser = argparse.ArgumentParser() # Note that Registration of memory pages happens before the state update transaction, hence - # make sure to use from_block which preceeds (~500 blocks) the block of the state transition fact + # make sure to use from_block which precedes (~500 blocks) the block of the state transition fact parser.add_argument('--from_block', dest='from_block', default=5742000, help='find memory pages written after this block') parser.add_argument('--web3_node', dest='web3_node', default=GOERLI_NODE, @@ -251,7 +251,7 @@ def main(): ) pages = memory_pages_fetcher.get_memory_pages_from_fact( bytes.fromhex(args.fact)) - # Interpetation of pages + # Interpretation of pages state_diff = pages[1:] # ignore first page diffs = [item for page in state_diff for item in page] # flatten len_deployments = diffs.pop(0) diff --git a/crates/pathfinder/src/bin/pathfinder/config.rs b/crates/pathfinder/src/bin/pathfinder/config.rs index e2681362ad..e8c3402e0f 100644 --- a/crates/pathfinder/src/bin/pathfinder/config.rs +++ b/crates/pathfinder/src/bin/pathfinder/config.rs @@ -209,7 +209,7 @@ pub enum Color { impl Color { /// Returns true if color should be enabled, either because the setting is [Color::Always], - /// or because it is [Color::Auto] and stdout is targetting a terminal. + /// or because it is [Color::Auto] and stdout is targeting a terminal. pub fn is_color_enabled(&self) -> bool { use std::io::IsTerminal; match self { diff --git a/crates/pathfinder/src/p2p_network.rs b/crates/pathfinder/src/p2p_network.rs index 071eab80ce..8ff5e9d511 100644 --- a/crates/pathfinder/src/p2p_network.rs +++ b/crates/pathfinder/src/p2p_network.rs @@ -68,7 +68,7 @@ pub async fn start(context: P2PContext) -> anyhow::Result { p2p::libp2p::multiaddr::Protocol::P2p(peer_id) => Some(peer_id), _ => None, }) - .ok_or_else(|| anyhow::anyhow!("Boostrap addresses must inlcude peer ID"))?; + .ok_or_else(|| anyhow::anyhow!("Bootstrap addresses must include peer ID"))?; p2p_client.dial(peer_id, bootstrap_address.clone()).await?; p2p_client .start_listening( diff --git a/crates/pathfinder/src/p2p_network/sync_handlers/tests.rs b/crates/pathfinder/src/p2p_network/sync_handlers/tests.rs index 450d5b2d8b..e41a525237 100644 --- a/crates/pathfinder/src/p2p_network/sync_handlers/tests.rs +++ b/crates/pathfinder/src/p2p_network/sync_handlers/tests.rs @@ -716,9 +716,9 @@ mod prop { limit in rarely_outside(1..num_blocks), // step is always >= 1 step in rarely_outside(1..num_blocks / 4), - directon in prop_oneof![Just(Direction::Forward), Just(Direction::Backward)], + direction in prop_oneof![Just(Direction::Forward), Just(Direction::Backward)], ) -> (u64, u64, u64, u64, Step, Direction) { - (num_blocks, storage_seed, start, limit, step.into(), directon) + (num_blocks, storage_seed, start, limit, step.into(), direction) } } } diff --git a/crates/pathfinder/src/state/sync.rs b/crates/pathfinder/src/state/sync.rs index 4049c9c3fe..9d232f9935 100644 --- a/crates/pathfinder/src/state/sync.rs +++ b/crates/pathfinder/src/state/sync.rs @@ -277,7 +277,7 @@ where tracing::error!(reason=?e, "Sync consumer task terminated with an error"); } Err(e) if e.is_cancelled() => { - tracing::debug!("Sync consumer task cancelled succesfully"); + tracing::debug!("Sync consumer task cancelled successfully"); }, Err(panic) => { tracing::error!(%panic, "Sync consumer task panic'd"); @@ -297,7 +297,7 @@ where tracing::error!(reason=?e, "L1 sync task terminated with an error"); } Err(e) if e.is_cancelled() => { - tracing::debug!("L1 sync task cancelled succesfully"); + tracing::debug!("L1 sync task cancelled successfully"); }, Err(panic) => { tracing::error!(%panic, "L1 sync task panic'd"); @@ -312,7 +312,7 @@ where tracing::error!(reason=?e, "L2 sync task terminated with an error"); } Err(e) if e.is_cancelled() => { - tracing::debug!("L2 sync task cancelled succesfully"); + tracing::debug!("L2 sync task cancelled successfully"); }, Err(panic) => { tracing::error!(%panic, "L2 sync task panic'd"); @@ -834,7 +834,7 @@ async fn l2_reorg(connection: &mut Connection, reorg_tail: BlockNumber) -> anyho let mut head = transaction .block_id(pathfinder_storage::BlockId::Latest) - .context("Quering latest block number")? + .context("Querying latest block number")? .context("Latest block number is none during reorg")? .0; diff --git a/crates/pathfinder/src/state/sync/l2.rs b/crates/pathfinder/src/state/sync/l2.rs index 59738e8d7d..ab6093ec21 100644 --- a/crates/pathfinder/src/state/sync/l2.rs +++ b/crates/pathfinder/src/state/sync/l2.rs @@ -1039,7 +1039,7 @@ mod tests { let mut mock = MockGatewayApi::new(); let mut seq = mockall::Sequence::new(); - // Downlad the genesis block with respective state update and contracts + // Download the genesis block with respective state update and contracts expect_block( &mut mock, &mut seq, @@ -1064,7 +1064,7 @@ mod tests { BLOCK0_HASH.into(), Ok(BLOCK0_SIGNATURE.clone()), ); - // Downlad block #1 with respective state update and contracts + // Download block #1 with respective state update and contracts expect_block( &mut mock, &mut seq, diff --git a/crates/rpc/src/jsonrpc/router.rs b/crates/rpc/src/jsonrpc/router.rs index 5ac217f31d..a6eba348ea 100644 --- a/crates/rpc/src/jsonrpc/router.rs +++ b/crates/rpc/src/jsonrpc/router.rs @@ -225,7 +225,7 @@ pub trait RpcMethod: Send + Sync { /// async fn context_only(ctx: RpcContext) -> Result>; /// ``` /// -/// The generics allow us to achieve a form of variadic specilization and can be ignored by callers. +/// The generics allow us to achieve a form of variadic specialization and can be ignored by callers. /// See [sealed::Sealed] to add more method signatures or more information on how this works. pub trait IntoRpcMethod<'a, I, O, S>: sealed::Sealed { fn into_method(self) -> Box; @@ -252,12 +252,12 @@ mod sealed { /// The generics allow for a form of specialization over a methods Input, Output and State /// by treating each as a tuple. Varying the tuple length allows us to target a specific method /// signature. This same could be achieved with a single generic but it becomes less clear as - /// each permuation would require a different tuple length. + /// each permutation would require a different tuple length. /// /// By convention, the lack of a type is equivalent to the unit tuple (). So if we want to target functions /// with no input params, no input state and an output: /// ``` - /// Sealed + /// Sealed /// ``` pub trait Sealed { fn into_method(self) -> Box; diff --git a/crates/rpc/src/pathfinder/methods/get_transaction_status.rs b/crates/rpc/src/pathfinder/methods/get_transaction_status.rs index a981615031..0c2b0a1553 100644 --- a/crates/rpc/src/pathfinder/methods/get_transaction_status.rs +++ b/crates/rpc/src/pathfinder/methods/get_transaction_status.rs @@ -49,7 +49,7 @@ pub async fn get_transaction_status( let l1_accepted = db_tx .block_is_l1_accepted(block_hash.into()) - .context("Quering block's status")?; + .context("Querying block's status")?; if l1_accepted { Ok(Some(TransactionStatus::AcceptedOnL1)) diff --git a/crates/rpc/src/v02/method/get_transaction_receipt.rs b/crates/rpc/src/v02/method/get_transaction_receipt.rs index e232d23779..a9f2f06602 100644 --- a/crates/rpc/src/v02/method/get_transaction_receipt.rs +++ b/crates/rpc/src/v02/method/get_transaction_receipt.rs @@ -73,7 +73,7 @@ pub async fn get_transaction_receipt( let l1_accepted = db_tx .block_is_l1_accepted(block_number.into()) - .context("Quering block status")?; + .context("Querying block status")?; let block_status = if l1_accepted { BlockStatus::AcceptedOnL1 diff --git a/crates/rpc/src/v02/method/syncing.rs b/crates/rpc/src/v02/method/syncing.rs index 5d21beee56..743626cd5d 100644 --- a/crates/rpc/src/v02/method/syncing.rs +++ b/crates/rpc/src/v02/method/syncing.rs @@ -6,13 +6,13 @@ use serde::Serialize; crate::error::generate_rpc_error_subset!(SyncingError); -pub async fn syncing(context: RpcContext) -> Result { +pub async fn syncing(context: RpcContext) -> Result { // Scoped so I don't have to think too hard about mutex guard drop semantics. let value = { context.sync_status.status.read().await.clone() }; use crate::v02::types::syncing::Syncing; let value = match value { - Syncing::False(_) => SyncingOuput::False, + Syncing::False(_) => SyncingOutput::False, Syncing::Status(status) => { let status = SyncingStatus { starting_block_num: status.starting.number, @@ -22,7 +22,7 @@ pub async fn syncing(context: RpcContext) -> Result current_block_hash: status.current.hash, highest_block_hash: status.highest.hash, }; - SyncingOuput::Status(status) + SyncingOutput::Status(status) } }; @@ -31,19 +31,19 @@ pub async fn syncing(context: RpcContext) -> Result #[derive(Clone, Copy, Debug, PartialEq, Eq)] #[cfg_attr(any(test, feature = "rpc-full-serde"), derive(serde::Deserialize))] -pub enum SyncingOuput { +pub enum SyncingOutput { False, Status(SyncingStatus), } -impl Serialize for SyncingOuput { +impl Serialize for SyncingOutput { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { - SyncingOuput::False => serializer.serialize_str("false"), - SyncingOuput::Status(inner) => serializer.serialize_newtype_struct("status", &inner), + SyncingOutput::False => serializer.serialize_str("false"), + SyncingOutput::Status(inner) => serializer.serialize_newtype_struct("status", &inner), } } } @@ -68,15 +68,15 @@ pub struct SyncingStatus { #[cfg(test)] mod tests { - use super::SyncingOuput; + use super::SyncingOutput; use crate::context::RpcContext; use pathfinder_common::macro_prelude::*; mod serde { - use super::super::{SyncingOuput, SyncingStatus}; + use super::super::{SyncingOutput, SyncingStatus}; #[test] fn not_syncing() { - let json = serde_json::to_string(&SyncingOuput::False).unwrap(); + let json = serde_json::to_string(&SyncingOutput::False).unwrap(); assert_eq!(json, r#""false""#); } @@ -93,7 +93,7 @@ mod tests { current_block_hash: block_hash!("0x12345677"), highest_block_hash: block_hash!("0x1144ffaacc"), }; - let value = SyncingOuput::Status(status); + let value = SyncingOutput::Status(status); let json = serde_json::to_value(value).unwrap(); let expected = serde_json::json!( { @@ -130,7 +130,7 @@ mod tests { current_block_hash: block_hash!("0xccddee"), highest_block_hash: block_hash!("0xeeffaacc"), }; - let expected = SyncingOuput::Status(expected); + let expected = SyncingOutput::Status(expected); let context = RpcContext::for_tests(); *context.sync_status.status.write().await = status; @@ -149,6 +149,6 @@ mod tests { let result = super::syncing(context).await.unwrap(); - assert_eq!(result, SyncingOuput::False); + assert_eq!(result, SyncingOutput::False); } } diff --git a/crates/rpc/src/v03/method/get_events.rs b/crates/rpc/src/v03/method/get_events.rs index cfbb130f5e..8116af71a6 100644 --- a/crates/rpc/src/v03/method/get_events.rs +++ b/crates/rpc/src/v03/method/get_events.rs @@ -569,7 +569,7 @@ mod types { #[serde(deny_unknown_fields)] pub struct GetEventsResult { pub events: Vec, - /// Offset, measured in events, which points to the chunk that follows currenty requested chunk (`events`) + /// Offset, measured in events, which points to the chunk that follows currently requested chunk (`events`) pub continuation_token: Option, } } diff --git a/crates/rpc/src/v03/method/simulate_transaction.rs b/crates/rpc/src/v03/method/simulate_transaction.rs index 2c7d905055..9ba860c488 100644 --- a/crates/rpc/src/v03/method/simulate_transaction.rs +++ b/crates/rpc/src/v03/method/simulate_transaction.rs @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize}; #[derive(Deserialize, Debug)] #[serde(deny_unknown_fields)] -pub struct SimulateTrasactionInput { +pub struct SimulateTransactionInput { block_id: BlockId, // `transactions` used to be called `transaction` in the JSON-RPC 0.3.0 specification. #[serde(alias = "transaction")] @@ -52,7 +52,7 @@ impl From for SimulateTransactionError { pub async fn simulate_transaction( context: RpcContext, - input: SimulateTrasactionInput, + input: SimulateTransactionInput, ) -> Result { let span = tracing::Span::current(); @@ -459,7 +459,7 @@ mod tests { ], "simulation_flags": [] }); - let input = SimulateTrasactionInput::deserialize(&input_json).unwrap(); + let input = SimulateTransactionInput::deserialize(&input_json).unwrap(); let expected: Vec = { use dto::*; diff --git a/crates/rpc/src/v04/method/get_transaction_receipt.rs b/crates/rpc/src/v04/method/get_transaction_receipt.rs index 720ec2e85a..f2bcf8e73e 100644 --- a/crates/rpc/src/v04/method/get_transaction_receipt.rs +++ b/crates/rpc/src/v04/method/get_transaction_receipt.rs @@ -55,7 +55,7 @@ pub async fn get_transaction_receipt( let l1_accepted = db_tx .block_is_l1_accepted(block_number.into()) - .context("Quering block status")?; + .context("Querying block status")?; let finality_status = if l1_accepted { types::FinalityStatus::AcceptedOnL1 diff --git a/crates/rpc/src/v04/method/simulate_transactions.rs b/crates/rpc/src/v04/method/simulate_transactions.rs index 8a8cfb63c2..9e0e0b97bc 100644 --- a/crates/rpc/src/v04/method/simulate_transactions.rs +++ b/crates/rpc/src/v04/method/simulate_transactions.rs @@ -12,7 +12,7 @@ use starknet_gateway_types::trace as gateway_trace; #[derive(Deserialize, Debug)] #[serde(deny_unknown_fields)] -pub struct SimulateTrasactionInput { +pub struct SimulateTransactionInput { block_id: BlockId, transactions: Vec, simulation_flags: dto::SimulationFlags, @@ -53,7 +53,7 @@ impl From for SimulateTransactionError { pub async fn simulate_transactions( context: RpcContext, - input: SimulateTrasactionInput, + input: SimulateTransactionInput, ) -> Result { let span = tracing::Span::current(); tokio::task::spawn_blocking(move || { @@ -563,7 +563,7 @@ pub(crate) mod tests { ], "simulation_flags": ["SKIP_FEE_CHARGE"] }); - let input = SimulateTrasactionInput::deserialize(&input_json).unwrap(); + let input = SimulateTransactionInput::deserialize(&input_json).unwrap(); let expected: Vec = { use dto::*; @@ -1297,7 +1297,7 @@ pub(crate) mod tests { ) = setup_storage().await; let context = RpcContext::for_tests().with_storage(storage); - let input = SimulateTrasactionInput { + let input = SimulateTransactionInput { transactions: vec![ fixtures::input::declare(account_contract_address), fixtures::input::universal_deployer( @@ -1340,7 +1340,7 @@ pub(crate) mod tests { ) = setup_storage().await; let context = RpcContext::for_tests().with_storage(storage); - let input = SimulateTrasactionInput { + let input = SimulateTransactionInput { transactions: vec![ fixtures::input::declare(account_contract_address), fixtures::input::universal_deployer( @@ -1381,7 +1381,7 @@ pub(crate) mod tests { ) = setup_storage().await; let context = RpcContext::for_tests().with_storage(storage); - let input = SimulateTrasactionInput { + let input = SimulateTransactionInput { transactions: vec![ fixtures::input::declare(account_contract_address), fixtures::input::universal_deployer( diff --git a/crates/rpc/src/v04/method/syncing.rs b/crates/rpc/src/v04/method/syncing.rs index 812eb4e848..301acb40e2 100644 --- a/crates/rpc/src/v04/method/syncing.rs +++ b/crates/rpc/src/v04/method/syncing.rs @@ -5,13 +5,13 @@ use crate::felt::RpcFelt; crate::error::generate_rpc_error_subset!(SyncingError); -pub async fn syncing(context: RpcContext) -> Result { +pub async fn syncing(context: RpcContext) -> Result { // Scoped so I don't have to think too hard about mutex guard drop semantics. let value = { context.sync_status.status.read().await.clone() }; use crate::v02::types::syncing::Syncing; let value = match value { - Syncing::False(_) => SyncingOuput::False, + Syncing::False(_) => SyncingOutput::False, Syncing::Status(status) => { let status = SyncingStatus { starting_block_num: status.starting.number, @@ -21,7 +21,7 @@ pub async fn syncing(context: RpcContext) -> Result current_block_hash: status.current.hash, highest_block_hash: status.highest.hash, }; - SyncingOuput::Status(status) + SyncingOutput::Status(status) } }; @@ -29,19 +29,19 @@ pub async fn syncing(context: RpcContext) -> Result } #[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub enum SyncingOuput { +pub enum SyncingOutput { False, Status(SyncingStatus), } -impl serde::Serialize for SyncingOuput { +impl serde::Serialize for SyncingOutput { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { match self { - SyncingOuput::False => serializer.serialize_str("false"), - SyncingOuput::Status(inner) => serializer.serialize_newtype_struct("status", &inner), + SyncingOutput::False => serializer.serialize_str("false"), + SyncingOutput::Status(inner) => serializer.serialize_newtype_struct("status", &inner), } } } @@ -63,15 +63,15 @@ pub struct SyncingStatus { #[cfg(test)] mod tests { - use super::SyncingOuput; + use super::SyncingOutput; use crate::context::RpcContext; use pathfinder_common::macro_prelude::*; mod serde { - use super::super::{SyncingOuput, SyncingStatus}; + use super::super::{SyncingOutput, SyncingStatus}; #[test] fn not_syncing() { - let json = serde_json::to_string(&SyncingOuput::False).unwrap(); + let json = serde_json::to_string(&SyncingOutput::False).unwrap(); assert_eq!(json, r#""false""#); } @@ -88,7 +88,7 @@ mod tests { current_block_hash: block_hash!("0x12345677"), highest_block_hash: block_hash!("0x1144ffaacc"), }; - let value = SyncingOuput::Status(status); + let value = SyncingOutput::Status(status); let json = serde_json::to_value(value).unwrap(); let expected = serde_json::json!( { @@ -125,7 +125,7 @@ mod tests { current_block_hash: block_hash!("0xccddee"), highest_block_hash: block_hash!("0xeeffaacc"), }; - let expected = SyncingOuput::Status(expected); + let expected = SyncingOutput::Status(expected); let context = RpcContext::for_tests(); *context.sync_status.status.write().await = status; @@ -144,6 +144,6 @@ mod tests { let result = super::syncing(context).await.unwrap(); - assert_eq!(result, SyncingOuput::False); + assert_eq!(result, SyncingOutput::False); } } diff --git a/crates/rpc/src/v05/method/get_transaction_receipt.rs b/crates/rpc/src/v05/method/get_transaction_receipt.rs index 5fc8030ea4..b980f80a60 100644 --- a/crates/rpc/src/v05/method/get_transaction_receipt.rs +++ b/crates/rpc/src/v05/method/get_transaction_receipt.rs @@ -55,7 +55,7 @@ pub async fn get_transaction_receipt( let l1_accepted = db_tx .block_is_l1_accepted(block_number.into()) - .context("Quering block status")?; + .context("Querying block status")?; let finality_status = if l1_accepted { types::FinalityStatus::AcceptedOnL1 diff --git a/crates/rpc/src/v05/method/get_transaction_status.rs b/crates/rpc/src/v05/method/get_transaction_status.rs index ba6c653860..5766c34f23 100644 --- a/crates/rpc/src/v05/method/get_transaction_status.rs +++ b/crates/rpc/src/v05/method/get_transaction_status.rs @@ -111,7 +111,7 @@ pub async fn get_transaction_status( let l1_accepted = db_tx .block_is_l1_accepted(block_hash.into()) - .context("Quering block's status")?; + .context("Querying block's status")?; Ok(Some(if l1_accepted { GetTransactionStatusOutput::AcceptedOnL1(receipt.execution_status.into()) diff --git a/crates/rpc/src/v05/method/simulate_transactions.rs b/crates/rpc/src/v05/method/simulate_transactions.rs index acac8833f1..77a77518ba 100644 --- a/crates/rpc/src/v05/method/simulate_transactions.rs +++ b/crates/rpc/src/v05/method/simulate_transactions.rs @@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize}; #[derive(Deserialize, Debug)] #[serde(deny_unknown_fields)] -pub struct SimulateTrasactionInput { +pub struct SimulateTransactionInput { block_id: BlockId, transactions: Vec, simulation_flags: dto::SimulationFlags, @@ -72,7 +72,7 @@ impl From for SimulateTransactionError { pub async fn simulate_transactions( context: RpcContext, - input: SimulateTrasactionInput, + input: SimulateTransactionInput, ) -> Result { let span = tracing::Span::current(); tokio::task::spawn_blocking(move || { @@ -559,7 +559,7 @@ pub(crate) mod tests { ], "simulation_flags": ["SKIP_FEE_CHARGE"] }); - let input = SimulateTrasactionInput::deserialize(&input_json).unwrap(); + let input = SimulateTransactionInput::deserialize(&input_json).unwrap(); let expected: Vec = { use dto::*; @@ -669,7 +669,7 @@ pub(crate) mod tests { }, )); - let input = SimulateTrasactionInput { + let input = SimulateTransactionInput { block_id: last_block_header.number.into(), transactions: vec![declare], simulation_flags: dto::SimulationFlags(vec![]), @@ -1473,7 +1473,7 @@ pub(crate) mod tests { ) = setup_storage().await; let context = RpcContext::for_tests().with_storage(storage); - let input = SimulateTrasactionInput { + let input = SimulateTransactionInput { transactions: vec![ fixtures::input::declare(account_contract_address), fixtures::input::universal_deployer( @@ -1516,7 +1516,7 @@ pub(crate) mod tests { ) = setup_storage().await; let context = RpcContext::for_tests().with_storage(storage); - let input = SimulateTrasactionInput { + let input = SimulateTransactionInput { transactions: vec![ fixtures::input::declare(account_contract_address), fixtures::input::universal_deployer( @@ -1557,7 +1557,7 @@ pub(crate) mod tests { ) = setup_storage().await; let context = RpcContext::for_tests().with_storage(storage); - let input = SimulateTrasactionInput { + let input = SimulateTransactionInput { transactions: vec![ fixtures::input::declare(account_contract_address), fixtures::input::universal_deployer( diff --git a/crates/storage/src/connection/state_update.rs b/crates/storage/src/connection/state_update.rs index f34e280349..ff0e61ce86 100644 --- a/crates/storage/src/connection/state_update.rs +++ b/crates/storage/src/connection/state_update.rs @@ -72,7 +72,7 @@ pub(super) fn insert_state_update( .map(|sierra| ClassHash(sierra.0)); let cairo = state_update.declared_cairo_classes.iter().copied(); // Older cairo 0 classes were never declared, but instead got implicitly declared on first deployment. - // Until such classes dissappear we need to cater for them here. This works because the sql only + // Until such classes disappear we need to cater for them here. This works because the sql only // updates the row if it is null. let deployed = state_update .contract_updates @@ -593,13 +593,13 @@ mod tests { let tx = db.transaction().unwrap(); let header = BlockHeader::builder().finalize_with_hash(block_hash_bytes!(b"hash")); - let contract_adress = contract_address_bytes!(b"contract address"); - let contract_adress2 = contract_address_bytes!(b"contract address 2"); + let contract_address = contract_address_bytes!(b"contract address"); + let contract_address2 = contract_address_bytes!(b"contract address 2"); let state_update = StateUpdate::default() - .with_contract_nonce(contract_adress, contract_nonce_bytes!(b"nonce value")) - .with_contract_nonce(contract_adress2, contract_nonce_bytes!(b"nonce value 2")) + .with_contract_nonce(contract_address, contract_nonce_bytes!(b"nonce value")) + .with_contract_nonce(contract_address2, contract_nonce_bytes!(b"nonce value 2")) .with_storage_update( - contract_adress, + contract_address, storage_address_bytes!(b"storage address"), storage_value_bytes!(b"storage value"), ); diff --git a/crates/storage/src/connection/transaction.rs b/crates/storage/src/connection/transaction.rs index 82b8bee34c..f151885a12 100644 --- a/crates/storage/src/connection/transaction.rs +++ b/crates/storage/src/connection/transaction.rs @@ -476,7 +476,7 @@ mod tests { } #[test] - fn transaction_wtih_receipt() { + fn transaction_with_receipt() { let (mut db, header, body) = setup(); let tx = db.transaction().unwrap(); diff --git a/crates/storage/src/fake.rs b/crates/storage/src/fake.rs index ba6578293e..210a66d5a2 100644 --- a/crates/storage/src/fake.rs +++ b/crates/storage/src/fake.rs @@ -96,7 +96,7 @@ pub mod init { /// - old roots wrt previous state update, genesis' old root is `0` /// - replaced classes for block N point to some deployed contracts from block N-1 /// - each storage diff has its respective nonce update - /// - storage entries contrain at least 1 element + /// - storage entries constrain at least 1 element /// - declared cairo|sierra definitions /// - each declared class has random bytes inserted as its definition /// - all those definitions are **very short and fall far below the soft limit in protobuf diff --git a/doc/rpc/v03/starknet_api_openrpc.json b/doc/rpc/v03/starknet_api_openrpc.json index de3a6676ba..1987cae5ee 100644 --- a/doc/rpc/v03/starknet_api_openrpc.json +++ b/doc/rpc/v03/starknet_api_openrpc.json @@ -487,7 +487,7 @@ { "name": "starknet_estimateFee", "summary": "estimate the fee for of StarkNet transactions", - "description": "estimates the resources required by transactions when applyed on a given state", + "description": "estimates the resources required by transactions when applied on a given state", "params": [ { "name": "request", diff --git a/doc/rpc/v04/starknet_api_openrpc.json b/doc/rpc/v04/starknet_api_openrpc.json index d144a5a6c0..2c2df4b5e4 100644 --- a/doc/rpc/v04/starknet_api_openrpc.json +++ b/doc/rpc/v04/starknet_api_openrpc.json @@ -519,7 +519,7 @@ { "name": "starknet_estimateFee", "summary": "estimate the fee for of StarkNet transactions", - "description": "estimates the resources required by transactions when applyed on a given state", + "description": "estimates the resources required by transactions when applied on a given state", "params": [ { "name": "request", diff --git a/doc/rpc/v04/starknet_write_api.json b/doc/rpc/v04/starknet_write_api.json index 3afc574f59..8f3eb13608 100644 --- a/doc/rpc/v04/starknet_write_api.json +++ b/doc/rpc/v04/starknet_write_api.json @@ -289,7 +289,7 @@ }, "UNEXPECTED_ERROR": { "code": 63, - "message": "An unexpected error occured", + "message": "An unexpected error occurred", "data": "string" } } diff --git a/doc/rpc/v05/starknet_api_openrpc.json b/doc/rpc/v05/starknet_api_openrpc.json index e305079319..5841f240b6 100644 --- a/doc/rpc/v05/starknet_api_openrpc.json +++ b/doc/rpc/v05/starknet_api_openrpc.json @@ -582,7 +582,7 @@ { "name": "starknet_estimateFee", "summary": "estimate the fee for of StarkNet transactions", - "description": "estimates the resources required by transactions when applyed on a given state", + "description": "estimates the resources required by transactions when applied on a given state", "params": [ { "name": "request", @@ -1393,7 +1393,7 @@ }, "l1_gas_price": { "title": "L1 gas price", - "descritpion": "The price of l1 gas in the block", + "description": "The price of l1 gas in the block", "$ref": "#/components/schemas/RESOURCE_PRICE" }, "starknet_version": { @@ -1435,7 +1435,7 @@ }, "l1_gas_price": { "title": "L1 gas price", - "descritpion": "The price of l1 gas in the block", + "description": "The price of l1 gas in the block", "$ref": "#/components/schemas/RESOURCE_PRICE" }, "starknet_version": {