Removes cap_accounts_data_allocations_per_transaction featurization (#33754)
This commit is contained in:
parent
0fcc0a0941
commit
c1353e172c
|
@ -655,7 +655,6 @@ macro_rules! with_mock_invoke_context {
|
|||
compute_budget.max_invoke_stack_height,
|
||||
compute_budget.max_instruction_trace_length,
|
||||
);
|
||||
$transaction_context.enable_cap_accounts_data_allocations_per_transaction();
|
||||
let mut sysvar_cache = SysvarCache::default();
|
||||
sysvar_cache.fill_missing_entries(|pubkey, callback| {
|
||||
for index in 0..$transaction_context.get_number_of_accounts() {
|
||||
|
|
|
@ -32,19 +32,16 @@ use {
|
|||
clock::Slot,
|
||||
entrypoint::{MAX_PERMITTED_DATA_INCREASE, SUCCESS},
|
||||
feature_set::{
|
||||
bpf_account_data_direct_mapping, cap_accounts_data_allocations_per_transaction,
|
||||
delay_visibility_of_program_deployment, enable_bpf_loader_extend_program_ix,
|
||||
enable_bpf_loader_set_authority_checked_ix, enable_program_redeployment_cooldown,
|
||||
limit_max_instruction_trace_length, native_programs_consume_cu,
|
||||
remove_bpf_loader_incorrect_program_id,
|
||||
bpf_account_data_direct_mapping, delay_visibility_of_program_deployment,
|
||||
enable_bpf_loader_extend_program_ix, enable_bpf_loader_set_authority_checked_ix,
|
||||
enable_program_redeployment_cooldown, limit_max_instruction_trace_length,
|
||||
native_programs_consume_cu, remove_bpf_loader_incorrect_program_id,
|
||||
},
|
||||
instruction::{AccountMeta, InstructionError},
|
||||
loader_instruction::LoaderInstruction,
|
||||
loader_upgradeable_instruction::UpgradeableLoaderInstruction,
|
||||
native_loader,
|
||||
program_error::{
|
||||
MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED, MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED,
|
||||
},
|
||||
program_error::MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED,
|
||||
program_utils::limited_deserialize,
|
||||
pubkey::Pubkey,
|
||||
saturating_add_assign,
|
||||
|
@ -1595,17 +1592,11 @@ fn execute<'a, 'b: 'a>(
|
|||
}
|
||||
match result {
|
||||
ProgramResult::Ok(status) if status != SUCCESS => {
|
||||
let error: InstructionError = if (status == MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED
|
||||
let error: InstructionError = if status == MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED
|
||||
&& !invoke_context
|
||||
.feature_set
|
||||
.is_active(&cap_accounts_data_allocations_per_transaction::id()))
|
||||
|| (status == MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED
|
||||
&& !invoke_context
|
||||
.feature_set
|
||||
.is_active(&limit_max_instruction_trace_length::id()))
|
||||
.is_active(&limit_max_instruction_trace_length::id())
|
||||
{
|
||||
// Until the cap_accounts_data_allocations_per_transaction feature is
|
||||
// enabled, map the `MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED` error to `InvalidError`.
|
||||
// Until the limit_max_instruction_trace_length feature is
|
||||
// enabled, map the `MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED` error to `InvalidError`.
|
||||
InstructionError::InvalidError
|
||||
|
|
|
@ -4864,12 +4864,6 @@ impl Bank {
|
|||
std::usize::MAX
|
||||
},
|
||||
);
|
||||
if self
|
||||
.feature_set
|
||||
.is_active(&feature_set::cap_accounts_data_allocations_per_transaction::id())
|
||||
{
|
||||
transaction_context.enable_cap_accounts_data_allocations_per_transaction();
|
||||
}
|
||||
#[cfg(debug_assertions)]
|
||||
transaction_context.set_signature(tx.signature());
|
||||
|
||||
|
|
|
@ -12171,8 +12171,7 @@ fn test_cap_accounts_data_allocations_per_transaction() {
|
|||
/ MAX_PERMITTED_DATA_LENGTH as usize;
|
||||
|
||||
let (genesis_config, mint_keypair) = create_genesis_config(1_000_000 * LAMPORTS_PER_SOL);
|
||||
let mut bank = Bank::new_for_tests(&genesis_config);
|
||||
bank.activate_feature(&feature_set::cap_accounts_data_allocations_per_transaction::id());
|
||||
let bank = Bank::new_for_tests(&genesis_config);
|
||||
|
||||
let mut instructions = Vec::new();
|
||||
let mut keypairs = vec![mint_keypair.insecure_clone()];
|
||||
|
|
|
@ -144,8 +144,6 @@ pub struct TransactionContext {
|
|||
accounts_resize_delta: RefCell<i64>,
|
||||
#[cfg(not(target_os = "solana"))]
|
||||
rent: Rent,
|
||||
#[cfg(not(target_os = "solana"))]
|
||||
is_cap_accounts_data_allocations_per_transaction_enabled: bool,
|
||||
/// Useful for debugging to filter by or to look it up on the explorer
|
||||
#[cfg(all(not(target_os = "solana"), debug_assertions))]
|
||||
signature: Signature,
|
||||
|
@ -174,7 +172,6 @@ impl TransactionContext {
|
|||
return_data: TransactionReturnData::default(),
|
||||
accounts_resize_delta: RefCell::new(0),
|
||||
rent,
|
||||
is_cap_accounts_data_allocations_per_transaction_enabled: false,
|
||||
#[cfg(all(not(target_os = "solana"), debug_assertions))]
|
||||
signature: Signature::default(),
|
||||
}
|
||||
|
@ -440,12 +437,6 @@ impl TransactionContext {
|
|||
.map_err(|_| InstructionError::GenericError)
|
||||
.map(|value_ref| *value_ref)
|
||||
}
|
||||
|
||||
/// Enables enforcing a maximum accounts data allocation size per transaction
|
||||
#[cfg(not(target_os = "solana"))]
|
||||
pub fn enable_cap_accounts_data_allocations_per_transaction(&mut self) {
|
||||
self.is_cap_accounts_data_allocations_per_transaction_enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// Return data at the end of a transaction
|
||||
|
@ -1114,10 +1105,6 @@ impl<'a> BorrowedAccount<'a> {
|
|||
if new_length > MAX_PERMITTED_DATA_LENGTH as usize {
|
||||
return Err(InstructionError::InvalidRealloc);
|
||||
}
|
||||
if self
|
||||
.transaction_context
|
||||
.is_cap_accounts_data_allocations_per_transaction_enabled
|
||||
{
|
||||
// The resize can not exceed the per-transaction maximum
|
||||
let length_delta = (new_length as i64).saturating_sub(old_length as i64);
|
||||
if self
|
||||
|
@ -1128,7 +1115,6 @@ impl<'a> BorrowedAccount<'a> {
|
|||
{
|
||||
return Err(InstructionError::MaxAccountsDataAllocationsExceeded);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue