diff --git a/src/chain.rs b/src/chain.rs index f0daad8..c2dd1ed 100644 --- a/src/chain.rs +++ b/src/chain.rs @@ -354,16 +354,24 @@ impl Chain { } } - /// Returns whether the chain supports the `PUSH0` opcode or not. + /// Returns whether the chain supports the [Shanghai hardfork][ref]. /// /// See [`NamedChain::supports_push0`] for more info. - pub const fn supports_push0(self) -> bool { + /// + /// [ref]: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md + pub const fn supports_shanghai(self) -> bool { match self.kind() { - ChainKind::Named(named) => named.supports_push0(), + ChainKind::Named(named) => named.supports_shanghai(), ChainKind::Id(_) => false, } } + #[doc(hidden)] + #[deprecated(since = "0.1.3", note = "use `supports_shanghai` instead")] + pub const fn supports_push0(self) -> bool { + self.supports_shanghai() + } + /// Returns the chain's blockchain explorer and its API (Etherscan and Etherscan-like) URLs. /// /// See [`NamedChain::etherscan_urls`] for more info. diff --git a/src/named.rs b/src/named.rs index d425573..f76193e 100644 --- a/src/named.rs +++ b/src/named.rs @@ -373,21 +373,31 @@ impl NamedChain { } } - /// Returns whether the chain supports the `PUSH0` opcode or not. + /// Returns whether the chain supports the [Shanghai hardfork][ref]. /// - /// For more information, see EIP-3855: - /// `` - pub const fn supports_push0(self) -> bool { + /// [ref]: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md + pub const fn supports_shanghai(self) -> bool { + use NamedChain as C; + match self { - NamedChain::Mainnet - | NamedChain::Goerli - | NamedChain::Sepolia - | NamedChain::Gnosis - | NamedChain::Chiado => true, + C::Mainnet + | C::Goerli + | C::Sepolia + | C::OptimismGoerli + | C::OptimismSepolia + | C::BaseGoerli + | C::Gnosis + | C::Chiado => true, _ => false, } } + #[doc(hidden)] + #[deprecated(since = "0.1.3", note = "use `supports_shanghai` instead")] + pub const fn supports_push0(self) -> bool { + self.supports_shanghai() + } + /// Returns the chain's blockchain explorer and its API (Etherscan and Etherscan-like) URLs. /// /// Returns `(API_URL, BASE_URL)`