Skip to content
LogoLogo

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())
    }
}

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, Either is a plain boolean or, and both branches are always evaluated as Noir requires.
  • A build that would brick fails. weld test solves every phase on every golden payment shape.