Skip to content

Untrusted advice as field elements in AllConstraints - #75

Open
quangvdao wants to merge 6 commits into
drift-guardsfrom
t5/advice-field-ff6fc
Open

quangvdao wants to merge 6 commits into
drift-guardsfrom
t5/advice-field-ff6fc

Conversation

@quangvdao

Copy link
Copy Markdown
Collaborator

Untrusted advice as field elements in AllConstraints

Stacked on #74.

Jolt's verifier holds only a commitment to the untrusted advice. In the RAM value check it adds the committed block to the initial RAM (ram_val_check_advice_block in crates/jolt-verifier/src/stages/stage4/ram_val_check.rs), so each advice word can be any field element, including one outside the 64-bit range. Until now AllConstraints took the untrusted advice as bytes, so it admitted fewer witnesses than the verifier accepts, and the soundness theorem did not cover a prover that commits to an out-of-range word.

This PR makes AllConstraints take the advice words as untrustedAdvice : Nat → F and proves soundness for that relation with no new premise.

Statement changes

def AllConstraints {F : Type} [Field F] {params : WitnessParams}
    (joltInstance : JoltInstance SourceInstruction) (untrustedAdvice : Nat → F)
    (witness : WitnessType F params) : Prop :=
  ∃ context : ConstraintContext joltInstance JoltPrivateInputs.noUntrustedAdvice params,
    FieldConstraintEquations context.bytecode
      (committedInitialValue context.io.memory_layout context.initialRam untrustedAdvice)
      context.io context.entry witness
  • committedInitialValue is the committed word inside the untrusted-advice block and the cast of the fixed 64-bit initial word elsewhere.
  • JoltInstance.soundness and JoltInstance.sail_soundness take untrustedAdvice : Nat → F where they took private inputs. Neither gains a hypothesis.
  • JoltInstance.completeness concludes AllConstraints with the honest words adviceBlockWords layout (initialRamWord trace): the words of the untrusted-advice block of the run's initial RAM. Its premises are those on Add an assumption registry and a nightly drift check against Jolt main #74, including setupSized from JoltConstraints side of #39, and re-pin of both libraries to Jolt ff6fc6568 with no temporary restrictions #73. JoltInstance.completeness_someWitness quantifies over advice words.
  • The old relation stays as the internal AllConstraintsOnBytes, and the old soundness proof as JoltInstance.soundness_onBytes. Neither is a headline statement.
  • The constraint predicates for RAM values (37) and (38) take a field-valued initial value, and the soundness lemmas take FieldConstraintEquations at an arbitrary initial value. None gains a hypothesis.

How the proof works

allConstraintsOnBytes_of_allConstraints (theorems/Soundness/UntrustedAdvice/Bytes.lean) turns a satisfying assignment of the new relation into one of the byte relation:

  1. Each committed word that is the cast of a 64-bit word keeps that word, and every other word becomes zero. The run's advice bytes are the little-endian bytes of these words, exactly max_untrusted_advice_size of them.
  2. No row selects a word that changes. Every untrusted-advice word is write-protected, so a store there has zero increment and writes a register value, which is a 64-bit word (RegisterWords.lean). A load reads a range-checked doubleword (LoadWords.lean, using loadWindowsOk for every expansion). So at the first row that selects a protected word, its initial value is a 64-bit word (initialValue_word_of_selected).
  3. Subtracting the difference from RamVal and RamValFinal at each changed word keeps every constraint (shiftRam_equations). The public I/O mask is zero on the block, so the final-RAM output check is unaffected.

The block-size fact needs no premise at this pin: MemoryLayout.new rounds the advice capacity to a multiple of 8 and requires a power of two, and JoltDevice::try_with_io checks the advice length against that rounded size. untrustedBlock_geometry (theorems/untrusted_advice_block.lean) derives the block layout from the model's copies of these checks.

Not changed

  • Trusted advice is still part of the instance as packed bytes. The new assumptions.toml entry TrustedAdviceAsBytes records that the theorems hold when the trusted party commits to those bytes.
  • The model does not reproduce block_selector_mle_msb, which rejects a block whose start is not aligned to its size. That check only removes accepted proofs, so the soundness theorem covers a larger set.
  • The model at this pin has no inline instructions yet. Jolt's InlineExpansionBuilder::emit_ld can emit narrow loads with no range check. Porting the inlines must therefore extend loadWindowsOk to their loads.
  • Lean has no flag for an absent untrusted-advice commitment. AllConstraints quantifies over every advice word sequence, and the absent commitment equals the all-zero sequence.

Audit and docs

  • Audit/Premises.lean and Audit/Statements.lean are regenerated. The diff changes only the four headline statements above and the fingerprints of the changed and new definitions.
  • assumptions.toml has the new entries TrustedAdviceAsBytes and data.untrustedAdvice.
  • docs/whole-run-theorem.md, JoltConstraints/documentation/model_review.md and methods/soundness.md describe the new relation.
  • reports/2026-11-25-witness-column-typing.md compares each witness column and relation input with what Jolt's verifier knows at the pin.

Validation

  • lake build JoltConstraints passes (2493 jobs). The commits after that build change only scripts and a workflow, merged from Add an assumption registry and a nightly drift check against Jolt main #74.
  • #print axioms for every headline theorem lists only propext, Classical.choice and Quot.sound.
  • At the head: scripts/check-assumptions.py --jolt-dir reports 30 entries, all registered; scripts/check-lean-policy.py passes 789 files; scripts/jolt_citations.py --unresolved --check resolves 292 cited files at ff6fc6568; the script tests pass.
  • An independent review of the port found no defects in the statements or proofs.

🤖 Generated with Claude Code

Jolt's verifier holds only a commitment to the untrusted advice and adds the
committed block to the initial RAM (ram_val_check_advice_block), so each
advice word is an arbitrary field element. AllConstraints now takes
untrustedAdvice : Nat → F, and the initial RAM value of a block word is the
committed word (committedInitialValue). The byte relation stays internal as
AllConstraintsOnBytes, with its soundness proof as soundness_onBytes.

JoltInstance.soundness and sail_soundness take the advice words and gain no
premise. allConstraintsOnBytes_of_allConstraints reduces the new relation to
the byte relation: no row selects a protected word whose initial value is out
of the 64-bit range, because a load reads a range-checked doubleword and a
store to a write-protected word keeps its value and writes a register word.
Shifting RamVal and RamValFinal by the difference keeps every constraint.
The block size needs no premise: the checked layout makes the capacity a
multiple of 8 and initialization admits exactly that many bytes.

Completeness concludes AllConstraints at adviceBlockWords of the run's
initial RAM. assumptions.toml records trusted advice as bytes
(TrustedAdviceAsBytes) and the new data.untrustedAdvice binder; the audit
tables are regenerated.
whole-run-theorem.md, model_review.md and methods/soundness.md describe the
new relation, the reduction to the byte relation and the remaining
trusted-advice gap. reports/2026-11-25-witness-column-typing.md ports the
2026-11-12 review note to ff6fc6568: for each witness column and relation
input it compares what Jolt's verifier knows with the Lean type, and records
that the block-size gap of a6b6dc717 is closed at the pin.
Completeness keeps T5's conclusion over the honest advice words and gains the
setupSized premise from the fix round.
# Conflicts:
#	JoltConstraints/Audit/Statements.lean

This branch has not been deployed

No deployments
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