mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-02 13:23:10 +00:00
small refactor
This commit is contained in:
parent
b59cd0da92
commit
bfe38b012e
@ -34,7 +34,7 @@ fn main() {
|
||||
}
|
||||
|
||||
for i in 0..(program_outputs.len() - 1) {
|
||||
let Some(chained_call) = program_outputs[i].chained_call.clone() else {
|
||||
let Some(chained_call) = &program_outputs[i].chained_call else {
|
||||
panic!("Expected chained call");
|
||||
};
|
||||
|
||||
|
||||
@ -8,11 +8,7 @@ use nssa_core::{
|
||||
};
|
||||
use risc0_zkvm::{ExecutorEnv, InnerReceipt, Receipt, default_prover};
|
||||
|
||||
use crate::{
|
||||
error::NssaError,
|
||||
program::{Program, ProgramWithDependencies},
|
||||
state::MAX_NUMBER_CHAINED_CALLS,
|
||||
};
|
||||
use crate::{error::NssaError, program::Program, state::MAX_NUMBER_CHAINED_CALLS};
|
||||
|
||||
use crate::program_methods::{PRIVACY_PRESERVING_CIRCUIT_ELF, PRIVACY_PRESERVING_CIRCUIT_ID};
|
||||
|
||||
@ -20,6 +16,27 @@ use crate::program_methods::{PRIVACY_PRESERVING_CIRCUIT_ELF, PRIVACY_PRESERVING_
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Proof(pub(crate) Vec<u8>);
|
||||
|
||||
pub struct ProgramWithDependencies {
|
||||
pub program: Program,
|
||||
// TODO: this will have a copy of each dependency bytecode in each program
|
||||
pub dependencies: HashMap<ProgramId, Program>,
|
||||
}
|
||||
|
||||
impl ProgramWithDependencies {
|
||||
pub fn new(program: Program, dependencies: HashMap<ProgramId, Program>) -> Self {
|
||||
Self {
|
||||
program,
|
||||
dependencies,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Program> for ProgramWithDependencies {
|
||||
fn from(program: Program) -> Self {
|
||||
ProgramWithDependencies::new(program, HashMap::new())
|
||||
}
|
||||
}
|
||||
|
||||
/// Generates a proof of the execution of a NSSA program inside the privacy preserving execution
|
||||
/// circuit
|
||||
pub fn execute_and_prove(
|
||||
|
||||
@ -98,27 +98,6 @@ impl Program {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ProgramWithDependencies {
|
||||
pub program: Program,
|
||||
// TODO: this will have a copy of each dependency bytecode in each program
|
||||
pub dependencies: HashMap<ProgramId, Program>,
|
||||
}
|
||||
|
||||
impl ProgramWithDependencies {
|
||||
pub fn new(program: Program, dependencies: HashMap<ProgramId, Program>) -> Self {
|
||||
Self {
|
||||
program,
|
||||
dependencies,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Program> for ProgramWithDependencies {
|
||||
fn from(program: Program) -> Self {
|
||||
ProgramWithDependencies::new(program, HashMap::new())
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Testnet only. Refactor to prevent compilation on mainnet.
|
||||
impl Program {
|
||||
pub fn pinata() -> Self {
|
||||
|
||||
@ -244,15 +244,9 @@ pub mod tests {
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
Address, PublicKey, PublicTransaction, V02State,
|
||||
error::NssaError,
|
||||
execute_and_prove,
|
||||
privacy_preserving_transaction::{
|
||||
PrivacyPreservingTransaction, circuit, message::Message, witness_set::WitnessSet,
|
||||
},
|
||||
program::{Program, ProgramWithDependencies},
|
||||
public_transaction,
|
||||
signature::PrivateKey,
|
||||
error::NssaError, execute_and_prove, privacy_preserving_transaction::{
|
||||
circuit::{self, ProgramWithDependencies}, message::Message, witness_set::WitnessSet, PrivacyPreservingTransaction
|
||||
}, program::Program, public_transaction, signature::PrivateKey, Address, PublicKey, PublicTransaction, V02State
|
||||
};
|
||||
|
||||
use nssa_core::{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user