Skip to content

Commit

Permalink
primitives-traits: rm redundant definitions of EMPTY_OMMER_ROOT_HASH (
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Oct 17, 2024
1 parent 63a75fd commit 491f154
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 19 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/ethereum/consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ reth-consensus.workspace = true

# alloy
alloy-primitives.workspace = true
alloy-consensus.workspace = true

tracing.workspace = true
2 changes: 1 addition & 1 deletion crates/ethereum/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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};

Expand Down
1 change: 1 addition & 0 deletions crates/ethereum/payload/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ revm-primitives.workspace = true

# alloy
alloy-primitives.workspace = true
alloy-consensus.workspace = true

# misc
tracing.workspace = true
3 changes: 2 additions & 1 deletion crates/ethereum/payload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions crates/optimism/consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ reth-optimism-chainspec.workspace = true

# ethereum
alloy-primitives.workspace = true
alloy-consensus.workspace = true

tracing.workspace = true

Expand Down
5 changes: 2 additions & 3 deletions crates/optimism/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions crates/optimism/payload/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion crates/optimism/payload/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions crates/optimism/primitives/src/bedrock.rs
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 0 additions & 4 deletions crates/primitives-traits/src/constants/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/proofs.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-eth-api/src/helpers/pending_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-types-compat/src/engine/payload.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand All @@ -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,
};
Expand Down

0 comments on commit 491f154

Please sign in to comment.