Skip to content

Commit

Permalink
chore: phase out reth-primitives from optimism consensus (#14548)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Feb 18, 2025
1 parent ffd0f11 commit 5fe28fd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

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

14 changes: 6 additions & 8 deletions crates/optimism/consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ reth-execution-types.workspace = true
reth-chainspec.workspace = true
reth-consensus-common.workspace = true
reth-consensus.workspace = true
reth-primitives.workspace = true
reth-primitives-traits.workspace = true
reth-storage-api.workspace = true
reth-storage-errors.workspace = true
Expand All @@ -26,7 +25,7 @@ reth-trie-common.workspace = true
# op-reth
reth-optimism-forks.workspace = true
reth-optimism-chainspec.workspace = true
# TODO: remove this after feature cleanup
# remove this after feature cleanup
reth-optimism-primitives = { workspace = true, features = ["serde", "reth-codec"] }

# ethereum
Expand All @@ -43,23 +42,22 @@ thiserror.workspace = true

[dev-dependencies]
reth-provider = { workspace = true, features = ["test-utils"] }
reth-trie-db.workspace = true
reth-db-common.workspace = true
reth-optimism-node.workspace = true
reth-revm.workspace = true
op-alloy-consensus.workspace = true
reth-trie.workspace = true
reth-optimism-chainspec.workspace = true
reth-optimism-node.workspace = true

alloy-chains.workspace = true
alloy-primitives.workspace = true
reth-optimism-chainspec.workspace = true
reth-trie.workspace = true
op-alloy-consensus.workspace = true

[features]
default = ["std"]
std = [
"reth-chainspec/std",
"reth-consensus/std",
"reth-consensus-common/std",
"reth-primitives/std",
"reth-primitives-traits/std",
"reth-optimism-forks/std",
"reth-optimism-chainspec/std",
Expand Down
6 changes: 4 additions & 2 deletions crates/optimism/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ use reth_consensus_common::validation::{
use reth_execution_types::BlockExecutionResult;
use reth_optimism_forks::OpHardforks;
use reth_optimism_primitives::DepositReceipt;
use reth_primitives::{GotExpected, NodePrimitives, RecoveredBlock, SealedHeader};
use reth_primitives_traits::{Block, BlockBody, BlockHeader, SealedBlock};
use reth_primitives_traits::{
Block, BlockBody, BlockHeader, GotExpected, NodePrimitives, RecoveredBlock, SealedBlock,
SealedHeader,
};

mod proof;
pub use proof::calculate_receipt_root_no_memo_optimism;
Expand Down
5 changes: 2 additions & 3 deletions crates/optimism/consensus/src/proof.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! Helper function for Receipt root calculation for Optimism hardforks.
use alloc::vec::Vec;
use alloy_consensus::ReceiptWithBloom;
use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::B256;
use alloy_trie::root::ordered_trie_root_with_encoder;
use reth_optimism_forks::OpHardforks;
use reth_optimism_primitives::DepositReceipt;
use reth_primitives::ReceiptWithBloom;

/// Calculates the receipt root for a header.
pub(crate) fn calculate_receipt_root_optimism<R: DepositReceipt>(
Expand Down Expand Up @@ -79,12 +79,11 @@ pub fn calculate_receipt_root_no_memo_optimism<R: DepositReceipt>(
#[cfg(test)]
mod tests {
use super::*;
use alloy_consensus::Receipt;
use alloy_consensus::{Receipt, ReceiptWithBloom};
use alloy_primitives::{b256, bloom, hex, Address, Bloom, Bytes, Log, LogData};
use op_alloy_consensus::OpDepositReceipt;
use reth_optimism_chainspec::BASE_SEPOLIA;
use reth_optimism_primitives::OpReceipt;
use reth_primitives::ReceiptWithBloom;

/// Tests that the receipt root is computed correctly for the regolith block.
/// This was implemented due to a minor bug in op-geth and op-erigon where in
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/consensus/src/validation/canyon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use alloy_consensus::BlockHeader;
use alloy_trie::EMPTY_ROOT_HASH;
use reth_consensus::ConsensusError;
use reth_primitives::GotExpected;
use reth_primitives_traits::GotExpected;

/// Verifies that withdrawals root in block header (Shanghai) is always [`EMPTY_ROOT_HASH`] in
/// Canyon.
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/consensus/src/validation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use reth_chainspec::{BaseFeeParams, EthChainSpec};
use reth_consensus::ConsensusError;
use reth_optimism_forks::OpHardforks;
use reth_optimism_primitives::DepositReceipt;
use reth_primitives::{gas_spent_by_transactions, GotExpected};
use reth_primitives_traits::{receipt::gas_spent_by_transactions, GotExpected};

/// Validate a block with regard to execution results:
///
Expand Down

0 comments on commit 5fe28fd

Please sign in to comment.