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:
59
Cargo.lock
generated
59
Cargo.lock
generated
@ -130,9 +130,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-dyn-abi"
|
||||
version = "0.8.7"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f95d76a38cae906fd394a5afb0736aaceee5432efe76addfd71048e623e208af"
|
||||
checksum = "e6228abfc751a29cde117b0879b805a3e0b3b641358f063272c83ca459a56886"
|
||||
dependencies = [
|
||||
"alloy-json-abi",
|
||||
"alloy-primitives",
|
||||
@ -206,9 +206,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-json-abi"
|
||||
version = "0.8.7"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03c66eec1acdd96b39b995b8f5ee5239bc0c871d62c527ae1ac9fd1d7fecd455"
|
||||
checksum = "d46eb5871592c216d39192499c95a99f7175cb94104f88c307e6dc960676d9f1"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-sol-type-parser",
|
||||
@ -283,9 +283,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-primitives"
|
||||
version = "0.8.7"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ecb848c43f6b06ae3de2e4a67496cbbabd78ae87db0f1248934f15d76192c6a"
|
||||
checksum = "38f35429a652765189c1c5092870d8360ee7b7769b09b06d89ebaefd34676446"
|
||||
dependencies = [
|
||||
"alloy-rlp",
|
||||
"arbitrary",
|
||||
@ -600,9 +600,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-sol-macro"
|
||||
version = "0.8.7"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "661c516eb1fa3294cc7f2fb8955b3b609d639c282ac81a4eedb14d3046db503a"
|
||||
checksum = "3b2395336745358cc47207442127c47c63801a7065ecc0aa928da844f8bb5576"
|
||||
dependencies = [
|
||||
"alloy-sol-macro-expander",
|
||||
"alloy-sol-macro-input",
|
||||
@ -614,9 +614,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-sol-macro-expander"
|
||||
version = "0.8.7"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ecbabb8fc3d75a0c2cea5215be22e7a267e3efde835b0f2a8922f5e3f5d47683"
|
||||
checksum = "9ed5047c9a241df94327879c2b0729155b58b941eae7805a7ada2e19436e6b39"
|
||||
dependencies = [
|
||||
"alloy-sol-macro-input",
|
||||
"const-hex",
|
||||
@ -632,9 +632,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-sol-macro-input"
|
||||
version = "0.8.7"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16517f2af03064485150d89746b8ffdcdbc9b6eeb3d536fb66efd7c2846fbc75"
|
||||
checksum = "5dee02a81f529c415082235129f0df8b8e60aa1601b9c9298ffe54d75f57210b"
|
||||
dependencies = [
|
||||
"const-hex",
|
||||
"dunce",
|
||||
@ -647,9 +647,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-sol-type-parser"
|
||||
version = "0.8.7"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c07ebb0c1674ff8cbb08378d7c2e0e27919d2a2dae07ad3bca26174deda8d389"
|
||||
checksum = "f631f0bd9a9d79619b27c91b6b1ab2c4ef4e606a65192369a1ee05d40dcf81cc"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"winnow",
|
||||
@ -657,9 +657,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-sol-types"
|
||||
version = "0.8.7"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e448d879903624863f608c552d10efb0e0905ddbee98b0049412799911eb062"
|
||||
checksum = "c2841af22d99e2c0f82a78fe107b6481be3dd20b89bfb067290092794734343a"
|
||||
dependencies = [
|
||||
"alloy-json-abi",
|
||||
"alloy-primitives",
|
||||
@ -1018,9 +1018,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-compression"
|
||||
version = "0.4.14"
|
||||
version = "0.4.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "998282f8f49ccd6116b0ed8a4de0fbd3151697920e7c7533416d6e25e76434a7"
|
||||
checksum = "e26a9844c659a2a293d239c7910b752f8487fe122c6c8bd1659bf85a6507c302"
|
||||
dependencies = [
|
||||
"brotli",
|
||||
"flate2",
|
||||
@ -1498,9 +1498,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.18.0"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae"
|
||||
checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d"
|
||||
dependencies = [
|
||||
"bytemuck_derive",
|
||||
]
|
||||
@ -2011,6 +2011,12 @@ dependencies = [
|
||||
"itertools 0.10.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "critical-section"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f64009896348fc5af4222e9cf7d7d82a95a256c634ebcf61c53e4ea461422242"
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.13"
|
||||
@ -5131,6 +5137,10 @@ name = "once_cell"
|
||||
version = "1.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||
dependencies = [
|
||||
"critical-section",
|
||||
"portable-atomic",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "oorandom"
|
||||
@ -5413,9 +5423,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||
|
||||
[[package]]
|
||||
name = "pest"
|
||||
version = "2.7.13"
|
||||
version = "2.7.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9"
|
||||
checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"thiserror",
|
||||
@ -8393,7 +8403,6 @@ dependencies = [
|
||||
"itertools 0.13.0",
|
||||
"metrics",
|
||||
"notify",
|
||||
"once_cell",
|
||||
"parking_lot 0.12.3",
|
||||
"rand 0.8.5",
|
||||
"rayon",
|
||||
@ -10256,9 +10265,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn-solidity"
|
||||
version = "0.8.7"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20e7b52ad118b2153644eea95c6fc740b6c1555b2344fdab763fc9de4075f665"
|
||||
checksum = "ebfc1bfd06acc78f16d8fd3ef846bc222ee7002468d10a7dce8d703d6eab89a3"
|
||||
dependencies = [
|
||||
"paste",
|
||||
"proc-macro2",
|
||||
|
||||
@ -497,7 +497,9 @@ notify = { version = "6.1.1", default-features = false, features = [
|
||||
"macos_fsevent",
|
||||
] }
|
||||
nybbles = "0.2.1"
|
||||
once_cell = "1.19"
|
||||
once_cell = { version = "1.19", default-features = false, features = [
|
||||
"critical-section",
|
||||
] }
|
||||
parking_lot = "0.12"
|
||||
paste = "1.0"
|
||||
rand = "0.8.5"
|
||||
|
||||
@ -11,6 +11,12 @@
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
use once_cell as _;
|
||||
#[cfg(not(feature = "std"))]
|
||||
pub(crate) use once_cell::sync::{Lazy as LazyLock, OnceCell as OnceLock};
|
||||
#[cfg(feature = "std")]
|
||||
pub(crate) use std::sync::{LazyLock, OnceLock};
|
||||
|
||||
/// Chain specific constants
|
||||
pub(crate) mod constants;
|
||||
pub use constants::MIN_TRANSACTION_GAS;
|
||||
@ -34,9 +40,9 @@ pub use spec::{
|
||||
DepositContract, ForkBaseFeeParams, DEV, HOLESKY, MAINNET, SEPOLIA,
|
||||
};
|
||||
|
||||
/// Simple utility to create a `OnceCell` with a value set.
|
||||
pub fn once_cell_set<T>(value: T) -> once_cell::sync::OnceCell<T> {
|
||||
let once = once_cell::sync::OnceCell::new();
|
||||
/// Simple utility to create a thread-safe sync cell with a value set.
|
||||
pub fn once_cell_set<T>(value: T) -> OnceLock<T> {
|
||||
let once = OnceLock::new();
|
||||
let _ = once.set(value);
|
||||
once
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ use alloy_genesis::Genesis;
|
||||
use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256};
|
||||
use alloy_trie::EMPTY_ROOT_HASH;
|
||||
use derive_more::From;
|
||||
use once_cell::sync::{Lazy, OnceCell};
|
||||
|
||||
use reth_ethereum_forks::{
|
||||
ChainHardforks, DisplayHardforks, EthereumHardfork, EthereumHardforks, ForkCondition,
|
||||
ForkFilter, ForkFilterKey, ForkHash, ForkId, Hardfork, Hardforks, Head, DEV_HARDFORKS,
|
||||
@ -24,10 +24,10 @@ use reth_primitives_traits::{
|
||||
};
|
||||
use reth_trie_common::root::state_root_ref_unhashed;
|
||||
|
||||
use crate::{constants::MAINNET_DEPOSIT_CONTRACT, once_cell_set, EthChainSpec};
|
||||
use crate::{constants::MAINNET_DEPOSIT_CONTRACT, once_cell_set, EthChainSpec, LazyLock, OnceLock};
|
||||
|
||||
/// The Ethereum mainnet spec
|
||||
pub static MAINNET: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
pub static MAINNET: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
|
||||
let mut spec = ChainSpec {
|
||||
chain: Chain::mainnet(),
|
||||
genesis: serde_json::from_str(include_str!("../res/genesis/mainnet.json"))
|
||||
@ -55,7 +55,7 @@ pub static MAINNET: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
});
|
||||
|
||||
/// The Sepolia spec
|
||||
pub static SEPOLIA: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
pub static SEPOLIA: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
|
||||
let mut spec = ChainSpec {
|
||||
chain: Chain::sepolia(),
|
||||
genesis: serde_json::from_str(include_str!("../res/genesis/sepolia.json"))
|
||||
@ -80,7 +80,7 @@ pub static SEPOLIA: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
});
|
||||
|
||||
/// The Holesky spec
|
||||
pub static HOLESKY: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
pub static HOLESKY: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
|
||||
let mut spec = ChainSpec {
|
||||
chain: Chain::holesky(),
|
||||
genesis: serde_json::from_str(include_str!("../res/genesis/holesky.json"))
|
||||
@ -106,7 +106,7 @@ pub static HOLESKY: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
///
|
||||
/// 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 DEV: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
pub static DEV: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
|
||||
ChainSpec {
|
||||
chain: Chain::dev(),
|
||||
genesis: serde_json::from_str(include_str!("../res/genesis/dev.json"))
|
||||
@ -182,13 +182,13 @@ pub struct ChainSpec {
|
||||
///
|
||||
/// This is either stored at construction time if it is known using [`once_cell_set`], or
|
||||
/// computed once on the first access.
|
||||
pub genesis_hash: OnceCell<B256>,
|
||||
pub genesis_hash: OnceLock<B256>,
|
||||
|
||||
/// The header corresponding to the genesis block.
|
||||
///
|
||||
/// This is either stored at construction time if it is known using [`once_cell_set`], or
|
||||
/// computed once on the first access.
|
||||
pub genesis_header: OnceCell<Header>,
|
||||
pub genesis_header: OnceLock<Header>,
|
||||
|
||||
/// The block at which [`EthereumHardfork::Paris`] was activated and the final difficulty at
|
||||
/// this block.
|
||||
@ -665,7 +665,7 @@ impl From<Genesis> for ChainSpec {
|
||||
Self {
|
||||
chain: genesis.config.chain_id.into(),
|
||||
genesis,
|
||||
genesis_hash: OnceCell::new(),
|
||||
genesis_hash: OnceLock::new(),
|
||||
hardforks: ChainHardforks::new(ordered_hardforks),
|
||||
paris_block_and_final_difficulty,
|
||||
deposit_contract,
|
||||
@ -898,7 +898,7 @@ impl ChainSpecBuilder {
|
||||
ChainSpec {
|
||||
chain: self.chain.expect("The chain is required"),
|
||||
genesis: self.genesis.expect("The genesis is required"),
|
||||
genesis_hash: OnceCell::new(),
|
||||
genesis_hash: OnceLock::new(),
|
||||
hardforks: self.hardforks,
|
||||
paris_block_and_final_difficulty,
|
||||
deposit_contract: None,
|
||||
@ -2217,7 +2217,7 @@ Post-merge hard forks (timestamp based):
|
||||
let spec = ChainSpec {
|
||||
chain: Chain::mainnet(),
|
||||
genesis: Genesis::default(),
|
||||
genesis_hash: OnceCell::new(),
|
||||
genesis_hash: OnceLock::new(),
|
||||
hardforks: ChainHardforks::new(vec![(
|
||||
EthereumHardfork::Frontier.boxed(),
|
||||
ForkCondition::Never,
|
||||
@ -2235,7 +2235,7 @@ Post-merge hard forks (timestamp based):
|
||||
let spec = ChainSpec {
|
||||
chain: Chain::mainnet(),
|
||||
genesis: Genesis::default(),
|
||||
genesis_hash: OnceCell::new(),
|
||||
genesis_hash: OnceLock::new(),
|
||||
hardforks: ChainHardforks::new(vec![(
|
||||
EthereumHardfork::Shanghai.boxed(),
|
||||
ForkCondition::Never,
|
||||
|
||||
@ -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"]
|
||||
|
||||
@ -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)),
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
use alloy_primitives::U256;
|
||||
use once_cell::sync::Lazy;
|
||||
use reth_ethereum_forks::{ChainHardforks, EthereumHardfork, ForkCondition};
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use once_cell::sync::Lazy as LazyLock;
|
||||
#[cfg(feature = "std")]
|
||||
use std::sync::LazyLock;
|
||||
|
||||
/// 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)),
|
||||
|
||||
@ -13,10 +13,14 @@ use alloy_primitives::{Bytes, TxHash};
|
||||
use alloy_rlp::{Decodable, Encodable, Error as RlpError, Header};
|
||||
use core::mem;
|
||||
use derive_more::{AsRef, Deref};
|
||||
use once_cell::sync::Lazy;
|
||||
use once_cell as _;
|
||||
#[cfg(not(feature = "std"))]
|
||||
use once_cell::sync::Lazy as LazyLock;
|
||||
use rayon::prelude::{IntoParallelIterator, ParallelIterator};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use signature::{decode_with_eip155_chain_id, with_eip155_parity};
|
||||
#[cfg(feature = "std")]
|
||||
use std::sync::LazyLock;
|
||||
|
||||
pub use error::{
|
||||
InvalidTransactionError, TransactionConversionError, TryFromRecoveredTransactionError,
|
||||
@ -72,8 +76,8 @@ pub type TxHashOrNumber = BlockHashOrNumber;
|
||||
|
||||
// Expected number of transactions where we can expect a speed-up by recovering the senders in
|
||||
// parallel.
|
||||
pub(crate) static PARALLEL_SENDER_RECOVERY_THRESHOLD: Lazy<usize> =
|
||||
Lazy::new(|| match rayon::current_num_threads() {
|
||||
pub(crate) static PARALLEL_SENDER_RECOVERY_THRESHOLD: LazyLock<usize> =
|
||||
LazyLock::new(|| match rayon::current_num_threads() {
|
||||
0..=1 => usize::MAX,
|
||||
2..=8 => 10,
|
||||
_ => 5,
|
||||
|
||||
@ -110,6 +110,7 @@ pub trait EthBlocks: LoadBlock {
|
||||
/// Helper function for `eth_getBlockReceipts`.
|
||||
///
|
||||
/// Returns all transaction receipts in block, or `None` if block wasn't found.
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn block_receipts(
|
||||
&self,
|
||||
block_id: BlockId,
|
||||
@ -118,6 +119,7 @@ pub trait EthBlocks: LoadBlock {
|
||||
Self: LoadReceipt;
|
||||
|
||||
/// Helper method that loads a bock and all its receipts.
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn load_block_and_receipts(
|
||||
&self,
|
||||
block_id: BlockId,
|
||||
|
||||
@ -61,6 +61,7 @@ pub trait EthCall: Call + LoadPendingBlock {
|
||||
/// The transactions are packed into individual blocks. Overrides can be provided.
|
||||
///
|
||||
/// See also: <https://github.com/ethereum/go-ethereum/pull/27720>
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn simulate_v1(
|
||||
&self,
|
||||
payload: SimulatePayload,
|
||||
|
||||
@ -56,13 +56,14 @@ metrics.workspace = true
|
||||
# misc
|
||||
auto_impl.workspace = true
|
||||
itertools.workspace = true
|
||||
notify = { workspace = true, default-features = false, features = ["macos_fsevent"] }
|
||||
notify = { workspace = true, default-features = false, features = [
|
||||
"macos_fsevent",
|
||||
] }
|
||||
parking_lot.workspace = true
|
||||
dashmap = { workspace = true, features = ["inline"] }
|
||||
strum.workspace = true
|
||||
|
||||
# test-utils
|
||||
once_cell = { workspace = true, optional = true }
|
||||
reth-ethereum-engine-primitives = { workspace = true, optional = true }
|
||||
alloy-consensus = { workspace = true, optional = true }
|
||||
|
||||
@ -79,20 +80,22 @@ parking_lot.workspace = true
|
||||
tempfile.workspace = true
|
||||
assert_matches.workspace = true
|
||||
rand.workspace = true
|
||||
once_cell.workspace = true
|
||||
eyre.workspace = true
|
||||
|
||||
alloy-consensus.workspace = true
|
||||
|
||||
[features]
|
||||
optimism = ["reth-primitives/optimism", "reth-execution-types/optimism", "reth-optimism-primitives"]
|
||||
optimism = [
|
||||
"reth-primitives/optimism",
|
||||
"reth-execution-types/optimism",
|
||||
"reth-optimism-primitives",
|
||||
]
|
||||
serde = ["reth-execution-types/serde"]
|
||||
test-utils = [
|
||||
"reth-db/test-utils",
|
||||
"reth-nippy-jar/test-utils",
|
||||
"reth-trie/test-utils",
|
||||
"reth-chain-state/test-utils",
|
||||
"once_cell",
|
||||
"reth-ethereum-engine-primitives",
|
||||
"alloy-consensus",
|
||||
]
|
||||
|
||||
@ -5,7 +5,7 @@ use alloy_primitives::{
|
||||
b256, hex_literal::hex, map::HashMap, Address, BlockNumber, Bytes, Log, Parity, Sealable,
|
||||
TxKind, B256, U256,
|
||||
};
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use reth_db::tables;
|
||||
use reth_db_api::{database::Database, models::StoredBlockBodyIndices};
|
||||
use reth_primitives::{
|
||||
@ -14,7 +14,7 @@ use reth_primitives::{
|
||||
};
|
||||
use reth_trie::root::{state_root_unhashed, storage_root_unhashed};
|
||||
use revm::{db::BundleState, primitives::AccountInfo};
|
||||
use std::str::FromStr;
|
||||
use std::{str::FromStr, sync::LazyLock};
|
||||
|
||||
/// Assert genesis block
|
||||
pub fn assert_genesis_block<DB: Database, Spec: Send + Sync>(
|
||||
@ -61,7 +61,7 @@ pub fn assert_genesis_block<DB: Database, Spec: Send + Sync>(
|
||||
// StageCheckpoints is not updated in tests
|
||||
}
|
||||
|
||||
pub(crate) static TEST_BLOCK: Lazy<SealedBlock> = Lazy::new(|| SealedBlock {
|
||||
pub(crate) static TEST_BLOCK: LazyLock<SealedBlock> = LazyLock::new(|| SealedBlock {
|
||||
header: SealedHeader::new(
|
||||
Header {
|
||||
parent_hash: hex!("c86e8cc0310ae7c531c758678ddbfd16fc51c8cef8cec650b032de9869e8b94f")
|
||||
|
||||
Reference in New Issue
Block a user