arnaucube
arnaucube/schnorrPublic Self-hosted repository
Make trait SignatureVerifierBuilder
Brian Lawrence tideofwords@gmail.com
Mon, 30 Sep 2024 15:44:27 -0700
commit

4037853be879c0049506c4e7c66b9d5361c6ab48

parent

8e25c446037e6662dd00bdacd4aeff0e94b1e01c

2 files changed, 25 insertions(+), 5 deletions(-)

jump to
M src/mod65537.rs → src/mod65537.rs

@@ -19,8 +19,6 @@ use crate::schnorr::{SchnorrPublicKey, SchnorrSignature};

type GoldF = GoldilocksField; - - #[derive(Debug, Default)] pub struct Mod65537Generator { a: Target,
M src/schnorr_prover.rs → src/schnorr_prover.rs

@@ -78,8 +78,30 @@ }

pub struct SchnorrBuilder {} -impl SchnorrBuilder { - pub fn constrain_sig < +pub trait SignatureVerifierBuilder { + fn constrain_sig < + C: GenericConfig<2, F = GoldF>, + > ( + &self, + builder: &mut CircuitBuilder::<GoldF, 2>, + sig: &SchnorrSignatureTarget, + msg: &MessageTarget, + pk: &SchnorrPublicKeyTarget, + ); + + fn verify_sig < + C: GenericConfig<2, F = GoldF>, + > ( + &self, + builder: &mut CircuitBuilder::<GoldF, 2>, + sig: &SchnorrSignatureTarget, + msg: &MessageTarget, + pk: &SchnorrPublicKeyTarget, + ) -> BoolTarget; +} + +impl SignatureVerifierBuilder for SchnorrBuilder { + fn constrain_sig < C: GenericConfig<2, F = GoldF>, > ( &self,

@@ -93,7 +115,7 @@ let true_target = builder._true();

builder.connect(verification_output.target, true_target.target); } - pub fn verify_sig < + fn verify_sig < C: GenericConfig<2, F = GoldF>, > ( &self,