Framework overview
A policy is a Noir library crate that defines one Rule. You write judgments over typed values and return a Verdict. weld build generates one thin bin package per phase whose main recomputes the context, checks the params commitment, calls your phase method, and asserts the verdict. You never write main, never see the five public inputs, never hash anything, and never call assert.
impl Rule<Params> for Corridor {
fn on_initiate(p: Params, ctx: Ctx<Initiate>) -> (Verdict, Attest) {
let note = ctx.recipient_note();
(Verdict::require(note.amount <= p.cap, "corridor/over-cap"), Attest::none())
}
}Programming model
The one-page corridor example and what the developer never has to write.
Core types
Rule, StatefulRule, Verdict, Ctx, and the accessor table by phase.
Params
Salted, committed, tunable without a VK rotation.
State
A per-FI Poseidon2 tree anchored on chain; velocity limits in six lines.
Combinators
All, Either, OnlyIf, and the standard catalog of eleven rules.
CLI
build, test, codegen, register, dev.
Guarantees the framework gives you
- No unwelded value is reachable. Every accessor returns a value tied to the context root by an in-circuit equality.
- Phase restrictions are types.
ctx.inputs()does not compile at accept or reject. - Verdicts compose. Because rules return verdicts instead of asserting,
Eitheris a plain boolean or, and both branches are always evaluated as Noir requires. - A build that would brick fails.
weld testsolves every phase on every golden payment shape.