Feature Gate Update - Requires the owner accounts of programs to be built-ins. (#31488)

Requires the owner accounts of programs to be built-ins.
(owned by the native_loader and have the executable flag set)
This commit is contained in:
Alexander Meißner 2023-05-04 21:03:09 +02:00 committed by GitHub
parent 53aec4a96d
commit 67939c061e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 3 deletions

View File

@ -535,16 +535,23 @@ impl Accounts {
builtins_start_index.saturating_add(owner_index)
} else {
let owner_index = accounts.len();
if let Some((program_account, _)) =
if let Some((owner_account, _)) =
self.accounts_db.load_with_fixed_root(ancestors, owner_id)
{
if disable_builtin_loader_ownership_chains
&& !native_loader::check_id(owner_account.owner())
|| !owner_account.executable()
{
error_counters.invalid_program_for_execution += 1;
return Err(TransactionError::InvalidProgramForExecution);
}
Self::accumulate_and_check_loaded_account_data_size(
&mut accumulated_accounts_data_size,
program_account.data().len(),
owner_account.data().len(),
requested_loaded_accounts_data_size_limit,
error_counters,
)?;
accounts.push((*owner_id, program_account));
accounts.push((*owner_id, owner_account));
} else {
error_counters.account_not_found += 1;
return Err(TransactionError::ProgramAccountNotFound);