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: use alloy-chains' is_arbitrum #9432

Merged
merged 2 commits into from
Nov 29, 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
11 changes: 4 additions & 7 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3013,11 +3013,8 @@ pub fn prove_storage(storage: &HashMap<U256, U256>, keys: &[B256]) -> Vec<Vec<By
}

pub fn is_arbitrum(chain_id: u64) -> bool {
matches!(
NamedChain::try_from(chain_id),
Ok(NamedChain::Arbitrum |
NamedChain::ArbitrumTestnet |
NamedChain::ArbitrumGoerli |
NamedChain::ArbitrumNova)
)
if let Ok(chain) = NamedChain::try_from(chain_id) {
return chain.is_arbitrum()
}
false
}
47 changes: 19 additions & 28 deletions crates/cli/src/utils/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,41 +159,32 @@ pub fn init_progress(len: u64, label: &str) -> indicatif::ProgressBar {
/// True if the network calculates gas costs differently.
pub fn has_different_gas_calc(chain_id: u64) -> bool {
if let Some(chain) = Chain::from(chain_id).named() {
return matches!(
chain,
NamedChain::Acala |
NamedChain::AcalaMandalaTestnet |
NamedChain::AcalaTestnet |
NamedChain::Arbitrum |
NamedChain::ArbitrumGoerli |
NamedChain::ArbitrumSepolia |
NamedChain::ArbitrumTestnet |
NamedChain::Etherlink |
NamedChain::EtherlinkTestnet |
NamedChain::Karura |
NamedChain::KaruraTestnet |
NamedChain::Mantle |
NamedChain::MantleSepolia |
NamedChain::MantleTestnet |
NamedChain::Moonbase |
NamedChain::Moonbeam |
NamedChain::MoonbeamDev |
NamedChain::Moonriver
);
return chain.is_arbitrum() ||
matches!(
chain,
NamedChain::Acala |
NamedChain::AcalaMandalaTestnet |
NamedChain::AcalaTestnet |
NamedChain::Etherlink |
NamedChain::EtherlinkTestnet |
NamedChain::Karura |
NamedChain::KaruraTestnet |
NamedChain::Mantle |
NamedChain::MantleSepolia |
NamedChain::MantleTestnet |
NamedChain::Moonbase |
NamedChain::Moonbeam |
NamedChain::MoonbeamDev |
NamedChain::Moonriver
);
}
false
}

/// True if it supports broadcasting in batches.
pub fn has_batch_support(chain_id: u64) -> bool {
if let Some(chain) = Chain::from(chain_id).named() {
return !matches!(
chain,
NamedChain::Arbitrum |
NamedChain::ArbitrumTestnet |
NamedChain::ArbitrumGoerli |
NamedChain::ArbitrumSepolia
);
return !chain.is_arbitrum();
}
true
}
Expand Down