Merge branch 'main' into marvin/nonce

This commit is contained in:
jonesmarvin8
2026-02-17 18:26:48 -05:00
40 changed files with 1309 additions and 1403 deletions
+2 -2
View File
@@ -102,7 +102,7 @@ async fn amm_public() -> Result<()> {
from: format_public_account_id(supply_account_id_1),
to: Some(format_public_account_id(recipient_account_id_1)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 7,
};
@@ -126,7 +126,7 @@ async fn amm_public() -> Result<()> {
from: format_public_account_id(supply_account_id_2),
to: Some(format_public_account_id(recipient_account_id_2)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 7,
};
@@ -26,7 +26,7 @@ async fn private_transfer_to_owned_account() -> Result<()> {
from: format_private_account_id(from),
to: Some(format_private_account_id(to)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 100,
});
@@ -59,13 +59,13 @@ async fn private_transfer_to_foreign_account() -> Result<()> {
let from: AccountId = ctx.existing_private_accounts()[0];
let to_npk = NullifierPublicKey([42; 32]);
let to_npk_string = hex::encode(to_npk.0);
let to_ipk = Secp256k1Point::from_scalar(to_npk.0);
let to_vpk = Secp256k1Point::from_scalar(to_npk.0);
let command = Command::AuthTransfer(AuthTransferSubcommand::Send {
from: format_private_account_id(from),
to: None,
to_npk: Some(to_npk_string),
to_ipk: Some(hex::encode(to_ipk.0)),
to_vpk: Some(hex::encode(to_vpk.0)),
amount: 100,
});
@@ -113,7 +113,7 @@ async fn deshielded_transfer_to_public_account() -> Result<()> {
from: format_private_account_id(from),
to: Some(format_public_account_id(to)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 100,
});
@@ -168,12 +168,12 @@ async fn private_transfer_to_owned_account_using_claiming_path() -> Result<()> {
.cloned()
.context("Failed to get private account")?;
// Send to this account using claiming path (using npk and ipk instead of account ID)
// Send to this account using claiming path (using npk and vpk instead of account ID)
let command = Command::AuthTransfer(AuthTransferSubcommand::Send {
from: format_private_account_id(from),
to: None,
to_npk: Some(hex::encode(to_keys.nullifer_public_key.0)),
to_ipk: Some(hex::encode(to_keys.incoming_viewing_public_key.0)),
to_vpk: Some(hex::encode(to_keys.viewing_public_key.0)),
amount: 100,
});
@@ -221,7 +221,7 @@ async fn shielded_transfer_to_owned_private_account() -> Result<()> {
from: format_public_account_id(from),
to: Some(format_private_account_id(to)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 100,
});
@@ -256,14 +256,14 @@ async fn shielded_transfer_to_foreign_account() -> Result<()> {
let to_npk = NullifierPublicKey([42; 32]);
let to_npk_string = hex::encode(to_npk.0);
let to_ipk = Secp256k1Point::from_scalar(to_npk.0);
let to_vpk = Secp256k1Point::from_scalar(to_npk.0);
let from: AccountId = ctx.existing_public_accounts()[0];
let command = Command::AuthTransfer(AuthTransferSubcommand::Send {
from: format_public_account_id(from),
to: None,
to_npk: Some(to_npk_string),
to_ipk: Some(hex::encode(to_ipk.0)),
to_vpk: Some(hex::encode(to_vpk.0)),
amount: 100,
});
@@ -325,12 +325,12 @@ async fn private_transfer_to_owned_account_continuous_run_path() -> Result<()> {
.cloned()
.context("Failed to get private account")?;
// Send transfer using nullifier and incoming viewing public keys
// Send transfer using nullifier and viewing public keys
let command = Command::AuthTransfer(AuthTransferSubcommand::Send {
from: format_private_account_id(from),
to: None,
to_npk: Some(hex::encode(to_keys.nullifer_public_key.0)),
to_ipk: Some(hex::encode(to_keys.incoming_viewing_public_key.0)),
to_vpk: Some(hex::encode(to_keys.viewing_public_key.0)),
amount: 100,
});
@@ -19,7 +19,7 @@ async fn successful_transfer_to_existing_account() -> Result<()> {
from: format_public_account_id(ctx.existing_public_accounts()[0]),
to: Some(format_public_account_id(ctx.existing_public_accounts()[1])),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 100,
});
@@ -72,7 +72,7 @@ pub async fn successful_transfer_to_new_account() -> Result<()> {
from: format_public_account_id(ctx.existing_public_accounts()[0]),
to: Some(format_public_account_id(new_persistent_account_id)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 100,
});
@@ -108,7 +108,7 @@ async fn failed_transfer_with_insufficient_balance() -> Result<()> {
from: format_public_account_id(ctx.existing_public_accounts()[0]),
to: Some(format_public_account_id(ctx.existing_public_accounts()[1])),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 1000000,
});
@@ -146,7 +146,7 @@ async fn two_consecutive_successful_transfers() -> Result<()> {
from: format_public_account_id(ctx.existing_public_accounts()[0]),
to: Some(format_public_account_id(ctx.existing_public_accounts()[1])),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 100,
});
@@ -178,7 +178,7 @@ async fn two_consecutive_successful_transfers() -> Result<()> {
from: format_public_account_id(ctx.existing_public_accounts()[0]),
to: Some(format_public_account_id(ctx.existing_public_accounts()[1])),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 100,
});
+6 -6
View File
@@ -50,7 +50,7 @@ async fn restore_keys_from_seed() -> Result<()> {
from: format_private_account_id(from),
to: Some(format_private_account_id(to_account_id1)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 100,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@@ -60,7 +60,7 @@ async fn restore_keys_from_seed() -> Result<()> {
from: format_private_account_id(from),
to: Some(format_private_account_id(to_account_id2)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 101,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@@ -96,7 +96,7 @@ async fn restore_keys_from_seed() -> Result<()> {
from: format_public_account_id(from),
to: Some(format_public_account_id(to_account_id3)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 102,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@@ -106,7 +106,7 @@ async fn restore_keys_from_seed() -> Result<()> {
from: format_public_account_id(from),
to: Some(format_public_account_id(to_account_id4)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 103,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@@ -169,7 +169,7 @@ async fn restore_keys_from_seed() -> Result<()> {
from: format_private_account_id(to_account_id1),
to: Some(format_private_account_id(to_account_id2)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 10,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@@ -178,7 +178,7 @@ async fn restore_keys_from_seed() -> Result<()> {
from: format_public_account_id(to_account_id3),
to: Some(format_public_account_id(to_account_id4)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: 11,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
+9 -9
View File
@@ -115,7 +115,7 @@ async fn create_and_transfer_public_token() -> Result<()> {
from: format_public_account_id(supply_account_id),
to: Some(format_public_account_id(recipient_account_id)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: transfer_amount,
};
@@ -208,7 +208,7 @@ async fn create_and_transfer_public_token() -> Result<()> {
definition: format_public_account_id(definition_account_id),
holder: Some(format_public_account_id(recipient_account_id)),
holder_npk: None,
holder_ipk: None,
holder_vpk: None,
amount: mint_amount,
};
@@ -343,7 +343,7 @@ async fn create_and_transfer_token_with_private_supply() -> Result<()> {
from: format_private_account_id(supply_account_id),
to: Some(format_private_account_id(recipient_account_id)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: transfer_amount,
};
@@ -525,7 +525,7 @@ async fn create_token_with_private_definition() -> Result<()> {
definition: format_private_account_id(definition_account_id),
holder: Some(format_public_account_id(recipient_account_id_public)),
holder_npk: None,
holder_ipk: None,
holder_vpk: None,
amount: mint_amount_public,
};
@@ -572,7 +572,7 @@ async fn create_token_with_private_definition() -> Result<()> {
definition: format_private_account_id(definition_account_id),
holder: Some(format_private_account_id(recipient_account_id_private)),
holder_npk: None,
holder_ipk: None,
holder_vpk: None,
amount: mint_amount_private,
};
@@ -701,7 +701,7 @@ async fn create_token_with_private_definition_and_supply() -> Result<()> {
from: format_private_account_id(supply_account_id),
to: Some(format_private_account_id(recipient_account_id)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: transfer_amount,
};
@@ -819,7 +819,7 @@ async fn shielded_token_transfer() -> Result<()> {
from: format_public_account_id(supply_account_id),
to: Some(format_private_account_id(recipient_account_id)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: transfer_amount,
};
@@ -933,7 +933,7 @@ async fn deshielded_token_transfer() -> Result<()> {
from: format_private_account_id(supply_account_id),
to: Some(format_public_account_id(recipient_account_id)),
to_npk: None,
to_ipk: None,
to_vpk: None,
amount: transfer_amount,
};
@@ -1056,7 +1056,7 @@ async fn token_claiming_path_with_private_accounts() -> Result<()> {
definition: format_private_account_id(definition_account_id),
holder: None,
holder_npk: Some(hex::encode(holder_keys.nullifer_public_key.0)),
holder_ipk: Some(hex::encode(holder_keys.incoming_viewing_public_key.0)),
holder_vpk: Some(hex::encode(holder_keys.viewing_public_key.0)),
amount: mint_amount,
};
+10 -10
View File
@@ -15,8 +15,8 @@ use nssa::{
};
use nssa_core::{
MembershipProof, NullifierPublicKey,
account::{AccountWithMetadata, Nonce, data::Data},
encryption::IncomingViewingPublicKey,
account::{AccountWithMetadata, data::Data},
encryption::ViewingPublicKey,
};
use tokio::test;
@@ -192,8 +192,8 @@ impl TpsTestManager {
fn build_privacy_transaction() -> PrivacyPreservingTransaction {
let program = Program::authenticated_transfer_program();
let sender_nsk = [1; 32];
let sender_isk = [99; 32];
let sender_ipk = IncomingViewingPublicKey::from_scalar(sender_isk);
let sender_vsk = [99; 32];
let sender_vpk = ViewingPublicKey::from_scalar(sender_vsk);
let sender_npk = NullifierPublicKey::from(&sender_nsk);
let sender_pre = AccountWithMetadata::new(
Account {
@@ -206,18 +206,18 @@ fn build_privacy_transaction() -> PrivacyPreservingTransaction {
AccountId::from(&sender_npk),
);
let recipient_nsk = [2; 32];
let recipient_isk = [99; 32];
let recipient_ipk = IncomingViewingPublicKey::from_scalar(recipient_isk);
let recipient_vsk = [99; 32];
let recipient_vpk = ViewingPublicKey::from_scalar(recipient_vsk);
let recipient_npk = NullifierPublicKey::from(&recipient_nsk);
let recipient_pre =
AccountWithMetadata::new(Account::default(), false, AccountId::from(&recipient_npk));
let eph_holder_from = EphemeralKeyHolder::new(&sender_npk);
let sender_ss = eph_holder_from.calculate_shared_secret_sender(&sender_ipk);
let sender_ss = eph_holder_from.calculate_shared_secret_sender(&sender_vpk);
let sender_epk = eph_holder_from.generate_ephemeral_public_key();
let eph_holder_to = EphemeralKeyHolder::new(&recipient_npk);
let recipient_ss = eph_holder_to.calculate_shared_secret_sender(&recipient_ipk);
let recipient_ss = eph_holder_to.calculate_shared_secret_sender(&recipient_vpk);
let recipient_epk = eph_holder_from.generate_ephemeral_public_key();
let balance_to_move: u128 = 1;
@@ -245,8 +245,8 @@ fn build_privacy_transaction() -> PrivacyPreservingTransaction {
vec![],
vec![],
vec![
(sender_npk, sender_ipk, sender_epk),
(recipient_npk, recipient_ipk, recipient_epk),
(sender_npk, sender_vpk, sender_epk),
(recipient_npk, recipient_vpk, recipient_epk),
],
output,
)
+2 -2
View File
@@ -600,10 +600,10 @@ fn test_wallet_ffi_get_private_account_keys() -> Result<()> {
.0;
let expected_npk = &key_chain.nullifer_public_key;
let expected_ivk = &key_chain.incoming_viewing_public_key;
let expected_vpk = &key_chain.viewing_public_key;
assert_eq!(&keys.npk(), expected_npk);
assert_eq!(&keys.ivk().unwrap(), expected_ivk);
assert_eq!(&keys.vpk().unwrap(), expected_vpk);
unsafe {
wallet_ffi_free_private_account_keys((&mut keys) as *mut FfiPrivateAccountKeys);