Skip to content

Commit

Permalink
fix(clippy)
Browse files Browse the repository at this point in the history
  • Loading branch information
Trantorian1 authored and jbcaron committed Oct 1, 2024
1 parent 68aefb1 commit b9b9625
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 29 deletions.
5 changes: 2 additions & 3 deletions crates/client/block_import/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Step 1. pre-validate: [`UnverifiedFullBlock`] ====[`crate::pre_validate`]===> [`PreValidatedBlock`]
//! Step 2. verify_apply: [`PreValidatedBlock`] ====[`crate::verify_apply`]===> [`BlockImportResult`]

use anyhow::Context;
use mp_block::{
header::{GasPrices, L1DataAvailabilityMode},
Header,
Expand Down Expand Up @@ -106,7 +105,7 @@ pub struct LegacyDeclaredClass {

impl From<LegacyClassUpdate> for LegacyDeclaredClass {
fn from(value: LegacyClassUpdate) -> Self {
Self { class_hash: value.class_hash, contract_class: value.contract_class.into() }
Self { class_hash: value.class_hash, contract_class: value.contract_class }
}
}

Expand All @@ -121,7 +120,7 @@ impl From<SierraClassUpdate> for SierraDeclaredClass {
fn from(value: SierraClassUpdate) -> Self {
Self {
class_hash: value.class_hash,
contract_class: value.contract_class.into(),
contract_class: value.contract_class,
compiled_class_hash: value.compiled_class_hash,
}
}
Expand Down
2 changes: 0 additions & 2 deletions crates/client/gateway/src/client/builder.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::collections::HashMap;

use reqwest::{
header::{HeaderMap, HeaderName, HeaderValue},
Client,
Expand Down
18 changes: 5 additions & 13 deletions crates/client/sync/src/fetch/fetchers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,18 @@ use anyhow::Context;
use core::fmt;
use core::time::Duration;
use futures::FutureExt;
use mc_block_import::{UnverifiedCommitments, UnverifiedFullBlock, UnverifiedHeader, UnverifiedPendingFullBlock};
use mc_block_import::{UnverifiedCommitments, UnverifiedFullBlock, UnverifiedPendingFullBlock};
use mc_gateway::client::builder::FeederClient;
use mc_gateway::error::{SequencerError, StarknetError, StarknetErrorCode};
use mp_block::header::GasPrices;
use mp_chain_config::StarknetVersion;
use mp_class::class_update::{ClassUpdate, LegacyClassUpdate, SierraClassUpdate};
use mp_class::{ContractClass, MISSED_CLASS_HASHES};
use mp_convert::{felt_to_u128, ToFelt};
use mp_convert::ToFelt;
use mp_gateway::block::{ProviderBlock, ProviderBlockPending};
use mp_gateway::state_update::ProviderStateUpdateWithBlockPendingMaybe::{self, NonPending, Pending};
use mp_gateway::state_update::{
ProviderStateUpdate, ProviderStateUpdatePending, ProviderStateUpdatePendingMaybe, ProviderStateUpdateWithBlock,
ProviderStateUpdateWithBlockPending, StateDiff,
};
use mp_receipt::TransactionReceipt;
use mp_transactions::{Transaction, MAIN_CHAIN_ID};
use mp_gateway::state_update::ProviderStateUpdateWithBlockPendingMaybe::{self};
use mp_gateway::state_update::{ProviderStateUpdate, ProviderStateUpdatePending, StateDiff};
use mp_transactions::MAIN_CHAIN_ID;
use mp_utils::{stopwatch_end, wait_or_graceful_shutdown, PerfStopwatch};
use starknet_api::core::ChainId;
use starknet_providers::sequencer::models::{Block as SequencerBlock, StateUpdate as SequencerStateUpdate};
use starknet_providers::Provider;
use starknet_types_core::felt::Felt;
use std::sync::Arc;
use url::Url;
Expand Down
1 change: 0 additions & 1 deletion crates/client/sync/src/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use mc_gateway::{
error::{SequencerError, StarknetError, StarknetErrorCode},
};
use mp_utils::{channel_wait_or_graceful_shutdown, wait_or_graceful_shutdown};
use starknet_providers::{ProviderError, SequencerGatewayProvider};
use tokio::sync::{mpsc, oneshot};

use crate::fetch::fetchers::fetch_block_and_updates;
Expand Down
1 change: 0 additions & 1 deletion crates/client/sync/src/l2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use mc_gateway::error::SequencerError;
use mc_telemetry::{TelemetryHandle, VerbosityLevel};
use mp_utils::{channel_wait_or_graceful_shutdown, wait_or_graceful_shutdown, PerfStopwatch};
use starknet_api::core::ChainId;
use starknet_providers::SequencerGatewayProvider;
use starknet_types_core::felt::Felt;
use std::pin::pin;
use std::sync::Arc;
Expand Down
2 changes: 0 additions & 2 deletions crates/client/sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ use mc_block_import::BlockImporter;
use mc_db::MadaraBackend;
use mc_gateway::client::builder::FeederClient;
use mc_telemetry::TelemetryHandle;
use mp_convert::ToFelt;
use reqwest::header::{HeaderName, HeaderValue};
use starknet_providers::SequencerGatewayProvider;
use std::{sync::Arc, time::Duration};

pub mod fetch;
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/gateway/src/block.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Context;
use mp_block::header::L1DataAvailabilityMode;
use mp_chain_config::StarknetVersion;
use mp_convert::{felt_to_u128, hex_serde::U128AsHex};
use mp_convert::hex_serde::U128AsHex;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use starknet_types_core::felt::Felt;
Expand Down
10 changes: 5 additions & 5 deletions crates/primitives/gateway/src/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl ConfirmedReceipt {
transaction_index: index,
actual_fee: transaction_receipt.actual_fee().amount,
execution_resources: transaction_receipt.execution_resources().clone().into(),
l2_to_l1_messages: transaction_receipt.messages_sent().iter().map(|msg| msg.clone().into()).collect(),
l2_to_l1_messages: transaction_receipt.messages_sent().to_vec(),
l1_to_l2_consumed_message,
events: transaction_receipt.events().to_vec(),
execution_status,
Expand Down Expand Up @@ -125,7 +125,7 @@ impl ConfirmedReceipt {
execution_result: execution_result(self.execution_status, self.revert_error),
contract_address: match tx {
DeployAccountTransaction::V1(tx) => tx.contract_address,
DeployAccountTransaction::V3(tx) => Felt::default(),
DeployAccountTransaction::V3(_) => Felt::default(),
},
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@ impl From<ExecutionResources> for mp_receipt::ExecutionResources {
}

let BuiltinCounters {
output_builtin,
output_builtin: _,
pedersen_builtin,
range_check_builtin,
ecdsa_builtin,
Expand All @@ -192,8 +192,8 @@ impl From<ExecutionResources> for mp_receipt::ExecutionResources {
keccak_builtin,
poseidon_builtin,
segment_arena_builtin,
add_mod_builtin,
mul_mod_builtin,
add_mod_builtin: _,
mul_mod_builtin: _,
} = resources.builtin_instance_counter;

Self {
Expand Down
3 changes: 2 additions & 1 deletion crates/primitives/gateway/src/state_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ impl From<StateDiff> for mp_state_update::StateDiff {
}
}

#[derive(Debug, Clone, PartialEq, Serialize)] // no Deserialize because it's untagged
#[derive(Debug, Clone, PartialEq, Serialize)]
#[serde(untagged)]
#[allow(clippy::large_enum_variant)]
pub enum ProviderStateUpdateWithBlockPendingMaybe {
NonPending(ProviderStateUpdateWithBlock),
Pending(ProviderStateUpdateWithBlockPending),
Expand Down

0 comments on commit b9b9625

Please sign in to comment.