Skip to content

Commit

Permalink
Fix program buffer account rent-exempt lamport calculation (#34722)
Browse files Browse the repository at this point in the history
fix program buffer size in minimul for rent exempt calculation

Co-authored-by: HaoranYi <haoran.yi@solana.com>
  • Loading branch information
HaoranYi and HaoranYi authored Jan 10, 2024
1 parent e3df207 commit 61e42cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion runtime/src/loader_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pub fn load_upgradeable_buffer<T: Client>(
let program = load_program_from_file(name);
let buffer_pubkey = buffer_keypair.pubkey();
let buffer_authority_pubkey = buffer_authority_keypair.pubkey();
let program_buffer_bytes = UpgradeableLoaderState::size_of_programdata(program.len());

bank_client
.send_and_confirm_message(
Expand All @@ -127,7 +128,7 @@ pub fn load_upgradeable_buffer<T: Client>(
&buffer_authority_pubkey,
1.max(
bank_client
.get_minimum_balance_for_rent_exemption(program.len())
.get_minimum_balance_for_rent_exemption(program_buffer_bytes)
.unwrap(),
),
program.len(),
Expand Down

0 comments on commit 61e42cb

Please sign in to comment.