lilium_transcript/
protocols.rs1use crate::{
2 transcript::{MessageGuard, TranscriptGuard},
3 Message, TranscriptBuilder,
4};
5use ark_ff::Field;
6use sponge::sponge::Duplex;
7use std::fmt::Debug;
8
9pub trait Protocol<F: Field> {
10 type Key;
11 type Instance: Message<F>;
12 type Proof;
13 type Error: Debug + Clone;
14
15 fn transcript_pattern(key: &Self::Key, builder: TranscriptBuilder) -> TranscriptBuilder;
16 fn prove(instance: Self::Instance) -> Self::Proof;
17 fn verify<S: Duplex<F>>(
18 key: &Self::Key,
19 instance: MessageGuard<Self::Instance>,
20 transcript: TranscriptGuard<F, S, Self::Proof>,
21 ) -> Result<(), Self::Error>;
22}
23
24pub trait Reduction<F: Field> {
25 type A: Message<F>;
26 type B;
27 type Key;
28 type Proof;
29 type Error;
30
31 fn transcript_pattern(key: &Self::Key, builder: TranscriptBuilder) -> TranscriptBuilder;
32 fn verify_reduction<S: Duplex<F>>(
33 key: &Self::Key,
34 instance: MessageGuard<Self::A>,
35 transcript: TranscriptGuard<F, S, Self::Proof>,
36 ) -> Result<Self::B, Self::Error>;
37}