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

chore: remove unused imports #7170

Merged
merged 1 commit into from
Feb 19, 2024
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
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 @@ -975,7 +975,7 @@ pub fn to_eip_access_list(
#[cfg(test)]
mod tests {
use alloy_consensus::Receipt;
use alloy_primitives::{b256, hex, LogData, Signature};
use alloy_primitives::{b256, hex, LogData};
use std::str::FromStr;

use super::*;
Expand Down
11 changes: 2 additions & 9 deletions crates/anvil/src/eth/backend/mem/in_memory_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,8 @@ impl MaybeForkedDatabase for MemDb {
#[cfg(test)]
mod tests {
use super::*;
use crate::{
eth::backend::db::{Db, SerializableAccountRecord, SerializableState},
revm::primitives::AccountInfo,
};
use alloy_primitives::{Address, Bytes, U256};
use foundry_evm::{
backend::MemDb,
revm::primitives::{Bytecode, KECCAK_EMPTY},
};
use alloy_primitives::Bytes;
use foundry_evm::revm::primitives::{Bytecode, KECCAK_EMPTY};
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/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ pub struct MinedTransactionReceipt {
mod tests {
use super::*;
use crate::eth::backend::db::Db;
use alloy_primitives::{Address, B256, U256};
use alloy_primitives::Address;
use foundry_evm::{
backend::MemDb,
revm::{
Expand Down
1 change: 0 additions & 1 deletion crates/anvil/tests/it/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use alloy_signer::Signer as AlloySigner;
use anvil::{eth::EthApi, spawn, NodeConfig, NodeHandle};
use anvil_core::types::Forking;
use ethers::{
core::rand,
prelude::{Bytes, LocalWallet, Middleware, SignerMiddleware},
providers::{Http, Provider},
signers::Signer,
Expand Down
5 changes: 2 additions & 3 deletions crates/anvil/tests/it/ipc.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
//! IPC tests

use crate::utils::ethers_ipc_provider;
use alloy_primitives::U256;
use anvil::{spawn, NodeConfig};
use ethers::{core::rand, prelude::Middleware};
use ethers::prelude::Middleware;
use futures::StreamExt;

use crate::utils::ethers_ipc_provider;

pub fn rand_ipc_endpoint() -> String {
let num: u64 = rand::Rng::gen(&mut rand::thread_rng());
if cfg!(windows) {
Expand Down
3 changes: 1 addition & 2 deletions crates/cast/bin/cmd/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,7 @@ pub fn sanitize_token(token: Token) -> Token {
#[cfg(test)]
mod tests {
use super::*;
use ethers_core::types::{H160, H256};
use std::str::FromStr;
use ethers_core::types::H160;

const ADDRESS: &str = "0x4D1A2e2bB4F88F0250f26Ffff098B0b30B26BF38";
const TRANSFER_SIG: &str = "Transfer(address indexed,address indexed,uint256)";
Expand Down
2 changes: 1 addition & 1 deletion crates/cheatcodes/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ mod tests {
use crate::CheatsConfig;
use alloy_primitives::FixedBytes;
use hex::FromHex;
use p256::ecdsa::{signature::hazmat::PrehashVerifier, Signature};
use p256::ecdsa::signature::hazmat::PrehashVerifier;
use std::{path::PathBuf, sync::Arc};

fn cheats() -> Cheatcodes {
Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ fn coerce_value(ty: &str, arg: &str) -> Result<DynSolValue> {
mod tests {
use super::*;
use alloy_dyn_abi::EventExt;
use alloy_primitives::{LogData, B256, U256};
use alloy_primitives::{B256, U256};

#[test]
fn test_get_func() {
Expand Down
9 changes: 3 additions & 6 deletions crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ use std::{
fs,
path::{Path, PathBuf},
str::FromStr,
string::ToString,
};

// Macros useful for creating a figment.
Expand Down Expand Up @@ -2574,15 +2573,13 @@ mod tests {
use super::*;
use crate::{
cache::{CachedChains, CachedEndpoints},
endpoints::{RpcEndpoint, RpcEndpointConfig, RpcEndpointType},
endpoints::{RpcEndpointConfig, RpcEndpointType},
etherscan::ResolvedEtherscanConfigs,
fs_permissions::PathPermission,
};
use alloy_primitives::Address;
use figment::{error::Kind::InvalidType, value::Value, Figment};
use figment::error::Kind::InvalidType;
use foundry_compilers::artifacts::{ModelCheckerEngine, YulDetails};
use pretty_assertions::assert_eq;
use std::{collections::BTreeMap, fs::File, io::Write, str::FromStr};
use std::{collections::BTreeMap, fs::File, io::Write};
use tempfile::tempdir;
use NamedChain::Moonbeam;

Expand Down
2 changes: 1 addition & 1 deletion crates/evm/core/src/fork/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ mod tests {
};
use foundry_common::provider::alloy::get_http_provider;
use foundry_config::{Config, NamedChain};
use std::{collections::BTreeSet, path::PathBuf, sync::Arc};
use std::{collections::BTreeSet, path::PathBuf};

const ENDPOINT: Option<&str> = option_env!("ETH_RPC_URL");

Expand Down
1 change: 0 additions & 1 deletion crates/evm/core/src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use alloy_providers::provider::TempProvider;
use alloy_rpc_types::Block;
use eyre::WrapErr;
use foundry_common::{
self,
provider::alloy::{ProviderBuilder, RpcUrl},
ALCHEMY_FREE_TIER_CUPS,
};
Expand Down
1 change: 0 additions & 1 deletion crates/fmt/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use crate::{
use alloy_primitives::Address;
use foundry_config::fmt::{HexUnderscore, MultilineFuncHeaderStyle, SingleLineBlockStyle};
use itertools::{Either, Itertools};
use solang_parser::pt::ImportPath;
use std::{fmt::Write, str::FromStr};
use thiserror::Error;

Expand Down
26 changes: 19 additions & 7 deletions crates/forge/bin/cmd/script/broadcast.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
use super::{
multi::MultiChainSequence, providers::ProvidersManager, receipts::clear_pendings,
sequence::ScriptSequence, transaction::TransactionWithMetadata, verify::VerifyBundle, *,
sequence::ScriptSequence, transaction::TransactionWithMetadata, verify::VerifyBundle,
NestedValue, ScriptArgs, ScriptConfig, ScriptResult,
};
use alloy_primitives::{utils::format_units, TxHash};
use alloy_primitives::{utils::format_units, Address, TxHash, U256};
use ethers_core::types::transaction::eip2718::TypedTransaction;
use ethers_providers::{JsonRpcClient, Middleware, Provider};
use ethers_signers::Signer;
use eyre::{bail, ContextCompat, Result, WrapErr};
use ethers_signers::{LocalWallet, Signer};
use eyre::{bail, Context, ContextCompat, Result};
use forge::{inspectors::cheatcodes::BroadcastableTransactions, traces::CallTraceDecoder};
use foundry_cli::{
init_progress, update_progress,
utils::{has_batch_support, has_different_gas_calc},
};
use foundry_common::{
provider::ethers::{estimate_eip1559_fees, try_get_http_provider, RetryProvider},
provider::{
alloy::RpcUrl,
ethers::{estimate_eip1559_fees, try_get_http_provider, RetryProvider},
},
shell,
types::{ToAlloy, ToEthers},
ContractsByArtifact,
};
use foundry_compilers::{artifacts::Libraries, ArtifactId};
use foundry_config::Config;
use foundry_wallets::WalletSigner;
use futures::StreamExt;
use std::{cmp::min, collections::HashSet, ops::Mul, sync::Arc};
use std::{
cmp::min,
collections::{HashMap, HashSet, VecDeque},
sync::Arc,
};

impl ScriptArgs {
/// Sends the transactions which haven't been broadcasted yet.
Expand Down Expand Up @@ -198,7 +210,7 @@ impl ScriptArgs {
|acc, receipt| {
let gas_used = receipt.gas_used.unwrap_or_default().to_alloy();
let gas_price = receipt.effective_gas_price.unwrap_or_default().to_alloy();
(acc.0 + gas_used, acc.1 + gas_price, acc.2 + gas_used.mul(gas_price))
(acc.0 + gas_used, acc.1 + gas_price, acc.2 + gas_used * gas_price)
},
);
let paid = format_units(total_paid, 18).unwrap_or_else(|_| "N/A".to_string());
Expand Down
2 changes: 1 addition & 1 deletion crates/forge/bin/cmd/script/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::*;
use super::{ScriptArgs, ScriptConfig};
use alloy_primitives::{Address, Bytes};
use eyre::{Context, ContextCompat, Result};
use forge::link::{LinkOutput, Linker};
Expand Down
16 changes: 12 additions & 4 deletions crates/forge/bin/cmd/script/cmd.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
use super::{multi::MultiChainSequence, sequence::ScriptSequence, verify::VerifyBundle, *};
use alloy_primitives::Bytes;

use super::{
multi::MultiChainSequence, sequence::ScriptSequence, verify::VerifyBundle, ScriptArgs,
ScriptConfig, ScriptResult,
};
use crate::cmd::script::{build::BuildOutput, receipts};
use alloy_primitives::{Address, Bytes};
use ethers_providers::Middleware;
use ethers_signers::Signer;
use eyre::{OptionExt, Result};
use forge::link::Linker;
use forge::{link::Linker, traces::CallTraceDecoder};
use foundry_cli::utils::LoadConfig;
use foundry_common::{
contracts::flatten_contracts, provider::ethers::try_get_http_provider, types::ToAlloy,
};
use foundry_compilers::{
artifacts::{ContractBytecodeSome, Libraries},
contracts::ArtifactContracts,
};
use foundry_debugger::Debugger;
use foundry_evm::inspectors::cheatcodes::BroadcastableTransaction;
use std::sync::Arc;

/// Helper alias type for the collection of data changed due to the new sender.
Expand Down
16 changes: 10 additions & 6 deletions crates/forge/bin/cmd/script/executor.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
use super::{
artifacts::ArtifactInfo,
runner::SimulationStage,
runner::{ScriptRunner, SimulationStage},
transaction::{AdditionalContract, TransactionWithMetadata},
*,
ScriptArgs, ScriptConfig, ScriptResult,
};
use alloy_primitives::{Address, Bytes, U256};
use eyre::Result;
use eyre::{Context, Result};
use forge::{
backend::Backend,
executors::ExecutorBuilder,
inspectors::{cheatcodes::BroadcastableTransactions, CheatsConfig},
traces::CallTraceDecoder,
traces::{render_trace_arena, CallTraceDecoder},
};
use foundry_cli::utils::{ensure_clean_constructor, needs_setup};
use foundry_common::{provider::ethers::RpcUrl, shell};
use foundry_common::{get_contract_name, provider::ethers::RpcUrl, shell, ContractsByArtifact};
use foundry_compilers::artifacts::ContractBytecodeSome;
use futures::future::join_all;
use parking_lot::RwLock;
use std::{collections::VecDeque, sync::Arc};
use std::{
collections::{BTreeMap, HashMap, VecDeque},
sync::Arc,
};

impl ScriptArgs {
/// Locally deploys and executes the contract method that will collect all broadcastable
Expand Down
7 changes: 2 additions & 5 deletions crates/forge/bin/cmd/script/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use self::{build::BuildOutput, runner::ScriptRunner};
use super::{build::BuildArgs, retry::RetryArgs};
use alloy_dyn_abi::FunctionExt;
use alloy_json_abi::{Function, InternalType, JsonAbi};
Expand All @@ -21,7 +20,6 @@ use forge::{
};
use foundry_common::{
abi::{encode_function_args, get_func},
contracts::get_contract_name,
errors::UnlinkedByteCode,
evm::{Breakpoints, EvmArgs},
fmt::{format_token, format_token_raw},
Expand All @@ -30,7 +28,6 @@ use foundry_common::{
};
use foundry_compilers::{
artifacts::{ContractBytecodeSome, Libraries},
contracts::ArtifactContracts,
ArtifactId,
};
use foundry_config::{
Expand All @@ -50,7 +47,7 @@ use foundry_wallets::MultiWallet;
use futures::future;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};
use std::collections::{BTreeMap, HashMap, HashSet};
use yansi::Paint;

mod artifacts;
Expand Down Expand Up @@ -705,7 +702,7 @@ For more information, please see https://eips.ethereum.org/EIPS/eip-3855",
mod tests {
use super::*;
use foundry_cli::utils::LoadConfig;
use foundry_config::{NamedChain, UnresolvedEnvVarError};
use foundry_config::UnresolvedEnvVarError;
use std::fs;
use tempfile::tempdir;

Expand Down
4 changes: 3 additions & 1 deletion crates/forge/bin/cmd/script/runner.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::*;
use super::ScriptResult;
use alloy_primitives::{Address, Bytes, U256};
use eyre::Result;
use forge::{
Expand All @@ -8,6 +8,8 @@ use forge::{
traces::{TraceKind, Traces},
};
use foundry_common::types::ToEthers;
use foundry_config::Config;
use yansi::Paint;

/// Represents which simulation stage is the script execution at.
pub enum SimulationStage {
Expand Down
1 change: 0 additions & 1 deletion crates/forge/bin/cmd/verify/etherscan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ async fn ensure_solc_build_metadata(version: Version) -> Result<Version> {
mod tests {
use super::*;
use clap::Parser;
use foundry_cli::utils::LoadConfig;
use foundry_common::fs;
use foundry_test_utils::forgetest_async;
use tempfile::tempdir;
Expand Down
3 changes: 1 addition & 2 deletions crates/forge/src/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,9 @@ impl Linker {

#[cfg(test)]
mod tests {
use std::{collections::HashMap, path::PathBuf};

use super::*;
use foundry_compilers::{Project, ProjectPathsConfig};
use std::collections::HashMap;

struct LinkerTest {
project: Project,
Expand Down
1 change: 0 additions & 1 deletion crates/forge/src/multi_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ use revm::primitives::SpecId;
use std::{
collections::BTreeMap,
fmt::Debug,
iter::Iterator,
path::Path,
sync::{mpsc, Arc},
};
Expand Down
Loading