Skip to content
Closed
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
2 changes: 1 addition & 1 deletion crates/apollo_consensus_orchestrator_config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use starknet_api::core::{ChainId, ContractAddress};
use url::Url;
use validator::Validate;

#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum DeploymentMode {
// Production mode.
Expand Down
2 changes: 1 addition & 1 deletion crates/apollo_gateway/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub fn create_sierra_program(version_id: &VersionId) -> Vec<Felt> {
]
}

#[derive(Clone)]
#[derive(Clone, Copy)]
pub enum TransactionType {
Declare,
DeployAccount,
Expand Down
2 changes: 1 addition & 1 deletion crates/apollo_l1_provider_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ impl std::fmt::Display for ProviderState {
}
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum SessionState {
Propose,
Validate,
Expand Down
6 changes: 3 additions & 3 deletions crates/apollo_node/src/servers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ fn create_wrapper_servers(
components: &mut SequencerNodeComponents,
) -> WrapperServers {
let config_manager_runner_server = create_wrapper_server!(
&config.components.config_manager.execution_mode.clone().into(),
&config.components.config_manager.execution_mode.into(),
components.config_manager_runner
);

Expand Down Expand Up @@ -713,12 +713,12 @@ fn create_wrapper_servers(
);

let mempool_p2p_runner_server = create_wrapper_server!(
&config.components.mempool_p2p.execution_mode.clone().into(),
&config.components.mempool_p2p.execution_mode.into(),
components.mempool_p2p_runner
);

let state_sync_runner_server = create_wrapper_server!(
&config.components.state_sync.execution_mode.clone().into(),
&config.components.state_sync.execution_mode.into(),
components.state_sync_runner
);

Expand Down
4 changes: 2 additions & 2 deletions crates/apollo_node_config/src/component_execution_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub trait ExpectedComponentConfig {
fn is_running_locally(&self) -> bool;
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq)]
pub enum ReactiveComponentExecutionMode {
Disabled,
Remote,
Expand All @@ -47,7 +47,7 @@ impl ExpectedComponentConfig for ReactiveComponentExecutionMode {
}
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq)]
pub enum ActiveComponentExecutionMode {
Disabled,
Enabled,
Expand Down
4 changes: 2 additions & 2 deletions crates/apollo_rpc/src/v0_8/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ pub struct L1HandlerTransactionOutput {
// Note: This is not the same as the Builtins in starknet_api, the serialization of SegmentArena is
// different.
// TODO(yair): remove this once a newer version of the API is published.
#[derive(Debug, Clone, Eq, Hash, PartialEq, Deserialize, Serialize, PartialOrd, Ord)]
#[derive(Debug, Clone, Copy, Eq, Hash, PartialEq, Deserialize, Serialize, PartialOrd, Ord)]
pub enum Builtin {
#[serde(rename = "range_check_builtin_applications")]
RangeCheck,
Expand Down Expand Up @@ -954,7 +954,7 @@ impl Add for ExecutionResources {
// and not as the trait Add.
Some(v_ref) => *v_ref = (*v_ref).saturating_add((*v).into()),
None => {
self.computation_resources.builtin_instance_counter.insert(k.clone(), *v);
self.computation_resources.builtin_instance_counter.insert(*k, *v);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl<S: StateReader + Send + 'static> ConcurrentTransactionExecutor<S> {
&block_context.versioned_constants.os_constants,
)?;

let bouncer_config = block_context.bouncer_config.clone();
let bouncer_config = block_context.bouncer_config;
let worker_executor = Arc::new(WorkerExecutor::initialize(
block_state,
vec![],
Expand All @@ -70,7 +70,7 @@ impl<S: StateReader + Send + 'static> ConcurrentTransactionExecutor<S> {
worker_pool: Arc<WorkerPool<CachedState<S>>>,
block_deadline: Option<Instant>,
) -> Self {
let bouncer_config = block_context.bouncer_config.clone();
let bouncer_config = block_context.bouncer_config;
let worker_executor = Arc::new(WorkerExecutor::initialize(
block_state,
vec![],
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/blockifier/transaction_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl<S: StateReader> TransactionExecutor<S> {
config: TransactionExecutorConfig,
worker_pool: Option<Arc<WorkerPool<CachedState<S>>>>,
) -> Self {
let bouncer_config = block_context.bouncer_config.clone();
let bouncer_config = block_context.bouncer_config;
// Note: the state might not be empty even at this point; it is the creator's
// responsibility to tune the bouncer according to pre and post block process.
Self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,7 @@ fn test_execute_txs_bouncing(#[case] concurrency_enabled: bool, #[case] external
assert_eq!(remaining_tx_results.len(), 0);

// Reset the bouncer and add the remaining transactions.
tx_executor.bouncer =
Mutex::new(Bouncer::new(tx_executor.block_context.bouncer_config.clone())).into();
tx_executor.bouncer = Mutex::new(Bouncer::new(tx_executor.block_context.bouncer_config)).into();
let remaining_tx_results = tx_executor.execute_txs(remaining_txs, None);

assert_eq!(remaining_tx_results.len(), 2);
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/bouncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ macro_rules! impl_field_wise_ops {
};
}

#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct BouncerConfig {
pub block_max_capacity: BouncerWeights,
pub builtin_weights: BuiltinWeights,
Expand Down
16 changes: 8 additions & 8 deletions crates/blockifier/src/concurrency/worker_logic_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub fn test_commit_tx() {
.into_iter()
.map(Transaction::Account)
.collect::<Vec<Transaction>>();
let bouncer = Bouncer::new(block_context.bouncer_config.clone());
let bouncer = Bouncer::new(block_context.bouncer_config);
let cached_state =
test_state(&block_context.chain_info, BALANCE, &[(account, 1), (test_contract, 1)]);
let versioned_state = safe_versioned_state_for_testing(cached_state);
Expand Down Expand Up @@ -219,7 +219,7 @@ fn test_commit_tx_when_sender_is_sequencer() {
nonce!(0_u8),
))];

let bouncer = Bouncer::new(block_context.bouncer_config.clone());
let bouncer = Bouncer::new(block_context.bouncer_config);

let state = test_state(&block_context.chain_info, BALANCE, &[(account, 1), (test_contract, 1)]);
let versioned_state = safe_versioned_state_for_testing(state);
Expand Down Expand Up @@ -289,7 +289,7 @@ pub fn test_validate_after_commit_tx() {
nonce!(0_u8),
))];

let bouncer = Bouncer::new(block_context.bouncer_config.clone());
let bouncer = Bouncer::new(block_context.bouncer_config);
let cached_state =
test_state(&block_context.chain_info, BALANCE, &[(account, 1), (test_contract, 1)]);
let versioned_state = safe_versioned_state_for_testing(cached_state);
Expand Down Expand Up @@ -383,7 +383,7 @@ fn test_worker_execute(default_all_resource_bounds: ValidResourceBounds) {
.map(Transaction::Account)
.collect::<Vec<Transaction>>();

let bouncer = Bouncer::new(block_context.bouncer_config.clone());
let bouncer = Bouncer::new(block_context.bouncer_config);
let worker_executor = WorkerExecutor::new(
safe_versioned_state.clone(),
txs.to_vec(),
Expand Down Expand Up @@ -541,7 +541,7 @@ fn test_worker_validate(default_all_resource_bounds: ValidResourceBounds) {
.map(Transaction::Account)
.collect::<Vec<Transaction>>();

let bouncer = Bouncer::new(block_context.bouncer_config.clone());
let bouncer = Bouncer::new(block_context.bouncer_config);
let worker_executor = WorkerExecutor::new(
safe_versioned_state.clone(),
txs.to_vec(),
Expand Down Expand Up @@ -658,7 +658,7 @@ fn test_deploy_before_declare(
let txs =
[declare_tx, invoke_tx].into_iter().map(Transaction::Account).collect::<Vec<Transaction>>();

let bouncer = Bouncer::new(block_context.bouncer_config.clone());
let bouncer = Bouncer::new(block_context.bouncer_config);
let worker_executor = WorkerExecutor::new(
safe_versioned_state,
txs.to_vec(),
Expand Down Expand Up @@ -740,7 +740,7 @@ fn test_worker_commit_phase(default_all_resource_bounds: ValidResourceBounds) {
})
.collect::<Vec<Transaction>>();

let bouncer = Bouncer::new(block_context.bouncer_config.clone());
let bouncer = Bouncer::new(block_context.bouncer_config);
let worker_executor = WorkerExecutor::new(
safe_versioned_state,
txs.to_vec(),
Expand Down Expand Up @@ -842,7 +842,7 @@ fn test_worker_commit_phase_with_halt() {
})
.collect::<Vec<Transaction>>();

let bouncer = Bouncer::new(block_context.bouncer_config.clone());
let bouncer = Bouncer::new(block_context.bouncer_config);
let worker_executor = WorkerExecutor::new(
safe_versioned_state,
txs.to_vec(),
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl BlockContext {
block_timestamp: BlockTimestamp(rounded_timestamp),
sequencer_address: 0_u128.into(),
// TODO(Yoni): consider setting here trivial prices if and when this field is exposed.
gas_prices: self.block_info.gas_prices.clone(),
gas_prices: self.block_info.gas_prices,
use_kzg_da: self.block_info.use_kzg_da,
starknet_version: self.block_info.starknet_version,
}
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/execution/stack_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub const TRACE_LENGTH_CAP: usize = 15000;
pub const TRACE_EXTRA_CHARS_SLACK: usize = 100;

#[cfg_attr(feature = "transaction_serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PreambleType {
CallContract,
LibraryCall,
Expand Down Expand Up @@ -126,7 +126,7 @@ impl From<&ErrorStackSegment> for String {
}

#[cfg_attr(feature = "transaction_serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, Default, PartialEq)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub enum ErrorStackHeader {
Constructor,
Execution,
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier_reexecution/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct BlockifierReexecutionCliArgs {
pub command: Command,
}

#[derive(clap::ValueEnum, Clone, Debug)]
#[derive(clap::ValueEnum, Clone, Copy, Debug)]
pub enum SupportedChainId {
Mainnet,
Testnet,
Expand Down Expand Up @@ -60,7 +60,7 @@ pub struct RpcArgs {
impl RpcArgs {
pub fn parse_chain_id(&self) -> ChainId {
if let Some(chain_id) = &self.chain_id {
return chain_id.clone().into();
return (*chain_id).into();
}
if let Some(hex_str) = &self.custom_chain_id {
return chain_id_from_hex_str(hex_str).expect("Failed to parse hex chain id");
Expand Down
2 changes: 1 addition & 1 deletion crates/native_blockifier/src/py_block_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl PyBlockExecutor {
next_block_info.try_into()?,
self.chain_info.clone(),
self.versioned_constants.clone(),
self.bouncer_config.clone(),
self.bouncer_config,
);
let next_block_number = block_context.block_info().block_number;

Expand Down
4 changes: 2 additions & 2 deletions crates/starknet_api/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ macro_rules! impl_try_from_uint_for_nonzero_gas_price {
impl_try_from_uint_for_nonzero_gas_price!(u8, u16, u32, u64, u128);

// TODO(Arni): Remove derive of Default. Gas prices should always be set.
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct GasPriceVector {
pub l1_gas_price: NonzeroGasPrice,
pub l1_data_gas_price: NonzeroGasPrice,
Expand All @@ -599,7 +599,7 @@ pub enum FeeType {
}

// TODO(Arni): Remove derive of Default. Gas prices should always be set.
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct GasPrices {
pub eth_gas_prices: GasPriceVector, // In wei.
pub strk_gas_prices: GasPriceVector, // In fri.
Expand Down
4 changes: 2 additions & 2 deletions crates/starknet_api/src/block_hash/block_hash_calculator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub static STARKNET_GAS_PRICES0: LazyLock<Felt> = LazyLock::new(|| {
});

#[allow(non_camel_case_types)]
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd)]
pub enum BlockHashVersion {
V0_13_2,
V0_13_4,
Expand Down Expand Up @@ -213,7 +213,7 @@ pub fn calculate_block_hash(
let block_commitments = &partial_block_hash_components.header_commitments;
Ok(BlockHash(
HashChain::new()
.chain(&block_hash_version.clone().into())
.chain(&block_hash_version.into())
.chain(&partial_block_hash_components.block_number.0.into())
.chain(&state_root.0)
.chain(&partial_block_hash_components.sequencer.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async fn test_block_hash_regression(
price_in_wei: 9_u8.into(),
},
l2_gas_price: GasPricePerToken { price_in_fri: 11_u8.into(), price_in_wei: 12_u8.into() },
starknet_version: block_hash_version.clone().into(),
starknet_version: block_hash_version.into(),
header_commitments: block_commitments,
};

Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_api/src/deprecated_contract_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub enum L1HandlerType {
}

/// A function state mutability.
#[derive(Debug, Clone, Default, Eq, PartialEq, Deserialize, Serialize)]
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Deserialize, Serialize)]
pub enum FunctionStateMutability {
#[serde(rename = "view")]
#[default]
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_api/src/execution_resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ pub struct ExecutionResources {
pub gas_consumed: GasVector,
}

#[derive(Clone, Debug, Deserialize, EnumIter, Eq, Hash, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, EnumIter, Eq, Hash, PartialEq, Serialize)]
pub enum Builtin {
#[serde(rename = "range_check_builtin_applications")]
RangeCheck,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::db::serde_db_utils::{deserialize_felt_no_packing, serialize_felt_no_p
use crate::patricia_merkle_tree::leaf::leaf_impl::ContractState;
use crate::patricia_merkle_tree::types::{fixed_hex_string_no_prefix, CompiledClassHash};

#[derive(Clone, Debug)]
#[derive(Clone, Copy, Debug)]
pub enum CommitterLeafPrefix {
StorageLeaf,
StateTreeLeaf,
Expand Down
Loading