This commit is contained in:
Sergio Chouhy 2025-09-19 12:23:11 -03:00
parent fcebd5f726
commit 2de7e49eeb
3 changed files with 11 additions and 5 deletions

View File

@ -1,4 +1,4 @@
use nssa_core::program::{read_nssa_inputs, write_nssa_outputs, ProgramInput};
use nssa_core::program::{ProgramInput, read_nssa_inputs, write_nssa_outputs};
/// A transfer of balance program.
/// To be used both in public and private contexts.

View File

@ -1,7 +1,12 @@
use risc0_zkvm::{guest::env, serde::to_vec};
use nssa_core::{
account::{Account, AccountWithMetadata, AccountId}, compute_digest_for_path, encryption::Ciphertext, program::{validate_execution, ProgramOutput, DEFAULT_PROGRAM_ID}, Commitment, CommitmentSetDigest, EncryptionScheme, Nullifier, NullifierPublicKey, PrivacyPreservingCircuitInput, PrivacyPreservingCircuitOutput
Commitment, CommitmentSetDigest, EncryptionScheme, Nullifier, NullifierPublicKey,
PrivacyPreservingCircuitInput, PrivacyPreservingCircuitOutput,
account::{Account, AccountId, AccountWithMetadata},
compute_digest_for_path,
encryption::Ciphertext,
program::{DEFAULT_PROGRAM_ID, ProgramOutput, validate_execution},
};
fn main() {

View File

@ -204,7 +204,7 @@ fn main() {
mod tests {
use nssa_core::account::{Account, AccountId, AccountWithMetadata};
use crate::{TOKEN_HOLDING_DATA_SIZE, new_definition, transfer};
use crate::{new_definition, transfer, TOKEN_HOLDING_DATA_SIZE, TOKEN_HOLDING_TYPE};
#[should_panic(expected = "Invalid number of input accounts")]
#[test]
@ -358,11 +358,12 @@ mod tests {
#[should_panic(expected = "Invalid sender data")]
#[test]
fn test_transfer_invalid_instruction_type_should_fail() {
let invalid_type = TOKEN_HOLDING_TYPE ^ 1;
let pre_states = vec![
AccountWithMetadata {
account: Account {
// First byte should be 0x01 for transfers
data: vec![0; TOKEN_HOLDING_DATA_SIZE],
// First byte should be `TOKEN_HOLDING_TYPE` for token holding accounts
data: vec![invalid_type; TOKEN_HOLDING_DATA_SIZE],
..Account::default()
},
is_authorized: true,