Skip to main content

kimchi/circuits/witness/
constant_cell.rs

1use super::{variables::Variables, WitnessCell};
2use alloc::{boxed::Box, vec::Vec};
3use ark_ff::Field;
4
5/// Witness cell with constant value
6pub struct ConstantCell<F: Field> {
7    value: F,
8}
9
10impl<F: Field> ConstantCell<F> {
11    /// Create witness cell with constant value
12    pub fn create(value: F) -> Box<ConstantCell<F>> {
13        Box::new(ConstantCell { value })
14    }
15}
16
17impl<F: Field, const W: usize> WitnessCell<F, F, W> for ConstantCell<F> {
18    fn value(&self, _witness: &mut [Vec<F>; W], _variables: &Variables<F>, _index: usize) -> F {
19        self.value
20    }
21}