Skip to content

Refactor, add error enum, and add program id - #11

Open
samkim-crypto wants to merge 7 commits into
solana-program:mainfrom
samkim-crypto:clean-up
Open

Refactor, add error enum, and add program id#11
samkim-crypto wants to merge 7 commits into
solana-program:mainfrom
samkim-crypto:clean-up

Conversation

@samkim-crypto

@samkim-crypto samkim-crypto commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

Cleaned up a few things in the ed25519-verify crate for basic improvements and also consistency with the secp256k1-verify library.

  • Safety-net tests: Added unit tests cross-checking the hand-transcribed curve constants (ED25519_BASEPOINT_NEGATED_COMPRESSED, EDWARDS_IDENTITY_COMPRESSED) against curve25519-dalek, plus isolated coverage for is_small_order, multiply_by_8, and compute_challenge. Also removed a dead default-features = false in ed25519-program's Cargo.toml that had no effect.
  • Constant consolidation & module split: Refactored the six curve/field constants previously scattered across verifier.rs, scalar.rs, and lib.rs into a single constants.rs, and moved basic point arithmetic logic in verifier.rs to a separate points.rs module.
  • Introduced Ed25519VerifyError: Ed25519Verifier::verify_signature now returns Result<(), Ed25519VerifyError> (six variants covering canonical/small-order rejections, malformed encoding, and signature mismatch) instead of ProgramError, and solana-ed25519-verify no longer depends on solana-program-error at all. ed25519-program's process_instruction now explicitly maps every verification failure to ProgramError::InvalidInstructionData.
  • Feature-gated the crate: Added verify and instruction Cargo features (both default-on), so a client that only needs to build CPI instructions can depend on instruction alone without pulling in solana-curve25519/solana-sha512-hasher.
  • Declared a canonical program ID and switched to solana-address: Added declare_id!("ed2DNnfPh19L66ahBPivbPkf5H1nW82zWTYGMjuQk9L") in instruction.rs, exposing id()/ID, and migrated the crate (and ed25519-program's tests) from solana-pubkey::Pubkey to solana-address::Address.
  • Updated README.md: Documented the new error type, Cargo features, and canonical program ID. The CU cost table and make cu-program were left untouched, pending separate compute-unit testing in a follow-up PR.

@samkim-crypto
samkim-crypto requested a review from zz-sol August 21, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant