Conversation
|
|
||
| let rent = Rent::get()?; | ||
| let rent_exempt_reserve = rent.minimum_balance(native_account_info.data_len()); | ||
| let rent_exempt_reserve = if let Ok(rent_sysvar_info) = next_account_info(account_info_iter) |
There was a problem hiding this comment.
| let rent_exempt_reserve = if let Ok(rent_sysvar_info) = next_account_info(account_info_iter) | |
| let rent_exempt_reserve = if let Ok(rent_sysvar_info) = next_account_info(account_info_iter) && account_info_iter.address == expected_rent_sysvar |
@febo Can we change to that?
We are passing some other account as remaining account, this change is now breaking our deployed logic on devnet.
We pass the other account because of another solana runtime bug solana-labs/solana#9711 during a CPI call, Solana Runtime only checks balances of accounts used by the CPI call.
Not adding the extra account account here would make the CPI "sum of account balances before and after instruction do not match" error.
We have the following code:
normalAccountWithData.sub_lamports(sol_amount)?;
wsolAta.add_lamports(sol_amount)?;
anchor_lang::solana_program::program::invoke(
&Instruction {
program_id: token::spl_token::ID,
accounts: vec![
AccountMeta::new(wsolAta.key(), false),
AccountMeta::new(normalAccountWithData.key(), false),
],
data: TokenInstruction::SyncNative.pack(),
},
&[
[wsolAta.to](http://wsolata.to/)_account_info(),
[normalAccountWithData.to](http://normalaccountwithdata.to/)_account_info(),
],
)?;
EDIT: another suggestion maybe add next_account_info to check key if it is the token_program_id then assume it is not passed, this is exactly how anchor implements optional accounts.
Whats the timeline for this on mainnet?
There was a problem hiding this comment.
We understand we can add the sysvar rent before the additional account but we cannot push it to mainnet before you push this to mainnet too I presume. Can we have timelines so it can be coordinated
There was a problem hiding this comment.
You can start adding the rent sysvar right away -- if the current program is ok with a different random account, it should be fine with the rent sysvar either way
Problem
PR #132 add the requirement of using the Rent sysvar in
SyncNativeto update the current rent-exempt reserve, which can lead to an increase CU consumption.Solution
Allow the Rent sysvar account to be provided.