diff --git a/spec/chapters/memw.typ b/spec/chapters/memw.typ index b6a140c96..239db58cc 100644 --- a/spec/chapters/memw.typ +++ b/spec/chapters/memw.typ @@ -100,7 +100,7 @@ provide these below. #render_constraint_table(alignedchip, config, groups: "assumptions") -#render_constraint_table(alignedchip, config) +#render_constraint_table(alignedchip, config, groups: ("consistency", "memory", "output")) == Padding The table can be padded to the next power of two with the following value assignments: diff --git a/spec/chapters/signatures.typ b/spec/chapters/signatures.typ index 969cfaaa7..80d491285 100644 --- a/spec/chapters/signatures.typ +++ b/spec/chapters/signatures.typ @@ -45,6 +45,7 @@ #let interactions = signatures.signatures.filter(s => s.kind == "interaction") The following lists signatures of the #interactions.len() interactions in this VM. +#show figure: set block(breakable: true) #figure(table( columns: (1fr, auto), inset: 7pt, diff --git a/spec/chapters/verifier.typ b/spec/chapters/verifier.typ index e85903478..0447bd308 100644 --- a/spec/chapters/verifier.typ +++ b/spec/chapters/verifier.typ @@ -1,4 +1,21 @@ +#import "../meta.typ": todo // TODO: // - sigma protocol, layout the various steps // - Fiat Shamir transformation into non-interactive protocol. // + += Auxiliary verification steps +#todo[ + *Verify that the number of tables used by the prover in an epoch/proof is + lower than some bound.* + Without this restriction, a prover can construct an interaction multiplicity + of $-1$ by repeating a table row a large number of times. + While this strategy this would result in a large increase of + proof size, the excess can be purged during recursion. + This could e.g. be used to bypass range checks. + + TODO: determine the right bound. The `IS_WH` chip with its multiplicity of type + `B20` induces an upper bound: it requires $approx 2^43$ rows + (or $approx 2^23$ tables) to achieve a multiplicity sum of $-1$. + This can then be used to forge an `IS_HALF` check. +] \ No newline at end of file diff --git a/spec/meta.typ b/spec/meta.typ index 9e7967c41..107d97e02 100644 --- a/spec/meta.typ +++ b/spec/meta.typ @@ -66,7 +66,7 @@ ) ) -#let todo(background: white, foreground: black, name: none, body) = block(fill: background, outset: 0.4em, radius: 20%, stroke: black)[ +#let todo(background: white, foreground: black, name: none, body) = block(fill: background, outset: 0.4em, radius: .5em, stroke: black)[ #set text(fill: foreground) *TODO #if name != none { [(#name)] }*: #body ] diff --git a/spec/src/branch.toml b/spec/src/branch.toml index 45e6d5618..dd2ea8d93 100644 --- a/spec/src/branch.toml +++ b/spec/src/branch.toml @@ -78,7 +78,7 @@ def = {idx = "i", polys = [ [[variables.multiplicity]] name = "μ" -type = "Bit" +type = "Byte" desc = "" pad = 0 @@ -109,6 +109,11 @@ input = ["JALR"] [[constraint_groups]] name = "all" +[[constraints.all]] +kind = "template" +tag = "IS_BYTE" +input = ["μ"] + [[constraints.all]] kind = "template" tag = "ADD" @@ -127,7 +132,6 @@ cond = "JALR" kind = "template" tag = "IS_BYTE" input = [["idx", "next_pc_low", 1]] -cond = "μ" [[constraints.all]] kind = "interaction" diff --git a/spec/src/bytewise.toml b/spec/src/bytewise.toml index b315a92b3..8e35f7579 100644 --- a/spec/src/bytewise.toml +++ b/spec/src/bytewise.toml @@ -26,13 +26,18 @@ pad = 0 [[variables.multiplicity]] name = "μ" -type = "BaseField" +type = "Byte" desc = "" pad = 0 [[constraint_groups]] name = "all" +[[constraints.all]] +kind = "template" +tag = "IS_BYTE" +input = ["μ"] + [[constraints.all]] kind = "interaction" tag = "BYTE_ALU" diff --git a/spec/src/dvrm.toml b/spec/src/dvrm.toml index 8467bea96..5b539ea92 100644 --- a/spec/src/dvrm.toml +++ b/spec/src/dvrm.toml @@ -171,13 +171,13 @@ def = ["+", "μ_q", "μ_r"] [[variables.multiplicity]] name = "μ_q" -type = "BaseField" +type = "Byte" desc = "" pad = 0 [[variables.multiplicity]] name = "μ_r" -type = "BaseField" +type = "Byte" desc = "" pad = 0 @@ -187,6 +187,16 @@ pad = 0 [[constraint_groups]] name = "range" +[[constraints.range]] +kind = "template" +tag = "IS_BYTE" +input = ["μ_q"] + +[[constraints.range]] +kind = "template" +tag = "IS_BYTE" +input = ["μ_r"] + [[constraints.range]] kind = "interaction" tag = "IS_HALF" diff --git a/spec/src/eq.toml b/spec/src/eq.toml index a06bb1b16..d2cfdee44 100644 --- a/spec/src/eq.toml +++ b/spec/src/eq.toml @@ -38,7 +38,7 @@ pad = 0 [[variables.multiplicity]] name = "μ" -type = "BaseField" +type = "Bit" desc = "" pad = 0 @@ -55,6 +55,11 @@ iter = ["i", 0, 1] [[constraint_groups]] name = "all" +[[constraints.all]] +kind = "template" +tag = "IS_BIT" +input = ["μ"] + [[constraints.all]] kind = "interaction" tag = "IS_HALF" diff --git a/spec/src/fext_fma.toml b/spec/src/fext_fma.toml index 1adb99eb0..83d16e10e 100644 --- a/spec/src/fext_fma.toml +++ b/spec/src/fext_fma.toml @@ -73,6 +73,11 @@ pad = 0 [[constraint_groups]] name = "all" +[[constraints.all]] +kind = "template" +tag = "IS_BIT" +input = ["μ"] + [[constraints.all]] kind = "template" tag = "REG" diff --git a/spec/src/fext_load.toml b/spec/src/fext_load.toml index 5b00c44a3..7e792155b 100644 --- a/spec/src/fext_load.toml +++ b/spec/src/fext_load.toml @@ -28,6 +28,11 @@ pad = 0 [[constraint_groups]] name = "all" +[[constraints.all]] +kind = "template" +tag = "IS_BIT" +input = ["μ"] + [[constraints.all]] kind = "template" tag = "REG" diff --git a/spec/src/fext_zero.toml b/spec/src/fext_zero.toml index c4f29ad53..10cf41cea 100644 --- a/spec/src/fext_zero.toml +++ b/spec/src/fext_zero.toml @@ -22,6 +22,11 @@ pad = 0 [[constraint_groups]] name = "all" +[[constraints.all]] +kind = "template" +tag = "IS_BIT" +input = ["μ"] + [[constraints.all]] kind = "template" tag = "REG" diff --git a/spec/src/is_wh.toml b/spec/src/is_wh.toml index 51426791f..73a38cd87 100644 --- a/spec/src/is_wh.toml +++ b/spec/src/is_wh.toml @@ -8,13 +8,19 @@ pad = 0 [[variables.multiplicity]] name = "μ" -type = "BaseField" +type = "B20" desc = "" pad = 0 [[constraint_groups]] name = "all" +[[constraints.all]] +kind = "interaction" +tag = "IS_B20" +input = ["μ"] +multiplicity = 1 + [[constraints.all]] kind = "interaction" tag = "IS_HALF" diff --git a/spec/src/is_whh.toml b/spec/src/is_whh.toml index f00392ddb..8f46b72be 100644 --- a/spec/src/is_whh.toml +++ b/spec/src/is_whh.toml @@ -3,7 +3,7 @@ code = "WHH" [[variables.condition]] name = "cond" -type = "BaseField" +type = "Bit" desc = "the multiplicity with which to apply the interactions" [[variables.input]] diff --git a/spec/src/keccak.toml b/spec/src/keccak.toml index 41d52b2a8..4eba17ffc 100644 --- a/spec/src/keccak.toml +++ b/spec/src/keccak.toml @@ -40,6 +40,11 @@ pad = 0 [[constraint_groups]] name = "output" +[[constraints.output]] +kind = "template" +tag = "IS_BIT" +input = ["μ"] + [[constraints.output]] kind = "interaction" tag = "ECALL" diff --git a/spec/src/keccak_round.toml b/spec/src/keccak_round.toml index 8e11dda20..67a2cf9e3 100644 --- a/spec/src/keccak_round.toml +++ b/spec/src/keccak_round.toml @@ -168,6 +168,11 @@ desc = "" [[constraint_groups]] name = "io" +[[constraints.io]] +kind = "template" +tag = "IS_BIT" +input = ["μ"] + [[constraints.io]] kind = "interaction" tag = "KECCAK" @@ -227,7 +232,6 @@ kind = "template" tag = "IS_BYTE" input = [["idx", ["idx", "Cxz_left", "x"], "z"]] iters = [["x", 0, 4], ["z", 0, 7]] -cond = "μ" [[constraints.theta]] kind = "template" @@ -275,7 +279,6 @@ kind = "template" tag = "IS_BYTE" input = [["idx", ["idx", ["idx", "rot_left", "x"], "y"], "z"]] iters = [["x", 0, 4], ["y", 0, 4], ["z", 0, 7]] -cond = "μ" ref = "keccak:c:range_rot_left" [[constraints.rho]] @@ -283,7 +286,6 @@ kind = "template" tag = "IS_BYTE" input = [["idx", ["idx", ["idx", "rot_right", "x"], "y"], "z"]] iters = [["x", 0, 4], ["y", 0, 4], ["z", 0, 7]] -cond = "μ" ref = "keccak:c:range_rot_right" [[constraint_groups]] diff --git a/spec/src/load.toml b/spec/src/load.toml index 3d3363f34..1e2e9cc07 100644 --- a/spec/src/load.toml +++ b/spec/src/load.toml @@ -83,6 +83,11 @@ desc = "`IS_WORD[timestamp]`" [[constraint_groups]] name = "all" +[[constraints.all]] +kind = "template" +tag = "IS_BIT" +input = ["μ"] + [[constraints.all]] kind = "template" tag = "IS_BIT" diff --git a/spec/src/lt.toml b/spec/src/lt.toml index 57661333d..ace32e0e2 100644 --- a/spec/src/lt.toml +++ b/spec/src/lt.toml @@ -84,7 +84,7 @@ def = ["idx", "carry", 1] [[variables.multiplicity]] name = "μ" -type = "Bit" +type = "Byte" desc = "" pad = 0 @@ -101,6 +101,11 @@ ref = "lt:a:range_rhs" name = "range" desc = "Range-check the inputs" +[[constraints.range]] +kind = "template" +tag = "IS_BYTE" +input = ["μ"] + [[constraints.range]] kind = "interaction" tag = "IS_HALF" diff --git a/spec/src/mul.toml b/spec/src/mul.toml index e1837020a..ebfa4ee91 100644 --- a/spec/src/mul.toml +++ b/spec/src/mul.toml @@ -111,13 +111,13 @@ def = ["+", "μ_lo", "μ_hi"] [[variables.multiplicity]] name = "μ_lo" -type = "BaseField" +type = "Byte" desc = "" pad = 0 [[variables.multiplicity]] name = "μ_hi" -type = "BaseField" +type = "Byte" desc = "" pad = 0 @@ -126,6 +126,16 @@ pad = 0 [[constraint_groups]] name = "def" +[[constraints.def]] +kind = "template" +tag = "IS_BYTE" +input = ["μ_lo"] + +[[constraints.def]] +kind = "template" +tag = "IS_BYTE" +input = ["μ_hi"] + [[constraints.def]] kind = "template" tag = "IS_BIT" diff --git a/spec/src/reg_read.toml b/spec/src/reg_read.toml index 709f123a4..6a57ecbcc 100644 --- a/spec/src/reg_read.toml +++ b/spec/src/reg_read.toml @@ -2,7 +2,7 @@ name = "REG" [[variables.condition]] name = "cond" -type = "BaseField" +type = "Bit" desc = "the multiplicity with which to apply the interaction" [[variables.input]] diff --git a/spec/src/reg_write.toml b/spec/src/reg_write.toml index 411adf24c..a9d037b61 100644 --- a/spec/src/reg_write.toml +++ b/spec/src/reg_write.toml @@ -2,7 +2,7 @@ name = "REGW" [[variables.condition]] name = "cond" -type = "BaseField" +type = "Bit" desc = "the multiplicity with which to apply the interaction" [[variables.input]] diff --git a/spec/src/rotxor.toml b/spec/src/rotxor.toml index 9f0e398b4..73bb1cabf 100644 --- a/spec/src/rotxor.toml +++ b/spec/src/rotxor.toml @@ -99,7 +99,7 @@ pad = 0 [[variables.multiplicity]] name = "μ" -type = "BaseField" +type = "Bit" desc = "" pad = 0 @@ -179,6 +179,11 @@ iter = ["i", 0, 3] [[constraint_groups]] name = "output" +[[constraints.output]] +kind = "template" +tag = "IS_BIT" +input = ["μ"] + [[constraints.output]] kind = "interaction" tag = "ROTXOR" diff --git a/spec/src/sha256round.toml b/spec/src/sha256round.toml index 48c944835..a887b383b 100644 --- a/spec/src/sha256round.toml +++ b/spec/src/sha256round.toml @@ -276,6 +276,11 @@ cond = "μ" [[constraint_groups]] name = "output" +[[constraints.output]] +kind = "template" +tag = "IS_BIT" +input = ["μ"] + [[constraints.output]] kind = "interaction" tag = "SHA256ROUND" diff --git a/spec/src/shift.toml b/spec/src/shift.toml index 81d42f9f3..771f006f5 100644 --- a/spec/src/shift.toml +++ b/spec/src/shift.toml @@ -182,6 +182,16 @@ tag = "IS_BIT" input = ["word_instr"] ref = "shift:c:word_instr" +[[constraints.input]] +kind = "template" +tag = "IS_BIT" +input = ["μ"] + +[[constraints.input]] +kind = "template" +tag = "IS_BIT" +input = ["zbs"] + [[constraint_groups]] name = "left_flag"