Skip to content

Commit

Permalink
fix: use body.recover_signers_unchecked instead on `try_with_sender…
Browse files Browse the repository at this point in the history
…s_unchecked` (#12668)
  • Loading branch information
joshieDo authored Nov 20, 2024
1 parent 02a90e1 commit 10caa9f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions crates/primitives/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Block {
let senders = if self.body.transactions.len() == senders.len() {
senders
} else {
let Some(senders) = self.body.recover_signers() else { return Err(self) };
let Some(senders) = self.body.recover_signers_unchecked() else { return Err(self) };
senders
};

Expand Down Expand Up @@ -379,7 +379,7 @@ impl SealedBlock {
let senders = if self.body.transactions.len() == senders.len() {
senders
} else {
let Some(senders) = self.body.recover_signers() else { return Err(self) };
let Some(senders) = self.body.recover_signers_unchecked() else { return Err(self) };
senders
};

Expand Down Expand Up @@ -616,6 +616,15 @@ impl BlockBody {
TransactionSigned::recover_signers(&self.transactions, self.transactions.len())
}

/// Recover signer addresses for all transactions in the block body _without ensuring that the
/// signature has a low `s` value_.
///
/// Returns `None`, if some transaction's signature is invalid, see also
/// [`TransactionSigned::recover_signer_unchecked`].
pub fn recover_signers_unchecked(&self) -> Option<Vec<Address>> {
TransactionSigned::recover_signers_unchecked(&self.transactions, self.transactions.len())
}

/// Returns whether or not the block body contains any blob transactions.
#[inline]
pub fn has_blob_transactions(&self) -> bool {
Expand Down

0 comments on commit 10caa9f

Please sign in to comment.