Skip to content

Commit

Permalink
chore(deps): bump, unpatch Alloy (#6416)
Browse files Browse the repository at this point in the history
* chore(deps): bump, unpatch Alloy

* fix

* chore: clippy

* anvil test tracing
  • Loading branch information
DaniPopes authored Nov 24, 2023
1 parent 970313b commit 890bc7a
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 118 deletions.
142 changes: 80 additions & 62 deletions Cargo.lock

Large diffs are not rendered by default.

50 changes: 20 additions & 30 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,8 @@ foundry-evm-traces = { path = "crates/evm/traces" }
foundry-macros = { path = "crates/macros" }
foundry-test-utils = { path = "crates/test-utils" }

# block explorer & verification bindings
foundry-block-explorers = { version = "0.1", default-features = false }
# solc & compilation utilities
foundry-compilers = { version = "0.1", default-features = false }
foundry-block-explorers = { version = "0.1.1", default-features = false }
foundry-compilers = { version = "0.1.1", default-features = false }

## revm
# no default features to avoid c-kzg
Expand All @@ -144,11 +142,11 @@ ethers-middleware = { version = "2.0", default-features = false }
ethers-solc = { version = "2.0", default-features = false }

## alloy
alloy-primitives = "0.4.1"
alloy-dyn-abi = "0.4.1"
alloy-json-abi = "0.4.1"
alloy-sol-types = "0.4.1"
syn-solidity = "0.4.1"
alloy-primitives = "0.5.0"
alloy-dyn-abi = "0.5.0"
alloy-json-abi = "0.5.0"
alloy-sol-types = "0.5.0"
syn-solidity = "0.5.0"

alloy-chains = "0.1.3"
alloy-rlp = "0.3.3"
Expand Down Expand Up @@ -189,24 +187,16 @@ tower-http = "0.4"
#ethers-solc = { path = "../ethers-rs/ethers-solc" }

[patch.crates-io]
ethers = { git = "https://github.com/gakonst/ethers-rs", rev = "546ea029362a7502365667c6f99fac92ad0aeb9f" }
ethers-core = { git = "https://github.com/gakonst/ethers-rs", rev = "546ea029362a7502365667c6f99fac92ad0aeb9f" }
ethers-contract = { git = "https://github.com/gakonst/ethers-rs", rev = "546ea029362a7502365667c6f99fac92ad0aeb9f" }
ethers-contract-abigen = { git = "https://github.com/gakonst/ethers-rs", rev = "546ea029362a7502365667c6f99fac92ad0aeb9f" }
ethers-providers = { git = "https://github.com/gakonst/ethers-rs", rev = "546ea029362a7502365667c6f99fac92ad0aeb9f" }
ethers-signers = { git = "https://github.com/gakonst/ethers-rs", rev = "546ea029362a7502365667c6f99fac92ad0aeb9f" }
ethers-middleware = { git = "https://github.com/gakonst/ethers-rs", rev = "546ea029362a7502365667c6f99fac92ad0aeb9f" }
ethers-solc = { git = "https://github.com/gakonst/ethers-rs", rev = "546ea029362a7502365667c6f99fac92ad0aeb9f" }

foundry-block-explorers = { git = "https://github.com/foundry-rs/block-explorers" }

alloy-dyn-abi = { git = "https://github.com/alloy-rs/core/" }
alloy-json-abi = { git = "https://github.com/alloy-rs/core/" }
alloy-primitives = { git = "https://github.com/alloy-rs/core/" }
alloy-sol-macro = { git = "https://github.com/alloy-rs/core/" }
alloy-sol-types = { git = "https://github.com/alloy-rs/core/" }
alloy-sol-type-parser = { git = "https://github.com/alloy-rs/core/" }
syn-solidity = { git = "https://github.com/alloy-rs/core/" }

revm = { git = "https://github.com/bluealloy/revm", rev = "1609e07c68048909ad1682c98cf2b9baa76310b5" }
revm-primitives = { git = "https://github.com/bluealloy/revm", rev = "1609e07c68048909ad1682c98cf2b9baa76310b5" }
ethers = { git = "https://github.com/gakonst/ethers-rs", rev = "8175f0f97070ad69abd5dfa7b8df31f1c1dcc3d6" }
ethers-core = { git = "https://github.com/gakonst/ethers-rs", rev = "8175f0f97070ad69abd5dfa7b8df31f1c1dcc3d6" }
ethers-contract = { git = "https://github.com/gakonst/ethers-rs", rev = "8175f0f97070ad69abd5dfa7b8df31f1c1dcc3d6" }
ethers-contract-abigen = { git = "https://github.com/gakonst/ethers-rs", rev = "8175f0f97070ad69abd5dfa7b8df31f1c1dcc3d6" }
ethers-providers = { git = "https://github.com/gakonst/ethers-rs", rev = "8175f0f97070ad69abd5dfa7b8df31f1c1dcc3d6" }
ethers-signers = { git = "https://github.com/gakonst/ethers-rs", rev = "8175f0f97070ad69abd5dfa7b8df31f1c1dcc3d6" }
ethers-middleware = { git = "https://github.com/gakonst/ethers-rs", rev = "8175f0f97070ad69abd5dfa7b8df31f1c1dcc3d6" }
ethers-solc = { git = "https://github.com/gakonst/ethers-rs", rev = "8175f0f97070ad69abd5dfa7b8df31f1c1dcc3d6" }

revm = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
revm-interpreter = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
revm-precompile = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
revm-primitives = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
2 changes: 1 addition & 1 deletion crates/anvil/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ impl NodeConfig {
/// random, free port by setting it to `0`
#[doc(hidden)]
pub fn test() -> Self {
Self { enable_tracing: false, silent: true, port: 0, ..Default::default() }
Self { enable_tracing: true, silent: true, port: 0, ..Default::default() }
}
}

Expand Down
1 change: 1 addition & 0 deletions crates/anvil/src/eth/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub fn to_precompile_id(spec_id: SpecId) -> revm::precompile::SpecId {
SpecId::CANCUN |
SpecId::BEDROCK |
SpecId::REGOLITH |
SpecId::CANYON |
SpecId::LATEST => revm::precompile::SpecId::BERLIN,
}
}
9 changes: 4 additions & 5 deletions crates/anvil/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,18 +375,17 @@ impl Future for NodeHandle {
}
}

#[allow(unused)]
#[doc(hidden)]
pub fn init_tracing() -> LoggingManager {
use tracing_subscriber::prelude::*;

let manager = LoggingManager::default();
// check whether `RUST_LOG` is explicitly set
if std::env::var("RUST_LOG").is_ok() {
let _ = if std::env::var("RUST_LOG").is_ok() {
tracing_subscriber::Registry::default()
.with(tracing_subscriber::EnvFilter::from_default_env())
.with(tracing_subscriber::fmt::layer())
.init();
.try_init()
} else {
tracing_subscriber::Registry::default()
.with(NodeLogLayer::new(manager.clone()))
Expand All @@ -396,8 +395,8 @@ pub fn init_tracing() -> LoggingManager {
.with_target(false)
.with_level(false),
)
.init();
}
.try_init()
};

manager
}
19 changes: 13 additions & 6 deletions crates/anvil/tests/it/optimism.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! tests for OP chain support
//! Tests for OP chain support.
use anvil::{spawn, Hardfork, NodeConfig};
use ethers::{
abi::Address,
Expand Down Expand Up @@ -40,7 +41,6 @@ async fn test_deposits_not_supported_if_optimism_disabled() {

// sending the deposit transaction should fail with error saying not supported
let res = provider.send_transaction(deposit_tx.clone(), None).await;
assert!(res.is_err());
assert!(res
.unwrap_err()
.to_string()
Expand All @@ -54,7 +54,7 @@ async fn test_send_value_deposit_transaction() {
spawn(NodeConfig::test().with_optimism(true).with_hardfork(Some(Hardfork::Paris))).await;
let provider = handle.http_provider();

let send_value: U256 = "1234".parse().unwrap();
let send_value = U256::from(1234);
let from_addr: Address = "cf7f9e66af820a19257a2108375b180b0ec49167".parse().unwrap();
let to_addr: Address = "71562b71999873db5b286df957af199ec94617f7".parse().unwrap();

Expand All @@ -79,7 +79,11 @@ async fn test_send_value_deposit_transaction() {
mint: Some(U256::zero()),
is_system_tx: true,
});
provider.send_transaction(deposit_tx.clone(), None).await.unwrap().await.unwrap().unwrap();

let pending = provider.send_transaction(deposit_tx.clone(), None).await.unwrap();
let receipt = pending.await.unwrap().expect("dropped");
assert_eq!(receipt.from, from_addr);
assert_eq!(receipt.to, Some(to_addr));

// mine block
api.evm_mine(None).await.unwrap();
Expand All @@ -96,7 +100,7 @@ async fn test_send_value_raw_deposit_transaction() {
spawn(NodeConfig::test().with_optimism(true).with_hardfork(Some(Hardfork::Paris))).await;
let provider = handle.http_provider();

let send_value: U256 = "1234".parse().unwrap();
let send_value = U256::from(1234);
let from_addr: Address = "cf7f9e66af820a19257a2108375b180b0ec49167".parse().unwrap();
let to_addr: Address = "71562b71999873db5b286df957af199ec94617f7".parse().unwrap();

Expand All @@ -123,7 +127,10 @@ async fn test_send_value_raw_deposit_transaction() {
});

let rlpbytes = deposit_tx.rlp();
provider.send_raw_transaction(rlpbytes).await.unwrap().await.unwrap().unwrap();
let pending = provider.send_raw_transaction(rlpbytes).await.unwrap();
let receipt = pending.await.unwrap().expect("dropped");
assert_eq!(receipt.from, from_addr);
assert_eq!(receipt.to, Some(to_addr));

// mine block
api.evm_mine(None).await.unwrap();
Expand Down
17 changes: 8 additions & 9 deletions crates/common/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,14 @@ impl ProjectCompiler {
for (name, artifact) in artifacts {
let size = deployed_contract_size(artifact).unwrap_or_default();

let dev_functions = artifact
.abi
.as_ref()
.map(|abi| abi.abi.functions())
.into_iter()
.flatten()
.filter(|func| {
func.name.is_test() || func.name.eq("IS_TEST") || func.name.eq("IS_SCRIPT")
});
let dev_functions =
artifact.abi.as_ref().map(|abi| abi.functions()).into_iter().flatten().filter(
|func| {
func.name.is_test() ||
func.name.eq("IS_TEST") ||
func.name.eq("IS_SCRIPT")
},
);

let is_dev_contract = dev_functions.count() > 0;
size_report.contracts.insert(name, ContractInfo { size, is_dev_contract });
Expand Down
6 changes: 3 additions & 3 deletions crates/forge/bin/cmd/inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl InspectArgs {
.abi
.as_ref()
.ok_or_else(|| eyre::eyre!("Failed to fetch lossless ABI"))?;
print_abi(&abi.abi, pretty)?;
print_abi(abi, pretty)?;
}
ContractArtifactField::Bytecode => {
let tval: Value = to_value(&artifact.bytecode)?;
Expand Down Expand Up @@ -165,7 +165,7 @@ impl InspectArgs {
ContractArtifactField::Errors => {
let mut out = serde_json::Map::new();
if let Some(abi) = &artifact.abi {
let abi = &abi.abi;
let abi = &abi;
// Print the signature of all errors
for er in abi.errors.iter().flat_map(|(_, errors)| errors) {
let types = er.inputs.iter().map(|p| p.ty.clone()).collect::<Vec<_>>();
Expand All @@ -182,7 +182,7 @@ impl InspectArgs {
ContractArtifactField::Events => {
let mut out = serde_json::Map::new();
if let Some(abi) = &artifact.abi {
let abi = &abi.abi;
let abi = &abi;
// print the signature of all events including anonymous
for ev in abi.events.iter().flat_map(|(_, events)| events) {
let types = ev.inputs.iter().map(|p| p.ty.clone()).collect::<Vec<_>>();
Expand Down
4 changes: 2 additions & 2 deletions crates/forge/bin/cmd/selectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl SelectorsSubcommands {

let mut artifacts = artifacts.into_iter().peekable();
while let Some((contract, artifact)) = artifacts.next() {
let abi = artifact.abi.ok_or_else(|| eyre::eyre!("Unable to fetch abi"))?.abi;
let abi = artifact.abi.ok_or_else(|| eyre::eyre!("Unable to fetch abi"))?;
if abi.functions.is_empty() && abi.events.is_empty() && abi.errors.is_empty() {
continue
}
Expand Down Expand Up @@ -234,7 +234,7 @@ impl SelectorsSubcommands {
let mut artifacts = artifacts.into_iter().peekable();

while let Some((contract, artifact)) = artifacts.next() {
let abi = artifact.abi.ok_or_else(|| eyre::eyre!("Unable to fetch abi"))?.abi;
let abi = artifact.abi.ok_or_else(|| eyre::eyre!("Unable to fetch abi"))?;
if abi.functions.is_empty() && abi.events.is_empty() && abi.errors.is_empty() {
continue
}
Expand Down

0 comments on commit 890bc7a

Please sign in to comment.