Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
eb8ddd6
docs(adr): ADR-0054 encrypted DKG share delivery with HPKE (proposed)
satran004 Oct 5, 2026
9a2f7ab
docs(adr): ADR-0054 r2 — address review round 1 (F1–F2)
satran004 Oct 5, 2026
cc63762
docs(adr): ADR-0054 r3 — address review round 2 (F3)
satran004 Oct 5, 2026
b8521d7
Merge remote-tracking branch 'origin/main' into design/adr-0054-hpke-…
satran004 Oct 9, 2026
afe4d8d
docs(adr): ADR-0054 status Accepted (design); Q1–Q8 leans adopted
satran004 Oct 9, 2026
5f1c25b
feat(dkg): ADR-0054 M0 — normative dkg-share-delivery-hpke-v1 spec, i…
satran004 Oct 9, 2026
bc64e7b
feat(dkg): ADR-0054 M1 — HPKE (RFC 9180 Base) and X25519 handling on …
satran004 Oct 9, 2026
e0fe7e2
feat(dkg): ADR-0054 M2 — encrypted DKG share delivery over the board
satran004 Oct 9, 2026
c51d372
docs(dkg): ADR-0054 M3 — support matrix, guide, ADR-0053 Q1/Q7 notes,…
satran004 Oct 9, 2026
acaff08
fix(dkg): ADR-0054 final review — platform faults fail closed, instan…
satran004 Oct 9, 2026
ece0691
fix(dkg): ADR-0054 review round 2 — provider-independent small-order …
satran004 Oct 9, 2026
6174e2a
fix(dkg): ADR-0054 review round 3 — known-answer self-test, I10 wordi…
satran004 Oct 9, 2026
a3b67a1
docs(dkg): ADR-0054 spec §4.2 — small order decided as in §2.2
satran004 Oct 9, 2026
914b68c
fix(dkg): ADR-0054 review F4 — wipe HPKE intermediates when HKDF fails
satran004 Oct 9, 2026
52e9bf5
fix(dkg): ADR-0054 external review of 914b68c — lifecycle checks befo…
satran004 Oct 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/adr/0053-threshold-elgamal-jubjub-dkg.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Accepted (design) — 2026-10-05.
- Q2–Q6 were decided by the maintainer on 2026-10-05: each recorded lean is adopted. Q1 (the
private channels) stays escalated and does not block the library, whose transport is
pluggable (#77).
- **2026-10-09:** Q1 is answered by ADR-0054 (Accepted), which provides an optional ZeroJ
transport for the private shares: HPKE-encrypted envelopes on the board. Q7 is resolved for
deployments that use that transport and meet its delivery contract (ADR-0054 Q6). Neither
changes this ADR's protocol, encodings or admission.

This ADR builds on ADR-0052 (Accepted). It changes no maturity claim. ADR-0039's assurance
classes apply: every secret-bearing operation here is **compatibility/offline** class.
Expand Down Expand Up @@ -510,6 +514,11 @@ ADR-0052's host API, ADR-0052's own M0 and M1 come first (see the PR description
would need its own pinned references and review.
- Lean: (a). **Escalated**, and still open; tracked in #77. The library takes no position:
the transport is the application's.
- **Answered 2026-10-09 by ADR-0054 (Accepted).** It adds an optional transport,
`dkg-share-delivery-hpke-v1`: each `SHARE` is HPKE-encrypted (RFC 9180) to a per-attempt
recipient key and posted on the board. It is a pinned standard used as specified, not new
cryptography, and replacing ideal channels by encryption is stated there as Assumption A1,
for external review. Option (a) stays available.
2. **Q2 (D2): thresholds above a majority**, such as 4-of-5.
- Lean: unsupported. Theorem 1 covers only `t < n/2`.
- **Decided 2026-10-05 (maintainer): lean adopted.**
Expand Down Expand Up @@ -543,6 +552,17 @@ ADR-0052's host API, ADR-0052's own M0 and M1 come first (see the PR description
disqualification. This changes `QUAL` semantics and needs analysis;
- (c) use a construction from the asynchronous-DKG literature (out of scope, D8).
- Lean: (a), with the transport review gate covering deadlines. **Escalated.**
- **Resolved 2026-10-09, scoped (ADR-0054 Q6).** For deployments that use
`dkg-share-delivery-hpke-v1` and meet its contract, a share is delivered when its envelope
is in the final round-1 window. Three rules then apply:
- the processing barrier (ADR-0054 D6a);
- abort T1 for a missing own key (D4);
- a dealer's `COMMITMENTS` only after its envelopes are final (D7a).

Together they make an honest recipient's false absence complaint impossible, and keep every
answer by an honest qualified dealer at a corrupted index. Secrecy then no longer depends on
publication timing. The precondition, and this question, stay as stated above for
application-provided channels.

## Related findings (out of scope)

Expand Down
834 changes: 834 additions & 0 deletions docs/adr/0054-hpke-dkg-share-delivery.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/adr/circuit-annotation/cardano-gadget-support-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ Relevant source:
| `ZkPedersenCommitment`, `ZkPedersen.assertBalanced` | Typed in-circuit commitments with origin tracking; no-wraparound balance helper (ADR-0051 D3/D3a) | Requires BLS12-381 scalar field | Direct | Experimental, pending review and external review | Unopened external commitments enter only through `witnessInSubgroup` (in-circuit subgroup proof, 5,547 rows) or `fromVerifierCheckedPublic` (public coordinates; the verifier runs `PedersenCommitment.decode`). `assertBalanced` refuses, at definition time, any side whose maximum `Σ coefficient·(2^width − 1)` reaches `l`, then asserts the integer relation on committed values. |
| `ZkPedersenVector`, `InCircuitPedersenVector`, `PedersenVectorCommitment` | `pedersen-jubjub-vector-v1`: commitment to up to 16 values (ADR-0051 D5) | Requires BLS12-381 scalar field | Direct | Experimental, pending spec review and external review | Bases from Zcash `FindGroupHash` (`ZeroJ_PV`), pinned and checked against Zcash known answers. The point binds neither length nor schema: every proof binds a public schema digest (`bindSchema`) checked against `PedersenSchemaRegistry`, and received commitments need an authenticated issuance record. 2,411 / 3,581 / 8,261 rows at n = 1 / 4 / 16 (64-bit values). |
| `InCircuitElGamal`, `ZkElGamal` | `elgamal-jubjub-v1` encryption relation and DLEQ trustee relation (ADR-0052 D3) | Requires BLS12-381 scalar field | Direct | Experimental, pending review and external review | Message width 1–64; 252-bit private randomness consumed by one decomposition; keys via `fromVerifierFixedPublic` (verifier checks subgroup) or `witnessInSubgroup`, identity refused; DLEQ needs all six coordinates public and `X ∈ 𝔾` as a verifier precondition. 6,558 / 6,938 rows (width 1 / 64); DLEQ 6,546. Spec: `docs/specs/elgamal-jubjub-v1.md`. |
| `ElGamal` host API; `DkgParticipant`, `ThresholdKeyContext` | Admission, bounds, verified shares; t-of-n key generation and decryption (ADR-0052, ADR-0053) | Jubjub over BLS12-381 scalar field | Not a circuit gadget | Experimental; **offline/isolated secret operations only** | Secret multiplications use the blinded best-effort schedule (no constant-time claim). The DKG's transport (broadcast with agreement, private channels, deadlines) and the admission verifier's authenticity/closure checks are the application's. Spec: `docs/specs/elgamal-jubjub-threshold-v1.md`. |
| `ElGamal` host API; `DkgParticipant`, `ThresholdKeyContext` | Admission, bounds, verified shares; t-of-n key generation and decryption (ADR-0052, ADR-0053) | Jubjub over BLS12-381 scalar field | Not a circuit gadget | Experimental; **offline/isolated secret operations only** | Secret multiplications use the blinded best-effort schedule (no constant-time claim). The DKG's transport (broadcast with agreement, private channels, deadlines) and the admission verifier's authenticity/closure checks are the application's; the private channels can instead be the encrypted board delivery of ADR-0054 (next row). Spec: `docs/specs/elgamal-jubjub-threshold-v1.md`. |
| `DkgShareDelivery`, `DkgShareDeliveryKeys`, `DkgKeyDirectory` | Encrypted delivery of DKG `SHARE`s over the public board: HPKE (RFC 9180 Base; X25519, HKDF-SHA256, ChaCha20Poly1305) to per-attempt keys announced in round 0 (ADR-0054) | X25519, JDK providers | Not a circuit gadget | Experimental; **Assumption A1 and the delivery contract (P1–P3) await external review** | The key generation, transcript and admission are unchanged. `closeRound1` is the processing barrier: binding the participant enforces processing before closing, and the application must pass the window after its cutoff and finality. A dealer posts `COMMITMENTS` only after its envelopes are final. A participant whose directory holds no key, or not its own key, for it aborts (T1). Checked against RFC 9180 A.2.1 (all 257 encryptions), Wycheproof X25519, ChaCha20-Poly1305 and HKDF, and BouncyCastle 1.83's HPKE; identical results in a GraalVM native image. Spec: `docs/specs/dkg-share-delivery-hpke-v1.md`. |
| `PedersenCommitment.commit` (off-circuit) | Host-side commitment generation | Jubjub over BLS12-381 scalar field | Not a circuit gadget | **Offline/isolated generation only (ADR-0038)** | Both secret scalars use a fresh multiple-of-`l` blinding and fixed 316-add/316-double schedule. The former loop-bound/operation-count channel is removed and the raw trailing-zero signal is blinded, but Java branches and `BigInteger` remain variable-time. The commitment's hiding and binding are unaffected; the restriction is on secret-bearing execution. |
| `InCircuitEdDSAJubjub` / `ZkEdDSAJubjub` | EdDSA-Jubjub verification | Requires BLS12-381 scalar field | Direct | Yes for verification, pending external review; signing is not constant-time | Use `verifyStrict` when `pk` is prover-supplied, `verifyWithRegisteredKey` when it is a public input or constant. No unqualified `verify`. Spec: `docs/specs/jubjub-eddsa-v1.md`. |
| `zeroj-bls12381` | BLS12-381 field, G1/G2, pairing, hash-to-curve | BLS12-381 | Not a circuit gadget | Supports off-chain proof verification and conversion paths; Cardano has BLS builtins | Use for proof systems and BBS, not directly inside symbolic circuits unless a circuit gadget is built. |
Expand Down
70 changes: 70 additions & 0 deletions docs/benchmarks/dkg-share-delivery-hpke-2026-10-09.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Encrypted DKG share delivery (`dkg-share-delivery-hpke-v1`): host measurements (ADR-0054)

**Date:** 2026-10-09
**Harness:** `ElGamalBenchmark.dkgShareDelivery`, run in its own JVM with
`./gradlew :zeroj-circuit-lib:elgamalBenchmark --tests '*ElGamalBenchmark.dkgShareDelivery'`.
**Machine:** Apple M4 Max (arm64), macOS, Oracle GraalVM JDK 25.0.2 (JIT, not native image).

These numbers are evidence for this JVM and CPU only. They record throughput and make no
timing-side-channel claim. X25519, HKDF and ChaCha20-Poly1305 are the JDK providers (SunEC,
SunJCE); secret operations are compatibility/offline class (ADR-0039).

## Per envelope

| Operation (100-byte `SHARE`) | µs/op |
|---|---:|
| `SealBase`: ephemeral key, DH, key schedule, AEAD | 114 |
| `OpenBase`: DH, key schedule, AEAD, recipient's public key supplied | 59 |
| Announcement small-order probe (one X25519) | 54 |

Sealing needs two X25519 operations: the ephemeral public key and the DH. Opening needs one,
because `closeRound1` passes the recipient's known public key. An earlier version that
recomputed it cost 111 µs per open. The harness calls the `byte[]` overload, which also rebuilds
the provider private key on every open. `closeRound1` builds it once per round, so the row is an
upper bound for production.

## Per participant and per run

Each participant:
- seals `n − 1` envelopes and opens `n − 1`;
- runs the probe on up to `n` announcements;
- runs two platform self-tests, in `start` and `closeRound1` (ADR-0054 implementation notes 7
and 10). Each one opens the RFC 9180 A.2.1 known answer, then seals and opens once.

The delivery work per participant is therefore about
`(n − 1) · 0.17 ms + n · 0.05 ms + 0.47 ms`:

| `n` | Delivery work per participant (computed from the table above) |
|---:|---:|
| 3 | ≈ 1.0 ms |
| 7 | ≈ 1.9 ms |
| 21 | ≈ 5.1 ms |
| 64 | ≈ 15 ms |

Whole encrypted runs, with all `n` participants in one JVM, measured against plain runs on the same
dealings. These were measured before the self-tests were added; they add about 0.5 ms per
participant, well inside the run-to-run noise:

| DKG (t, n) | Plain run | Encrypted run |
|---|---:|---:|
| (1, 3) | 45 ms | 48 ms |
| (2, 5) | 144 ms | 129 ms |
| (3, 7) | 298 ms | 279 ms |
| (5, 11) | 766 ms | 764 ms |
| (10, 21) | 3,819 ms | 3,540 ms |

The difference is within run-to-run noise. The threshold key generation's own work (blinded
dealing, VSS checks, recomputation) dominates, and the two harnesses differ slightly in overhead.
The board cost is `n(n − 1)` envelopes of 223 bytes per attempt plus `n` announcements of 106
bytes: about 0.9 MB of envelopes at `n = 64`.

## GraalVM native image

`HpkeNativeProbe` (in `zeroj-circuit-lib` test sources) compiled with `native-image` 25.0.2
(`--no-fallback`; about 19 s build) prints exactly the JVM's output:
- the RFC 9180 A.2.1 values;
- all 257 sequence ciphertexts (by digest);
- the RFC 7748 §6.1 public key;
- the small-order refusals.

No `META-INF/native-image` configuration was needed.
4 changes: 3 additions & 1 deletion docs/circuit-annotation-user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ ElGamal encryption (`elgamal-jubjub-v1`, experimental) has typed adapters too:

See `AnnotatedElGamalBallot` and `AnnotatedElGamalDleq`, proved and verified in
`AnnotatedElGamalTest`. The test also runs the full flow: verified admission of ballots,
possession proofs, threshold key generation, and verified decryption shares.
possession proofs, threshold key generation, and verified decryption shares. It runs the threshold key
generation twice: once over private channels, and once with the private shares HPKE-encrypted on the
board (`dkg-share-delivery-hpke-v1`, ADR-0054).
Jubjub adapters use BLS12-381.

Bind every prover-supplied point with `ZkJubjubPoint.witnessAffine(zk, u, v)`. It asserts the
Expand Down
Loading