Repository navigation
feat(sdk): add solana.Secp256k1Recover - #10
Merged
Mister-Meeseeks merged 1 commit intoOct 19, 2026
Merged
Conversation
Secp256k1Recover(c, hash, recoveryID, signature, output) calls the runtime's sol_secp256k1_recover syscall (by name on fogo-v0, by its static hash 0x17e40350 on solana-v3) and writes the 64-byte uncompressed public key. Wrong hash, signature or output lengths return the new status 2018 without a syscall; runtime statuses (2 invalid recovery ID, 3 invalid signature) propagate unchanged and leave the output untouched. Native contexts supply a RecoverSecp256k1 callback. The C adapter lives in secp256k1.c.txt and is emitted only for programs that call Secp256k1Recover (usesSDK), so every existing program keeps byte-identical C and ELFs; the pre-Check corpus still matches. Tests: native bounds/status/copy checks, a native-Go/generated-C boundary differential, and a real-SBF suite on both profiles that compares recovered keys and statuses with an independent math/big oracle (valid signatures, the other parity, high-s, recovery IDs above 3 and 255, zero and out-of-range scalars, and a wrong-length call). The committed SDK-2 example snapshots are refreshed for the new API file.
This was referenced Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
There's no way to recover a secp256k1 key in SDK 2, and doing it in software isn't viable on CU. Any program that verifies EVM-style ECDSA signatures is blocked. In Hyperlane that's five of eleven programs.
Solution
solana.Secp256k1Recover(c, hash, recoveryID, signature, output) uint64wrapssol_secp256k1_recover(fogo-v0 by name, solana-v3 hash0x17e40350) and writes the 64-byte key.outputuntouched.Tests
math/bigoracle: both parities, high-s, recovery IDs 4 and 255, zero and out-of-range scalars, wrong lengths.Linked work
Closes #1, together with #9, #11. If this merges first, #1 should stay open until the rest land. #13 numbers its new code 2020 to avoid this PR's 2018. Used by hyperlane-xyz/hyperlane-monorepo#9852. Refreshes example SDK snapshots;
sdk_sha256conflicts with the other SDK PRs are mechanical.