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

fix: use body.recover_signers_unchecked instead on try_with_senders_unchecked #12668

Merged
merged 2 commits into from
Nov 20, 2024
Merged
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
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
Loading