primitives: use alloy EMPTY_ constants (#11852)

This commit is contained in:
Thomas Coratger
2024-10-18 10:53:21 +02:00
committed by GitHub
parent 0c70f6bd35
commit 5859f93c56
6 changed files with 12 additions and 16 deletions

1
Cargo.lock generated
View File

@ -6340,6 +6340,7 @@ dependencies = [
name = "reth-basic-payload-builder" name = "reth-basic-payload-builder"
version = "1.1.0" version = "1.1.0"
dependencies = [ dependencies = [
"alloy-consensus",
"alloy-primitives", "alloy-primitives",
"alloy-rlp", "alloy-rlp",
"futures-core", "futures-core",

View File

@ -2,6 +2,7 @@ pub use alloy_eips::eip1559::BaseFeeParams;
use alloc::{boxed::Box, sync::Arc, vec::Vec}; use alloc::{boxed::Box, sync::Arc, vec::Vec};
use alloy_chains::{Chain, NamedChain}; use alloy_chains::{Chain, NamedChain};
use alloy_consensus::constants::EMPTY_WITHDRAWALS;
use alloy_genesis::Genesis; use alloy_genesis::Genesis;
use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256}; use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256};
use alloy_trie::EMPTY_ROOT_HASH; use alloy_trie::EMPTY_ROOT_HASH;
@ -18,8 +19,8 @@ use reth_network_peers::{
}; };
use reth_primitives_traits::{ use reth_primitives_traits::{
constants::{ constants::{
EIP1559_INITIAL_BASE_FEE, EMPTY_WITHDRAWALS, ETHEREUM_BLOCK_GAS_LIMIT, EIP1559_INITIAL_BASE_FEE, ETHEREUM_BLOCK_GAS_LIMIT, HOLESKY_GENESIS_HASH,
HOLESKY_GENESIS_HASH, SEPOLIA_GENESIS_HASH, SEPOLIA_GENESIS_HASH,
}, },
Header, SealedHeader, Header, SealedHeader,
}; };

View File

@ -26,6 +26,7 @@ reth-tasks.workspace = true
alloy-rlp.workspace = true alloy-rlp.workspace = true
alloy-primitives.workspace = true alloy-primitives.workspace = true
revm.workspace = true revm.workspace = true
alloy-consensus.workspace = true
# async # async
tokio = { workspace = true, features = ["sync", "time"] } tokio = { workspace = true, features = ["sync", "time"] }

View File

@ -9,6 +9,7 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use crate::metrics::PayloadBuilderMetrics; use crate::metrics::PayloadBuilderMetrics;
use alloy_consensus::constants::EMPTY_WITHDRAWALS;
use alloy_primitives::{Bytes, B256, U256}; use alloy_primitives::{Bytes, B256, U256};
use futures_core::ready; use futures_core::ready;
use futures_util::FutureExt; use futures_util::FutureExt;
@ -18,7 +19,7 @@ use reth_payload_builder::{
}; };
use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes, PayloadBuilderError}; use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes, PayloadBuilderError};
use reth_primitives::{ use reth_primitives::{
constants::{EMPTY_WITHDRAWALS, RETH_CLIENT_VERSION, SLOT_DURATION}, constants::{RETH_CLIENT_VERSION, SLOT_DURATION},
proofs, BlockNumberOrTag, SealedBlock, Withdrawals, proofs, BlockNumberOrTag, SealedBlock, Withdrawals,
}; };
use reth_provider::{ use reth_provider::{

View File

@ -1,6 +1,5 @@
//! Ethereum protocol-related constants //! Ethereum protocol-related constants
use alloy_consensus::EMPTY_ROOT_HASH;
use alloy_primitives::{address, b256, Address, B256, U256}; use alloy_primitives::{address, b256, Address, B256, U256};
use core::time::Duration; use core::time::Duration;
@ -112,15 +111,6 @@ pub const OP_SYSTEM_TX_FROM_ADDR: Address = address!("deaddeaddeaddeaddeaddeadde
/// To address from Optimism system txs: `0x4200000000000000000000000000000000000015` /// To address from Optimism system txs: `0x4200000000000000000000000000000000000015`
pub const OP_SYSTEM_TX_TO_ADDR: Address = address!("4200000000000000000000000000000000000015"); pub const OP_SYSTEM_TX_TO_ADDR: Address = address!("4200000000000000000000000000000000000015");
/// Transactions root of empty receipts set.
pub const EMPTY_RECEIPTS: B256 = EMPTY_ROOT_HASH;
/// Transactions root of empty transactions set.
pub const EMPTY_TRANSACTIONS: B256 = EMPTY_ROOT_HASH;
/// Withdrawals root of empty withdrawals set.
pub const EMPTY_WITHDRAWALS: B256 = EMPTY_ROOT_HASH;
/// The number of blocks to unwind during a reorg that already became a part of canonical chain. /// The number of blocks to unwind during a reorg that already became a part of canonical chain.
/// ///
/// In reality, the node can end up in this particular situation very rarely. It would happen only /// In reality, the node can end up in this particular situation very rarely. It would happen only

View File

@ -1,11 +1,13 @@
//! Common conversions from alloy types. //! Common conversions from alloy types.
use crate::{ use crate::{
constants::EMPTY_TRANSACTIONS, transaction::extract_chain_id, Block, BlockBody, Signature, transaction::extract_chain_id, Block, BlockBody, Signature, Transaction, TransactionSigned,
Transaction, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, TxType, TransactionSignedEcRecovered, TransactionSignedNoHash, TxType,
}; };
use alloc::{string::ToString, vec::Vec}; use alloc::{string::ToString, vec::Vec};
use alloy_consensus::{Transaction as _, TxEip1559, TxEip2930, TxEip4844, TxLegacy}; use alloy_consensus::{
constants::EMPTY_TRANSACTIONS, Transaction as _, TxEip1559, TxEip2930, TxEip4844, TxLegacy,
};
use alloy_primitives::{Parity, TxKind}; use alloy_primitives::{Parity, TxKind};
use alloy_rlp::Error as RlpError; use alloy_rlp::Error as RlpError;
use alloy_serde::WithOtherFields; use alloy_serde::WithOtherFields;