From 392aee1ca5bea6c2768e7d70f33fefc4ba96ae60 Mon Sep 17 00:00:00 2001 From: Andreas Bigger Date: Wed, 16 Aug 2023 13:30:47 -0400 Subject: [PATCH 1/2] Mostly nit fixes and some small style changes. --- bin/reth/src/node/mod.rs | 8 +------- crates/interfaces/src/executor.rs | 1 + crates/primitives/src/receipt.rs | 15 +++------------ 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/bin/reth/src/node/mod.rs b/bin/reth/src/node/mod.rs index 992750c8d4a1..f99a029e8598 100644 --- a/bin/reth/src/node/mod.rs +++ b/bin/reth/src/node/mod.rs @@ -157,6 +157,7 @@ pub struct NodeCommand { #[clap(flatten)] pub ext: Ext::Node, + /// Rollup related arguments #[cfg(feature = "optimism")] #[clap(flatten)] rollup: crate::args::RollupArgs, @@ -210,13 +211,6 @@ impl NodeCommand { "Either feature \"optimism\" or \"ethereum\" must be enabled for this crate." ); - // We cannot do this since runs with `--all-features` will error. - // See mutually exclusive features discussion here: - // https://github.com/rust-lang/cargo/issues/2980 - // - // #[cfg(all(feature = "ethereum", feature = "optimism"))] - // compile_error!("Cannot use both \"optimism\" and \"ethereum\" feature flags."); - // Raise the fd limit of the process. // Does not do anything on windows. raise_fd_limit(); diff --git a/crates/interfaces/src/executor.rs b/crates/interfaces/src/executor.rs index 4fce270a6edb..593aa3d4a894 100644 --- a/crates/interfaces/src/executor.rs +++ b/crates/interfaces/src/executor.rs @@ -42,6 +42,7 @@ pub enum BlockExecutionError { CanonicalRevert { inner: String }, #[error("Transaction error on commit: {inner:?}")] CanonicalCommit { inner: String }, + // === tree errors === // TODO(mattsse): move this to tree error #[error("Block hash {block_hash} not found in blockchain tree chain")] diff --git a/crates/primitives/src/receipt.rs b/crates/primitives/src/receipt.rs index c62b0f4eb7d6..e9b076353d7e 100644 --- a/crates/primitives/src/receipt.rs +++ b/crates/primitives/src/receipt.rs @@ -109,8 +109,7 @@ impl ReceiptWithBloom { TxType::DEPOSIT => { let consumed = started_len - b.len(); let has_nonce = rlp_head.payload_length - consumed > 0; - let deposit_nonce = - if has_nonce { Some(reth_rlp::Decodable::decode(b)?) } else { None }; + let deposit_nonce = has_nonce.then_some(reth_rlp::Decodable::decode(b)?); Receipt { tx_type, success, cumulative_gas_used, logs, deposit_nonce } } @@ -205,21 +204,13 @@ impl proptest::arbitrary::Arbitrary for Receipt { logs in proptest::collection::vec(proptest::arbitrary::any::(), 0..=20), _deposit_nonce in any::>()) -> Receipt { - - // Only reecipts for deposit transactions may contain a deposit nonce - #[cfg(feature = "optimism")] - let deposit_nonce = if tx_type == TxType::DEPOSIT { - _deposit_nonce - } else { - None - }; - Receipt { tx_type, success, cumulative_gas_used, logs, + // Only reecipts for deposit transactions may contain a deposit nonce #[cfg(feature = "optimism")] - deposit_nonce + deposit_nonce: (tx_type == TxType::DEPOSIT).then_some(_deposit_nonce).flatten() } } }; From fc6bb2084ae756538d963c31ff74ff8e7081eb83 Mon Sep 17 00:00:00 2001 From: Andreas Bigger Date: Thu, 17 Aug 2023 16:31:19 -0400 Subject: [PATCH 2/2] Fixed internal unwrapping issue --- crates/primitives/src/receipt.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/primitives/src/receipt.rs b/crates/primitives/src/receipt.rs index e9b076353d7e..b62e835cf7a6 100644 --- a/crates/primitives/src/receipt.rs +++ b/crates/primitives/src/receipt.rs @@ -109,7 +109,8 @@ impl ReceiptWithBloom { TxType::DEPOSIT => { let consumed = started_len - b.len(); let has_nonce = rlp_head.payload_length - consumed > 0; - let deposit_nonce = has_nonce.then_some(reth_rlp::Decodable::decode(b)?); + let deposit_nonce = + if has_nonce { Some(reth_rlp::Decodable::decode(b)?) } else { None }; Receipt { tx_type, success, cumulative_gas_used, logs, deposit_nonce } }