Skip to content

Commit

Permalink
cli: Warn on sizes above 10MB during solana rent (#922)
Browse files Browse the repository at this point in the history
* CliError

* review fix
  • Loading branch information
kubanemil authored Apr 22, 2024
1 parent 127faa3 commit 06dc262
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cli/src/cluster_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use {
signature::Signature,
slot_history,
stake::{self, state::StakeStateV2},
system_instruction,
system_instruction::{self, MAX_PERMITTED_DATA_LENGTH},
sysvar::{
self,
slot_history::SlotHistory,
Expand Down Expand Up @@ -2181,6 +2181,9 @@ pub fn process_calculate_rent(
data_length: usize,
use_lamports_unit: bool,
) -> ProcessResult {
if data_length > MAX_PERMITTED_DATA_LENGTH.try_into().unwrap() {
eprintln!("Warning: Maximum account size is {MAX_PERMITTED_DATA_LENGTH} bytes, {data_length} provided");
}
let rent_account = rpc_client.get_account(&sysvar::rent::id())?;
let rent: Rent = rent_account.deserialize_data()?;
let rent_exempt_minimum_lamports = rent.minimum_balance(data_length);
Expand Down

0 comments on commit 06dc262

Please sign in to comment.