Skip to content

test(ed25519-verify): add mixed-order strict-parity regression vectors - #9

Open
latent-9 wants to merge 1 commit into
solana-program:mainfrom
latent-9:fix-cofactorless-verify-strict-torsion
Open

test(ed25519-verify): add mixed-order strict-parity regression vectors#9
latent-9 wants to merge 1 commit into
solana-program:mainfrom
latent-9:fix-cofactorless-verify-strict-torsion

Conversation

@latent-9

@latent-9 latent-9 commented Aug 15, 2026

Copy link
Copy Markdown

While fuzzing this crate against ed25519-dalek I found that the cofactorless strict preset disagreed with dalek's verify_strict on signatures where a low-order torsion component is folded into a prime-order public key. The root cause was the runtime scalar negation (L - H): the group order L is odd, so (L - H)*A differs from -(H*A) by L*A, which is only the identity when A has prime order. On a mixed-order key it leaves a non-identity L*T torsion component, so cofactorless verification returned the wrong verdict.

That fix has since landed in main as part of #10, which removes the runtime scalar negation. This PR adds the regression vectors that prove that fix:

  • Two public keys with order-2 and order-4 torsion folded into an otherwise prime-order key.
  • Two signatures that are valid ZIP-215 signatures over the same message, which dalek's verify_strict accepts.
  • The vectors are added to dalek_verify_strict_preset_matches_dalek, which asserts the preset returns the same verdict as dalek.

On the code before #10 the preset rejects these signatures (the bug), and on main it accepts them (fixed). No production code changes.

@latent-9

Copy link
Copy Markdown
Author

FYI: PR #11 refactors scalar.rs and verifier.rs, the same files this fix touches. Happy to rebase once it lands, or adapt the fix to the refactored code if that helps. Flagging it so the parity fix does not get lost in the refactor.

Fold order-2 and order-4 torsion into prime-order public keys and assert the
cofactorless strict preset agrees with ed25519-dalek's verify_strict on them.

These vectors fail on the code before the runtime scalar negation was removed
(PR solana-program#10) and pass on main. The maintainer fix replaces scalar::negate with a
negated basepoint constant; these vectors lock in that parity behavior.
@latent-9
latent-9 force-pushed the fix-cofactorless-verify-strict-torsion branch from a09654c to 06928b6 Compare August 22, 2026 01:44
@latent-9 latent-9 changed the title Fix dalek_verify_strict parity for mixed-order keys test(ed25519-verify): add mixed-order strict-parity regression vectors Aug 22, 2026
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