Skip to content

feat: ed25519 & secp256k1 sig verification helper modules#3952

Merged
jacobcreech merged 14 commits intosolana-foundation:masterfrom
Otter-0x4ka5h:sig-verification
Nov 20, 2025
Merged

feat: ed25519 & secp256k1 sig verification helper modules#3952
jacobcreech merged 14 commits intosolana-foundation:masterfrom
Otter-0x4ka5h:sig-verification

Conversation

@Otter-0x4ka5h
Copy link
Copy Markdown
Contributor

Changes summary

Added signature_verifications/ module with:

  • ed25519::verify_ed25519_ix and secp256k1::verify_secp256k1_ix.

Implementations:

  • Validate sysvar program_id, no accounts, and bounds.
  • Added explicit checks.
Error handling:
  • Introduced specific error codes at the end of the constraint section: Ed25519InvalidProgram, Secp256k1InvalidProgram, InstructionHasAccounts, MessageTooLong, DataLengthMismatch, InvalidRecoveryId, NumSigsAddrsMismatch.

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 22, 2025

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

A member of the Team first needs to authorize it.

@swaroop-osec swaroop-osec self-requested a review September 23, 2025 19:41
Copy link
Copy Markdown
Collaborator

@swaroop-osec swaroop-osec left a comment

Choose a reason for hiding this comment

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

Also why there is two folders signature_verifications and signature_verification?

@Otter-0x4ka5h
Copy link
Copy Markdown
Contributor Author

Otter-0x4ka5h commented Sep 24, 2025

Also why there is two folders signature_verifications and signature_verification?

Initially I created signature_verifications and then I renamed it to signature_verification. there are no two folders, there is only one.

ah got it, the old folder still in the commits.

@swaroop-osec
Copy link
Copy Markdown
Collaborator

Closes #3944

@nutafrost nutafrost moved this to Security Review Required in Anchor 1.0 Sep 25, 2025
@nutafrost nutafrost removed this from Anchor 1.0 Sep 25, 2025
@nutafrost nutafrost moved this to Security Review Required in Anchor 1.0 Oct 7, 2025
@nutafrost nutafrost moved this from Security Review Required to Security Review Done in Anchor 1.0 Nov 4, 2025
@nutafrost nutafrost moved this from Security Review Done to Security Review Required in Anchor 1.0 Nov 4, 2025
@jamie-osec jamie-osec moved this from Security Review Required to Security Review Done in Anchor 1.0 Nov 7, 2025
Copy link
Copy Markdown
Collaborator

@jamie-osec jamie-osec left a comment

Choose a reason for hiding this comment

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

LGTM


expected.push(1u8); // num signatures
expected.extend_from_slice(&sig_offset.to_le_bytes());
expected.push(0u8); // sig ix idx
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we change this to always index into the current instruction (would require us to call solana_program::sysvar::instructions::load_current_index_checked) or add the index as an argument?

I think it's a bit confusing if verify_ed25519_ix operates on the current instruction, but verify_secp256k1_ix defaults to the first one.

Maybe both this functions should take an index as argument and we add two helper functions which always call them with the current index?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added

@jacobcreech jacobcreech merged commit 83bb40c into solana-foundation:master Nov 20, 2025
55 of 56 checks passed
@github-project-automation github-project-automation bot moved this from Security Review Done to Done in Anchor 1.0 Nov 20, 2025
jamie-osec added a commit to jamie-osec/anchor that referenced this pull request Jan 28, 2026
jamie-osec added a commit to jamie-osec/anchor that referenced this pull request Feb 5, 2026
jamie-osec added a commit to jamie-osec/anchor that referenced this pull request Feb 12, 2026
jamie-osec added a commit that referenced this pull request Feb 12, 2026
Otter-0x4ka5h added a commit to Otter-0x4ka5h/anchor that referenced this pull request Mar 25, 2026
…ndation#3952)

* feat: ed25519 & secp256k1 sig verification helper modules

* fix: fmt/clippy

* feat: workflow tests

* fix: yarn lint

* fix: yarn test

* fix: workflow tests with ts-mocha & naming errors

* fix: yarn lint

* fix: review comments

* fix: ref ix data itself for indecies

* cargo fmt -- --check

* cargo clippy

* chore(feat): requseted changes for seperate current index and ix params functions

---------

Co-authored-by: Akash Thota <your.email@example.com>
Co-authored-by: Akash Thota <Otter-0x4ka5h@osec.io>
Co-authored-by: Jacob Creech <82475023+jacobcreech@users.noreply.github.com>
Otter-0x4ka5h pushed a commit to Otter-0x4ka5h/anchor that referenced this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants