mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
chore: bump alloy to 0.15.9, replace reth types with alloy's (#16069)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
317
Cargo.lock
generated
317
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
54
Cargo.toml
54
Cargo.toml
@@ -468,33 +468,33 @@ alloy-trie = { version = "0.8.1", default-features = false }
|
||||
|
||||
alloy-hardforks = "0.2.0"
|
||||
|
||||
alloy-consensus = { version = "0.15.7", default-features = false }
|
||||
alloy-contract = { version = "0.15.7", default-features = false }
|
||||
alloy-eips = { version = "0.15.7", default-features = false }
|
||||
alloy-genesis = { version = "0.15.7", default-features = false }
|
||||
alloy-json-rpc = { version = "0.15.7", default-features = false }
|
||||
alloy-network = { version = "0.15.7", default-features = false }
|
||||
alloy-network-primitives = { version = "0.15.7", default-features = false }
|
||||
alloy-provider = { version = "0.15.7", features = ["reqwest"], default-features = false }
|
||||
alloy-pubsub = { version = "0.15.7", default-features = false }
|
||||
alloy-rpc-client = { version = "0.15.7", default-features = false }
|
||||
alloy-rpc-types = { version = "0.15.7", features = ["eth"], default-features = false }
|
||||
alloy-rpc-types-admin = { version = "0.15.7", default-features = false }
|
||||
alloy-rpc-types-anvil = { version = "0.15.7", default-features = false }
|
||||
alloy-rpc-types-beacon = { version = "0.15.7", default-features = false }
|
||||
alloy-rpc-types-debug = { version = "0.15.7", default-features = false }
|
||||
alloy-rpc-types-engine = { version = "0.15.7", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "0.15.7", default-features = false }
|
||||
alloy-rpc-types-mev = { version = "0.15.7", default-features = false }
|
||||
alloy-rpc-types-trace = { version = "0.15.7", default-features = false }
|
||||
alloy-rpc-types-txpool = { version = "0.15.7", default-features = false }
|
||||
alloy-serde = { version = "0.15.7", default-features = false }
|
||||
alloy-signer = { version = "0.15.7", default-features = false }
|
||||
alloy-signer-local = { version = "0.15.7", default-features = false }
|
||||
alloy-transport = { version = "0.15.7" }
|
||||
alloy-transport-http = { version = "0.15.7", features = ["reqwest-rustls-tls"], default-features = false }
|
||||
alloy-transport-ipc = { version = "0.15.7", default-features = false }
|
||||
alloy-transport-ws = { version = "0.15.7", default-features = false }
|
||||
alloy-consensus = { version = "0.15.9", default-features = false }
|
||||
alloy-contract = { version = "0.15.9", default-features = false }
|
||||
alloy-eips = { version = "0.15.9", default-features = false }
|
||||
alloy-genesis = { version = "0.15.9", default-features = false }
|
||||
alloy-json-rpc = { version = "0.15.9", default-features = false }
|
||||
alloy-network = { version = "0.15.9", default-features = false }
|
||||
alloy-network-primitives = { version = "0.15.9", default-features = false }
|
||||
alloy-provider = { version = "0.15.9", features = ["reqwest"], default-features = false }
|
||||
alloy-pubsub = { version = "0.15.9", default-features = false }
|
||||
alloy-rpc-client = { version = "0.15.9", default-features = false }
|
||||
alloy-rpc-types = { version = "0.15.9", features = ["eth"], default-features = false }
|
||||
alloy-rpc-types-admin = { version = "0.15.9", default-features = false }
|
||||
alloy-rpc-types-anvil = { version = "0.15.9", default-features = false }
|
||||
alloy-rpc-types-beacon = { version = "0.15.9", default-features = false }
|
||||
alloy-rpc-types-debug = { version = "0.15.9", default-features = false }
|
||||
alloy-rpc-types-engine = { version = "0.15.9", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "0.15.9", default-features = false }
|
||||
alloy-rpc-types-mev = { version = "0.15.9", default-features = false }
|
||||
alloy-rpc-types-trace = { version = "0.15.9", default-features = false }
|
||||
alloy-rpc-types-txpool = { version = "0.15.9", default-features = false }
|
||||
alloy-serde = { version = "0.15.9", default-features = false }
|
||||
alloy-signer = { version = "0.15.9", default-features = false }
|
||||
alloy-signer-local = { version = "0.15.9", default-features = false }
|
||||
alloy-transport = { version = "0.15.9" }
|
||||
alloy-transport-http = { version = "0.15.9", features = ["reqwest-rustls-tls"], default-features = false }
|
||||
alloy-transport-ipc = { version = "0.15.9", default-features = false }
|
||||
alloy-transport-ws = { version = "0.15.9", default-features = false }
|
||||
|
||||
# op
|
||||
alloy-op-evm = { version = "0.6.0", default-features = false }
|
||||
|
||||
@@ -31,8 +31,7 @@ pub use info::ChainInfo;
|
||||
pub use spec::test_fork_ids;
|
||||
pub use spec::{
|
||||
make_genesis_header, BaseFeeParams, BaseFeeParamsKind, ChainSpec, ChainSpecBuilder,
|
||||
ChainSpecProvider, DepositContract, ForkBaseFeeParams, HardforkBlobParams, DEV, HOLESKY, HOODI,
|
||||
MAINNET, SEPOLIA,
|
||||
ChainSpecProvider, DepositContract, ForkBaseFeeParams, DEV, HOLESKY, HOODI, MAINNET, SEPOLIA,
|
||||
};
|
||||
|
||||
use reth_primitives_traits::sync::OnceLock;
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::{
|
||||
constants::{MAINNET_DEPOSIT_CONTRACT, MAINNET_PRUNE_DELETE_LIMIT},
|
||||
EthChainSpec,
|
||||
};
|
||||
use alloc::{boxed::Box, collections::BTreeMap, string::String, sync::Arc, vec::Vec};
|
||||
use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
||||
use alloy_chains::{Chain, NamedChain};
|
||||
use alloy_consensus::{
|
||||
constants::{
|
||||
@@ -16,7 +16,7 @@ use alloy_consensus::{
|
||||
};
|
||||
use alloy_eips::{
|
||||
eip1559::INITIAL_BASE_FEE, eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS,
|
||||
eip7685::EMPTY_REQUESTS_HASH, eip7840::BlobParams,
|
||||
eip7685::EMPTY_REQUESTS_HASH, eip7892::BlobScheduleBlobParams,
|
||||
};
|
||||
use alloy_genesis::Genesis;
|
||||
use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256};
|
||||
@@ -112,7 +112,7 @@ pub static MAINNET: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
|
||||
)),
|
||||
base_fee_params: BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
|
||||
prune_delete_limit: MAINNET_PRUNE_DELETE_LIMIT,
|
||||
blob_params: HardforkBlobParams::default(),
|
||||
blob_params: BlobScheduleBlobParams::default(),
|
||||
};
|
||||
spec.genesis.config.dao_fork_support = true;
|
||||
spec.into()
|
||||
@@ -141,7 +141,7 @@ pub static SEPOLIA: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
|
||||
)),
|
||||
base_fee_params: BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
|
||||
prune_delete_limit: 10000,
|
||||
blob_params: HardforkBlobParams::default(),
|
||||
blob_params: BlobScheduleBlobParams::default(),
|
||||
};
|
||||
spec.genesis.config.dao_fork_support = true;
|
||||
spec.into()
|
||||
@@ -168,7 +168,7 @@ pub static HOLESKY: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
|
||||
)),
|
||||
base_fee_params: BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
|
||||
prune_delete_limit: 10000,
|
||||
blob_params: HardforkBlobParams::default(),
|
||||
blob_params: BlobScheduleBlobParams::default(),
|
||||
};
|
||||
spec.genesis.config.dao_fork_support = true;
|
||||
spec.into()
|
||||
@@ -197,7 +197,7 @@ pub static HOODI: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
|
||||
)),
|
||||
base_fee_params: BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
|
||||
prune_delete_limit: 10000,
|
||||
blob_params: HardforkBlobParams::default(),
|
||||
blob_params: BlobScheduleBlobParams::default(),
|
||||
};
|
||||
spec.genesis.config.dao_fork_support = true;
|
||||
spec.into()
|
||||
@@ -261,32 +261,6 @@ impl From<ForkBaseFeeParams> for BaseFeeParamsKind {
|
||||
#[derive(Clone, Debug, PartialEq, Eq, From)]
|
||||
pub struct ForkBaseFeeParams(Vec<(Box<dyn Hardfork>, BaseFeeParams)>);
|
||||
|
||||
/// A container for hardforks that use eip-7804 blobs.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct HardforkBlobParams {
|
||||
/// Configuration for blob-related calculations for the Cancun hardfork.
|
||||
pub cancun: BlobParams,
|
||||
/// Configuration for blob-related calculations for the Prague hardfork.
|
||||
pub prague: BlobParams,
|
||||
}
|
||||
|
||||
impl HardforkBlobParams {
|
||||
/// Constructs params for chainspec from a provided blob schedule.
|
||||
/// Falls back to defaults if the schedule is missing.
|
||||
pub fn from_schedule(blob_schedule: &BTreeMap<String, BlobParams>) -> Self {
|
||||
Self {
|
||||
cancun: blob_schedule.get("cancun").copied().unwrap_or_else(BlobParams::cancun),
|
||||
prague: blob_schedule.get("prague").copied().unwrap_or_else(BlobParams::prague),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for HardforkBlobParams {
|
||||
fn default() -> Self {
|
||||
Self { cancun: BlobParams::cancun(), prague: BlobParams::prague() }
|
||||
}
|
||||
}
|
||||
|
||||
impl core::ops::Deref for ChainSpec {
|
||||
type Target = ChainHardforks;
|
||||
|
||||
@@ -330,7 +304,7 @@ pub struct ChainSpec {
|
||||
pub prune_delete_limit: usize,
|
||||
|
||||
/// The settings passed for blob configurations for specific hardforks.
|
||||
pub blob_params: HardforkBlobParams,
|
||||
pub blob_params: BlobScheduleBlobParams,
|
||||
}
|
||||
|
||||
impl Default for ChainSpec {
|
||||
@@ -746,7 +720,7 @@ impl From<Genesis> for ChainSpec {
|
||||
ordered_hardforks.append(&mut hardforks);
|
||||
|
||||
// Extract blob parameters directly from blob_schedule
|
||||
let blob_params = HardforkBlobParams::from_schedule(&genesis.config.blob_schedule);
|
||||
let blob_params = genesis.config.blob_schedule_blob_params();
|
||||
|
||||
// NOTE: in full node, we prune all receipts except the deposit contract's. We do not
|
||||
// have the deployment block in the genesis file, so we use block zero. We use the same
|
||||
@@ -1064,14 +1038,18 @@ mod tests {
|
||||
use super::*;
|
||||
use alloy_chains::Chain;
|
||||
use alloy_consensus::constants::ETH_TO_WEI;
|
||||
use alloy_eips::eip4844::BLOB_TX_MIN_BLOB_GASPRICE;
|
||||
use alloy_eips::{eip4844::BLOB_TX_MIN_BLOB_GASPRICE, eip7840::BlobParams};
|
||||
use alloy_evm::block::calc::{base_block_reward, block_reward};
|
||||
use alloy_genesis::{ChainConfig, GenesisAccount};
|
||||
use alloy_primitives::{b256, hex};
|
||||
use alloy_trie::{TrieAccount, EMPTY_ROOT_HASH};
|
||||
use core::ops::Deref;
|
||||
use reth_ethereum_forks::{ForkCondition, ForkHash, ForkId, Head};
|
||||
use std::{collections::HashMap, str::FromStr};
|
||||
use std::{
|
||||
collections::{BTreeMap, HashMap},
|
||||
str::FromStr,
|
||||
string::String,
|
||||
};
|
||||
|
||||
fn test_hardfork_fork_ids(spec: &ChainSpec, cases: &[(EthereumHardfork, ForkId)]) {
|
||||
for (hardfork, expected_id) in cases {
|
||||
@@ -2549,8 +2527,8 @@ Post-merge hard forks (timestamp based):
|
||||
}
|
||||
}"#;
|
||||
let schedule: BTreeMap<String, BlobParams> = serde_json::from_str(s).unwrap();
|
||||
let hardfork_params = HardforkBlobParams::from_schedule(&schedule);
|
||||
let expected = HardforkBlobParams {
|
||||
let hardfork_params = BlobScheduleBlobParams::from_schedule(&schedule);
|
||||
let expected = BlobScheduleBlobParams {
|
||||
cancun: BlobParams {
|
||||
target_blob_count: 3,
|
||||
max_blob_count: 6,
|
||||
@@ -2563,6 +2541,7 @@ Post-merge hard forks (timestamp based):
|
||||
update_fraction: 3338477,
|
||||
min_blob_fee: BLOB_TX_MIN_BLOB_GASPRICE,
|
||||
},
|
||||
scheduled: Default::default(),
|
||||
};
|
||||
assert_eq!(hardfork_params, expected);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ use alloy_evm::{
|
||||
};
|
||||
use alloy_primitives::{Bytes, U256};
|
||||
use core::{convert::Infallible, fmt::Debug};
|
||||
use reth_chainspec::{ChainSpec, EthChainSpec, HardforkBlobParams, MAINNET};
|
||||
use reth_chainspec::{ChainSpec, EthChainSpec, MAINNET};
|
||||
use reth_ethereum_primitives::{Block, EthPrimitives, TransactionSigned};
|
||||
use reth_evm::{ConfigureEvm, EvmEnv, EvmFactory, NextBlockEnvAttributes, TransactionEnv};
|
||||
use reth_primitives_traits::{SealedBlock, SealedHeader};
|
||||
@@ -101,7 +101,8 @@ impl<EvmFactory> EthEvmConfig<EvmFactory> {
|
||||
/// Returns blob params by hard fork as specified in chain spec.
|
||||
/// Blob params are in format `(spec id, target blob count, max blob count)`.
|
||||
pub fn blob_max_and_target_count_by_hardfork(&self) -> Vec<(SpecId, u64, u64)> {
|
||||
let HardforkBlobParams { cancun, prague } = self.chain_spec().blob_params;
|
||||
let cancun = self.chain_spec().blob_params.cancun();
|
||||
let prague = self.chain_spec().blob_params.prague();
|
||||
Vec::from([
|
||||
(SpecId::CANCUN, cancun.target_blob_count, cancun.max_blob_count),
|
||||
(SpecId::PRAGUE, prague.target_blob_count, prague.max_blob_count),
|
||||
|
||||
@@ -61,5 +61,6 @@ arbitrary = [
|
||||
"revm-primitives/arbitrary",
|
||||
"revm/arbitrary",
|
||||
"reth-ethereum/arbitrary",
|
||||
"alloy-rpc-types-engine/arbitrary",
|
||||
]
|
||||
default = []
|
||||
|
||||
Reference in New Issue
Block a user