This commit is contained in:
Sergio Chouhy 2025-07-16 17:40:22 -03:00
parent 0e704cd51a
commit 8ecfa9887b
4 changed files with 9 additions and 14 deletions

View File

@ -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};

View File

@ -1,5 +1,3 @@
mod programs;
use risc0_zkvm::{default_executor, ExecutorEnv};
use toy_example_core::account::Account;
use transfer_methods::TRANSFER_ELF;

View File

@ -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<P: Program>(
input_accounts: &[Account],
instruction_data: &P::InstructionData,

View File

@ -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