fix: tests fix

This commit is contained in:
Oleksandr Pravdyvyi 2025-10-29 12:02:41 +02:00
parent e41ffeac68
commit a903c221db
No known key found for this signature in database
GPG Key ID: 9F8955C63C443871
4 changed files with 34 additions and 25 deletions

View File

@ -31,7 +31,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_success() {
info!("test_success");
info!("########## test_success ##########");
let command = Command::AuthTransfer(AuthTransferSubcommand::Send {
from: make_public_account_input_from_str(ACC_SENDER),
to: Some(make_public_account_input_from_str(ACC_RECEIVER)),
@ -70,7 +70,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_success_move_to_another_account() {
info!("test_success_move_to_another_account");
info!("########## test_success_move_to_another_account ##########");
let command = Command::Account(AccountSubcommand::New(NewSubcommand::Public {}));
let wallet_config = fetch_config().await.unwrap();
@ -134,7 +134,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_failure() {
info!("test_failure");
info!("########## test_failure ##########");
let command = Command::AuthTransfer(AuthTransferSubcommand::Send {
from: make_public_account_input_from_str(ACC_SENDER),
to: Some(make_public_account_input_from_str(ACC_RECEIVER)),
@ -175,7 +175,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_success_two_transactions() {
info!("test_success_two_transactions");
info!("########## test_success_two_transactions ##########");
let command = Command::AuthTransfer(AuthTransferSubcommand::Send {
from: make_public_account_input_from_str(ACC_SENDER),
to: Some(make_public_account_input_from_str(ACC_RECEIVER)),
@ -245,7 +245,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_get_account() {
info!("test_get_account");
info!("########## test_get_account ##########");
let wallet_config = fetch_config().await.unwrap();
let seq_client = SequencerClient::new(wallet_config.sequencer_addr.clone()).unwrap();
@ -268,6 +268,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
/// token transfer to a new account.
#[nssa_integration_test]
pub async fn test_success_token_program() {
info!("########## test_success_token_program ##########");
let wallet_config = fetch_config().await.unwrap();
// Create new account for the token definition
@ -424,6 +425,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
/// private token transfer to a new account. All accounts are owned except definition.
#[nssa_integration_test]
pub async fn test_success_token_program_private_owned() {
info!("########## test_success_token_program_private_owned ##########");
let wallet_config = fetch_config().await.unwrap();
// Create new account for the token definition (public)
@ -574,6 +576,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
/// private token transfer to a new account.
#[nssa_integration_test]
pub async fn test_success_token_program_private_claiming_path() {
info!("########## test_success_token_program_private_claiming_path ##########");
let wallet_config = fetch_config().await.unwrap();
// Create new account for the token definition (public)
@ -705,6 +708,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
/// shielded token transfer to a new account. All accounts are owned except definition.
#[nssa_integration_test]
pub async fn test_success_token_program_shielded_owned() {
info!("########## test_success_token_program_shielded_owned ##########");
let wallet_config = fetch_config().await.unwrap();
// Create new account for the token definition (public)
@ -835,6 +839,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
/// deshielded token transfer to a new account. All accounts are owned except definition.
#[nssa_integration_test]
pub async fn test_success_token_program_deshielded_owned() {
info!("########## test_success_token_program_deshielded_owned ##########");
let wallet_config = fetch_config().await.unwrap();
// Create new account for the token definition (public)
@ -973,7 +978,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_success_private_transfer_to_another_owned_account() {
info!("test_success_private_transfer_to_another_owned_account");
info!("########## test_success_private_transfer_to_another_owned_account ##########");
let from: Address = ACC_SENDER_PRIVATE.parse().unwrap();
let to: Address = ACC_RECEIVER_PRIVATE.parse().unwrap();
@ -1009,7 +1014,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_success_private_transfer_to_another_foreign_account() {
info!("test_success_private_transfer_to_another_foreign_account");
info!("########## test_success_private_transfer_to_another_foreign_account ##########");
let from: Address = ACC_SENDER_PRIVATE.parse().unwrap();
let to_npk = NullifierPublicKey([42; 32]);
let to_npk_string = hex::encode(to_npk.0);
@ -1055,7 +1060,9 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_success_private_transfer_to_another_owned_account_claiming_path() {
info!("test_success_private_transfer_to_another_owned_account_claiming_path");
info!(
"########## test_success_private_transfer_to_another_owned_account_claiming_path ##########"
);
let from: Address = ACC_SENDER_PRIVATE.parse().unwrap();
let command = Command::Account(AccountSubcommand::New(NewSubcommand::Private {}));
@ -1119,7 +1126,9 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_success_private_transfer_to_another_owned_account_cont_run_path() {
info!("test_success_private_transfer_to_another_owned_account_cont_run_path");
info!(
"########## test_success_private_transfer_to_another_owned_account_cont_run_path ##########"
);
let continious_run_handle = tokio::spawn(wallet::execute_continious_run());
let from: Address = ACC_SENDER_PRIVATE.parse().unwrap();
@ -1189,7 +1198,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_success_deshielded_transfer_to_another_account() {
info!("test_success_deshielded_transfer_to_another_account");
info!("########## test_success_deshielded_transfer_to_another_account ##########");
let from: Address = ACC_SENDER_PRIVATE.parse().unwrap();
let to: Address = ACC_RECEIVER.parse().unwrap();
@ -1238,7 +1247,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_success_shielded_transfer_to_another_owned_account() {
info!("test_success_shielded_transfer_to_another_owned_account");
info!("########## test_success_shielded_transfer_to_another_owned_account ##########");
let from: Address = ACC_SENDER.parse().unwrap();
let to: Address = ACC_RECEIVER_PRIVATE.parse().unwrap();
@ -1280,7 +1289,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_success_shielded_transfer_to_another_foreign_account() {
info!("test_success_shielded_transfer_to_another_foreign_account");
info!("########## test_success_shielded_transfer_to_another_foreign_account ##########");
let to_npk = NullifierPublicKey([42; 32]);
let to_npk_string = hex::encode(to_npk.0);
let to_ipk = Secp256k1Point::from_scalar(to_npk.0);
@ -1325,7 +1334,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_pinata() {
info!("test_pinata");
info!("########## test_pinata ##########");
let pinata_addr = PINATA_BASE58;
let pinata_prize = 150;
let solution = 989106;
@ -1370,7 +1379,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_program_deployment() {
info!("test program deployment");
info!("########## test program deployment ##########");
let bytecode = NSSA_PROGRAM_FOR_TEST_DATA_CHANGER.to_vec();
let message = nssa::program_deployment_transaction::Message::new(bytecode.clone());
let transaction = ProgramDeploymentTransaction::new(message);
@ -1417,7 +1426,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_authenticated_transfer_initialize_function() {
info!("test initialize account for authenticated transfer");
info!("########## test initialize account for authenticated transfer ##########");
let command = Command::Account(AccountSubcommand::New(NewSubcommand::Public {}));
let SubcommandReturnValue::RegisterAccount { addr } =
wallet::execute_subcommand(command).await.unwrap()
@ -1426,7 +1435,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
};
let command = Command::AuthTransfer(AuthTransferSubcommand::Init {
addr: addr.to_string(),
addr: make_public_account_input_from_str(&addr.to_string()),
});
wallet::execute_subcommand(command).await.unwrap();
@ -1453,7 +1462,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_pinata_private_receiver() {
info!("test_pinata_private_receiver");
info!("########## test_pinata_private_receiver ##########");
let pinata_addr = PINATA_BASE58;
let pinata_prize = 150;
let solution = 989106;
@ -1510,7 +1519,7 @@ pub fn prepare_function_map() -> HashMap<String, TestFunction> {
#[nssa_integration_test]
pub async fn test_pinata_private_receiver_new_account() {
info!("test_pinata_private_receiver");
info!("########## test_pinata_private_receiver ##########");
let pinata_addr = PINATA_BASE58;
let pinata_prize = 150;
let solution = 989106;

View File

@ -19,9 +19,9 @@ pub enum AuthTransferSubcommand {
addr: String,
},
///Send native tokens from one account to another with variable privacy
///
///
///If receiver is private, then `to` and (`to_npk` , `to_ipk`) is a mutually exclusive patterns.
///
///
///First is used for owned accounts, second otherwise.
Send {
///from - valid 32 byte base58 string with privacy prefix

View File

@ -13,7 +13,7 @@ use crate::{
#[derive(Subcommand, Debug, Clone)]
pub enum TokenProgramAgnosticSubcommand {
///Produce new ERC-20 token
///
///
///Currently the only supported privacy options is for public definition
New {
///definition_addr - valid 32 byte base58 string with privacy prefix
@ -28,9 +28,9 @@ pub enum TokenProgramAgnosticSubcommand {
total_supply: u128,
},
///Send tokens from one account to another with variable privacy
///
///
///If receiver is private, then `to` and (`to_npk` , `to_ipk`) is a mutually exclusive patterns.
///
///
///First is used for owned accounts, second otherwise.
Send {
///from - valid 32 byte base58 string with privacy prefix

View File

@ -219,9 +219,9 @@ pub enum Command {
}
///To execute commands, env var NSSA_WALLET_HOME_DIR must be set into directory with config
///
///
/// All account adresses must be valid 32 byte base58 strings.
///
///
/// All account addresses must be provided as {privacy_prefix}/{addr},
/// where valid options for `privacy_prefix` is `Public` and `Private`
#[derive(Parser, Debug)]