fix account resize test by requesting max tx data size (#28826)
* fix account resize test by requesting max tx data size * define data size limit in incremental of 1024
This commit is contained in:
parent
516d27bc42
commit
ae48ac97dd
|
@ -25,7 +25,7 @@ pub enum LoadedAccountsDataLimitType {
|
|||
|
||||
/// Get default value of `ComputeBudget::accounts_data_size_limit` if not set specifically. It
|
||||
/// sets to 10MB initially, may be changed with feature gate.
|
||||
const DEFAULT_LOADED_ACCOUNTS_DATA_LIMIT: u32 = 10_000_000;
|
||||
const DEFAULT_LOADED_ACCOUNTS_DATA_LIMIT: u32 = 10 * 1024 * 1024;
|
||||
pub fn get_default_loaded_accounts_data_limit(limit_type: &LoadedAccountsDataLimitType) -> u32 {
|
||||
match limit_type {
|
||||
LoadedAccountsDataLimitType::V0 => DEFAULT_LOADED_ACCOUNTS_DATA_LIMIT,
|
||||
|
@ -34,7 +34,7 @@ pub fn get_default_loaded_accounts_data_limit(limit_type: &LoadedAccountsDataLim
|
|||
/// Get max value of `ComputeBudget::accounts_data_size_limit`, it caps value user
|
||||
/// sets via `ComputeBudgetInstruction::set_compute_unit_limit`. It is set to 100MB
|
||||
/// initially, can be changed with feature gate.
|
||||
const MAX_LOADED_ACCOUNTS_DATA_LIMIT: u32 = 100_000_000;
|
||||
const MAX_LOADED_ACCOUNTS_DATA_LIMIT: u32 = 100 * 1024 * 1024;
|
||||
pub fn get_max_loaded_accounts_data_limit(limit_type: &LoadedAccountsDataLimitType) -> u32 {
|
||||
match limit_type {
|
||||
LoadedAccountsDataLimitType::V0 => MAX_LOADED_ACCOUNTS_DATA_LIMIT,
|
||||
|
|
|
@ -19509,7 +19509,10 @@ pub(crate) mod tests {
|
|||
account_metas,
|
||||
);
|
||||
Transaction::new_signed_with_payer(
|
||||
&[instruction],
|
||||
&[
|
||||
instruction,
|
||||
ComputeBudgetInstruction::set_accounts_data_size_limit(u32::MAX),
|
||||
],
|
||||
Some(&payer.pubkey()),
|
||||
&[payer],
|
||||
recent_blockhash,
|
||||
|
@ -19811,6 +19814,7 @@ pub(crate) mod tests {
|
|||
&mock_program_id,
|
||||
mock_realloc_process_instruction,
|
||||
);
|
||||
|
||||
let recent_blockhash = bank.last_blockhash();
|
||||
|
||||
let funding_keypair = Keypair::new();
|
||||
|
@ -19827,7 +19831,7 @@ pub(crate) mod tests {
|
|||
let account_balance = LAMPORTS_PER_SOL;
|
||||
let account_size = rng.gen_range(
|
||||
1,
|
||||
(MAX_PERMITTED_DATA_LENGTH / 4) as usize - MAX_PERMITTED_DATA_INCREASE,
|
||||
MAX_PERMITTED_DATA_LENGTH as usize - MAX_PERMITTED_DATA_INCREASE,
|
||||
);
|
||||
let account_data =
|
||||
AccountSharedData::new(account_balance, account_size, &mock_program_id);
|
||||
|
@ -19857,9 +19861,8 @@ pub(crate) mod tests {
|
|||
{
|
||||
let account_pubkey = Pubkey::new_unique();
|
||||
let account_balance = LAMPORTS_PER_SOL;
|
||||
let account_size = rng
|
||||
.gen_range(MAX_PERMITTED_DATA_LENGTH / 8, MAX_PERMITTED_DATA_LENGTH / 4)
|
||||
as usize;
|
||||
let account_size =
|
||||
rng.gen_range(MAX_PERMITTED_DATA_LENGTH / 2, MAX_PERMITTED_DATA_LENGTH) as usize;
|
||||
let account_data =
|
||||
AccountSharedData::new(account_balance, account_size, &mock_program_id);
|
||||
bank.store_account(&account_pubkey, &account_data);
|
||||
|
|
Loading…
Reference in New Issue