Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

test: ensure confidential_transfer using the latest blockhash #6840

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions token/program-2022-test/tests/confidential_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1621,11 +1621,12 @@ async fn confidential_transfer_configure_token_account_with_proof_context() {
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
];

let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
let tx = Transaction::new_signed_with_payer(
&instructions,
Some(&ctx.payer.pubkey()),
&[&ctx.payer, &context_state_account],
ctx.last_blockhash,
last_blockhash,
);
ctx.banks_client.process_transaction(tx).await.unwrap();
}
Expand Down Expand Up @@ -1707,11 +1708,12 @@ async fn confidential_transfer_configure_token_account_with_proof_context() {
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
];

let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
let tx = Transaction::new_signed_with_payer(
&instructions,
Some(&ctx.payer.pubkey()),
&[&ctx.payer, &context_state_account],
ctx.last_blockhash,
last_blockhash,
);
ctx.banks_client.process_transaction(tx).await.unwrap();
}
Expand Down Expand Up @@ -1793,11 +1795,12 @@ async fn confidential_transfer_empty_account_with_proof_context() {
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
];

let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
let tx = Transaction::new_signed_with_payer(
&instructions,
Some(&ctx.payer.pubkey()),
&[&ctx.payer, &context_state_account],
ctx.last_blockhash,
last_blockhash,
);
ctx.banks_client.process_transaction(tx).await.unwrap();
}
Expand Down Expand Up @@ -1847,11 +1850,12 @@ async fn confidential_transfer_empty_account_with_proof_context() {
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
];

let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
let tx = Transaction::new_signed_with_payer(
&instructions,
Some(&ctx.payer.pubkey()),
&[&ctx.payer, &context_state_account],
ctx.last_blockhash,
last_blockhash,
);
ctx.banks_client.process_transaction(tx).await.unwrap();
}
Expand Down Expand Up @@ -1959,11 +1963,12 @@ async fn confidential_transfer_withdraw_with_proof_context() {
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
];

let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
let tx = Transaction::new_signed_with_payer(
&instructions,
Some(&ctx.payer.pubkey()),
&[&ctx.payer, &context_state_account],
ctx.last_blockhash,
last_blockhash,
);
ctx.banks_client.process_transaction(tx).await.unwrap();
}
Expand Down Expand Up @@ -2016,11 +2021,12 @@ async fn confidential_transfer_withdraw_with_proof_context() {
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
];

let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
let tx = Transaction::new_signed_with_payer(
&instructions,
Some(&ctx.payer.pubkey()),
&[&ctx.payer, &context_state_account],
ctx.last_blockhash,
last_blockhash,
);
ctx.banks_client.process_transaction(tx).await.unwrap();
}
Expand Down Expand Up @@ -2148,11 +2154,12 @@ async fn confidential_transfer_transfer_with_proof_context() {
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
];

let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
let tx = Transaction::new_signed_with_payer(
&instructions,
Some(&ctx.payer.pubkey()),
&[&ctx.payer, &context_state_account],
ctx.last_blockhash,
last_blockhash,
);
ctx.banks_client.process_transaction(tx).await.unwrap();
}
Expand Down Expand Up @@ -2219,11 +2226,12 @@ async fn confidential_transfer_transfer_with_proof_context() {
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
];

let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
let tx = Transaction::new_signed_with_payer(
&instructions,
Some(&ctx.payer.pubkey()),
&[&ctx.payer, &context_state_account],
ctx.last_blockhash,
last_blockhash,
);
ctx.banks_client.process_transaction(tx).await.unwrap();
}
Expand Down
Loading