mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: replace once_cell with std (#11694)
Co-authored-by: Emilia Hane <elsaemiliaevahane@gmail.com>
This commit is contained in:
@ -43,4 +43,13 @@ op-alloy-rpc-types.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = []
|
||||
std = [
|
||||
"alloy-chains/std",
|
||||
"alloy-genesis/std",
|
||||
"alloy-primitives/std",
|
||||
"op-alloy-rpc-types/std",
|
||||
"reth-chainspec/std",
|
||||
"reth-ethereum-forks/std",
|
||||
"reth-primitives-traits/std",
|
||||
"reth-optimism-forks/std",
|
||||
]
|
||||
|
||||
@ -1,18 +1,17 @@
|
||||
//! Chain specification for the Base Mainnet network.
|
||||
|
||||
use alloc::sync::Arc;
|
||||
use alloc::{sync::Arc, vec};
|
||||
|
||||
use alloy_chains::Chain;
|
||||
use alloy_primitives::{b256, U256};
|
||||
use once_cell::sync::Lazy;
|
||||
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};
|
||||
use reth_ethereum_forks::EthereumHardfork;
|
||||
use reth_optimism_forks::OptimismHardfork;
|
||||
|
||||
use crate::OpChainSpec;
|
||||
use crate::{LazyLock, OpChainSpec};
|
||||
|
||||
/// The Base mainnet spec
|
||||
pub static BASE_MAINNET: Lazy<Arc<OpChainSpec>> = Lazy::new(|| {
|
||||
pub static BASE_MAINNET: LazyLock<Arc<OpChainSpec>> = LazyLock::new(|| {
|
||||
OpChainSpec {
|
||||
inner: ChainSpec {
|
||||
chain: Chain::base_mainnet(),
|
||||
|
||||
@ -1,18 +1,17 @@
|
||||
//! Chain specification for the Base Sepolia testnet network.
|
||||
|
||||
use alloc::sync::Arc;
|
||||
use alloc::{sync::Arc, vec};
|
||||
|
||||
use alloy_chains::Chain;
|
||||
use alloy_primitives::{b256, U256};
|
||||
use once_cell::sync::Lazy;
|
||||
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};
|
||||
use reth_ethereum_forks::EthereumHardfork;
|
||||
use reth_optimism_forks::OptimismHardfork;
|
||||
|
||||
use crate::OpChainSpec;
|
||||
use crate::{LazyLock, OpChainSpec};
|
||||
|
||||
/// The Base Sepolia spec
|
||||
pub static BASE_SEPOLIA: Lazy<Arc<OpChainSpec>> = Lazy::new(|| {
|
||||
pub static BASE_SEPOLIA: LazyLock<Arc<OpChainSpec>> = LazyLock::new(|| {
|
||||
OpChainSpec {
|
||||
inner: ChainSpec {
|
||||
chain: Chain::base_sepolia(),
|
||||
|
||||
@ -4,18 +4,17 @@ use alloc::sync::Arc;
|
||||
|
||||
use alloy_chains::Chain;
|
||||
use alloy_primitives::U256;
|
||||
use once_cell::sync::Lazy;
|
||||
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};
|
||||
use reth_optimism_forks::DEV_HARDFORKS;
|
||||
use reth_primitives_traits::constants::DEV_GENESIS_HASH;
|
||||
|
||||
use crate::OpChainSpec;
|
||||
use crate::{LazyLock, OpChainSpec};
|
||||
|
||||
/// OP dev testnet specification
|
||||
///
|
||||
/// Includes 20 prefunded accounts with `10_000` ETH each derived from mnemonic "test test test test
|
||||
/// test test test test test test test junk".
|
||||
pub static OP_DEV: Lazy<Arc<OpChainSpec>> = Lazy::new(|| {
|
||||
pub static OP_DEV: LazyLock<Arc<OpChainSpec>> = LazyLock::new(|| {
|
||||
OpChainSpec {
|
||||
inner: ChainSpec {
|
||||
chain: Chain::dev(),
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
|
||||
)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
@ -16,14 +17,17 @@ mod dev;
|
||||
mod op;
|
||||
mod op_sepolia;
|
||||
|
||||
use alloc::{vec, vec::Vec};
|
||||
use alloy_chains::Chain;
|
||||
use alloy_genesis::Genesis;
|
||||
use alloy_primitives::{Parity, Signature, B256, U256};
|
||||
pub use base::BASE_MAINNET;
|
||||
pub use base_sepolia::BASE_SEPOLIA;
|
||||
use core::fmt::Display;
|
||||
use derive_more::{Constructor, Deref, From, Into};
|
||||
pub use dev::OP_DEV;
|
||||
use once_cell::sync::OnceCell;
|
||||
#[cfg(not(feature = "std"))]
|
||||
pub(crate) use once_cell::sync::Lazy as LazyLock;
|
||||
pub use op::OP_MAINNET;
|
||||
pub use op_sepolia::OP_SEPOLIA;
|
||||
use reth_chainspec::{
|
||||
@ -33,7 +37,8 @@ use reth_chainspec::{
|
||||
use reth_ethereum_forks::{ChainHardforks, EthereumHardfork, ForkCondition, Hardfork};
|
||||
use reth_network_peers::NodeRecord;
|
||||
use reth_primitives_traits::Header;
|
||||
use std::fmt::Display;
|
||||
#[cfg(feature = "std")]
|
||||
pub(crate) use std::sync::LazyLock;
|
||||
|
||||
/// Chain spec builder for a OP stack chain.
|
||||
#[derive(Debug, Default, From)]
|
||||
@ -345,7 +350,6 @@ impl From<Genesis> for OpChainSpec {
|
||||
inner: ChainSpec {
|
||||
chain: genesis.config.chain_id.into(),
|
||||
genesis,
|
||||
genesis_hash: OnceCell::new(),
|
||||
hardforks: ChainHardforks::new(ordered_hardforks),
|
||||
paris_block_and_final_difficulty,
|
||||
base_fee_params: optimism_genesis_info.base_fee_params,
|
||||
|
||||
@ -1,19 +1,18 @@
|
||||
//! Chain specification for the Optimism Mainnet network.
|
||||
|
||||
use alloc::sync::Arc;
|
||||
use alloc::{sync::Arc, vec};
|
||||
|
||||
use alloy_chains::Chain;
|
||||
use alloy_primitives::{b256, U256};
|
||||
use once_cell::sync::Lazy;
|
||||
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};
|
||||
use reth_ethereum_forks::EthereumHardfork;
|
||||
use reth_optimism_forks::OptimismHardfork;
|
||||
use reth_primitives_traits::constants::ETHEREUM_BLOCK_GAS_LIMIT;
|
||||
|
||||
use crate::OpChainSpec;
|
||||
use crate::{LazyLock, OpChainSpec};
|
||||
|
||||
/// The Optimism Mainnet spec
|
||||
pub static OP_MAINNET: Lazy<Arc<OpChainSpec>> = Lazy::new(|| {
|
||||
pub static OP_MAINNET: LazyLock<Arc<OpChainSpec>> = LazyLock::new(|| {
|
||||
OpChainSpec {
|
||||
inner: ChainSpec {
|
||||
chain: Chain::optimism_mainnet(),
|
||||
|
||||
@ -1,19 +1,18 @@
|
||||
//! Chain specification for the Optimism Sepolia testnet network.
|
||||
|
||||
use alloc::sync::Arc;
|
||||
use alloc::{sync::Arc, vec};
|
||||
|
||||
use alloy_chains::{Chain, NamedChain};
|
||||
use alloy_primitives::{b256, U256};
|
||||
use once_cell::sync::Lazy;
|
||||
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};
|
||||
use reth_ethereum_forks::EthereumHardfork;
|
||||
use reth_optimism_forks::OptimismHardfork;
|
||||
use reth_primitives_traits::constants::ETHEREUM_BLOCK_GAS_LIMIT;
|
||||
|
||||
use crate::OpChainSpec;
|
||||
use crate::{LazyLock, OpChainSpec};
|
||||
|
||||
/// The OP Sepolia spec
|
||||
pub static OP_SEPOLIA: Lazy<Arc<OpChainSpec>> = Lazy::new(|| {
|
||||
pub static OP_SEPOLIA: LazyLock<Arc<OpChainSpec>> = LazyLock::new(|| {
|
||||
OpChainSpec {
|
||||
inner: ChainSpec {
|
||||
chain: Chain::from_named(NamedChain::OptimismSepolia),
|
||||
|
||||
Reference in New Issue
Block a user