Skip to content

Commit

Permalink
chore: solc 0.8.25 (#7424)
Browse files Browse the repository at this point in the history
* chore: solc 0.8.25

* replace ethers-solc
  • Loading branch information
mattsse authored Mar 18, 2024
1 parent a08a7da commit 3865e57
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 62 deletions.
66 changes: 34 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ foundry-linking = { path = "crates/linking" }

# solc & compilation utilities
foundry-block-explorers = { version = "0.2.3", default-features = false }
foundry-compilers = { version = "0.3.9", default-features = false }
foundry-compilers = { version = "0.3.13", default-features = false }

## revm
# no default features to avoid c-kzg
Expand All @@ -156,7 +156,6 @@ ethers-contract-abigen = { version = "2.0.14", default-features = false }
ethers-providers = { version = "2.0.14", default-features = false }
ethers-signers = { version = "2.0.14", default-features = false }
ethers-middleware = { version = "2.0.14", default-features = false }
ethers-solc = { version = "2.0.14", default-features = false }

## alloy
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
Expand Down
4 changes: 3 additions & 1 deletion crates/anvil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ clap_complete_fig = "4"
ethereum-forkid = "0.12"

[dev-dependencies]
alloy-json-abi.workspace = true
ethers = { workspace = true, features = ["abigen"] }
ethers-core = { workspace = true, features = ["optimism"] }
ethers-solc = { workspace = true, features = ["project-util", "full"] }
foundry-compilers = { workspace = true, features = ["project-util", "full"] }

pretty_assertions = "1.3.0"
tokio = { version = "1", features = ["full"] }
crc = "3.0.1"
Expand Down
13 changes: 8 additions & 5 deletions crates/anvil/tests/it/ganache.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! tests against local ganache for local debug purposes
#![allow(unused)]
use crate::init_tracing;
use crate::{
init_tracing,
utils::{ContractInstanceCompat, DeploymentTxFactoryCompat},
};
use ethers::{
abi::Address,
contract::{Contract, ContractFactory, ContractInstance},
Expand All @@ -11,7 +14,7 @@ use ethers::{
types::{BlockNumber, U256},
utils::hex,
};
use ethers_solc::{project_util::TempProject, Artifact};
use foundry_compilers::{project_util::TempProject, Artifact};
use std::sync::Arc;

// the mnemonic used to start the local ganache instance
Expand Down Expand Up @@ -115,7 +118,7 @@ contract Contract {

let (abi, bytecode, _) = contract.into_contract_bytecode().into_parts();

let factory = ContractFactory::new(abi.unwrap(), bytecode.unwrap(), Arc::clone(&client));
let factory = ContractFactory::new_compat(abi.unwrap(), bytecode.unwrap(), Arc::clone(&client));
let contract = factory.deploy(()).unwrap().legacy().send().await;
contract.unwrap_err();
}
Expand Down Expand Up @@ -153,13 +156,13 @@ contract Contract {
let client = Arc::new(http_client());

// deploy successfully
let factory = ContractFactory::new(abi.clone().unwrap(), bytecode.unwrap(), client);
let factory = ContractFactory::new_compat(abi.clone().unwrap(), bytecode.unwrap(), client);
let contract = factory.deploy(()).unwrap().legacy().send().await.unwrap();
let provider = SignerMiddleware::new(
Provider::<Http>::try_from("http://127.0.0.1:8545").unwrap(),
ganache_wallet2(),
);
let contract = ContractInstance::new(contract.address(), abi.unwrap(), provider);
let contract = ContractInstance::new_compat(contract.address(), abi.unwrap(), provider);
let resp = contract.method::<_, U256>("getSecret", ()).unwrap().legacy().call().await;
resp.unwrap_err();

Expand Down
11 changes: 7 additions & 4 deletions crates/anvil/tests/it/geth.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! tests against local geth for local debug purposes
use crate::abi::VENDING_MACHINE_CONTRACT;
use crate::{
abi::VENDING_MACHINE_CONTRACT,
utils::{ContractInstanceCompat, DeploymentTxFactoryCompat},
};
use ethers::{
abi::Address,
contract::{Contract, ContractFactory},
Expand All @@ -9,7 +12,7 @@ use ethers::{
types::U256,
utils::WEI_IN_ETHER,
};
use ethers_solc::{project_util::TempProject, Artifact};
use foundry_compilers::{project_util::TempProject, Artifact};
use futures::StreamExt;
use std::sync::Arc;
use tokio::time::timeout;
Expand Down Expand Up @@ -52,15 +55,15 @@ async fn test_geth_revert_transaction() {

// deploy successfully
let factory =
ContractFactory::new(abi.clone().unwrap(), bytecode.unwrap(), Arc::clone(&client));
ContractFactory::new_compat(abi.clone().unwrap(), bytecode.unwrap(), Arc::clone(&client));

let mut tx = factory.deploy(()).unwrap().tx;
tx.set_from(account);

let resp = client.send_transaction(tx, None).await.unwrap().await.unwrap().unwrap();

let contract =
Contract::<Provider<_>>::new(resp.contract_address.unwrap(), abi.unwrap(), client);
Contract::<Provider<_>>::new_compat(resp.contract_address.unwrap(), abi.unwrap(), client);

let ten = WEI_IN_ETHER.saturating_mul(10u64.into());
let call = contract.method::<_, ()>("buyRevert", ten).unwrap().value(ten).from(account);
Expand Down
20 changes: 11 additions & 9 deletions crates/anvil/tests/it/otterscan.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
//! tests for otterscan endpoints
use crate::{
abi::MulticallContract,
utils::{ethers_http_provider, ethers_ws_provider},
utils::{
ethers_http_provider, ethers_ws_provider, ContractInstanceCompat, DeploymentTxFactoryCompat,
},
};
use alloy_primitives::U256 as rU256;
use alloy_rpc_types::{BlockNumberOrTag, BlockTransactions};
Expand All @@ -19,8 +21,8 @@ use ethers::{
types::{Bytes, TransactionRequest},
utils::get_contract_address,
};
use ethers_solc::{project_util::TempProject, Artifact};
use foundry_common::types::{ToAlloy, ToEthers};
use foundry_compilers::{project_util::TempProject, Artifact};
use std::{collections::VecDeque, str::FromStr, sync::Arc};

#[tokio::test(flavor = "multi_thread")]
Expand Down Expand Up @@ -136,10 +138,10 @@ contract Contract {
let client = Arc::new(SignerMiddleware::new(provider, wallets[0].clone()));

// deploy successfully
let factory = ContractFactory::new(abi.clone().unwrap(), bytecode.unwrap(), client);
let factory = ContractFactory::new_compat(abi.clone().unwrap(), bytecode.unwrap(), client);
let contract = factory.deploy(()).unwrap().send().await.unwrap();

let contract = ContractInstance::new(
let contract = ContractInstance::new_compat(
contract.address(),
abi.unwrap(),
SignerMiddleware::new(ethers_http_provider(&handle.http_endpoint()), wallets[1].clone()),
Expand Down Expand Up @@ -194,10 +196,10 @@ contract Contract {
let client = Arc::new(SignerMiddleware::new(provider, wallets[0].clone()));

// deploy successfully
let factory = ContractFactory::new(abi.clone().unwrap(), bytecode.unwrap(), client);
let factory = ContractFactory::new_compat(abi.clone().unwrap(), bytecode.unwrap(), client);
let contract = factory.deploy(()).unwrap().send().await.unwrap();

let contract = ContractInstance::new(
let contract = ContractInstance::new_compat(
contract.address(),
abi.unwrap(),
SignerMiddleware::new(ethers_http_provider(&handle.http_endpoint()), wallets[1].clone()),
Expand Down Expand Up @@ -307,10 +309,10 @@ contract Contract {
let client = Arc::new(SignerMiddleware::new(provider, wallets[0].clone()));

// deploy successfully
let factory = ContractFactory::new(abi.clone().unwrap(), bytecode.unwrap(), client);
let factory = ContractFactory::new_compat(abi.clone().unwrap(), bytecode.unwrap(), client);
let contract = factory.deploy(()).unwrap().send().await.unwrap();

let contract = ContractInstance::new(
let contract = ContractInstance::new_compat(
contract.address(),
abi.unwrap(),
SignerMiddleware::new(ethers_http_provider(&handle.http_endpoint()), wallets[1].clone()),
Expand Down Expand Up @@ -397,7 +399,7 @@ contract Contract {
let client = Arc::new(SignerMiddleware::new(provider, wallet));

// deploy successfully
let factory = ContractFactory::new(abi.clone().unwrap(), bytecode.unwrap(), client);
let factory = ContractFactory::new_compat(abi.clone().unwrap(), bytecode.unwrap(), client);
let contract = factory.deploy(()).unwrap().send().await.unwrap();

let call = contract.method::<_, ()>("trigger_revert", ()).unwrap().gas(150_000u64);
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/tests/it/revert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use ethers::{
types::U256,
utils::WEI_IN_ETHER,
};
use ethers_solc::{project_util::TempProject, Artifact};
use foundry_compilers::{project_util::TempProject, Artifact};
use std::sync::Arc;

#[tokio::test(flavor = "multi_thread")]
Expand Down
Loading

0 comments on commit 3865e57

Please sign in to comment.