diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index 61b01c0ff6..3c06b8ddcc 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -2103,7 +2103,7 @@ fn main() { println!("{}:", pubkey); println!(" - balance: {} SOL", lamports_to_sol(account.lamports)); println!(" - owner: '{}'", account.owner()); - println!(" - executable: {}", account.executable); + println!(" - executable: {}", account.executable()); println!(" - slot: {}", slot); println!(" - rent_epoch: {}", account.rent_epoch); if !exclude_account_data { diff --git a/programs/bpf_loader/src/syscalls.rs b/programs/bpf_loader/src/syscalls.rs index b5f7a50bd0..aeaa047843 100644 --- a/programs/bpf_loader/src/syscalls.rs +++ b/programs/bpf_loader/src/syscalls.rs @@ -1733,7 +1733,7 @@ where })?; if i == program_account_index - || account.borrow().executable + || account.borrow().executable() || (invoke_context.is_feature_active(&cpi_share_ro_and_exec_accounts::id()) && !caller_write_privileges[i]) { @@ -1990,7 +1990,7 @@ fn call<'a>( for (i, (account, account_ref)) in accounts.iter().zip(account_refs).enumerate() { let account = account.borrow(); if let Some(account_ref) = account_ref { - if message.is_writable(i, demote_sysvar_write_locks) && !account.executable { + if message.is_writable(i, demote_sysvar_write_locks) && !account.executable() { *account_ref.lamports = account.lamports; *account_ref.owner = *account.owner(); if account_ref.data.len() != account.data().len() { diff --git a/runtime/src/accounts.rs b/runtime/src/accounts.rs index e6b95c5bce..fbd1d2c714 100644 --- a/runtime/src/accounts.rs +++ b/runtime/src/accounts.rs @@ -228,7 +228,8 @@ impl Accounts { }) .unwrap_or_default(); - if account.executable && bpf_loader_upgradeable::check_id(account.owner()) { + if account.executable() && bpf_loader_upgradeable::check_id(account.owner()) + { // The upgradeable loader requires the derived ProgramData account if let Ok(UpgradeableLoaderState::Program { programdata_address, @@ -352,7 +353,7 @@ impl Accounts { return Err(TransactionError::ProgramAccountNotFound); } }; - if !program.executable { + if !program.executable() { error_counters.invalid_program_for_execution += 1; return Err(TransactionError::InvalidProgramForExecution); } diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 5e05ab9a9a..749bdd13da 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -289,7 +289,7 @@ impl<'a> LoadedAccount<'a> { LoadedAccount::Stored(stored_account_meta) => { stored_account_meta.account_meta.executable } - LoadedAccount::Cached((_, cached_account)) => cached_account.account.executable, + LoadedAccount::Cached((_, cached_account)) => cached_account.account.executable(), } } @@ -3256,7 +3256,7 @@ impl AccountsDb { hasher.hash(&account.data()); hasher.hash(&account.owner().as_ref()); - if account.executable { + if account.executable() { hasher.hash(&[1u8; 1]); } else { hasher.hash(&[0u8; 1]); diff --git a/runtime/src/message_processor.rs b/runtime/src/message_processor.rs index 46294d8756..4d420ac77f 100644 --- a/runtime/src/message_processor.rs +++ b/runtime/src/message_processor.rs @@ -116,7 +116,7 @@ impl PreAccount { let owner_changed = pre.owner() != post.owner(); if owner_changed && (!is_writable // line coverage used to get branch coverage - || pre.executable + || pre.executable() || program_id != pre.owner() || !Self::is_zeroed(&post.data())) { @@ -136,7 +136,7 @@ impl PreAccount { if !is_writable { return Err(InstructionError::ReadonlyLamportChange); } - if pre.executable { + if pre.executable() { return Err(InstructionError::ExecutableLamportChange); } } @@ -156,10 +156,10 @@ impl PreAccount { // and if the account is not executable if !(program_id == pre.owner() && is_writable // line coverage used to get branch coverage - && !pre.executable) + && !pre.executable()) && pre.data() != post.data() { - if pre.executable { + if pre.executable() { return Err(InstructionError::ExecutableDataModified); } else if is_writable { return Err(InstructionError::ExternalAccountDataModified); @@ -169,13 +169,13 @@ impl PreAccount { } // executable is one-way (false->true) and only the account owner may set it. - let executable_changed = pre.executable != post.executable; + let executable_changed = pre.executable() != post.executable(); if executable_changed { if !rent.is_exempt(post.lamports, post.data().len()) { return Err(InstructionError::ExecutableAccountNotRentExempt); } if !is_writable // line coverage used to get branch coverage - || pre.executable + || pre.executable() || program_id != pre.owner() { return Err(InstructionError::ExecutableModified); @@ -832,7 +832,7 @@ impl MessageProcessor { ic_msg!(invoke_context, "Unknown program {}", callee_program_id); InstructionError::MissingAccount })?; - if !program_account.borrow().executable { + if !program_account.borrow().executable() { ic_msg!( invoke_context, "Account {} is not executable", @@ -902,7 +902,7 @@ impl MessageProcessor { let dst_keyed_account = &keyed_accounts[dst_keyed_account_index]; let src_keyed_account = account.borrow(); if message.is_writable(src_keyed_account_index, demote_sysvar_write_locks) - && !src_keyed_account.executable + && !src_keyed_account.executable() { if dst_keyed_account.data_len()? != src_keyed_account.data().len() && dst_keyed_account.data_len()? != 0 @@ -1108,7 +1108,7 @@ impl MessageProcessor { )?; pre_sum += u128::from(pre_account.lamports()); post_sum += u128::from(account.lamports); - if is_writable && !account.executable { + if is_writable && !account.executable() { pre_account.update(&account); } return Ok(()); diff --git a/runtime/src/rent_collector.rs b/runtime/src/rent_collector.rs index 80951d2b42..be0e5aa71c 100644 --- a/runtime/src/rent_collector.rs +++ b/runtime/src/rent_collector.rs @@ -61,7 +61,7 @@ impl RentCollector { address: &Pubkey, account: &mut AccountSharedData, ) -> u64 { - if account.executable + if account.executable() || account.rent_epoch > self.epoch || sysvar::check_id(account.owner()) || *address == incinerator::id() diff --git a/sdk/src/keyed_account.rs b/sdk/src/keyed_account.rs index e1a81fc44d..22933eb0af 100644 --- a/sdk/src/keyed_account.rs +++ b/sdk/src/keyed_account.rs @@ -52,7 +52,7 @@ impl<'a> KeyedAccount<'a> { } pub fn executable(&self) -> Result { - Ok(self.try_borrow()?.executable) + Ok(self.try_borrow()?.executable()) } pub fn rent_epoch(&self) -> Result {