Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove foundry-utils #6401

Merged
merged 10 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
42 changes: 6 additions & 36 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ members = [
"crates/forge/",
"crates/macros/",
"crates/test-utils/",
"crates/utils/",
]
resolver = "2"

Expand Down Expand Up @@ -125,7 +124,6 @@ foundry-evm-fuzz = { path = "crates/evm/fuzz" }
foundry-evm-traces = { path = "crates/evm/traces" }
foundry-macros = { path = "crates/macros" }
foundry-test-utils = { path = "crates/test-utils" }
foundry-utils = { path = "crates/utils" }

# block explorer & verification bindings
foundry-block-explorers = { version = "0.1", default-features = false }
Expand Down
1 change: 0 additions & 1 deletion crates/anvil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ anvil-server = { path = "server" }
foundry-common.workspace = true
foundry-config.workspace = true
foundry-evm.workspace = true
foundry-utils.workspace = true

# evm support
bytes = "1.4.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/anvil/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ homepage.workspace = true
repository.workspace = true

[dependencies]
# foundry internal
foundry-common.workspace = true
foundry-evm.workspace = true
foundry-utils.workspace = true

revm = { workspace = true, default-features = false, features = ["std", "serde", "memory_limit"] }

alloy-primitives = { workspace = true, features = ["serde"] }
Expand Down
3 changes: 2 additions & 1 deletion crates/anvil/core/src/eth/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ use ethers_core::{
types::{H256, U256},
utils::rlp,
};
use foundry_utils::types::ToEthers;
use foundry_common::types::ToEthers;
use revm::primitives::KECCAK_EMPTY;

// reexport for convenience
pub use ethers_core::types::{EIP1186ProofResponse as AccountProof, StorageProof};

Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/core/src/eth/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use ethers_core::{
rlp::{Decodable, DecoderError, Encodable, Rlp, RlpStream},
},
};
use foundry_utils::types::{ToAlloy, ToEthers};
use foundry_common::types::{ToAlloy, ToEthers};

#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "fastrlp", derive(open_fastrlp::RlpEncodable, open_fastrlp::RlpDecodable))]
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/core/src/eth/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use ethers_core::{
rlp::{Decodable, DecoderError, Encodable, Rlp, RlpStream},
},
};
use foundry_common::types::ToAlloy;
use foundry_evm::traces::CallTraceArena;
use foundry_utils::types::ToAlloy;
use revm::{
interpreter::InstructionResult,
primitives::{CreateScheme, TransactTo, TxEnv},
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/core/src/eth/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use ethers_core::{
rlp::{Encodable, RlpStream},
},
};
use foundry_utils::types::ToAlloy;
use foundry_common::types::ToAlloy;

pub fn enveloped<T: Encodable>(id: u8, v: &T, s: &mut RlpStream) {
let encoded = rlp::encode(v);
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use ethers::{
utils::{format_ether, hex, to_checksum, WEI_IN_ETHER},
};
use foundry_common::{
types::{ToAlloy, ToEthers},
ProviderBuilder, ALCHEMY_FREE_TIER_CUPS, NON_ARCHIVE_NODE_WARNING, REQUEST_TIMEOUT,
};
use foundry_config::Config;
Expand All @@ -38,7 +39,6 @@ use foundry_evm::{
revm::primitives::{BlockEnv, CfgEnv, SpecId, TxEnv, U256 as rU256},
utils::apply_chain_and_block_specific_env_changes,
};
use foundry_utils::types::{ToAlloy, ToEthers};
use parking_lot::RwLock;
use serde_json::{json, to_writer, Value};
use std::{
Expand Down
3 changes: 1 addition & 2 deletions crates/anvil/src/eth/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ use ethers::{
},
utils::rlp,
};
use foundry_common::ProviderBuilder;
use foundry_common::{types::ToEthers, ProviderBuilder};
use foundry_evm::{
backend::DatabaseError,
revm::{
Expand All @@ -70,7 +70,6 @@ use foundry_evm::{
primitives::BlockEnv,
},
};
use foundry_utils::types::ToEthers;
use futures::channel::{mpsc::Receiver, oneshot};
use parking_lot::RwLock;
use std::{collections::HashSet, future::Future, sync::Arc, time::Duration};
Expand Down
3 changes: 1 addition & 2 deletions crates/anvil/src/eth/backend/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ethers::{
types::{BlockId, H256},
utils::keccak256,
};
use foundry_common::errors::FsPathError;
use foundry_common::{errors::FsPathError, types::ToAlloy};
use foundry_evm::{
backend::{DatabaseError, DatabaseResult, MemDb, StateSnapshot},
fork::BlockchainDb,
Expand All @@ -19,7 +19,6 @@ use foundry_evm::{
Database, DatabaseCommit,
},
};
use foundry_utils::types::ToAlloy;
use hash_db::HashDB;
use serde::{Deserialize, Serialize};
use std::{collections::BTreeMap, fmt, path::Path};
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/src/eth/backend/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use ethers::{
types::{Bloom, H256, U256},
utils::rlp,
};
use foundry_common::types::{ToAlloy, ToEthers};
use foundry_evm::{
backend::DatabaseError,
revm,
Expand All @@ -27,7 +28,6 @@ use foundry_evm::{
traces::{CallTraceArena, CallTraceNode},
utils::{eval_to_instruction_result, halt_to_instruction_result},
};
use foundry_utils::types::{ToAlloy, ToEthers};
use std::sync::Arc;

/// Represents an executed transaction (transacted on the DB)
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/src/eth/backend/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use ethers::{
abi::ethereum_types::BigEndianHash,
types::{Address, H256},
};
use foundry_common::types::{ToAlloy, ToEthers};
use foundry_evm::{
backend::{DatabaseError, DatabaseResult, StateSnapshot},
revm::{
db::DatabaseRef,
primitives::{AccountInfo, Bytecode, KECCAK_EMPTY},
},
};
use foundry_utils::types::{ToAlloy, ToEthers};
use parking_lot::Mutex;
use std::{collections::HashMap, sync::Arc};
use tokio::sync::RwLockWriteGuard;
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/src/eth/backend/mem/fork_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use crate::{
Address, U256,
};
use ethers::{prelude::H256, types::BlockId};
use foundry_common::types::{ToAlloy, ToEthers};
use foundry_evm::{
backend::{DatabaseResult, StateSnapshot},
fork::{database::ForkDbSnapshot, BlockchainDb},
revm::Database,
};
use foundry_utils::types::{ToAlloy, ToEthers};

pub use foundry_evm::fork::database::ForkedDatabase;

Expand Down
4 changes: 2 additions & 2 deletions crates/anvil/src/eth/backend/mem/in_memory_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ use crate::{
Address, U256,
};
use ethers::{prelude::H256, types::BlockId};
use foundry_common::types::{ToAlloy, ToEthers};
use foundry_evm::{
backend::{DatabaseResult, StateSnapshot},
fork::BlockchainDb,
};
use foundry_utils::types::{ToAlloy, ToEthers};

// reexport for convenience
pub use foundry_evm::{backend::MemDb, revm::db::DatabaseRef};
Expand Down Expand Up @@ -141,11 +141,11 @@ mod tests {
};
use alloy_primitives::{Bytes, U256 as rU256};
use ethers::types::U256;
use foundry_common::types::ToAlloy;
use foundry_evm::{
backend::MemDb,
revm::primitives::{Bytecode, KECCAK_EMPTY},
};
use foundry_utils::types::ToAlloy;
use std::{collections::BTreeMap, str::FromStr};

// verifies that all substantial aspects of a loaded account remain the state after an account
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ use ethers::{
utils::{keccak256, rlp},
};
use flate2::{read::GzDecoder, write::GzEncoder, Compression};
use foundry_common::types::{ToAlloy, ToEthers};
use foundry_evm::{
backend::{DatabaseError, DatabaseResult},
constants::DEFAULT_CREATE2_DEPLOYER_RUNTIME_CODE,
Expand All @@ -72,7 +73,6 @@ use foundry_evm::{
},
utils::{eval_to_instruction_result, halt_to_instruction_result, u256_to_h256_be},
};
use foundry_utils::types::{ToAlloy, ToEthers};
use futures::channel::mpsc::{unbounded, UnboundedSender};
use hash_db::HashDB;
use parking_lot::{Mutex, RwLock};
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/src/eth/backend/mem/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use ethers::{
types::H256,
utils::{rlp, rlp::RlpStream},
};
use foundry_common::types::{ToAlloy, ToEthers};
use foundry_evm::{
backend::DatabaseError,
hashbrown::HashMap as Map,
Expand All @@ -15,7 +16,6 @@ use foundry_evm::{
primitives::{AccountInfo, Bytecode, Log},
},
};
use foundry_utils::types::{ToAlloy, ToEthers};
use memory_db::HashKey;
use trie_db::TrieMut;

Expand Down
Loading
Loading