chore: use alloy-chains is_ethereum (#11049)

This commit is contained in:
Matthias Seitz
2024-09-19 18:59:28 +02:00
committed by GitHub
parent c3d090adf4
commit 9f23443029
4 changed files with 9 additions and 21 deletions

8
Cargo.lock generated
View File

@ -97,9 +97,9 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
[[package]] [[package]]
name = "alloy-chains" name = "alloy-chains"
version = "0.1.31" version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b68b94c159bcc2ca5f758b8663d7b00fc7c5e40569984595ddf2221b0f7f7f6e" checksum = "abf770dad29577cd3580f3dd09005799224a912b8cdfdd6dc04d030d42b3df4e"
dependencies = [ dependencies = [
"alloy-rlp", "alloy-rlp",
"arbitrary", "arbitrary",
@ -4410,7 +4410,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"windows-targets 0.52.6", "windows-targets 0.48.5",
] ]
[[package]] [[package]]
@ -11162,7 +11162,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [ dependencies = [
"windows-sys 0.59.0", "windows-sys 0.48.0",
] ]
[[package]] [[package]]

View File

@ -417,7 +417,7 @@ revm-primitives = { version = "9.0.2", features = [
], default-features = false } ], default-features = false }
# eth # eth
alloy-chains = "0.1.18" alloy-chains = "0.1.32"
alloy-dyn-abi = "0.8.0" alloy-dyn-abi = "0.8.0"
alloy-primitives = { version = "0.8.0", default-features = false } alloy-primitives = { version = "0.8.0", default-features = false }
alloy-rlp = "0.3.4" alloy-rlp = "0.3.4"

View File

@ -1,6 +1,6 @@
use crate::{constants::MAINNET_DEPOSIT_CONTRACT, once_cell_set, EthChainSpec}; use crate::{constants::MAINNET_DEPOSIT_CONTRACT, once_cell_set, EthChainSpec};
use alloc::{boxed::Box, sync::Arc, vec::Vec}; use alloc::{boxed::Box, sync::Arc, vec::Vec};
use alloy_chains::{Chain, ChainKind, NamedChain}; use alloy_chains::{Chain, NamedChain};
use alloy_genesis::Genesis; use alloy_genesis::Genesis;
use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256}; use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256};
use alloy_trie::EMPTY_ROOT_HASH; use alloy_trie::EMPTY_ROOT_HASH;
@ -235,20 +235,8 @@ impl ChainSpec {
/// Returns `true` if this chain contains Ethereum configuration. /// Returns `true` if this chain contains Ethereum configuration.
#[inline] #[inline]
pub const fn is_eth(&self) -> bool { pub const fn is_ethereum(&self) -> bool {
matches!( self.chain.is_ethereum()
self.chain.kind(),
ChainKind::Named(
NamedChain::Mainnet |
NamedChain::Morden |
NamedChain::Ropsten |
NamedChain::Rinkeby |
NamedChain::Goerli |
NamedChain::Kovan |
NamedChain::Holesky |
NamedChain::Sepolia
)
)
} }
/// Returns `true` if this chain contains Optimism configuration. /// Returns `true` if this chain contains Optimism configuration.

View File

@ -25,7 +25,7 @@ impl NetworkStackId {
pub fn id(chain: &ChainSpec) -> Option<&'static [u8]> { pub fn id(chain: &ChainSpec) -> Option<&'static [u8]> {
if chain.is_optimism() { if chain.is_optimism() {
return Some(Self::OPEL) return Some(Self::OPEL)
} else if chain.is_eth() { } else if chain.is_ethereum() {
return Some(Self::ETH) return Some(Self::ETH)
} }