Skip to content

ci: enforce Rust/TypeScript vector parity for verify_receipt (issue #53) - #245

Open
lawalajose wants to merge 1 commit into
accensa:mainfrom
lawalajose:issue-53-vector-parity
Open

ci: enforce Rust/TypeScript vector parity for verify_receipt (issue #53)#245
lawalajose wants to merge 1 commit into
accensa:mainfrom
lawalajose:issue-53-vector-parity

Conversation

@lawalajose

Copy link
Copy Markdown

Summary

Closes #53. The verify_receipt Merkle vectors were shared between this Rust contract and the accensa-app TypeScript SDK, but nothing automated kept the two copies from silently diverging. This establishes a single source of truth and a CI guard that fails the build on divergence.

What changed

  • Single source of truth: contracts/receipt-anchor/merkle-vectors.json is now the canonical vector set, with a committed content hash merkle-vectors.json.sha256. src/vectors.rs is generated from it by scripts/build-vectors.mjs (--check fails CI on drift or a stale hash).
  • Cross-repo guard: a vector-parity job in .github/workflows/ci.yml fetches accensa-app's vendored packages/sdk/merkle-vectors.json (pinned ACCELSA_APP_REF) and fails the build when its hash differs from ours. It runs on push to main, PRs, a daily schedule, and on repository_dispatch (a push here pings accensa-app). Strict on main/schedule/dispatch; a warning on PRs so the sync PR isn't blocked.
  • Extended vectors: now cover odd leaf counts requiring promotion (5-leaf), duplicate leaves, the sorted-pair tie (both siblings identical, 2-leaf [X,X]), and an over-long/wrong-length proof. A new test_shared_vectors_cover_required_edge_cases guard asserts these categories remain present.
  • Docs: docs/CONFORMANCE.md documents ownership, the three enforcement layers, and — importantly — what parity does not guarantee.

accensa-app side (required for full closure)

The mirror workflow and install steps live in cross-repo/accensa-app/ (.github/workflows/vector-parity.yml + README.md). A maintainer with access to accensa/accensa-app must open the companion PR that vendors the JSON + hash and adds that job. I could not open it from this environment — the ready-to-merge file and steps are provided there.

Verification

  • node contracts/receipt-anchor/scripts/build-vectors.mjs --check passes locally (vectors.rs + hash in sync).
  • All 19 vectors are validated in Node against the contract's exact sorted-pair SHA-256 fold (receipt-shard/src/lib.rs:127): every expected: true verifies, every negative case is rejected.

🤖 Generated with opencode

…ccensa#53)

Single source of truth: contracts/receipt-anchor/merkle-vectors.json owns the
shared Merkle inclusion vectors, with a committed content hash
(merkle-vectors.json.sha256). src/vectors.rs is now generated from it by
scripts/build-vectors.mjs; a --check mode fails CI on drift or a stale hash.

Cross-repo guard: a vector-parity job fetches accensa-app's vendored copy (pinned
ref) and fails the build on hash divergence; accensa-app runs the mirror job
(cross-repo/accensa-app). Strict on main/schedule/dispatch, warning on PRs so
the sync PR itself is not blocked.

Extended vectors to cover odd leaf counts requiring promotion, duplicate leaves,
the sorted-pair tie (both siblings identical), and an over-long/wrong-length
proof. A new test guard asserts these categories remain present.

See docs/CONFORMANCE.md for ownership, mechanism, and limits.
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@lawalajose 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

@mergekeeper

mergekeeper Bot commented Aug 27, 2026

Copy link
Copy Markdown

MergeKeeper review

Scope: in scope for linked issue #53.
Verdict: clean

Successfully implements CI enforcement of Rust/TypeScript vector parity for verify_receipt along with single source of truth, extended edge cases, and comprehensive documentation.

Reviewed commit: d4108bd079f0e59a8ace95ee08ffbebe13c1d45d.
CI and merge eligibility are checked separately.

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.

ci: enforce Rust/TypeScript vector parity for verify_receipt on every push

1 participant