diff --git a/crates/proof-impl/evm-ee-stf/src/lib.rs b/crates/proof-impl/evm-ee-stf/src/lib.rs index 1989338ed8..e904b16dc7 100644 --- a/crates/proof-impl/evm-ee-stf/src/lib.rs +++ b/crates/proof-impl/evm-ee-stf/src/lib.rs @@ -73,7 +73,6 @@ pub fn process_block_transaction( // `ElBlockStfInput`. This will allow for efficient filtering of`WithdrawalIntentEvents`. let withdrawal_intents = collect_withdrawal_intents(receipts.into_iter().map(|el| Some(el.receipt))) - .flatten() .collect::>(); // Construct the public parameters for the proof diff --git a/crates/reth/evm/src/utils.rs b/crates/reth/evm/src/utils.rs index aca66d400b..d75da939ef 100644 --- a/crates/reth/evm/src/utils.rs +++ b/crates/reth/evm/src/utils.rs @@ -30,23 +30,21 @@ pub fn wei_to_sats(wei: U256) -> (U256, U256) { /// A [`Descriptor`], if invalid does not create an [`WithdrawalIntent`]. pub fn collect_withdrawal_intents( receipts: impl Iterator>, -) -> impl Iterator> { +) -> impl Iterator { receipts .flatten() .flat_map(|receipt| receipt.logs) .filter(|log| log.address == BRIDGEOUT_ADDRESS) .filter_map(|log| { WithdrawalIntentEvent::decode_log(&log, true) - .map(|evt| { - let descriptor = Descriptor::from_bytes(&evt.destination); - match descriptor { - Ok(valid_descriptor) => Some(WithdrawalIntent { + .ok() + .and_then(|evt| { + Descriptor::from_bytes(&evt.destination) + .ok() + .map(|valid_descriptor| WithdrawalIntent { amt: evt.amount, destination: valid_descriptor, - }), - Err(_) => None, - } + }) }) - .ok() }) } diff --git a/crates/reth/node/src/payload_builder.rs b/crates/reth/node/src/payload_builder.rs index 2c93db464b..771efdb324 100644 --- a/crates/reth/node/src/payload_builder.rs +++ b/crates/reth/node/src/payload_builder.rs @@ -412,9 +412,7 @@ where attributes.withdrawals().clone(), )?; - let withdrawal_intents = collect_withdrawal_intents(receipts.iter().cloned()) - .flatten() - .collect(); + let withdrawal_intents = collect_withdrawal_intents(receipts.iter().cloned()).collect(); // merge all transitions into bundle state, this would apply the withdrawal balance changes // and 4788 contract call