Skip to content

Commit

Permalink
remove arc/mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaztec committed Dec 19, 2024
1 parent 1876c01 commit d7e6f1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
11 changes: 4 additions & 7 deletions crates/evm/core/src/backend/strategy.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use std::{
fmt::Debug,
sync::{Arc, Mutex},
};
use std::fmt::Debug;

use super::{BackendInner, Fork, ForkDB, ForkType, FoundryEvmInMemoryDB};
use alloy_primitives::{Address, U256};
Expand All @@ -17,7 +14,7 @@ pub struct BackendStrategyForkInfo<'a> {
pub trait BackendStrategy: Debug + Send + Sync {
fn name(&self) -> &'static str;

fn new_cloned(&self) -> Arc<Mutex<dyn BackendStrategy>>;
fn new_cloned(&self) -> Box<dyn BackendStrategy>;

/// When creating or switching forks, we update the AccountInfo of the contract
fn update_fork_db(
Expand Down Expand Up @@ -61,8 +58,8 @@ impl BackendStrategy for EvmBackendStrategy {
"evm"
}

fn new_cloned(&self) -> Arc<Mutex<dyn BackendStrategy>> {
Arc::new(Mutex::new(self.clone()))
fn new_cloned(&self) -> Box<dyn BackendStrategy> {
Box::new(self.clone())
}

fn update_fork_db(
Expand Down
9 changes: 3 additions & 6 deletions crates/strategy/zksync/src/backend.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use std::{
collections::hash_map::Entry,
sync::{Arc, Mutex},
};
use std::collections::hash_map::Entry;

use alloy_primitives::{map::HashMap, Address, U256};
use foundry_evm::backend::strategy::BackendStrategyExt;
Expand Down Expand Up @@ -43,8 +40,8 @@ impl BackendStrategy for ZksyncBackendStrategy {
"zk"
}

fn new_cloned(&self) -> Arc<Mutex<dyn BackendStrategy>> {
Arc::new(Mutex::new(self.clone()))
fn new_cloned(&self) -> Box<dyn BackendStrategy> {
Box::new(self.clone())
}

/// When creating or switching forks, we update the AccountInfo of the contract.
Expand Down

0 comments on commit d7e6f1d

Please sign in to comment.