mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-05 15:49:29 +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) {
|
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");
|
panic!("Expected chained call");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -8,11 +8,7 @@ use nssa_core::{
|
|||||||
};
|
};
|
||||||
use risc0_zkvm::{ExecutorEnv, InnerReceipt, Receipt, default_prover};
|
use risc0_zkvm::{ExecutorEnv, InnerReceipt, Receipt, default_prover};
|
||||||
|
|
||||||
use crate::{
|
use crate::{error::NssaError, program::Program, state::MAX_NUMBER_CHAINED_CALLS};
|
||||||
error::NssaError,
|
|
||||||
program::{Program, ProgramWithDependencies},
|
|
||||||
state::MAX_NUMBER_CHAINED_CALLS,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::program_methods::{PRIVACY_PRESERVING_CIRCUIT_ELF, PRIVACY_PRESERVING_CIRCUIT_ID};
|
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)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct Proof(pub(crate) Vec<u8>);
|
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
|
/// Generates a proof of the execution of a NSSA program inside the privacy preserving execution
|
||||||
/// circuit
|
/// circuit
|
||||||
pub fn execute_and_prove(
|
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.
|
// TODO: Testnet only. Refactor to prevent compilation on mainnet.
|
||||||
impl Program {
|
impl Program {
|
||||||
pub fn pinata() -> Self {
|
pub fn pinata() -> Self {
|
||||||
|
|||||||
@ -244,15 +244,9 @@ pub mod tests {
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Address, PublicKey, PublicTransaction, V02State,
|
error::NssaError, execute_and_prove, privacy_preserving_transaction::{
|
||||||
error::NssaError,
|
circuit::{self, ProgramWithDependencies}, message::Message, witness_set::WitnessSet, PrivacyPreservingTransaction
|
||||||
execute_and_prove,
|
}, program::Program, public_transaction, signature::PrivateKey, Address, PublicKey, PublicTransaction, V02State
|
||||||
privacy_preserving_transaction::{
|
|
||||||
PrivacyPreservingTransaction, circuit, message::Message, witness_set::WitnessSet,
|
|
||||||
},
|
|
||||||
program::{Program, ProgramWithDependencies},
|
|
||||||
public_transaction,
|
|
||||||
signature::PrivateKey,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use nssa_core::{
|
use nssa_core::{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user