Refactor, add error enum, and add program id - #11
Open
samkim-crypto wants to merge 7 commits into
Open
Conversation
…8`, and `compute_challenge`
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.
Summary of Changes
Cleaned up a few things in the ed25519-verify crate for basic improvements and also consistency with the secp256k1-verify library.
ED25519_BASEPOINT_NEGATED_COMPRESSED,EDWARDS_IDENTITY_COMPRESSED) againstcurve25519-dalek, plus isolated coverage foris_small_order,multiply_by_8, andcompute_challenge. Also removed a deaddefault-features = falseined25519-program'sCargo.tomlthat had no effect.verifier.rs,scalar.rs, andlib.rsinto a singleconstants.rs, and moved basic point arithmetic logic inverifier.rsto a separatepoints.rsmodule.Ed25519VerifyError:Ed25519Verifier::verify_signaturenow returnsResult<(), Ed25519VerifyError>(six variants covering canonical/small-order rejections, malformed encoding, and signature mismatch) instead ofProgramError, andsolana-ed25519-verifyno longer depends onsolana-program-errorat all.ed25519-program'sprocess_instructionnow explicitly maps every verification failure toProgramError::InvalidInstructionData.verifyandinstructionCargo features (both default-on), so a client that only needs to build CPI instructions can depend oninstructionalone without pulling insolana-curve25519/solana-sha512-hasher.solana-address: Addeddeclare_id!("ed2DNnfPh19L66ahBPivbPkf5H1nW82zWTYGMjuQk9L")ininstruction.rs, exposingid()/ID, and migrated the crate (anded25519-program's tests) fromsolana-pubkey::Pubkeytosolana-address::Address.README.md: Documented the new error type, Cargo features, and canonical program ID. The CU cost table andmake cu-programwere left untouched, pending separate compute-unit testing in a follow-up PR.