mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-14 03:59:30 +00:00
fixed integration tests
This commit is contained in:
parent
58fdb7e74c
commit
01cc7e24b6
@ -232,8 +232,6 @@ async fn create_and_transfer_public_token() -> Result<()> {
|
|||||||
holder_npk: None,
|
holder_npk: None,
|
||||||
holder_vpk: None,
|
holder_vpk: None,
|
||||||
amount: mint_amount,
|
amount: mint_amount,
|
||||||
holder_pin: None,
|
|
||||||
holder_key_path: None,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
|
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_npk: None,
|
||||||
holder_vpk: None,
|
holder_vpk: None,
|
||||||
amount: mint_amount_public,
|
amount: mint_amount_public,
|
||||||
holder_pin: None,
|
|
||||||
holder_key_path: None,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
|
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_npk: None,
|
||||||
holder_vpk: None,
|
holder_vpk: None,
|
||||||
amount: mint_amount_private,
|
amount: mint_amount_private,
|
||||||
holder_pin: None,
|
|
||||||
holder_key_path: None,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
|
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_npk: Some(hex::encode(holder_keys.nullifier_public_key.0)),
|
||||||
holder_vpk: Some(hex::encode(holder_keys.viewing_public_key.0)),
|
holder_vpk: Some(hex::encode(holder_keys.viewing_public_key.0)),
|
||||||
amount: mint_amount,
|
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?;
|
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
|
||||||
// This command breaks (Marvin)
|
|
||||||
println!("TEST5");
|
|
||||||
info!("Waiting for next block creation");
|
info!("Waiting for next block creation");
|
||||||
tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await;
|
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 {});
|
let command = Command::Account(AccountSubcommand::SyncPrivate {});
|
||||||
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
|
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
|
||||||
|
|
||||||
println!("TEST6");
|
|
||||||
// Verify commitment exists
|
// Verify commitment exists
|
||||||
let recipient_commitment = ctx
|
let recipient_commitment = ctx
|
||||||
.wallet()
|
.wallet()
|
||||||
|
|||||||
@ -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];
|
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
|
// all remaining vec fields are empty: u32 len=0
|
||||||
let empty_vec_bytes: &[u8] = &[0_u8; 4];
|
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 unbounded_window_bytes: &[u8] = &[0_u8; 2];
|
||||||
|
|
||||||
let expected_borsh_vec: Vec<u8> = [
|
let expected_borsh_vec: Vec<u8> = [
|
||||||
|
|||||||
@ -49,7 +49,7 @@ pub enum Instruction {
|
|||||||
|
|
||||||
pub fn compute_ata_seed(owner_id: AccountId, definition_id: AccountId) -> PdaSeed {
|
pub fn compute_ata_seed(owner_id: AccountId, definition_id: AccountId) -> PdaSeed {
|
||||||
use risc0_zkvm::sha::{Impl, Sha256};
|
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[0..32].copy_from_slice(&owner_id.to_bytes());
|
||||||
bytes[32..64].copy_from_slice(&definition_id.to_bytes());
|
bytes[32..64].copy_from_slice(&definition_id.to_bytes());
|
||||||
PdaSeed::new(
|
PdaSeed::new(
|
||||||
|
|||||||
@ -146,10 +146,6 @@ pub enum TokenProgramAgnosticSubcommand {
|
|||||||
/// amount - amount of balance to mint.
|
/// amount - amount of balance to mint.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
amount: u128,
|
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_npk,
|
||||||
holder_vpk,
|
holder_vpk,
|
||||||
amount,
|
amount,
|
||||||
holder_pin,
|
|
||||||
holder_key_path,
|
|
||||||
} => {
|
} => {
|
||||||
let definition = resolve_id_or_label(
|
let definition = resolve_id_or_label(
|
||||||
definition,
|
definition,
|
||||||
@ -436,14 +430,17 @@ impl WalletSubcommand for TokenProgramAgnosticSubcommand {
|
|||||||
&None,
|
&None,
|
||||||
&None,
|
&None,
|
||||||
)?;
|
)?;
|
||||||
let holder = Some(resolve_id_or_label(
|
let holder = match (holder, holder_label) {
|
||||||
holder.clone(),
|
(v, None) => v,
|
||||||
holder_label.clone(),
|
(None, Some(label)) => Some(resolve_account_label(
|
||||||
&wallet_core.storage.labels,
|
&label,
|
||||||
&wallet_core.storage.user_data,
|
&wallet_core.storage.labels,
|
||||||
&holder_pin,
|
&wallet_core.storage.user_data,
|
||||||
&holder_key_path,
|
)?),
|
||||||
)?);
|
(Some(_), Some(_)) => {
|
||||||
|
anyhow::bail!("Provide only one of --holder or --holder-label")
|
||||||
|
}
|
||||||
|
};
|
||||||
let underlying_subcommand = match (holder, holder_npk, holder_vpk) {
|
let underlying_subcommand = match (holder, holder_npk, holder_vpk) {
|
||||||
(None, None, None) => {
|
(None, None, None) => {
|
||||||
anyhow::bail!(
|
anyhow::bail!(
|
||||||
|
|||||||
@ -173,7 +173,8 @@ mod tests {
|
|||||||
|
|
||||||
use super::PersistentAccountDataPublic;
|
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] = [
|
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,
|
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,
|
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 {
|
fn make_public_account_data(data: Option<ChildKeysPublic>) -> PersistentAccountDataPublic {
|
||||||
PersistentAccountDataPublic {
|
PersistentAccountDataPublic {
|
||||||
account_id: AccountId::new([0u8; 32]),
|
account_id: AccountId::new([0_u8; 32]),
|
||||||
chain_index: ChainIndex::root(),
|
chain_index: ChainIndex::root(),
|
||||||
data,
|
data,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,11 +33,24 @@ impl NativeTokenTransfer<'_> {
|
|||||||
let program_id = Program::authenticated_transfer_program().id();
|
let program_id = Program::authenticated_transfer_program().id();
|
||||||
|
|
||||||
// Fetch nonces for both accounts unconditionally
|
// Fetch nonces for both accounts unconditionally
|
||||||
let nonces = self
|
let mut nonces = self
|
||||||
.0
|
.0
|
||||||
.get_accounts_nonces(account_ids.clone())
|
.get_accounts_nonces(vec![from])
|
||||||
.await
|
.await
|
||||||
.map_err(ExecutionFailureKind::SequencerError)?;
|
.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();
|
let message = Message::try_new(program_id, account_ids, nonces, balance_to_move).unwrap();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user