openvm_native_compiler/ir/
verify_batch.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use crate::ir::{Array, Builder, Config, DslIr, Ext, Felt, Usize, Var};

impl<C: Config> Builder<C> {
    /// - Requires `dimensions.len() == opened_values.len()`
    /// - `proof` is an array of arrays where inner arrays are of length `CHUNK`
    /// - `commit.len() = CHUNK`
    pub fn verify_batch_felt(
        &mut self,
        dimensions: &Array<C, Usize<C::F>>,
        opened_values: &Array<C, Array<C, Felt<C::F>>>,
        proof: &Array<C, Array<C, Felt<C::F>>>,
        index_bits: &Array<C, Var<C::N>>,
        commit: &Array<C, Felt<C::F>>,
    ) {
        self.push(DslIr::VerifyBatchFelt(
            dimensions.clone(),
            opened_values.clone(),
            proof.clone(),
            index_bits.clone(),
            commit.clone(),
        ));
    }

    /// Version of [`verify_batch_felt`] where `opened_values` are extension field elements.
    /// - Requires `dimensions.len() == opened_values.len()`
    /// - `proof` is an array of arrays where inner arrays are of length `CHUNK`
    /// - `commit.len() = CHUNK`
    pub fn verify_batch_ext(
        &mut self,
        dimensions: &Array<C, Usize<C::F>>,
        opened_values: &Array<C, Array<C, Ext<C::F, C::EF>>>,
        proof: &Array<C, Array<C, Felt<C::F>>>,
        index_bits: &Array<C, Var<C::N>>,
        commit: &Array<C, Felt<C::F>>,
    ) {
        self.push(DslIr::VerifyBatchExt(
            dimensions.clone(),
            opened_values.clone(),
            proof.clone(),
            index_bits.clone(),
            commit.clone(),
        ));
    }
}