diff --git a/taiga_halo2/src/circuit/vp_bytecode.rs b/taiga_halo2/src/circuit/vp_bytecode.rs index 05971d7b..afb39866 100644 --- a/taiga_halo2/src/circuit/vp_bytecode.rs +++ b/taiga_halo2/src/circuit/vp_bytecode.rs @@ -4,25 +4,30 @@ use crate::circuit::{ }; use crate::shielded_ptx::NoteVPVerifyingInfoSet; use borsh::{BorshDeserialize, BorshSerialize}; +#[cfg(feature = "serde")] +use serde; use std::path::PathBuf; #[derive(Clone, Debug, BorshSerialize, BorshDeserialize)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum ValidityPredicateRepresentation { // vampir has a unified circuit representation. VampIR(Vec), // Native halo2 circuits don't have a unified representatioin, enumerate the vp circuit examples for the moment. // TODO: figure out if we can have a unified circuit presentation. In theory, it's possible to separate the circuit system and proving system. Trivial, - // TODO: add other vp examples here if needed + // TODO: add other vp types here if needed } #[derive(Clone, Debug, BorshSerialize, BorshDeserialize)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct ValidityPredicateByteCode { circuit: ValidityPredicateRepresentation, inputs: Vec, } #[derive(Clone, Debug, BorshSerialize, BorshDeserialize)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct ApplicationByteCode { app_vp_bytecode: ValidityPredicateByteCode, dynamic_vp_bytecode: Vec, diff --git a/taiga_halo2/src/transaction.rs b/taiga_halo2/src/transaction.rs index 3de75dd9..351903f7 100644 --- a/taiga_halo2/src/transaction.rs +++ b/taiga_halo2/src/transaction.rs @@ -43,6 +43,7 @@ pub struct ShieldedPartialTxBundle(Vec); #[cfg_attr(feature = "nif", derive(NifStruct))] #[cfg_attr(feature = "nif", module = "Taiga.Transaction.Result")] #[cfg_attr(feature = "borsh", derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct ShieldedResult { pub anchors: Vec, pub nullifiers: Vec,