Skip to content

Commit 0c70f6b

Browse files
authored
primitives: use alloy KECCAK_EMPTY constant (paradigmxyz#11851)
1 parent dfcaad4 commit 0c70f6b

File tree

9 files changed

+14
-11
lines changed

9 files changed

+14
-11
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ethereum/evm/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,14 @@ impl ConfigureEvm for EthEvmConfig {
194194
#[cfg(test)]
195195
mod tests {
196196
use super::*;
197+
use alloy_consensus::constants::KECCAK_EMPTY;
197198
use alloy_genesis::Genesis;
198199
use alloy_primitives::{B256, U256};
199200
use reth_chainspec::{Chain, ChainSpec, MAINNET};
200201
use reth_evm::execute::ProviderError;
201202
use reth_primitives::{
202203
revm_primitives::{BlockEnv, CfgEnv, SpecId},
203-
Header, KECCAK_EMPTY,
204+
Header,
204205
};
205206
use reth_revm::{
206207
db::{CacheDB, EmptyDBTyped},

crates/optimism/evm/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ impl ConfigureEvm for OptimismEvmConfig {
208208
#[cfg(test)]
209209
mod tests {
210210
use super::*;
211+
use alloy_consensus::constants::KECCAK_EMPTY;
211212
use alloy_genesis::Genesis;
212213
use alloy_primitives::{B256, U256};
213214
use reth_chainspec::ChainSpec;
@@ -216,7 +217,7 @@ mod tests {
216217
use reth_optimism_chainspec::BASE_MAINNET;
217218
use reth_primitives::{
218219
revm_primitives::{BlockEnv, CfgEnv, SpecId},
219-
Header, Receipt, Receipts, SealedBlockWithSenders, TxType, KECCAK_EMPTY,
220+
Header, Receipt, Receipts, SealedBlockWithSenders, TxType,
220221
};
221222
use reth_revm::{
222223
db::{CacheDB, EmptyDBTyped},

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ pub const SEPOLIA_GENESIS_HASH: B256 =
106106
pub const HOLESKY_GENESIS_HASH: B256 =
107107
b256!("b5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4");
108108

109-
/// Keccak256 over empty array: `0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`
110-
pub const KECCAK_EMPTY: B256 =
111-
b256!("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
112-
113109
/// From address from Optimism system txs: `0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001`
114110
pub const OP_SYSTEM_TX_FROM_ADDR: Address = address!("deaddeaddeaddeaddeaddeaddeaddeaddead0001");
115111

crates/primitives/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub use block::{
3939
};
4040
#[cfg(feature = "reth-codec")]
4141
pub use compression::*;
42-
pub use constants::{HOLESKY_GENESIS_HASH, KECCAK_EMPTY, SEPOLIA_GENESIS_HASH};
42+
pub use constants::{HOLESKY_GENESIS_HASH, SEPOLIA_GENESIS_HASH};
4343
pub use receipt::{
4444
gas_spent_by_transactions, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Receipts,
4545
};

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
//! Loads a pending block from database. Helper trait for `eth_` block, transaction, call and trace
22
//! RPC methods.
33
4+
use alloy_consensus::constants::KECCAK_EMPTY;
45
use alloy_primitives::{Address, Bytes, B256, U256};
56
use alloy_rpc_types::{serde_helpers::JsonStorageKey, Account, EIP1186AccountProofResponse};
67
use futures::Future;
78
use reth_chainspec::{EthChainSpec, EthereumHardforks};
89
use reth_errors::RethError;
910
use reth_evm::ConfigureEvmEnv;
10-
use reth_primitives::{BlockId, Header, KECCAK_EMPTY};
11+
use reth_primitives::{BlockId, Header};
1112
use reth_provider::{
1213
BlockIdReader, BlockNumReader, ChainSpecProvider, StateProvider, StateProviderBox,
1314
StateProviderFactory,

crates/storage/storage-api/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ reth-trie.workspace = true
2626
# ethereum
2727
alloy-eips.workspace = true
2828
alloy-primitives.workspace = true
29+
alloy-consensus.workspace = true
2930

3031
auto_impl.workspace = true

crates/storage/storage-api/src/state.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ use super::{
22
AccountReader, BlockHashReader, BlockIdReader, StateProofProvider, StateRootProvider,
33
StorageRootProvider,
44
};
5+
use alloy_consensus::constants::KECCAK_EMPTY;
56
use alloy_eips::{BlockId, BlockNumHash, BlockNumberOrTag};
67
use alloy_primitives::{Address, BlockHash, BlockNumber, StorageKey, StorageValue, B256, U256};
78
use auto_impl::auto_impl;
89
use reth_execution_types::ExecutionOutcome;
9-
use reth_primitives::{Bytecode, KECCAK_EMPTY};
10+
use reth_primitives::Bytecode;
1011
use reth_storage_errors::provider::{ProviderError, ProviderResult};
1112

1213
/// Type alias of boxed [`StateProvider`].

crates/trie/common/src/proofs.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Merkle trie proofs.
22
33
use crate::{Nibbles, TrieAccount};
4+
use alloy_consensus::constants::KECCAK_EMPTY;
45
use alloy_primitives::{keccak256, Address, Bytes, B256, U256};
56
use alloy_rlp::{encode_fixed_size, Decodable, EMPTY_STRING_CODE};
67
use alloy_trie::{
@@ -9,13 +10,13 @@ use alloy_trie::{
910
EMPTY_ROOT_HASH,
1011
};
1112
use itertools::Itertools;
12-
use reth_primitives_traits::{constants::KECCAK_EMPTY, Account};
13+
use reth_primitives_traits::Account;
1314
use serde::{Deserialize, Serialize};
1415
use std::collections::HashMap;
1516

1617
/// The state multiproof of target accounts and multiproofs of their storage tries.
1718
/// Multiproof is effectively a state subtrie that only contains the nodes
18-
/// in the paths of target accounts.
19+
/// in the paths of target accounts.
1920
#[derive(Clone, Default, Debug)]
2021
pub struct MultiProof {
2122
/// State trie multiproof for requested accounts.

0 commit comments

Comments
 (0)