Skip to content

Commit

Permalink
fix(reth): don't change the return type of collect_withdrawal_intents
Browse files Browse the repository at this point in the history
  • Loading branch information
storopoli committed Jan 22, 2025
1 parent e88e2f5 commit 26d6b54
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
1 change: 0 additions & 1 deletion crates/proof-impl/evm-ee-stf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>();

// Construct the public parameters for the proof
Expand Down
16 changes: 7 additions & 9 deletions crates/reth/evm/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Item = Option<Receipt>>,
) -> impl Iterator<Item = Option<WithdrawalIntent>> {
) -> impl Iterator<Item = WithdrawalIntent> {
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()
})
}
4 changes: 1 addition & 3 deletions crates/reth/node/src/payload_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 26d6b54

Please sign in to comment.