From 0b69f36260be6182e317470e7ec1c5149dbd37d8 Mon Sep 17 00:00:00 2001 From: yaziciahmet Date: Wed, 18 Dec 2024 11:03:50 +0100 Subject: [PATCH] Lint --- bin/citrea/src/rollup/mod.rs | 8 ++++---- crates/common/src/config.rs | 2 +- crates/prover-services/src/parallel/mod.rs | 1 + crates/sovereign-sdk/rollup-interface/src/fork/mod.rs | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/citrea/src/rollup/mod.rs b/bin/citrea/src/rollup/mod.rs index 255c88e86..130532458 100644 --- a/bin/citrea/src/rollup/mod.rs +++ b/bin/citrea/src/rollup/mod.rs @@ -52,7 +52,7 @@ pub trait CitreaRollupBlueprint: RollupBlueprint { ::Storage: NativeStorage, { // Set forks before anything - set_forks(rollup_config.forks.clone()); + set_forks(rollup_config.forks); let mut task_manager = TaskManager::default(); let da_service = self @@ -176,7 +176,7 @@ pub trait CitreaRollupBlueprint: RollupBlueprint { ::Storage: NativeStorage, { // Set forks before anything - set_forks(rollup_config.forks.clone()); + set_forks(rollup_config.forks); let mut task_manager = TaskManager::default(); let da_service = self @@ -311,7 +311,7 @@ pub trait CitreaRollupBlueprint: RollupBlueprint { ::Storage: NativeStorage, { // Set forks before anything - set_forks(rollup_config.forks.clone()); + set_forks(rollup_config.forks); let mut task_manager = TaskManager::default(); let da_service = self @@ -445,7 +445,7 @@ pub trait CitreaRollupBlueprint: RollupBlueprint { ::Storage: NativeStorage, { // Set forks before anything - set_forks(rollup_config.forks.clone()); + set_forks(rollup_config.forks); // Migrate before constructing ledger_db instance so that no lock is present. let migrator = LedgerDBMigrator::new( diff --git a/crates/common/src/config.rs b/crates/common/src/config.rs index 404909c62..16a0e378b 100644 --- a/crates/common/src/config.rs +++ b/crates/common/src/config.rs @@ -306,7 +306,7 @@ impl FromEnv for LightClientProverConfig { impl FromEnv for Forks { fn from_env() -> anyhow::Result { let forks = std::env::var("FORKS")?; - Ok(Forks::from_utf8(&forks).ok_or(anyhow::anyhow!("Invalid FORKS env variable"))?) + Forks::from_utf8(&forks).ok_or(anyhow::anyhow!("Invalid FORKS env variable")) } } diff --git a/crates/prover-services/src/parallel/mod.rs b/crates/prover-services/src/parallel/mod.rs index 8dc66f9c6..8246f8e1c 100644 --- a/crates/prover-services/src/parallel/mod.rs +++ b/crates/prover-services/src/parallel/mod.rs @@ -49,6 +49,7 @@ where Stf::PreState: Clone + Send + Sync, { /// Creates a new prover. + #[allow(clippy::too_many_arguments)] pub fn new( da_service: Arc, vm: Vm, diff --git a/crates/sovereign-sdk/rollup-interface/src/fork/mod.rs b/crates/sovereign-sdk/rollup-interface/src/fork/mod.rs index 9859a409e..532da876d 100644 --- a/crates/sovereign-sdk/rollup-interface/src/fork/mod.rs +++ b/crates/sovereign-sdk/rollup-interface/src/fork/mod.rs @@ -330,9 +330,9 @@ pub(crate) const fn verify_forks(forks: &[Fork]) -> bool { /// This assumes that the list of forks is sorted by block number in ascending fashion. pub(crate) fn fork_pos_from_block_number(forks: &[Fork], block_number: u64) -> usize { let pos = forks.binary_search_by(|fork| fork.activation_height.cmp(&block_number)); - let active_fork_idx = match pos { + + match pos { Ok(idx) => idx, Err(idx) => idx.saturating_sub(1), - }; - active_fork_idx + } }