diff --git a/risc0-selective-privacy-poc/examples/private_execution.rs b/risc0-selective-privacy-poc/examples/private_execution.rs index 0296a83..2686596 100644 --- a/risc0-selective-privacy-poc/examples/private_execution.rs +++ b/risc0-selective-privacy-poc/examples/private_execution.rs @@ -1,6 +1,3 @@ -mod programs; - -use nssa; use nssa::program::TransferProgram; use outer_methods::{OUTER_ELF, OUTER_ID}; use risc0_zkvm::{default_prover, ExecutorEnv, ProveInfo, Receipt}; diff --git a/risc0-selective-privacy-poc/examples/public_execution.rs b/risc0-selective-privacy-poc/examples/public_execution.rs index 670ab68..7deb9a2 100644 --- a/risc0-selective-privacy-poc/examples/public_execution.rs +++ b/risc0-selective-privacy-poc/examples/public_execution.rs @@ -1,5 +1,3 @@ -mod programs; - use risc0_zkvm::{default_executor, ExecutorEnv}; use toy_example_core::account::Account; use transfer_methods::TRANSFER_ELF; diff --git a/risc0-selective-privacy-poc/src/lib.rs b/risc0-selective-privacy-poc/src/lib.rs index f5326a4..711663e 100644 --- a/risc0-selective-privacy-poc/src/lib.rs +++ b/risc0-selective-privacy-poc/src/lib.rs @@ -1,4 +1,5 @@ use outer_methods::OUTER_ELF; +use program::Program; use rand::{rngs::OsRng, Rng}; use risc0_zkvm::{ default_executor, default_prover, ExecutorEnv, ExecutorEnvBuilder, ProveInfo, Receipt, @@ -12,13 +13,6 @@ pub fn new_random_nonce() -> Nonce { let mut rng = OsRng; std::array::from_fn(|_| rng.gen()) } - -pub trait Program { - const PROGRAM_ID: [u32; 8]; - const PROGRAM_ELF: &[u8]; - type InstructionData: Serialize + for<'de> Deserialize<'de>; -} - pub(crate) fn write_inputs( input_accounts: &[Account], instruction_data: &P::InstructionData, diff --git a/risc0-selective-privacy-poc/src/program.rs b/risc0-selective-privacy-poc/src/program/mod.rs similarity index 51% rename from risc0-selective-privacy-poc/src/program.rs rename to risc0-selective-privacy-poc/src/program/mod.rs index 52ec5e4..a9af5fc 100644 --- a/risc0-selective-privacy-poc/src/program.rs +++ b/risc0-selective-privacy-poc/src/program/mod.rs @@ -1,8 +1,14 @@ +use serde::{Deserialize, Serialize}; use transfer_methods::{TRANSFER_ELF, TRANSFER_ID}; -pub struct TransferProgram; +pub trait Program { + const PROGRAM_ID: [u32; 8]; + const PROGRAM_ELF: &[u8]; + type InstructionData: Serialize + for<'de> Deserialize<'de>; +} -impl crate::Program for TransferProgram { +pub struct TransferProgram; +impl Program for TransferProgram { const PROGRAM_ID: [u32; 8] = TRANSFER_ID; const PROGRAM_ELF: &[u8] = TRANSFER_ELF; // Amount to transfer