Skip to content

Commit

Permalink
support serialize and deserialize for engines
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanKung committed Feb 5, 2024
1 parent b99fc06 commit d318dc6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ use traits::{
};

/// A type that holds public parameters of Nova
#[derive(Serialize, Deserialize)]
#[derive(Serialize, Deserialize, Clone)]
#[serde(bound = "")]
pub struct PublicParams<E1, E2, C1, C2>
where
Expand Down
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
14 changes: 8 additions & 6 deletions src/provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ use crate::{
traits::Engine,
};
use pasta_curves::{pallas, vesta};
use serde::Deserialize;
use serde::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 +58,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 +86,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 d318dc6

Please sign in to comment.