Skip to content

Commit cc50d8e

Browse files
Adjust light token rent assertions
1 parent e7d02d4 commit cc50d8e

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

program-tests/compressed-token-test/tests/light_token/create.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ async fn test_create_compressible_token_account_failing() {
250250
.get_minimum_balance_for_rent_exemption(0)
251251
.await
252252
.unwrap()
253-
+ 20_000;
253+
+ 10_000;
254254
context
255255
.rpc
256256
.airdrop_lamports(&poor_payer.pubkey(), poor_payer_lamports)
@@ -289,8 +289,17 @@ async fn test_create_compressible_token_account_failing() {
289289
)
290290
.await;
291291

292-
// Should fail with InsufficientFunds (1) from system program
293-
light_program_test::utils::assert::assert_rpc_error(result, 0, 1).unwrap();
292+
// Solana 4 reports this before instruction execution when the payer
293+
// would be left below the zero-data rent floor.
294+
assert!(
295+
matches!(
296+
result,
297+
Err(RpcError::TransactionError(
298+
solana_sdk::transaction::TransactionError::InsufficientFundsForRent { .. }
299+
))
300+
),
301+
"expected insufficient funds for rent, got {result:?}"
302+
);
294303
}
295304

296305
// Note: Test 4 (Non-compressible account already initialized) removed because:

program-tests/compressed-token-test/tests/light_token/create_ata.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ async fn test_create_ata_failing() {
462462
.get_minimum_balance_for_rent_exemption(0)
463463
.await
464464
.unwrap()
465-
+ 20_000;
465+
+ 10_000;
466466
context
467467
.rpc
468468
.airdrop_lamports(&poor_payer.pubkey(), poor_payer_lamports)
@@ -499,8 +499,17 @@ async fn test_create_ata_failing() {
499499
.create_and_send_transaction(&[create_ata_ix], &poor_payer_pubkey, &[&poor_payer])
500500
.await;
501501

502-
// Should fail with InsufficientFunds (1) from system program
503-
light_program_test::utils::assert::assert_rpc_error(result, 0, 1).unwrap();
502+
// Solana 4 reports this before instruction execution when the payer
503+
// would be left below the zero-data rent floor.
504+
assert!(
505+
matches!(
506+
result,
507+
Err(RpcError::TransactionError(
508+
solana_sdk::transaction::TransactionError::InsufficientFundsForRent { .. }
509+
))
510+
),
511+
"expected insufficient funds for rent, got {result:?}"
512+
);
504513
}
505514

506515
// Test 4: compress_to_account_pubkey provided (forbidden for ATAs)

0 commit comments

Comments
 (0)