Skip to content

Reject identity keys in the transaction circuit - #322

Open
HDauven wants to merge 2 commits into
phoenix/decoder-identityfrom
phoenix/identity-sender-key
Open

HDauven wants to merge 2 commits into
phoenix/decoder-identityfrom
phoenix/identity-sender-key

Conversation

@HDauven

@HDauven HDauven commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Stacked on #321.

  • The signature gadgets of jubjub-schnorr 0.7 constrain their key to differ from the identity, so the transaction circuit already rejects a sender key whose A or B is the identity. This adds a regression test for both keys and documents the dependency where the sender keys enter the circuit.
  • The circuit now also constrains the note key of each output, which the sender key is encrypted to, to differ from the identity. That costs one gate per key: two rows per circuit, no domain change. A regression test covers both outputs.

The circuits change, so the verifier-data test assets are updated.

Resolves #314

@HDauven
HDauven requested a balanced review from Copilot October 10, 2026 21:16
@HDauven
HDauven added this pull request to stack #328 October 10, 2026 21:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The changelog incorrectly presents existing behavior as a newly fixed bug.

1 open finding
What changed in this PR

Adds regression coverage confirming identity sender keys are unsatisfiable in the transaction circuit.

Changes:

  • Tests identity values for both sender key components.
  • Documents reliance on Schnorr’s non-identity constraint.
  • Updates test-helper lint handling and changelog.
File Description
circuits/​tests/​sender_key.rs Adds the identity-key regression test.
circuits/​tests/​common/​mod.rs Allows test-specific unused helper code.
circuits/​src/​sender_enc.rs Documents sender-key constraints.
circuits/​CHANGELOG.md Adds an inaccurate behavioral fix entry.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread circuits/CHANGELOG.md
@HDauven
HDauven force-pushed the phoenix/identity-sender-key branch from 3d38aff to 205c900 Compare October 10, 2026 23:13
@HDauven HDauven changed the title Test that an identity sender key is unsatisfiable Reject identity keys in the transaction circuit Oct 10, 2026
@HDauven

HDauven commented Oct 10, 2026

Copy link
Copy Markdown
Member Author

Force-pushed: added a commit that constrains the output note keys to differ from the identity, and moved the sender-key changelog entry to #320. The verifier-data assets and gate counts are updated.

@HDauven
HDauven force-pushed the phoenix/identity-sender-key branch from 205c900 to 4440cce Compare October 11, 2026 01:32
@HDauven

HDauven commented Oct 11, 2026

Copy link
Copy Markdown
Member Author

Force-pushed: rebased on the amended #320, with the verifier data regenerated.

@HDauven
HDauven marked this pull request as ready for review October 11, 2026 02:02

@moCello moCello left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE — The new constraint is sound: the type requires a subgroup point, in that subgroup only the identity has x = 0, and the inverse gate uses the same idiom as dusk-plonk's own truncation gadget. The regressions isolate the constraint they test. One small naming note below asks for nothing.

Comment thread circuits/tests/identity_keys.rs
A transaction whose sender public key has an identity `A` or `B` is
unsatisfiable, since the signature gadgets of jubjub-schnorr 0.7.0, the
version both crates require, reject identity keys. The circuit needs no
constraint of its own for it.

Document that the sender keys rely on it, and pin it with a regression:
a transaction with an identity `A`, then `B`, signed with a signature
that satisfies the signature equation for that key, must be
unsatisfiable, while the same construction proves for the honest key.
The transaction circuit encrypts the sender public key to the note
public key of each output, a public input it constrains to the
prime-order subgroup. That subgroup contains the identity, which is no
ElGamal key, and only the signature gadgets constrained their own keys
to differ from it.

Constrain each output note key to differ from the identity before the
sender encryption, as the signature gadgets of jubjub-schnorr do for
their keys: the prover supplies the inverse of the `x` coordinate,
which only the identity lacks in the subgroup, one gate per key.

The regression gives the first output, then the second, an identity
note key, with the sender encrypted to it as the circuit computes it,
and checks that both transactions are unsatisfiable while the honest
one proves. Without the constraint, both prove.

The circuits grow by two gates, which changes the verifier data of
every circuit, so the test assets are regenerated.
@HDauven
HDauven force-pushed the phoenix/identity-sender-key branch from 4440cce to 7843e47 Compare October 11, 2026 17:43
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.

Reject identity keys in the transaction circuit

3 participants