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: fix clippy and remove goerli usage from tests #7501

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
14 changes: 8 additions & 6 deletions crates/anvil/src/eth/backend/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,14 @@ impl<'a, DB: Db + ?Sized, Validator: TransactionValidator> TransactionExecutor<'
let ExecutedTransaction { transaction, logs, out, traces, exit_reason: exit, .. } = tx;
logs_bloom(logs.clone(), &mut bloom);

let contract_address = if let Some(Output::Create(_, contract_address)) = out {
trace!(target: "backend", "New contract deployed: at {:?}", contract_address);
contract_address
} else {
None
};
let contract_address = out.as_ref().and_then(|out| {
if let Output::Create(_, contract_address) = out {
trace!(target: "backend", "New contract deployed: at {:?}", contract_address);
*contract_address
} else {
None
}
});

let transaction_index = transaction_infos.len() as u32;
let info = TransactionInfo {
Expand Down
2 changes: 1 addition & 1 deletion crates/cast/bin/cmd/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ flag to set your key via:
let phrase = Mnemonic::<English>::new_from_phrase(mnemonic.as_str())?.to_phrase();
let builder = MnemonicBuilder::<English>::default().phrase(phrase.as_str());
let derivation_path = "m/44'/60'/0'/0/";
let index = if let Some(i) = mnemonic_index { i } else { 0 };
let index = mnemonic_index.unwrap_or_default();
let wallet = builder
.clone()
.derivation_path(format!("{derivation_path}{index}"))?
Expand Down
6 changes: 6 additions & 0 deletions crates/forge/tests/it/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ pub fn rpc_endpoints() -> RpcEndpoints {
"https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf".to_string(),
),
),
(
"rpcAliasSepolia",
RpcEndpoint::Url(
"https://eth-sepolia.g.alchemy.com/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf".to_string(),
),
),
("rpcEnvAlias", RpcEndpoint::Env("${RPC_ENV_ALIAS}".to_string())),
])
}
1 change: 0 additions & 1 deletion crates/script/src/artifacts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use alloy_json_abi::JsonAbi;
/// Bundles info of an artifact
pub struct ArtifactInfo<'a> {
pub contract_name: String,
pub contract_id: String,
pub abi: &'a JsonAbi,
pub code: &'a Vec<u8>,
}
4 changes: 1 addition & 3 deletions crates/script/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,6 @@ For more information, please see https://eips.ethereum.org/EIPS/eip-3855",

/// Container for data being collected after execution.
pub struct ExecutionArtifacts {
/// Mapping from contract to its runtime code.
pub known_contracts: ContractsByArtifact,
/// Trace decoder used to decode traces.
pub decoder: CallTraceDecoder,
/// Return values from the execution result.
Expand Down Expand Up @@ -327,7 +325,7 @@ impl ExecutedState {
build_data: self.build_data,
execution_data: self.execution_data,
execution_result: self.execution_result,
execution_artifacts: ExecutionArtifacts { known_contracts, decoder, returns, rpc_data },
execution_artifacts: ExecutionArtifacts { decoder, returns, rpc_data },
})
}

Expand Down
9 changes: 1 addition & 8 deletions crates/script/src/simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ impl PreSimulationState {
script_config: self.script_config,
script_wallets: self.script_wallets,
build_data: self.build_data,
execution_data: self.execution_data,
execution_artifacts: self.execution_artifacts,
transactions,
})
Expand Down Expand Up @@ -199,12 +198,7 @@ impl PreSimulationState {
if let Ok(Some((_, (abi, code)))) =
contracts.find_by_name_or_identifier(contract_name)
{
let info = ArtifactInfo {
contract_name: contract_name.to_string(),
contract_id: contract_id.to_string(),
abi,
code,
};
let info = ArtifactInfo { contract_name: contract_name.to_string(), abi, code };
return Some((*addr, info));
}
None
Expand Down Expand Up @@ -259,7 +253,6 @@ pub struct FilledTransactionsState {
pub script_config: ScriptConfig,
pub script_wallets: ScriptWallets,
pub build_data: LinkedBuildData,
pub execution_data: ExecutionData,
pub execution_artifacts: ExecutionArtifacts,
pub transactions: VecDeque<TransactionWithMetadata>,
}
Expand Down
4 changes: 2 additions & 2 deletions testdata/default/repros/Issue2956.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ contract Issue2956Test is DSTest {
uint256 fork2;

function setUp() public {
fork1 = vm.createFork("https://goerli.infura.io/v3/b9794ad1ddf84dfb8c34d6bb5dca2001", 7475589);
fork1 = vm.createFork("rpcAliasSepolia", 5565573);
fork2 = vm.createFork("https://api.avax-test.network/ext/bc/C/rpc", 12880747);
}

Expand All @@ -28,7 +28,7 @@ contract Issue2956Test is DSTest {
new Counter();

vm.selectFork(fork1);
assertEq(vm.getNonce(user), 3);
assertEq(vm.getNonce(user), 1);
vm.prank(user);
new Counter();
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/default/repros/Issue3221.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ contract Issue3221Test is DSTest {
uint256 fork2;

function setUp() public {
fork1 = vm.createFork("https://goerli.infura.io/v3/b1d3925804e74152b316ca7da97060d3", 7475589);
fork1 = vm.createFork("rpcAliasSepolia", 5565573);
fork2 = vm.createFork("https://api.avax-test.network/ext/bc/C/rpc", 12880747);
}

Expand Down
6 changes: 2 additions & 4 deletions testdata/default/repros/Issue3223.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ contract Issue3223Test is DSTest {
uint256 fork2;

function setUp() public {
fork1 = vm.createFork("https://goerli.infura.io/v3/b9794ad1ddf84dfb8c34d6bb5dca2001", 7475589);
fork1 = vm.createFork("rpcAliasSepolia", 2362365);
fork2 = vm.createFork("https://api.avax-test.network/ext/bc/C/rpc", 12880747);
}

Expand All @@ -25,9 +25,7 @@ contract Issue3223Test is DSTest {
new Counter();

vm.selectFork(fork1);
assertEq(vm.getNonce(user), 3);
vm.prank(user);
new Counter();
assertEq(vm.getNonce(user), 1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion testdata/default/repros/Issue3674.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contract Issue3674Test is DSTest {
Vm constant vm = Vm(HEVM_ADDRESS);

function testNonceCreateSelect() public {
vm.createSelectFork("https://goerli.infura.io/v3/b9794ad1ddf84dfb8c34d6bb5dca2001");
vm.createSelectFork("rpcAliasSepolia");

vm.createSelectFork("https://api.avax-test.network/ext/bc/C/rpc");
assert(vm.getNonce(msg.sender) > 0x17);
Expand Down
Loading