feat: replace once_cell with std (#11694)

Co-authored-by: Emilia Hane <elsaemiliaevahane@gmail.com>
This commit is contained in:
Deil Urba
2024-10-15 09:21:01 +01:00
committed by GitHub
parent 2a86245649
commit 3ab1f9559e
19 changed files with 129 additions and 80 deletions

View File

@ -41,5 +41,10 @@ proptest.workspace = true
default = ["std", "serde", "rustc-hash"]
arbitrary = ["dep:arbitrary", "dep:proptest", "dep:proptest-derive"]
serde = ["dep:serde"]
std = ["thiserror-no-std/std", "rustc-hash/std"]
std = [
"alloy-chains/std",
"alloy-primitives/std",
"thiserror-no-std/std",
"rustc-hash/std",
]
rustc-hash = ["dep:rustc-hash"]

View File

@ -1,12 +1,17 @@
use alloc::vec;
use alloy_primitives::U256;
use once_cell::sync::Lazy;
use once_cell as _;
#[cfg(not(feature = "std"))]
use once_cell::sync::Lazy as LazyLock;
#[cfg(feature = "std")]
use std::sync::LazyLock;
use crate::{ChainHardforks, EthereumHardfork, ForkCondition};
/// Dev hardforks
pub static DEV_HARDFORKS: Lazy<ChainHardforks> = Lazy::new(|| {
pub static DEV_HARDFORKS: LazyLock<ChainHardforks> = LazyLock::new(|| {
ChainHardforks::new(vec![
(EthereumHardfork::Frontier.boxed(), ForkCondition::Block(0)),
(EthereumHardfork::Homestead.boxed(), ForkCondition::Block(0)),