Skip to content

test(crypto): keep mock circuits impure for live - #850

Draft
0xisk wants to merge 1 commit into
mainfrom
test/crypto-mocks-impure
Draft

test(crypto): keep mock circuits impure for live#850
0xisk wants to merge 1 commit into
mainfrom
test/crypto-mocks-impure

Conversation

@0xisk

@0xisk 0xisk commented Sep 2, 2026

Copy link
Copy Markdown
Member

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Same technique already applied to MockEcdsa in #842.

Not visible in the diff:

  • Every crypto mock circuit was pure, so the artifacts shipped no keys/ or zkir/ and the specs passed on unit-live without proving anything. The _invocations counter is the only lever that forces impurity. Nothing was kept pure: none of these circuits is an oracle recomputing an expected value.
  • The counter is underscore-prefixed so it stays out of the generated ledger() reader. getPublicState() is still {} and the simulator ledger types are unchanged.
  • MockElGamal deploys 16 circuits where it deployed none. That is inside the local-node block-limit band, so the first live run has to confirm the deploy fits.
  • The suites only prove on a live run: live-tests label or a workflow dispatch.

PR Checklist

A mock whose circuits touch neither ledger nor witness has all of them
promoted to pure by the compiler, so the artifact ships no keys/ and no
zkir/ and the code is only ever evaluated in JS. The crypto specs then
pass identically on the live backend without proving anything.

An `_invocations` counter in each mock forces impurity, so every circuit
gets a proving key and a real proof on live. The specs move to
simulators to reach them.

The EcdhMask round-trip property drops to 3 runs on live: 100 runs is
200 transactions, well past the unit-live per-test timeout.
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Comment @coderabbitai help to get the list of available commands.

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