bdlop_r1cs_verify
stdlib/bdlop/bdlop_r1cs_verify.nbv
bdlop_r1cs_verify(static N, static r_a, static r_b, static r_c, let w, let s, let wtns_arg, let crossterm_arg, let state)
number of polynomials to represent wtns
- Calls
bdlop/bdlop_linear_nizk_comm,bdlop/bdlop_linear_nizk_verify,extend_to,mat_vec_mul,oraccle/oraccle_commit,oraccle/oraccle_sample_uniform,slice_from_start,valloc- Precompiles
clone!,constrain_eq!,div_ceil!,div_exact!,len!,println!
Source
(
static N,
static r_a,
static r_b,
static r_c,
let w,
let s,
let wtns_arg,
let crossterm_arg,
let state
)
# number of polynomials to represent wtns
static wtns_len = div_ceil! (len! w), N
# number of polynomials to represent crossterm
static crossterm_len = div_ceil! (div_exact! (len! r_a), (len! w)), N
(let state) = oraccle_commit("hidden_r1cs commit", state)
println! "wtns commit"
(let state) = oraccle_commit(bdlop_linear_nizk_comm(N, wtns_len, clone! wtns_arg), state)
println! "crossterm commit"
(let state) = oraccle_commit(bdlop_linear_nizk_comm(N, crossterm_len, clone! crossterm_arg), state)
println! "sampling challenge"
(let state, let challenge) = oraccle_sample_uniform(state)
println! "sampled scalar challenge: ", challenge[0]
let challenge = extend_to(N, challenge[0])
println! "oraccle samples done"
println! "verifying wtns nizk arg..."
(let state, let wtns) = bdlop_linear_nizk_verify(N, wtns_len, state, (clone! challenge), wtns_arg)
println! "wtns nizk verified"
println! "verifying crossterm nizk arg..."
(let state, let crossterm) = bdlop_linear_nizk_verify(N, crossterm_len, state, challenge, crossterm_arg)
println! "crossterm nizk verified"
println! "verifying final equalities"
let wtns = slice_from_start(wtns, len! w)
let a_w = mat_vec_mul(r_a, (clone! wtns))
static r1cs_height = len! a_w
let b_w = mat_vec_mul(r_b, (clone! wtns))
let e = a_w * b_w - (mat_vec_mul(r_c, wtns) * valloc(r1cs_height, s))
println! "final e value computed"
constrain_eq! e, slice_from_start(crossterm, r1cs_height)
println! "recursive r1cs is consistent"
println! (len! w), " witness elements", r1cs_height, " constraints"
(state)