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