mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-02 13:23:10 +00:00
minor changes
This commit is contained in:
parent
b6cabe8fb8
commit
9b7c2587fe
@ -105,10 +105,11 @@ fn main() {
|
||||
post_with_updated_values.nonce = *new_nonce;
|
||||
|
||||
if post_with_updated_values.program_owner == DEFAULT_PROGRAM_ID {
|
||||
// Claim account
|
||||
post_with_updated_values.program_owner = program_id;
|
||||
}
|
||||
|
||||
// Compute commitment and push
|
||||
// Compute commitment
|
||||
let commitment_post = Commitment::new(Npk, &post_with_updated_values);
|
||||
new_commitments.push(commitment_post);
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@ mod transaction;
|
||||
mod witness_set;
|
||||
|
||||
pub use message::Message;
|
||||
pub use witness_set::WitnessSet;
|
||||
pub use transaction::PrivacyPreservingTransaction;
|
||||
pub use witness_set::WitnessSet;
|
||||
|
||||
pub mod circuit {
|
||||
use nssa_core::{
|
||||
@ -194,12 +194,16 @@ mod tests {
|
||||
let commitment_set =
|
||||
CommitmentSet(MerkleTree::new(vec![commitment_sender.to_byte_array()]));
|
||||
|
||||
let program = Program::authenticated_transfer_program();
|
||||
|
||||
let expected_private_account_1 = Account {
|
||||
program_owner: program.id(),
|
||||
balance: 100 - balance_to_move,
|
||||
nonce: 0xdeadbeef1,
|
||||
..Default::default()
|
||||
};
|
||||
let expected_private_account_2 = Account {
|
||||
program_owner: program.id(),
|
||||
balance: balance_to_move,
|
||||
nonce: 0xdeadbeef2,
|
||||
..Default::default()
|
||||
@ -223,7 +227,7 @@ mod tests {
|
||||
private_key_1,
|
||||
commitment_set.get_proof_for(&commitment_sender).unwrap(),
|
||||
)],
|
||||
&Program::authenticated_transfer_program(),
|
||||
&program,
|
||||
&commitment_set.digest(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@ -683,22 +683,19 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_transition_from_privacy_preserving_transaction() {
|
||||
let sender = AccountWithMetadata {
|
||||
account: Account {
|
||||
balance: 200,
|
||||
program_owner: Program::authenticated_transfer_program().id(),
|
||||
..Account::default()
|
||||
},
|
||||
is_authorized: true,
|
||||
};
|
||||
let sender_signing_key = PrivateKey::try_new([1; 32]).unwrap();
|
||||
let sender_address =
|
||||
Address::from_public_key(&PublicKey::new_from_private_key(&sender_signing_key));
|
||||
|
||||
let mut state = V01State::new_with_genesis_accounts(&[(*sender_address.value(), 200)]);
|
||||
|
||||
let sender = AccountWithMetadata {
|
||||
account: state.get_account_by_address(&sender_address),
|
||||
is_authorized: true,
|
||||
};
|
||||
|
||||
let recipient = AccountWithMetadata {
|
||||
account: Account {
|
||||
..Account::default()
|
||||
},
|
||||
account: Account::default(),
|
||||
is_authorized: false,
|
||||
};
|
||||
|
||||
@ -708,8 +705,6 @@ mod tests {
|
||||
|
||||
let balance_to_move: u128 = 37;
|
||||
|
||||
let mut state = V01State::new_with_genesis_accounts(&[(*sender_address.value(), 200)]);
|
||||
|
||||
let (output, proof) = execute_and_prove(
|
||||
&[sender, recipient],
|
||||
&Program::serialize_instruction(balance_to_move).unwrap(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user