Skip to content

Commit

Permalink
support serialize and deserialize for engines (#307)
Browse files Browse the repository at this point in the history
* support serialize and deserialize for engines

* rm Clone, and fixed style
  • Loading branch information
RyanKung authored Feb 7, 2024
1 parent b99fc06 commit bdf3439
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/provider/hyperkzg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ where
}

/// An implementation of Nova traits with HyperKZG over the BN256 curve
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct Bn256EngineKZG;

impl Engine for Bn256EngineKZG {
Expand Down
13 changes: 7 additions & 6 deletions src/provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ use crate::{
traits::Engine,
};
use pasta_curves::{pallas, vesta};
use serde::{Deserialize, Serialize};

/// An implementation of the Nova `Engine` trait with BN254 curve and Pedersen commitment scheme
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct Bn256Engine;

/// An implementation of the Nova `Engine` trait with Grumpkin curve and Pedersen commitment scheme
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct GrumpkinEngine;

impl Engine for Bn256Engine {
Expand All @@ -56,11 +57,11 @@ impl Engine for GrumpkinEngine {
}

/// An implementation of the Nova `Engine` trait with Secp256k1 curve and Pedersen commitment scheme
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct Secp256k1Engine;

/// An implementation of the Nova `Engine` trait with Secp256k1 curve and Pedersen commitment scheme
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct Secq256k1Engine;

impl Engine for Secp256k1Engine {
Expand All @@ -84,11 +85,11 @@ impl Engine for Secq256k1Engine {
}

/// An implementation of the Nova `Engine` trait with Pallas curve and Pedersen commitment scheme
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct PallasEngine;

/// An implementation of the Nova `Engine` trait with Vesta curve and Pedersen commitment scheme
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct VestaEngine;

impl Engine for PallasEngine {
Expand Down

0 comments on commit bdf3439

Please sign in to comment.