Skip to content

M3: on-curve pubkey validation is compiled out of production builds #684

Description

@Miracle656

Background

From the 2026-08-05 external security assessment, finding M3, still open.

contracts/factory/src/validation.rs gates on-curve public-key validation behind #[cfg(test)], so it runs in tests and is compiled out of production builds. The check passes in CI and does not exist on chain.

docs/MAINNET_READINESS.md lists it as one of three blockers before real funds:

  1. M3: on-curve pubkey validation compiled out of prod (#[cfg(test)] in contracts/factory/src/validation.rs). Flip it on before mainnet.

Sized honestly: the fix itself is small — flip the gate and make it compile. It is listed here because it is a mainnet blocker, not because it is large. The care is in confirming it still builds within budget and that the WASM hash change is handled properly.

What to build

  1. Remove the #[cfg(test)] gate so validation runs in production.
  2. cargo test — all contract tests pass.
  3. Confirm an invalid (off-curve) key is actually rejected by a deployed build, not only in a unit test.
  4. Check the WASM size delta. Validation costs bytes and the contract has a size budget — see docs/wasm-size-optimization.md.
  5. The WASM hash changes. Update contracts/expected-hashes.json from the CI log, per the repo convention.

Acceptance criteria

  • Validation is present in a release build — demonstrated by rejecting an off-curve key against a deployed contract, with the transaction hash in the PR
  • cargo test passes
  • WASM size delta reported in the PR, and within budget
  • contracts/expected-hashes.json updated from the CI log
  • docs/MAINNET_READINESS.md updated — M3 moves out of the blocker list

Notes

  • A unit test passing is not evidence here: the tests are what the #[cfg(test)] gate already satisfies. The load-bearing evidence is a deployed contract rejecting a bad key.
  • Do not update expected-hashes.json by running a local build; take the hash from the CI log, which is the reproducible one.

Drips Wave · Complexity: Intermediate · 100 points


Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions