Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: moved optimism_receiptfn and its tests #10520

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

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

11 changes: 2 additions & 9 deletions crates/blockchain-tree/src/blockchain_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1386,14 +1386,10 @@ mod tests {
use reth_db_api::transaction::DbTxMut;
use reth_evm::test_utils::MockExecutorProvider;
use reth_evm_ethereum::execute::EthExecutorProvider;
#[cfg(not(feature = "optimism"))]
use reth_primitives::proofs::calculate_receipt_root;
#[cfg(feature = "optimism")]
use reth_primitives::proofs::calculate_receipt_root_optimism;
use reth_primitives::{
constants::{EIP1559_INITIAL_BASE_FEE, EMPTY_ROOT_HASH},
keccak256,
proofs::calculate_transaction_root,
proofs::{calculate_receipt_root, calculate_transaction_root},
revm_primitives::AccountInfo,
Account, Address, Header, Signature, Transaction, TransactionSigned,
TransactionSignedEcRecovered, TxEip1559, Withdrawals, B256,
Expand Down Expand Up @@ -1598,12 +1594,9 @@ mod tests {
})
.collect::<Vec<_>>();

#[cfg(not(feature = "optimism"))]
// receipts root computation is different for OP
let receipts_root = calculate_receipt_root(&receipts);

#[cfg(feature = "optimism")]
Redidacove marked this conversation as resolved.
Show resolved Hide resolved
let receipts_root = calculate_receipt_root_optimism(&receipts, &chain_spec, 0);

SealedBlockWithSenders::new(
SealedBlock {
header: Header {
Expand Down
3 changes: 2 additions & 1 deletion crates/ethereum-forks/src/hardfork/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ use crate::{hardfork, ChainHardforks, EthereumHardfork, ForkCondition, Hardfork}
hardfork!(
/// The name of an optimism hardfork.
///
/// When building a list of hardforks for a chain, it's still expected to mix with [`EthereumHardfork`].
/// When building a list of hardforks for a chain, it's still expected to mix with
/// [`EthereumHardfork`].
OptimismHardfork {
/// Bedrock: <https://blog.oplabs.co/introducing-optimism-bedrock>.
Bedrock,
Expand Down
12 changes: 9 additions & 3 deletions crates/optimism/consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ workspace = true

[dependencies]
# reth
reth-consensus-common.workspace = true
reth-chainspec.workspace = true
reth-primitives.workspace = true
reth-consensus-common.workspace = true
reth-consensus.workspace = true
reth-primitives.workspace = true
reth-trie-common.workspace = true

tracing.workspace = true

[dev-dependencies]
alloy-primitives.workspace = true
reth-optimism-chainspec.workspace = true


[features]
optimism = ["reth-primitives/optimism"]
optimism = ["reth-primitives/optimism"]
1 change: 1 addition & 0 deletions crates/optimism/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use reth_primitives::{
};
use std::{sync::Arc, time::SystemTime};

mod proof;
mod validation;
pub use validation::validate_block_post_execution;

Expand Down
323 changes: 323 additions & 0 deletions crates/optimism/consensus/src/proof.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/optimism/consensus/src/validation.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::proof::calculate_receipt_root_optimism;
use reth_chainspec::{ChainSpec, EthereumHardforks};
use reth_consensus::ConsensusError;
use reth_primitives::{
gas_spent_by_transactions, proofs::calculate_receipt_root_optimism, BlockWithSenders, Bloom,
GotExpected, Receipt, B256,
gas_spent_by_transactions, BlockWithSenders, Bloom, GotExpected, Receipt, B256,
};

/// Validate a block with regard to execution results:
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ repository.workspace = true
description = "OP primitive types"

[lints]
workspace = true
workspace = true
335 changes: 8 additions & 327 deletions crates/primitives/src/proofs.rs

Large diffs are not rendered by default.

Loading