Skip to content

Commit

Permalink
Make rent expansion based on bytes not current balance
Browse files Browse the repository at this point in the history
  • Loading branch information
brittcyr committed Oct 13, 2024
1 parent cc36ad6 commit 6805cfe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion programs/manifest/src/program/processor/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ fn expand_dynamic<'a, 'info, T: ManifestAccount + Pod + Clone>(
let new_size: usize = expandable_account.data_len() + block_size;

let rent: Rent = Rent::get()?;
let old_minimum_balance: u64 = rent.minimum_balance(expandable_account.data_len());
let new_minimum_balance: u64 = rent.minimum_balance(new_size);
let lamports_diff: u64 = new_minimum_balance.saturating_sub(expandable_account.lamports());
// Dont use the actual amount since that could have gas prepayments on it.
let lamports_diff: u64 = new_minimum_balance.saturating_sub(old_minimum_balance);

let payer: &AccountInfo = payer.info;
let system_program: &AccountInfo = system_program.info;
Expand Down

0 comments on commit 6805cfe

Please sign in to comment.