Skip to content
Merged
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
798 changes: 597 additions & 201 deletions Cargo.lock

Large diffs are not rendered by default.

76 changes: 38 additions & 38 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -278,41 +278,41 @@ foundry-compilers = { version = "0.21.0", default-features = false, features = [
"rustls",
"svm-solc",
] }
foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-core", rev = "8b3ea9453789ba0d9d8ebf0fc4ee0fed9e4add8f", features = ["zstd"] }
foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-core", rev = "957d190a53f3e287911ff50cbb55b340a99c2c19", features = ["zstd"] }
solang-parser = { version = "=0.3.9", package = "foundry-solang-parser" }
solar = { package = "solar-compiler", version = "=0.1.8", default-features = false }
svm = { package = "svm-rs", version = "0.5", default-features = false, features = [
"rustls",
] }

## alloy
alloy-consensus = { version = "2.4.0", default-features = false }
alloy-contract = { version = "2.4.0", default-features = false }
alloy-eips = { version = "2.4.0", default-features = false }
alloy-eip5792 = { version = "2.4.0", default-features = false }
alloy-ens = { version = "2.4.0", default-features = false }
alloy-genesis = { version = "2.4.0", default-features = false }
alloy-json-rpc = { version = "2.4.0", default-features = false }
alloy-network = { version = "2.4.0", default-features = false }
alloy-provider = { version = "2.4.0", default-features = false }
alloy-pubsub = { version = "2.4.0", default-features = false }
alloy-rpc-client = { version = "2.4.0", default-features = false }
alloy-rpc-types = { version = "2.4.0", default-features = true }
alloy-rpc-types-beacon = { version = "2.4.0", default-features = true }
alloy-rpc-types-engine = { version = "2.4.0", default-features = false }
alloy-rpc-types-eth = { version = "2.4.0", default-features = false }
alloy-serde = { version = "2.4.0", default-features = false }
alloy-signer = { version = "2.4.0", default-features = false }
alloy-signer-aws = { version = "2.4.0", default-features = false }
alloy-signer-gcp = { version = "2.4.0", default-features = false }
alloy-signer-ledger = { version = "2.4.0", default-features = false }
alloy-signer-local = { version = "2.4.0", default-features = false }
alloy-signer-trezor = { version = "2.4.0", default-features = false }
alloy-signer-turnkey = { version = "2.4.0", default-features = false }
alloy-transport = { version = "2.4.0", default-features = false }
alloy-transport-http = { version = "2.4.0", default-features = false }
alloy-transport-ipc = { version = "2.4.0", default-features = false }
alloy-transport-ws = { version = "2.4.0", default-features = false }
alloy-consensus = { version = "2.5.0", default-features = false }
alloy-contract = { version = "2.5.0", default-features = false }
alloy-eips = { version = "2.5.0", default-features = false }
alloy-eip5792 = { version = "2.5.0", default-features = false }
alloy-ens = { version = "2.5.0", default-features = false }
alloy-genesis = { version = "2.5.0", default-features = false }
alloy-json-rpc = { version = "2.5.0", default-features = false }
alloy-network = { version = "2.5.0", default-features = false }
alloy-provider = { version = "2.5.0", default-features = false }
alloy-pubsub = { version = "2.5.0", default-features = false }
alloy-rpc-client = { version = "2.5.0", default-features = false }
alloy-rpc-types = { version = "2.5.0", default-features = true }
alloy-rpc-types-beacon = { version = "2.5.0", default-features = true }
alloy-rpc-types-engine = { version = "2.5.0", default-features = false }
alloy-rpc-types-eth = { version = "2.5.0", default-features = false }
alloy-serde = { version = "2.5.0", default-features = false }
alloy-signer = { version = "2.5.0", default-features = false }
alloy-signer-aws = { version = "2.5.0", default-features = false }
alloy-signer-gcp = { version = "2.5.0", default-features = false }
alloy-signer-ledger = { version = "2.5.0", default-features = false }
alloy-signer-local = { version = "2.5.0", default-features = false }
alloy-signer-trezor = { version = "2.5.0", default-features = false }
alloy-signer-turnkey = { version = "2.5.0", default-features = false }
alloy-transport = { version = "2.5.0", default-features = false }
alloy-transport-http = { version = "2.5.0", default-features = false }
alloy-transport-ipc = { version = "2.5.0", default-features = false }
alloy-transport-ws = { version = "2.5.0", default-features = false }
alloy-hardforks = { version = "0.4.8", default-features = false }
alloy-op-hardforks = { version = "0.5.0", default-features = false }

Expand Down Expand Up @@ -340,13 +340,13 @@ op-alloy-rpc-types = "2.0.0"
op-alloy-flz = "0.13.1"

## alloy-evm
alloy-evm = "0.38.0"
alloy-evm = "0.39.0"
alloy-op-evm = "0.32.0"

# revm
revm = { version = "42.0.1", default-features = false }
revm-inspectors = { version = "0.42.2", features = ["serde"] }
op-revm = { git = "https://github.com/foundry-rs/optimism", rev = "566d19ee21aef0b1235c028bd1a4a98eacb95753", default-features = false }
revm = { version = "43.0.3", default-features = false }
revm-inspectors = { version = "0.44.1", features = ["serde"] }
op-revm = { git = "https://github.com/foundry-rs/optimism", rev = "206d26cedb9d861b983d89fc71e1122187dfa877", default-features = false }

## cli
anstream = "0.6"
Expand Down Expand Up @@ -511,12 +511,12 @@ rexpect = { git = "https://github.com/rust-cli/rexpect", rev = "2ed0b1898d7edaf6
# op-revm = { git = "https://github.com/bluealloy/revm.git", rev = "7e59936" }
# revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors.git", branch = "staging-revm" }

## Pinned to foundry-rs forks for the revm 42 stack.
alloy-op-evm = { git = "https://github.com/foundry-rs/optimism", rev = "566d19ee21aef0b1235c028bd1a4a98eacb95753" }
op-alloy-consensus = { git = "https://github.com/foundry-rs/optimism", rev = "566d19ee21aef0b1235c028bd1a4a98eacb95753" }
op-alloy-network = { git = "https://github.com/foundry-rs/optimism", rev = "566d19ee21aef0b1235c028bd1a4a98eacb95753" }
op-alloy-rpc-types = { git = "https://github.com/foundry-rs/optimism", rev = "566d19ee21aef0b1235c028bd1a4a98eacb95753" }
alloy-op-hardforks = { git = "https://github.com/foundry-rs/optimism", rev = "566d19ee21aef0b1235c028bd1a4a98eacb95753" }
## Pinned to foundry-rs forks for the revm 43 stack.
alloy-op-evm = { git = "https://github.com/foundry-rs/optimism", rev = "206d26cedb9d861b983d89fc71e1122187dfa877" }
op-alloy-consensus = { git = "https://github.com/foundry-rs/optimism", rev = "206d26cedb9d861b983d89fc71e1122187dfa877" }
op-alloy-network = { git = "https://github.com/foundry-rs/optimism", rev = "206d26cedb9d861b983d89fc71e1122187dfa877" }
op-alloy-rpc-types = { git = "https://github.com/foundry-rs/optimism", rev = "206d26cedb9d861b983d89fc71e1122187dfa877" }
alloy-op-hardforks = { git = "https://github.com/foundry-rs/optimism", rev = "206d26cedb9d861b983d89fc71e1122187dfa877" }

## foundry
# foundry-block-explorers = { git = "https://github.com/foundry-rs/block-explorers.git", rev = "f5b46b2" }
Expand Down
36 changes: 32 additions & 4 deletions crates/anvil/src/eth/backend/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use alloy_provider::{
};
use alloy_rpc_types::{
BlockId, BlockNumberOrTag as BlockNumber, BlockTransactions, EIP1186AccountProofResponse,
FeeHistory, Filter, Log,
FeeHistory, Filter, FilterBlockOption, FilterSet, Log,
request::TransactionRequest,
simulate::{SimulatePayload, SimulatedBlock},
trace::{
Expand Down Expand Up @@ -248,14 +248,15 @@ impl ClientFork {
}

pub async fn logs(&self, filter: &Filter) -> Result<Vec<Log>, TransportError> {
if let Some(logs) = self.storage_read().logs.get(filter).cloned() {
let key = LogsCacheKey::from(filter);
if let Some(logs) = self.storage_read().logs.get(&key).cloned() {
return Ok(logs);
}

let logs = self.provider().get_logs(filter).await?;

let mut storage = self.storage_write();
storage.logs.insert(filter.clone(), logs.clone());
storage.logs.insert(key, logs.clone());
Ok(logs)
}

Expand Down Expand Up @@ -710,7 +711,7 @@ pub struct ForkedStorage {
pub transactions: FbHashMap<32, AnyRpcTransaction>,
pub transaction_receipts: FbHashMap<32, FoundryTxReceipt>,
pub transaction_traces: FbHashMap<32, Vec<Trace>>,
pub logs: HashMap<Filter, Vec<Log>>,
pub logs: HashMap<LogsCacheKey, Vec<Log>>,
pub geth_transaction_traces: FbHashMap<32, GethTrace>,
pub block_traces: HashMap<u64, Vec<Trace>>,
pub block_receipts: HashMap<u64, Vec<FoundryTxReceipt>>,
Expand All @@ -724,3 +725,30 @@ impl ForkedStorage {
*self = Self::default()
}
}

/// Cache key for a log [`Filter`].
///
/// [`Filter`] is not hashable because its address and topic sets iterate in arbitrary order, so
/// the key stores them sorted.
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct LogsCacheKey {
block_option: FilterBlockOption,
address: Vec<Address>,
topics: [Vec<B256>; 4],
}

impl From<&Filter> for LogsCacheKey {
fn from(filter: &Filter) -> Self {
Self {
block_option: filter.block_option,
address: sorted_filter_set(&filter.address),
topics: filter.topics.each_ref().map(sorted_filter_set),
}
}
}

fn sorted_filter_set<T: Copy + Ord + std::hash::Hash>(set: &FilterSet<T>) -> Vec<T> {
let mut values = set.iter().copied().collect::<Vec<_>>();
values.sort_unstable();
values
}
6 changes: 3 additions & 3 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ impl Backend {
for res in genesis_accounts {
let (address, mut info) = res.unwrap()?;
info.balance = self.genesis.balance;
db.insert_account(address, info.clone());
db.insert_account(address, info);
}
} else {
let mut db = self.db.write().await;
Expand Down Expand Up @@ -1799,7 +1799,7 @@ impl Backend {
data: None,
}
}),
logs: result.clone()
logs: result
.into_logs()
.into_iter()
.enumerate()
Expand All @@ -1816,7 +1816,7 @@ impl Backend {
})
.collect(),
};
logs.extend(sim_res.logs.clone().iter().map(|log| log.inner.clone()));
logs.extend(sim_res.logs.iter().map(|log| log.inner.clone()));
log_index += sim_res.logs.len();
call_res.push(sim_res);
}
Expand Down
2 changes: 2 additions & 0 deletions crates/anvil/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Anvil is a fast local Ethereum development node.

// RPC futures need additional trait-resolution depth on nightly.
#![recursion_limit = "256"]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg))]

Expand Down
4 changes: 2 additions & 2 deletions crates/cast/src/cmd/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,12 +529,12 @@ impl WalletSubcommands {
if format_json {
if insecure {
accounts_json.as_array_mut().unwrap().push(json!({
"address": address.to_string(),
"address": address,
"private_key": format!("0x{}", private_key),
}));
} else {
accounts_json.as_array_mut().unwrap().push(json!({
"address": address.to_string()
"address": address
}));
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl ProjectCompiler {
// filter out forge-std specific contracts
!id.source.to_string_lossy().contains("/forge-std/src/")
}) {
artifacts.entry(id.name.clone()).or_default().push((id.source.clone(), artifact));
artifacts.entry(id.name).or_default().push((id.source, artifact));
}

for (name, artifact_list) in artifacts {
Expand Down
7 changes: 1 addition & 6 deletions crates/common/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,7 @@ pub fn is_impersonated_tx(tx: &AnyTxEnvelope) -> bool {
pub fn is_impersonated_sig(sig: &Signature, ty: u8) -> bool {
let impersonated_sig =
Signature::from_scalars_and_parity(B256::with_last_byte(1), B256::with_last_byte(1), false);
if ty != SYSTEM_TRANSACTION_TYPE
&& (sig == &impersonated_sig || sig.r() == impersonated_sig.r())
{
return true;
}
false
ty != SYSTEM_TRANSACTION_TYPE && (sig == &impersonated_sig || sig.r() == impersonated_sig.r())
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/core/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,7 @@ mod tests {
let meta = BlockchainDbMeta {
chain: None,
block_env: env.evm_env.block_env,
hosts: Default::default(),
..Default::default()
};

let db = BlockchainDb::new(
Expand Down
6 changes: 1 addition & 5 deletions crates/evm/coverage/src/anchors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@ fn is_in_source_range(element: &SourceElement, location: &SourceLocation) -> boo
let start_of_ranges = location.bytes.start.max(element.offset());
let end_of_ranges =
(location.bytes.start + location.len()).min(element.offset() + element.length());
let within_ranges = start_of_ranges <= end_of_ranges;
if !within_ranges {
return false;
}

true
start_of_ranges <= end_of_ranges
}
4 changes: 2 additions & 2 deletions crates/evm/networks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ alloy-primitives = { workspace = true, features = [
# github.com/base/base; bump via ./script/bump-base.sh. To iterate against a
# local base/base checkout instead, uncomment the [patch] block at the bottom
# of the workspace root Cargo.toml.
base-common-precompiles = { git = "https://github.com/base/base.git", rev = "3eb481791135e465e7e1682218f1e4619b574fa6" }
base-common-chains = { git = "https://github.com/base/base.git", rev = "3eb481791135e465e7e1682218f1e4619b574fa6" }
base-common-precompiles = { git = "https://github.com/base/base.git", rev = "f9d7bf5072faaf33b803d23f3102e4def1b23d75" }
base-common-chains = { git = "https://github.com/base/base.git", rev = "f9d7bf5072faaf33b803d23f3102e4def1b23d75" }

revm = { workspace = true, features = [
"std",
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/traces/src/debug/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl ContractSources {
let stripped = path.strip_prefix(root).unwrap_or(path).to_path_buf();
let source_data = Arc::new(SourceData::new(
output,
source.content.clone(),
source.content,
build.language,
stripped,
root,
Expand Down
6 changes: 2 additions & 4 deletions crates/evm/traces/src/identifier/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ impl<'a> LocalTraceIdentifier<'a> {

// Start at artifacts with the same code length: `len..len*1.1`.
let same_length_idx = self.find_index(len);
for idx in same_length_idx..self.ordered_ids.len() {
let (id, len) = self.ordered_ids[idx];
for &(id, len) in self.ordered_ids.iter().skip(same_length_idx) {
if len > max_len {
break;
}
Expand All @@ -105,8 +104,7 @@ impl<'a> LocalTraceIdentifier<'a> {
// Iterate over the remaining artifacts with less code length: `len*0.9..len`.
let min_len = (len * 9) / 10;
let idx = self.find_index(min_len);
for i in idx..same_length_idx {
let (id, _) = self.ordered_ids[i];
for &(id, _) in self.ordered_ids.iter().take(same_length_idx).skip(idx) {
if let found @ Some(_) = check(id, true, &mut min_score) {
return found;
}
Expand Down
4 changes: 4 additions & 0 deletions crates/evm/traces/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ impl TraceMode {
} else {
TracingInspectorConfig {
record_steps: self >= Self::Steps,
record_inputs: true,
record_bytecode: false,
step_limit: None,
record_memory_snapshots: self >= Self::Jump,
record_stack_snapshots: if self > Self::Steps {
StackSnapshotType::Full
Expand All @@ -395,6 +398,7 @@ impl TraceMode {
.then(|| OpcodeFilter::new().enabled(OpCode::JUMP).enabled(OpCode::JUMPDEST)),
exclude_precompile_calls: false,
record_immediate_bytes: self.is_debug(),
record_step_deltas: false,
}
.into()
}
Expand Down
6 changes: 1 addition & 5 deletions crates/fmt/src/state/sol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2654,11 +2654,7 @@ impl<'ast> State<'_, 'ast> {
last_span_end = expr.span.hi();
}

if self.has_comment_between(last_span_end, limits.hi()) {
return true;
}

false
self.has_comment_between(last_span_end, limits.hi())
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/forge/src/cmd/selectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ impl SelectorsSubcommands {
for (contract, artifact) in artifacts.by_ref() {
let abi = artifact.abi.ok_or_else(|| eyre::eyre!("Unable to fetch abi"))?;

let contract_selectors = selectors.entry(contract.clone()).or_default();
let contract_selectors = selectors.entry(contract).or_default();

for func in abi.functions() {
let sig = func.signature();
Expand Down
Loading
Loading