mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-04 06:13:10 +00:00
fmt
This commit is contained in:
parent
fcebd5f726
commit
2de7e49eeb
@ -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.
|
/// A transfer of balance program.
|
||||||
/// To be used both in public and private contexts.
|
/// To be used both in public and private contexts.
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
use risc0_zkvm::{guest::env, serde::to_vec};
|
use risc0_zkvm::{guest::env, serde::to_vec};
|
||||||
|
|
||||||
use nssa_core::{
|
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() {
|
fn main() {
|
||||||
|
|||||||
@ -204,7 +204,7 @@ fn main() {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use nssa_core::account::{Account, AccountId, AccountWithMetadata};
|
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")]
|
#[should_panic(expected = "Invalid number of input accounts")]
|
||||||
#[test]
|
#[test]
|
||||||
@ -358,11 +358,12 @@ mod tests {
|
|||||||
#[should_panic(expected = "Invalid sender data")]
|
#[should_panic(expected = "Invalid sender data")]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_transfer_invalid_instruction_type_should_fail() {
|
fn test_transfer_invalid_instruction_type_should_fail() {
|
||||||
|
let invalid_type = TOKEN_HOLDING_TYPE ^ 1;
|
||||||
let pre_states = vec![
|
let pre_states = vec![
|
||||||
AccountWithMetadata {
|
AccountWithMetadata {
|
||||||
account: Account {
|
account: Account {
|
||||||
// First byte should be 0x01 for transfers
|
// First byte should be `TOKEN_HOLDING_TYPE` for token holding accounts
|
||||||
data: vec![0; TOKEN_HOLDING_DATA_SIZE],
|
data: vec![invalid_type; TOKEN_HOLDING_DATA_SIZE],
|
||||||
..Account::default()
|
..Account::default()
|
||||||
},
|
},
|
||||||
is_authorized: true,
|
is_authorized: true,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user