RPC: getMinimumBalanceForRentExemption now only responds to valid account lengths (bp #12113) (#12115)
* getMinimumBalanceForRentExemption now only responds to valid account lengths
(cherry picked from commit 9e96180ce4
)
# Conflicts:
# core/src/rpc.rs
* Update rpc.rs
Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
@@ -50,6 +50,7 @@ use solana_sdk::{
|
||||
pubkey::Pubkey,
|
||||
signature::Signature,
|
||||
stake_history::StakeHistory,
|
||||
system_instruction,
|
||||
sysvar::{stake_history, Sysvar},
|
||||
timing::slot_duration_from_slots_per_year,
|
||||
transaction::{self, Transaction},
|
||||
@@ -1803,6 +1804,9 @@ impl RpcSol for RpcSolImpl {
|
||||
"get_minimum_balance_for_rent_exemption rpc request received: {:?}",
|
||||
data_len
|
||||
);
|
||||
if data_len as u64 > system_instruction::MAX_PERMITTED_DATA_LENGTH {
|
||||
return Err(Error::invalid_request());
|
||||
}
|
||||
meta.get_minimum_balance_for_rent_exemption(data_len, commitment)
|
||||
}
|
||||
|
||||
@@ -2505,7 +2509,7 @@ pub mod tests {
|
||||
message::Message,
|
||||
nonce, rpc_port,
|
||||
signature::{Keypair, Signer},
|
||||
system_instruction, system_program, system_transaction,
|
||||
system_program, system_transaction,
|
||||
transaction::{self, TransactionError},
|
||||
};
|
||||
use solana_transaction_status::{EncodedTransaction, TransactionWithStatusMeta, UiMessage};
|
||||
|
Reference in New Issue
Block a user