Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 491f154

Browse files
authored
primitives-traits: rm redundant definitions of EMPTY_OMMER_ROOT_HASH (paradigmxyz#11820)
1 parent 63a75fd commit 491f154

File tree

15 files changed

+24
-19
lines changed

15 files changed

+24
-19
lines changed

Cargo.lock

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ethereum/consensus/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ reth-consensus.workspace = true
1919

2020
# alloy
2121
alloy-primitives.workspace = true
22+
alloy-consensus.workspace = true
2223

2324
tracing.workspace = true

crates/ethereum/consensus/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
99
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
1010

11+
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
1112
use alloy_primitives::U256;
1213
use reth_chainspec::{EthChainSpec, EthereumHardfork, EthereumHardforks};
1314
use reth_consensus::{Consensus, ConsensusError, PostExecutionInput};
@@ -19,7 +20,6 @@ use reth_consensus_common::validation::{
1920
};
2021
use reth_primitives::{
2122
constants::MINIMUM_GAS_LIMIT, BlockWithSenders, Header, SealedBlock, SealedHeader,
22-
EMPTY_OMMER_ROOT_HASH,
2323
};
2424
use std::{fmt::Debug, sync::Arc, time::SystemTime};
2525

crates/ethereum/payload/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ revm-primitives.workspace = true
3434

3535
# alloy
3636
alloy-primitives.workspace = true
37+
alloy-consensus.workspace = true
3738

3839
# misc
3940
tracing.workspace = true

crates/ethereum/payload/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
1010
#![allow(clippy::useless_let_if_seq)]
1111

12+
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
1213
use alloy_primitives::U256;
1314
use reth_basic_payload_builder::{
1415
commit_withdrawals, is_better_payload, BuildArguments, BuildOutcome, PayloadBuilder,
@@ -26,7 +27,7 @@ use reth_primitives::{
2627
constants::{eip4844::MAX_DATA_GAS_PER_BLOCK, BEACON_NONCE},
2728
proofs::{self, calculate_requests_root},
2829
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
29-
Block, BlockBody, EthereumHardforks, Header, Receipt, EMPTY_OMMER_ROOT_HASH,
30+
Block, BlockBody, EthereumHardforks, Header, Receipt,
3031
};
3132
use reth_provider::{ChainSpecProvider, StateProviderFactory};
3233
use reth_revm::database::StateProviderDatabase;

crates/optimism/consensus/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ reth-optimism-chainspec.workspace = true
2525

2626
# ethereum
2727
alloy-primitives.workspace = true
28+
alloy-consensus.workspace = true
2829

2930
tracing.workspace = true
3031

crates/optimism/consensus/src/lib.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// The `optimism` feature must be enabled to use this crate.
1010
#![cfg(feature = "optimism")]
1111

12+
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
1213
use alloy_primitives::{B64, U256};
1314
use reth_chainspec::EthereumHardforks;
1415
use reth_consensus::{Consensus, ConsensusError, PostExecutionInput};
@@ -20,9 +21,7 @@ use reth_consensus_common::validation::{
2021
};
2122
use reth_optimism_chainspec::OpChainSpec;
2223
use reth_optimism_forks::OptimismHardforks;
23-
use reth_primitives::{
24-
BlockWithSenders, GotExpected, Header, SealedBlock, SealedHeader, EMPTY_OMMER_ROOT_HASH,
25-
};
24+
use reth_primitives::{BlockWithSenders, GotExpected, Header, SealedBlock, SealedHeader};
2625
use std::{sync::Arc, time::SystemTime};
2726

2827
mod proof;

crates/optimism/payload/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ alloy-rlp.workspace = true
4141
op-alloy-rpc-types-engine.workspace = true
4242
revm-primitives.workspace = true
4343
alloy-rpc-types-engine.workspace = true
44+
alloy-consensus.workspace = true
4445

4546
# misc
4647
tracing.workspace = true

crates/optimism/payload/src/builder.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use std::sync::Arc;
44

5+
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
56
use alloy_primitives::U256;
67
use reth_basic_payload_builder::*;
78
use reth_chain_state::ExecutedBlock;
@@ -16,7 +17,7 @@ use reth_primitives::{
1617
constants::BEACON_NONCE,
1718
proofs,
1819
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
19-
Block, BlockBody, Header, Receipt, TxType, EMPTY_OMMER_ROOT_HASH,
20+
Block, BlockBody, Header, Receipt, TxType,
2021
};
2122
use reth_provider::StateProviderFactory;
2223
use reth_revm::database::StateProviderDatabase;

crates/optimism/primitives/src/bedrock.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//! OP mainnet bedrock related data.
22
3-
use alloy_consensus::EMPTY_ROOT_HASH;
3+
use alloy_consensus::{EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH};
44
use alloy_primitives::{address, b256, bloom, bytes, B256, B64, U256};
55
use reth_primitives::Header;
6-
use reth_primitives_traits::constants::EMPTY_OMMER_ROOT_HASH;
76

87
/// Transaction 0x9ed8f713b2cc6439657db52dcd2fdb9cc944915428f3c6e2a7703e242b259cb9 in block 985,
98
/// replayed in blocks:

crates/primitives-traits/src/constants/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ pub const DEV_GENESIS_HASH: B256 =
119119
pub const KECCAK_EMPTY: B256 =
120120
b256!("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
121121

122-
/// Ommer root of empty list: `0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347`
123-
pub const EMPTY_OMMER_ROOT_HASH: B256 =
124-
b256!("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347");
125-
126122
/// From address from Optimism system txs: `0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001`
127123
pub const OP_SYSTEM_TX_FROM_ADDR: Address = address!("deaddeaddeaddeaddeaddeaddeaddeaddead0001");
128124

crates/primitives/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ pub use block::{
4040
#[cfg(feature = "reth-codec")]
4141
pub use compression::*;
4242
pub use constants::{
43-
DEV_GENESIS_HASH, EMPTY_OMMER_ROOT_HASH, HOLESKY_GENESIS_HASH, KECCAK_EMPTY,
44-
MAINNET_GENESIS_HASH, SEPOLIA_GENESIS_HASH,
43+
DEV_GENESIS_HASH, HOLESKY_GENESIS_HASH, KECCAK_EMPTY, MAINNET_GENESIS_HASH,
44+
SEPOLIA_GENESIS_HASH,
4545
};
4646
pub use receipt::{
4747
gas_spent_by_transactions, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Receipts,

crates/primitives/src/proofs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//! Helper function for calculating Merkle proofs and hashes.
22
33
use crate::{
4-
constants::EMPTY_OMMER_ROOT_HASH, Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef,
5-
Request, TransactionSigned, Withdrawal,
4+
Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Request, TransactionSigned, Withdrawal,
65
};
76
use alloc::vec::Vec;
7+
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
88
use alloy_eips::{eip2718::Encodable2718, eip7685::Encodable7685};
99
use alloy_primitives::{keccak256, B256};
1010
use reth_trie_common::root::{ordered_trie_root, ordered_trie_root_with_encoder};

crates/rpc/rpc-eth-api/src/helpers/pending_block.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::time::{Duration, Instant};
55

66
use crate::{EthApiTypes, FromEthApiError, FromEvmError};
77

8-
use alloy_consensus::EMPTY_ROOT_HASH;
8+
use alloy_consensus::{EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH};
99
use alloy_primitives::{BlockNumber, B256, U256};
1010
use alloy_rpc_types::BlockNumberOrTag;
1111
use futures::Future;
@@ -20,7 +20,7 @@ use reth_primitives::{
2020
ResultAndState, SpecId,
2121
},
2222
Block, BlockBody, Header, Receipt, Requests, SealedBlockWithSenders, SealedHeader,
23-
TransactionSignedEcRecovered, EMPTY_OMMER_ROOT_HASH,
23+
TransactionSignedEcRecovered,
2424
};
2525
use reth_provider::{
2626
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, ProviderError,

crates/rpc/rpc-types-compat/src/engine/payload.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Standalone Conversion Functions for Handling Different Versions of Execution Payloads in
22
//! Ethereum's Engine
33
4+
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
45
use alloy_eips::eip2718::{Decodable2718, Encodable2718};
56
use alloy_primitives::{B256, U256};
67
use alloy_rpc_types_engine::{
@@ -9,7 +10,7 @@ use alloy_rpc_types_engine::{
910
ExecutionPayloadV3, ExecutionPayloadV4, PayloadError,
1011
};
1112
use reth_primitives::{
12-
constants::{EMPTY_OMMER_ROOT_HASH, MAXIMUM_EXTRA_DATA_SIZE},
13+
constants::MAXIMUM_EXTRA_DATA_SIZE,
1314
proofs::{self},
1415
Block, BlockBody, Header, Request, SealedBlock, TransactionSigned, Withdrawals,
1516
};

0 commit comments

Comments
 (0)