-
Notifications
You must be signed in to change notification settings - Fork 19
Property-based fuzz tests for Stellar scalar arithmetic #3
Copy link
Copy link
Closed
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programcryptoCryptographic codeCryptographic codedripsFunded via Drips NetworkFunded via Drips Networkgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededstellarTouches Stellar / Soroban codeTouches Stellar / Soroban codetestTest coverage / harnessTest coverage / harness
Metadata
Metadata
Assignees
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programcryptoCryptographic codeCryptographic codedripsFunded via Drips NetworkFunded via Drips Networkgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededstellarTouches Stellar / Soroban codeTouches Stellar / Soroban codetestTest coverage / harnessTest coverage / harness
Type
Fields
Give feedbackNo fields configured for issues without a type.
Labels:
Stellar Wave,stellar,test,crypto,drips,help-wanted,good-first-issueTier: M (2–4 days)
Type: test
Context
Stealth address math involves a lot of scalar arithmetic mod L (the ed25519 group order). Unit tests cover specific values, but property-based tests are far better at catching the edge cases that break in production — overflow, wrap-around, near-boundary inputs, zero/identity, etc.
This issue adds
fast-check-driven property tests forsdk/src/chains/stellar/scalar.ts.Scope
Add
fast-checkas a dev-dependency and write property tests undertest/chains/stellar/properties.test.ts:Properties to cover
For all valid scalars
a, b, cand bytesxin the appropriate ranges:(a + b) + c == a + (b + c)mod La + b == b + amod La + 0 == amod LbytesToScalar(scalarToBytes(a)) == afor all validaseedToScalardeterminism: same seed → same scalar; different seeds → different scalars (with negligible collision probability)(m, s_h),(m + s_h) * G == m*G + s_h*G(the equation that makes stealth spending work)signWithScalarround-trip: for any scalaraand messagem,verify(signWithScalar(a, m), m, a*G) == trueConfiguration
fast-check'sBigInt-aware arbitraries for the scalar space.pnpm test:fuzzscript that bumps to 100,000.Acceptance criteria
Why this is a good first issue
The math is well-defined, the harness is contained to one file, and the acceptance criteria are objective (tests pass or don't). Good ramp for someone learning the Wraith codebase before tackling the larger audits.
Resources
fast-checkdocs: https://fast-check.dev/test/chains/stellar/scalar.test.ts