use midnight_proofs::{
circuit::{Layouter, Value},
plonk::Error,
};
use crate::{
types::{AssignedNative, InnerValue},
CircuitField,
};
pub trait MapCPU<F, Key, Value> {
fn new(default: &Value) -> Self;
fn succinct_repr(&self) -> F;
fn insert(&mut self, key: &Key, value: &Value);
fn get(&self, key: &Key) -> Value;
}
pub trait MapInstructions<F, AssignedKey, AssignedValue>
where
F: CircuitField,
AssignedKey: InnerValue,
AssignedValue: InnerValue,
{
type MapCPU: MapCPU<F, AssignedKey::Element, AssignedValue::Element>;
fn init(
&mut self,
layouter: &mut impl Layouter<F>,
map: Value<Self::MapCPU>,
) -> Result<(), Error>;
fn succinct_repr(&self) -> AssignedNative<F>;
fn insert(
&mut self,
layouter: &mut impl Layouter<F>,
key: &AssignedKey,
value: &AssignedValue,
) -> Result<(), Error>;
fn get(
&self,
layouter: &mut impl Layouter<F>,
key: &AssignedKey,
) -> Result<AssignedValue, Error>;
}