Skip to content

test: add fast-check property tests for Stellar scalar arithmetic#28

Closed
TheDEV111 wants to merge 1 commit into
wraith-protocol:developfrom
TheDEV111:feat/stellar-property-tests
Closed

test: add fast-check property tests for Stellar scalar arithmetic#28
TheDEV111 wants to merge 1 commit into
wraith-protocol:developfrom
TheDEV111:feat/stellar-property-tests

Conversation

@TheDEV111
Copy link
Copy Markdown

Closes #3

Implements all eight properties from issue #3:

  • Scalar addition: associativity, commutativity, additive identity
  • Round-trip: bytesToScalar(scalarToBytes(a)) == a
  • seedToScalar: determinism and distinct-seed collision resistance
  • Stealth equation: (m + s_h)G == mG + s_h*G (homomorphism)
  • View-tag uniformity: chi-square over 10k sequential inputs
  • signWithScalar: signature verification, wrong-message/wrong-key rejection

Default run: 1000 cases. FC_RUNS=100000 via pnpm test:fuzz. Nightly CI job (slow-tests) runs the high-case version at 02:00 UTC.

Implements all eight properties from issue wraith-protocol#3:
- Scalar addition: associativity, commutativity, additive identity
- Round-trip: bytesToScalar(scalarToBytes(a)) == a
- seedToScalar: determinism and distinct-seed collision resistance
- Stealth equation: (m + s_h)*G == m*G + s_h*G (homomorphism)
- View-tag uniformity: chi-square over 10k sequential inputs
- signWithScalar: signature verification, wrong-message/wrong-key rejection

Default run: 1000 cases. FC_RUNS=100000 via pnpm test:fuzz.
Nightly CI job (slow-tests) runs the high-case version at 02:00 UTC.
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@TheDEV111 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@truthixify truthixify changed the base branch from main to develop June 1, 2026 15:26
@truthixify
Copy link
Copy Markdown
Contributor

Closing as a duplicate. Issue #3 is being addressed in #15 which was opened first and is currently waiting on a rebase. Sorry about the wasted effort, that's on us for not making assignment-tracking more visible.

Your PR is actually slightly more thorough than #15 in a couple of places. Specifically, you have:

  • signature is rejected for wrong message
  • signature is rejected for wrong public key
  • scalarToBytes always returns 32 bytes (length invariant)
  • output is always a valid scalar in [0, L-1] (seedToScalar range invariant)
  • deriveStealthPubKey(m*G, s_h) == (m + s_h)*G (alternative formulation of the stealth equation)

Once #15 lands, a small follow-up PR adding these as additional negative-path and invariant tests would be very welcome. Would you be up for that, @TheDEV111? I'll fast-track the review.

Other open Stellar Wave issues you'd be well-suited for, given the property-test rigor here:

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.

Property-based fuzz tests for Stellar scalar arithmetic

2 participants