Skip to content

feat(zone-sdk): build and prove the program steps of an inscription - #18

Merged
pradovic merged 9 commits into
offsite/private-utxosfrom
pr/zone-sdk-proofs
Nov 20, 2026
Merged

pradovic merged 9 commits into
offsite/private-utxosfrom
pr/zone-sdk-proofs

Conversation

@pradovic

@pradovic pradovic commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

The sequencer builds and proves the program steps of an inscription. The zone describes each mini-block as a list of steps: a holder's step with the proof its node produced, or a ProgramStepSpec naming the program, the tracked program notes it consumes, the program notes it creates as value, stake key and data, the user notes it pays, and its message. prepare_program_inscription, on the sequencer, handle and client, walks the steps as the ledger does, builds each program step at its buffer position, derives nonces, commitments, nullifiers and the step id, picks the root, and returns a ProgramInscription: the op and, per program step, the spend witness bound to the op id, the openings of the created program notes and the three public inputs of the program proof.

A program step spends the set four blocks below the tip, PROGRAM_SPEND_ROOT_DEPTH, so a short reorg of the tip leaves the named root among the set's recent ones, and never a note a pending inscription already spends. A step consuming a note derives its output nonces from its first input, as the circuit enforces; one consuming nothing derives them from the publish parent and its index through the same rule. Everything the ledger would reject is refused before proving: an unknown or foreign input, a note consumed twice, unbalanced values, a deposit to another program, a deposit left unconsumed, too many inputs or outputs, a proof of the wrong kind.

Proving runs off the drive loop. prove_program_step proves a spend with Rapidsnark, and ProgramInscription::step_proofs interleaves the holders' proofs with the assembled program step proofs for the existing submit_prepared_inscription. The zone proves its program itself on the inputs the draft lists.

Tests cover the buffer position, deposits, later mini-blocks, each rejection, proof assembly, and one real spend proof verified against the public inputs the ledger derives from the op. An actor test prepares and submits on tracked notes. The cucumber scenario registers the groth16 crate's toy circuit as the program, publishes a program step creating a note, then one consuming it, and checks the sequencer tracks exactly the notes each block created, with paths valid against the channel's root.

The note-to-field conversions in program_steps.rs, the step id over notes and the spend witness layout, duplicate what core's test helper prove_program_spend does. A follow-up nomos PR moves them into core, and this file drops about a hundred lines on the next pin bump.

@pradovic
pradovic marked this pull request as draft November 19, 2026 17:18
@pradovic
pradovic force-pushed the pr/zone-sdk-program-notes branch from 2b28a0f to cfcaca8 Compare November 19, 2026 17:27
@pradovic
pradovic force-pushed the pr/zone-sdk-proofs branch 3 times, most recently from 6daa1b7 to ff4bc17 Compare November 19, 2026 20:47
Base automatically changed from pr/zone-sdk-program-notes to offsite/private-utxos November 20, 2026 08:33
@pradovic
pradovic marked this pull request as ready for review November 20, 2026 11:15

@hansieodendaal hansieodendaal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking good - one possible code guard to add.

Comment thread zone-sdk/src/sequencer/block_states.rs Resolved
Comment thread zone-sdk/src/sequencer/program_steps.rs Resolved
Comment thread zone-sdk/src/sequencer/program_steps.rs Resolved
Comment thread zone-sdk/src/sequencer/program_steps.rs Resolved

@hansieodendaal hansieodendaal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@pradovic
pradovic merged commit c55dcf0 into offsite/private-utxos Nov 20, 2026
11 of 12 checks passed
@pradovic
pradovic deleted the pr/zone-sdk-proofs branch November 20, 2026 18:35
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.

4 participants