Skip to content

Commit d5598e5

Browse files
committed
refactor: processor into separate crate and make it trait based
1 parent d38901c commit d5598e5

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

  • program-tests/compressed-token-test/tests/light_token

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,4 +694,29 @@ async fn test_create_compressible_token_account_failing() {
694694
// Only version 3 (ShaFlat) is supported for compressible accounts
695695
light_program_test::utils::assert::assert_rpc_error(result, 0, 2).unwrap();
696696
}
697+
698+
// Test 13: Rent sponsor self-referencing token account (audit issue #9)
699+
// The rent sponsor cannot be the same account as the token account being created.
700+
// This would create a self-referencing loop that could corrupt account state.
701+
// Error: 3 (InvalidAccountData)
702+
{
703+
context.token_account_keypair = Keypair::new();
704+
let compressible_data = CompressibleData {
705+
compression_authority: context.compression_authority,
706+
rent_sponsor: context.token_account_keypair.pubkey(), // Self-reference!
707+
num_prepaid_epochs: 2,
708+
lamports_per_write: Some(100),
709+
account_version: light_token_interface::state::TokenDataVersion::ShaFlat,
710+
compress_to_pubkey: false,
711+
payer: payer_pubkey,
712+
};
713+
714+
create_and_assert_token_account_fails(
715+
&mut context,
716+
compressible_data,
717+
"rent_sponsor_self_reference",
718+
3, // InvalidAccountData
719+
)
720+
.await;
721+
}
697722
}

0 commit comments

Comments
 (0)