Skip to content

client: Make sending a tx not panic and instead return an Error when signing fails - #3865

Merged
jacobcreech merged 11 commits into
otter-sec:masterfrom
cryptopapi997:ns/tx-not-panic
Nov 27, 2025
Merged

client: Make sending a tx not panic and instead return an Error when signing fails#3865
jacobcreech merged 11 commits into
otter-sec:masterfrom
cryptopapi997:ns/tx-not-panic

Conversation

@cryptopapi997

@cryptopapi997 cryptopapi997 commented Aug 20, 2025

Copy link
Copy Markdown
Contributor

It appears the reason why there were seemingly unused Results being returned by a bunch of transaction sending related functions in #3563 is because a signing failure used to return an Error at some point in the past (nowadays it just panics). Personally, I'm not a fan of this, esp as without #3563 as a developer you'd assume if you get returned a Result, that if something goes wrong it'd be part of that.

This PR makes it so. Alternatively, we could also add a comment above all functions calling signed_transaction_with_blockhash that indicates that this function will panic if signing fails, but I feel like a Result is more inline with how the rest of anchor handles this type of thing .

@vercel

vercel Bot commented Aug 20, 2025

Copy link
Copy Markdown

@cryptopapi997 is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@cryptopapi997

Copy link
Copy Markdown
Contributor Author

Also if this gets merged we should prob merge it before #3563 and then rebase that one, as otherwise we'd have #3563 removing the Result from a couple funcs and then this PR adding it right back lol

@jacobcreech jacobcreech moved this to Security Review Required in Anchor 1.0 Oct 21, 2025

@swaroop-osec swaroop-osec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@swaroop-osec

Copy link
Copy Markdown
Collaborator

@cryptopapi997 Can you please take a look at the failed tests?

@cryptopapi997

cryptopapi997 commented Oct 29, 2025

Copy link
Copy Markdown
Contributor Author

@swaroop-osec Fixed now. Good one to find too! My PR didn't introduce a bug directly that was causing the test to fail, but took a codepath that wasn't tested before (calling Requestbuilder::transaction()) which was broken because it didn't correctly build the transaction for the RequestBuilder as opposed to what the name claims, so this PR now includes a small bug fix as a bonus too.

Comment thread client/src/lib.rs Outdated

@jamie-osec jamie-osec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jamie-osec jamie-osec moved this from Security Review Required to Security Review Done in Anchor 1.0 Nov 12, 2025
@jacobcreech
jacobcreech merged commit 56d891a into otter-sec:master Nov 27, 2025
56 of 57 checks passed
@github-project-automation github-project-automation Bot moved this from Security Review Done to Done in Anchor 1.0 Nov 27, 2025
@cryptopapi997
cryptopapi997 deleted the ns/tx-not-panic branch November 27, 2025 04:50
akash-osec pushed a commit to akash-osec/anchor that referenced this pull request Mar 25, 2026
…signing fails (otter-sec#3865)

* .

* changelog

* switch error order

* copy over changes from other branch

* fix test

* switch to solana-signer
@jamie-osec jamie-osec added this to the v1.0.0 milestone Jun 23, 2026
akash-osec pushed a commit to akash-osec/anchor that referenced this pull request Jul 25, 2026
…signing fails (otter-sec#3865)

* .

* changelog

* switch error order

* copy over changes from other branch

* fix test

* switch to solana-signer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants