Skip to content

DO NOT MERGE: exercise the production ceremony with a 10-minute beacon lead - #5

Closed
mellowcroc wants to merge 2 commits into
mainfrom
test/production-path-10min-beacon-lead
Closed

DO NOT MERGE: exercise the production ceremony with a 10-minute beacon lead#5
mellowcroc wants to merge 2 commits into
mainfrom
test/production-path-10min-beacon-lead

Conversation

@mellowcroc

Copy link
Copy Markdown
Collaborator

DO NOT MERGE

This is a reproduction/test branch. It intentionally weakens a production security control so the complete production ceremony path can be exercised in a practical amount of time. Nothing in this PR should be merged or represented as production ceremony policy.

Stack

What it changes

Two commits sit on top of #4.

Tiny rehearsal circuit

Adds rehearsal-tiny-v1, a small circuit proving x^3 = pub, so the ceremony lifecycle can run in minutes instead of days. It carries one Groth16 commitment to exercise the same finalization/Cardano encoding shape as destination-v2.

Production remains protected by three independent checks:

  • Production definitions reject any key version other than destination-v2.
  • The CLI accepts rehearsal-tiny-v1 only in rehearsal mode.
  • The production decision still requires the exact K=21 domain.

The ceremony executors compile the circuit named by the authenticated definition instead of hardcoding destination-v2.

Ten-minute production witness lead

Reduces ProductionMinimumWitnessLeadSeconds from 24 hours to 10 minutes and proportionally reduces the reserved witness observation window from one hour to two minutes.

This is intentionally unsafe for real use. It exists only to make a complete production-mode reproduction fit inside a working session while retaining the same close/witness timing checks. Boundary tests derive their expectations from the signed policy, including the public-witness receipt tests added by #4.

Why this exists

The released 24-hour lead is a real security boundary: witnesses must be able to observe closure before the sealing randomness exists. Across two phases it also imposes at least 48 hours of waiting.

That cost meant the real finalize, audit, release, and decision paths had not been exercised end to end. The prior K=21 reproduction surfaced blocking defects now addressed in #1, including stale beacon-round selection after long replay and incorrect finalization-evidence derivation.

The prior run completed both phases, finalization, two independent audits, and a signed release in 56h42m. Both audits reproduced the proving key, verifying key, and Cardano encoding byte for byte with zero findings. This demonstrates resource and artifact coherence only; it does not establish participant independence or production readiness.

Validation

  • go test ./internal/mpcceremony
  • go test ./cmd/mpc-ceremony -skip '^TestProductionCeremonySourceAndBinaryExcludeWalletSecretAPIs$'
  • git diff --check feature/mpc-relay-ops...HEAD

The skipped CLI boundary test remains blocked by the repository's existing inconsistent vendor/modules.txt, which this branch does not modify.

The destination-v2 circuit has 1,789,750 constraints and forces a 2^21
domain, which makes every ceremony operation expensive: a single phase-1
contribution takes 56 minutes and moves 576 MiB, and a full lifecycle is a
multi-day exercise. Testing the orchestration at that size is impractical,
so in practice it was not tested at all.

Register a second circuit that proves x^3 = pub at a small domain, so the
same lifecycle runs in minutes. It carries exactly one Groth16 commitment,
matching destination-v2, because finalization exports a Cardano verifying
key whose BSB22 encoding assumes a single commitment; without it the
rehearsal could not reach the finalize stage at all.

Production must never see this circuit, and three independent things keep
it out. CeremonyDefinition.validate rejects any key version other than
destination-v2 when mode is production, and does so before any
environment-dependent check. The CLI refuses --key-version rehearsal-tiny-v1
unless --mode rehearsal. The exact-k21-rehearsal gate in the production
decision still demands domain 2^21, which a small run cannot satisfy.

CircuitBinding.Validate now checks key version and circuit id as a pair
rather than each against a single constant. Checking them independently
would let a definition name one circuit's version with another's id and
pass both checks while describing nothing that exists.

The four executor sites that previously hardcoded CompileDestinationV2 now
compile the circuit the signed definition names, so an operator cannot
select a circuit the ceremony was not created with.
DO NOT MERGE. Any transcript produced from this branch is a test artifact
and must never be presented as a ceremony.

The released ProductionMinimumWitnessLeadSeconds is 24 hours. It is the
window in which a public witness can observe a phase closure before the
randomness that seals that phase exists, which is what stops a coordinator
who already knows the beacon output from closing the phase around it. Two
phase closes make it 48 hours of mandated waiting, and that is the point
rather than an accident.

That cost makes the production path effectively untestable: a run cannot
finish in less than three days, so the finalize, audit, release, and
decision stages have never been exercised. A rehearsal reaches none of
them, because the production arm of CeremonyDefinition.validate is the
only place several of those checks live.

Reducing the constant to 10 minutes brings a full production run inside a
single working session. The witness observation window introduced on the
base branch is cut proportionally, from one hour to two minutes, so the
reproduction still exercises the reserved-window check without restoring
the multi-hour wait. Nothing else is relaxed: the clean-tree requirement,
the pinned build profile, the destination-v2 circuit binding, and every
other production gate remain exactly as released.
@mellowcroc
mellowcroc changed the base branch from feature/mpc-relay-ops to main August 19, 2026 15:52
@mellowcroc mellowcroc closed this Aug 20, 2026
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