primitives-traits: rm redundant definitions of EMPTY_OMMER_ROOT_HASH (#11820)

This commit is contained in:
Thomas Coratger
2024-10-17 11:30:26 +02:00
committed by GitHub
parent 63a75fdd95
commit 491f154c34
15 changed files with 24 additions and 19 deletions

4
Cargo.lock generated
View File

@ -7270,6 +7270,7 @@ dependencies = [
name = "reth-ethereum-consensus"
version = "1.1.0"
dependencies = [
"alloy-consensus",
"alloy-primitives",
"reth-chainspec",
"reth-consensus",
@ -7320,6 +7321,7 @@ dependencies = [
name = "reth-ethereum-payload-builder"
version = "1.1.0"
dependencies = [
"alloy-consensus",
"alloy-primitives",
"reth-basic-payload-builder",
"reth-chain-state",
@ -8086,6 +8088,7 @@ dependencies = [
name = "reth-optimism-consensus"
version = "1.1.0"
dependencies = [
"alloy-consensus",
"alloy-primitives",
"reth-chainspec",
"reth-consensus",
@ -8194,6 +8197,7 @@ dependencies = [
name = "reth-optimism-payload-builder"
version = "1.1.0"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-primitives",
"alloy-rlp",

View File

@ -19,5 +19,6 @@ reth-consensus.workspace = true
# alloy
alloy-primitives.workspace = true
alloy-consensus.workspace = true
tracing.workspace = true

View File

@ -8,6 +8,7 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
use alloy_primitives::U256;
use reth_chainspec::{EthChainSpec, EthereumHardfork, EthereumHardforks};
use reth_consensus::{Consensus, ConsensusError, PostExecutionInput};
@ -19,7 +20,6 @@ use reth_consensus_common::validation::{
};
use reth_primitives::{
constants::MINIMUM_GAS_LIMIT, BlockWithSenders, Header, SealedBlock, SealedHeader,
EMPTY_OMMER_ROOT_HASH,
};
use std::{fmt::Debug, sync::Arc, time::SystemTime};

View File

@ -34,6 +34,7 @@ revm-primitives.workspace = true
# alloy
alloy-primitives.workspace = true
alloy-consensus.workspace = true
# misc
tracing.workspace = true

View File

@ -9,6 +9,7 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![allow(clippy::useless_let_if_seq)]
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
use alloy_primitives::U256;
use reth_basic_payload_builder::{
commit_withdrawals, is_better_payload, BuildArguments, BuildOutcome, PayloadBuilder,
@ -26,7 +27,7 @@ use reth_primitives::{
constants::{eip4844::MAX_DATA_GAS_PER_BLOCK, BEACON_NONCE},
proofs::{self, calculate_requests_root},
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
Block, BlockBody, EthereumHardforks, Header, Receipt, EMPTY_OMMER_ROOT_HASH,
Block, BlockBody, EthereumHardforks, Header, Receipt,
};
use reth_provider::{ChainSpecProvider, StateProviderFactory};
use reth_revm::database::StateProviderDatabase;

View File

@ -25,6 +25,7 @@ reth-optimism-chainspec.workspace = true
# ethereum
alloy-primitives.workspace = true
alloy-consensus.workspace = true
tracing.workspace = true

View File

@ -9,6 +9,7 @@
// The `optimism` feature must be enabled to use this crate.
#![cfg(feature = "optimism")]
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
use alloy_primitives::{B64, U256};
use reth_chainspec::EthereumHardforks;
use reth_consensus::{Consensus, ConsensusError, PostExecutionInput};
@ -20,9 +21,7 @@ use reth_consensus_common::validation::{
};
use reth_optimism_chainspec::OpChainSpec;
use reth_optimism_forks::OptimismHardforks;
use reth_primitives::{
BlockWithSenders, GotExpected, Header, SealedBlock, SealedHeader, EMPTY_OMMER_ROOT_HASH,
};
use reth_primitives::{BlockWithSenders, GotExpected, Header, SealedBlock, SealedHeader};
use std::{sync::Arc, time::SystemTime};
mod proof;

View File

@ -41,6 +41,7 @@ alloy-rlp.workspace = true
op-alloy-rpc-types-engine.workspace = true
revm-primitives.workspace = true
alloy-rpc-types-engine.workspace = true
alloy-consensus.workspace = true
# misc
tracing.workspace = true

View File

@ -2,6 +2,7 @@
use std::sync::Arc;
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
use alloy_primitives::U256;
use reth_basic_payload_builder::*;
use reth_chain_state::ExecutedBlock;
@ -16,7 +17,7 @@ use reth_primitives::{
constants::BEACON_NONCE,
proofs,
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
Block, BlockBody, Header, Receipt, TxType, EMPTY_OMMER_ROOT_HASH,
Block, BlockBody, Header, Receipt, TxType,
};
use reth_provider::StateProviderFactory;
use reth_revm::database::StateProviderDatabase;

View File

@ -1,9 +1,8 @@
//! OP mainnet bedrock related data.
use alloy_consensus::EMPTY_ROOT_HASH;
use alloy_consensus::{EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH};
use alloy_primitives::{address, b256, bloom, bytes, B256, B64, U256};
use reth_primitives::Header;
use reth_primitives_traits::constants::EMPTY_OMMER_ROOT_HASH;
/// Transaction 0x9ed8f713b2cc6439657db52dcd2fdb9cc944915428f3c6e2a7703e242b259cb9 in block 985,
/// replayed in blocks:

View File

@ -119,10 +119,6 @@ pub const DEV_GENESIS_HASH: B256 =
pub const KECCAK_EMPTY: B256 =
b256!("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
/// Ommer root of empty list: `0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347`
pub const EMPTY_OMMER_ROOT_HASH: B256 =
b256!("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347");
/// From address from Optimism system txs: `0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001`
pub const OP_SYSTEM_TX_FROM_ADDR: Address = address!("deaddeaddeaddeaddeaddeaddeaddeaddead0001");

View File

@ -40,8 +40,8 @@ pub use block::{
#[cfg(feature = "reth-codec")]
pub use compression::*;
pub use constants::{
DEV_GENESIS_HASH, EMPTY_OMMER_ROOT_HASH, HOLESKY_GENESIS_HASH, KECCAK_EMPTY,
MAINNET_GENESIS_HASH, SEPOLIA_GENESIS_HASH,
DEV_GENESIS_HASH, HOLESKY_GENESIS_HASH, KECCAK_EMPTY, MAINNET_GENESIS_HASH,
SEPOLIA_GENESIS_HASH,
};
pub use receipt::{
gas_spent_by_transactions, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Receipts,

View File

@ -1,10 +1,10 @@
//! Helper function for calculating Merkle proofs and hashes.
use crate::{
constants::EMPTY_OMMER_ROOT_HASH, Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef,
Request, TransactionSigned, Withdrawal,
Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Request, TransactionSigned, Withdrawal,
};
use alloc::vec::Vec;
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
use alloy_eips::{eip2718::Encodable2718, eip7685::Encodable7685};
use alloy_primitives::{keccak256, B256};
use reth_trie_common::root::{ordered_trie_root, ordered_trie_root_with_encoder};

View File

@ -5,7 +5,7 @@ use std::time::{Duration, Instant};
use crate::{EthApiTypes, FromEthApiError, FromEvmError};
use alloy_consensus::EMPTY_ROOT_HASH;
use alloy_consensus::{EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH};
use alloy_primitives::{BlockNumber, B256, U256};
use alloy_rpc_types::BlockNumberOrTag;
use futures::Future;
@ -20,7 +20,7 @@ use reth_primitives::{
ResultAndState, SpecId,
},
Block, BlockBody, Header, Receipt, Requests, SealedBlockWithSenders, SealedHeader,
TransactionSignedEcRecovered, EMPTY_OMMER_ROOT_HASH,
TransactionSignedEcRecovered,
};
use reth_provider::{
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, ProviderError,

View File

@ -1,6 +1,7 @@
//! Standalone Conversion Functions for Handling Different Versions of Execution Payloads in
//! Ethereum's Engine
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
use alloy_eips::eip2718::{Decodable2718, Encodable2718};
use alloy_primitives::{B256, U256};
use alloy_rpc_types_engine::{
@ -9,7 +10,7 @@ use alloy_rpc_types_engine::{
ExecutionPayloadV3, ExecutionPayloadV4, PayloadError,
};
use reth_primitives::{
constants::{EMPTY_OMMER_ROOT_HASH, MAXIMUM_EXTRA_DATA_SIZE},
constants::MAXIMUM_EXTRA_DATA_SIZE,
proofs::{self},
Block, BlockBody, Header, Request, SealedBlock, TransactionSigned, Withdrawals,
};