fixed integration tests

This commit is contained in:
jonesmarvin8 2026-04-28 20:45:43 -04:00
parent 58fdb7e74c
commit 01cc7e24b6
6 changed files with 36 additions and 34 deletions

View File

@ -232,8 +232,6 @@ async fn create_and_transfer_public_token() -> Result<()> {
holder_npk: None,
holder_vpk: None,
amount: mint_amount,
holder_pin: None,
holder_key_path: None,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@ -577,8 +575,6 @@ async fn create_token_with_private_definition() -> Result<()> {
holder_npk: None,
holder_vpk: None,
amount: mint_amount_public,
holder_pin: None,
holder_key_path: None,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@ -627,8 +623,6 @@ async fn create_token_with_private_definition() -> Result<()> {
holder_npk: None,
holder_vpk: None,
amount: mint_amount_private,
holder_pin: None,
holder_key_path: None,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@ -1169,13 +1163,11 @@ async fn token_claiming_path_with_private_accounts() -> Result<()> {
holder_npk: Some(hex::encode(holder_keys.nullifier_public_key.0)),
holder_vpk: Some(hex::encode(holder_keys.viewing_public_key.0)),
amount: mint_amount,
holder_pin: None,
holder_key_path: None,
};
// This should be the one that breaks? (Marvin)
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
// This command breaks (Marvin)
println!("TEST5");
info!("Waiting for next block creation");
tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await;
@ -1183,7 +1175,6 @@ async fn token_claiming_path_with_private_accounts() -> Result<()> {
let command = Command::Account(AccountSubcommand::SyncPrivate {});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
println!("TEST6");
// Verify commitment exists
let recipient_commitment = ctx
.wallet()

View File

@ -204,7 +204,7 @@ pub mod tests {
let nonces_bytes: &[u8] = &[1, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
// all remaining vec fields are empty: u32 len=0
let empty_vec_bytes: &[u8] = &[0_u8; 4];
// validity windows: unbounded = {from: None (0u8), to: None (0u8)}
// validity windows: unbounded = {from: None (0_u8), to: None (0_u8)}
let unbounded_window_bytes: &[u8] = &[0_u8; 2];
let expected_borsh_vec: Vec<u8> = [

View File

@ -49,7 +49,7 @@ pub enum Instruction {
pub fn compute_ata_seed(owner_id: AccountId, definition_id: AccountId) -> PdaSeed {
use risc0_zkvm::sha::{Impl, Sha256};
let mut bytes = [0u8; 64];
let mut bytes = [0_u8; 64];
bytes[0..32].copy_from_slice(&owner_id.to_bytes());
bytes[32..64].copy_from_slice(&definition_id.to_bytes());
PdaSeed::new(

View File

@ -146,10 +146,6 @@ pub enum TokenProgramAgnosticSubcommand {
/// amount - amount of balance to mint.
#[arg(long)]
amount: u128,
#[arg(long, conflicts_with = "holder", conflicts_with = "holder_label")]
holder_pin: Option<String>,
#[arg(long, conflicts_with = "holder", conflicts_with = "holder_label")]
holder_key_path: Option<String>,
},
}
@ -425,8 +421,6 @@ impl WalletSubcommand for TokenProgramAgnosticSubcommand {
holder_npk,
holder_vpk,
amount,
holder_pin,
holder_key_path,
} => {
let definition = resolve_id_or_label(
definition,
@ -436,14 +430,17 @@ impl WalletSubcommand for TokenProgramAgnosticSubcommand {
&None,
&None,
)?;
let holder = Some(resolve_id_or_label(
holder.clone(),
holder_label.clone(),
&wallet_core.storage.labels,
&wallet_core.storage.user_data,
&holder_pin,
&holder_key_path,
)?);
let holder = match (holder, holder_label) {
(v, None) => v,
(None, Some(label)) => Some(resolve_account_label(
&label,
&wallet_core.storage.labels,
&wallet_core.storage.user_data,
)?),
(Some(_), Some(_)) => {
anyhow::bail!("Provide only one of --holder or --holder-label")
}
};
let underlying_subcommand = match (holder, holder_npk, holder_vpk) {
(None, None, None) => {
anyhow::bail!(

View File

@ -173,7 +173,8 @@ mod tests {
use super::PersistentAccountDataPublic;
// Root public account keys derived from a known test seed; see key_protocol's keys_public tests.
// Root public account keys derived from a known test seed; see key_protocol's keys_public
// tests.
const CSK_BYTES: [u8; 32] = [
40, 35, 239, 19, 53, 178, 250, 55, 115, 12, 34, 3, 153, 153, 72, 170, 190, 36, 172, 36,
202, 148, 181, 228, 35, 222, 58, 84, 156, 24, 146, 86,
@ -198,7 +199,7 @@ mod tests {
fn make_public_account_data(data: Option<ChildKeysPublic>) -> PersistentAccountDataPublic {
PersistentAccountDataPublic {
account_id: AccountId::new([0u8; 32]),
account_id: AccountId::new([0_u8; 32]),
chain_index: ChainIndex::root(),
data,
}

View File

@ -33,11 +33,24 @@ impl NativeTokenTransfer<'_> {
let program_id = Program::authenticated_transfer_program().id();
// Fetch nonces for both accounts unconditionally
let nonces = self
.0
.get_accounts_nonces(account_ids.clone())
.await
.map_err(ExecutionFailureKind::SequencerError)?;
let mut nonces = self
.0
.get_accounts_nonces(vec![from])
.await
.map_err(ExecutionFailureKind::SequencerError)?;
let to_signing_key = self.0.storage.user_data.get_pub_account_signing_key(to);
if let Some(_to_signing_key) = to_signing_key {
let to_nonces = self
.0
.get_accounts_nonces(vec![to])
.await
.map_err(ExecutionFailureKind::SequencerError)?;
nonces.extend(to_nonces);
} else {
println!(
"Receiver's account ({to}) private key not found in wallet. Proceeding with only sender's key."
);
}
let message = Message::try_new(program_id, account_ids, nonces, balance_to_move).unwrap();