From 2d0351ce360336e9d41c88c9c66d90fb33d2b7c1 Mon Sep 17 00:00:00 2001 From: 0xCypher <0xcypher02@gmail.com> Date: Fri, 8 Nov 2024 19:39:57 -0500 Subject: [PATCH 1/2] fix: fix native accounts --- crates/svm-test/src/utils/spl_token.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/svm-test/src/utils/spl_token.rs b/crates/svm-test/src/utils/spl_token.rs index 1bb819a..6772d08 100644 --- a/crates/svm-test/src/utils/spl_token.rs +++ b/crates/svm-test/src/utils/spl_token.rs @@ -23,10 +23,15 @@ where } pub fn program_account(account: spl_token::state::Account) -> Account { + let rent = Rent::default().minimum_balance(spl_token::state::Account::LEN); + let lamports = match account.mint { + _ if account.mint == WSOL => account.amount + rent, + _ => rent, + }; Account { owner: spl_token::ID, - data: super::pack_to_vec(account), - lamports: Rent::default().minimum_balance(spl_token::state::Account::LEN), + data: svm_test::utils::pack_to_vec(account), + lamports, ..Default::default() } } @@ -40,7 +45,9 @@ pub fn token(mint: Pubkey, owner: Pubkey, amount: u64) -> spl_token::state::Acco delegated_amount: 0, state: AccountState::Initialized, is_native: match mint { - _ if mint == WSOL => COption::Some(0), + _ if mint == WSOL => { + COption::Some(Rent::default().minimum_balance(spl_token::state::Account::LEN)) + } _ => COption::None, }, close_authority: COption::None, From cb1e5fd1f688207ba636ec89c6d8f5b087a4d211 Mon Sep 17 00:00:00 2001 From: 0xCypher <0xcypher02@gmail.com> Date: Fri, 8 Nov 2024 19:40:46 -0500 Subject: [PATCH 2/2] Update spl_token.rs --- crates/svm-test/src/utils/spl_token.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/svm-test/src/utils/spl_token.rs b/crates/svm-test/src/utils/spl_token.rs index 6772d08..9f795be 100644 --- a/crates/svm-test/src/utils/spl_token.rs +++ b/crates/svm-test/src/utils/spl_token.rs @@ -30,7 +30,7 @@ pub fn program_account(account: spl_token::state::Account) -> Account { }; Account { owner: spl_token::ID, - data: svm_test::utils::pack_to_vec(account), + data: super::pack_to_vec(account), lamports, ..Default::default() }