From cef75721d6e6c095de889cf9b38bd1186b703fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Thu, 18 Jul 2024 10:36:26 +0200 Subject: [PATCH] Adds deprecation attributes. --- program-runtime/src/invoke_context.rs | 1 + programs/bpf_loader/src/lib.rs | 3 +++ programs/bpf_loader/src/serialization.rs | 2 ++ programs/bpf_loader/src/syscalls/cpi.rs | 1 + sdk/src/transaction_context.rs | 2 ++ 5 files changed, 9 insertions(+) diff --git a/program-runtime/src/invoke_context.rs b/program-runtime/src/invoke_context.rs index c8b19521b6f125..bbefbaa56e793a 100644 --- a/program-runtime/src/invoke_context.rs +++ b/program-runtime/src/invoke_context.rs @@ -434,6 +434,7 @@ impl<'a> InvokeContext<'a> { })?; let borrowed_program_account = instruction_context .try_borrow_instruction_account(self.transaction_context, program_account_index)?; + #[allow(deprecated)] if !self .get_feature_set() .is_active(&remove_accounts_executable_flag_checks::id()) diff --git a/programs/bpf_loader/src/lib.rs b/programs/bpf_loader/src/lib.rs index f8bf8df9be76ef..20101362fd66dd 100644 --- a/programs/bpf_loader/src/lib.rs +++ b/programs/bpf_loader/src/lib.rs @@ -431,6 +431,7 @@ pub fn process_instruction_inner( } // Program Invocation + #[allow(deprecated)] if !invoke_context .get_feature_set() .is_active(&remove_accounts_executable_flag_checks::id()) @@ -723,6 +724,7 @@ fn process_loader_upgradeable_instruction( let program = instruction_context.try_borrow_instruction_account(transaction_context, 1)?; + #[allow(deprecated)] if !invoke_context .get_feature_set() .is_active(&remove_accounts_executable_flag_checks::id()) @@ -1467,6 +1469,7 @@ fn execute<'a, 'b: 'a>( )?; error = EbpfError::SyscallError(Box::new( + #[allow(deprecated)] if !invoke_context .get_feature_set() .is_active(&remove_accounts_executable_flag_checks::id()) diff --git a/programs/bpf_loader/src/serialization.rs b/programs/bpf_loader/src/serialization.rs index 2cb2f20b162280..15c5820dc23924 100644 --- a/programs/bpf_loader/src/serialization.rs +++ b/programs/bpf_loader/src/serialization.rs @@ -339,6 +339,7 @@ fn serialize_parameters_unaligned( s.write::((account.get_data().len() as u64).to_le()); let vm_data_addr = s.write_account(&mut account)?; let vm_owner_addr = s.write_all(account.get_owner().as_ref()); + #[allow(deprecated)] s.write::(account.is_executable() as u8); s.write::((account.get_rent_epoch()).to_le()); accounts_metadata.push(SerializedAccountMetadata { @@ -467,6 +468,7 @@ fn serialize_parameters_aligned( s.write::(NON_DUP_MARKER); s.write::(borrowed_account.is_signer() as u8); s.write::(borrowed_account.is_writable() as u8); + #[allow(deprecated)] s.write::(borrowed_account.is_executable() as u8); s.write_all(&[0u8, 0, 0, 0]); let vm_key_addr = s.write_all(borrowed_account.get_key().as_ref()); diff --git a/programs/bpf_loader/src/syscalls/cpi.rs b/programs/bpf_loader/src/syscalls/cpi.rs index 94046f5f741560..7485578cbb4ea7 100644 --- a/programs/bpf_loader/src/syscalls/cpi.rs +++ b/programs/bpf_loader/src/syscalls/cpi.rs @@ -881,6 +881,7 @@ where .transaction_context .get_key_of_account_at_index(instruction_account.index_in_transaction)?; + #[allow(deprecated)] if callee_account.is_executable() { // Use the known account consume_compute_meter( diff --git a/sdk/src/transaction_context.rs b/sdk/src/transaction_context.rs index cb7dfa451d85cc..8121682d7941fe 100644 --- a/sdk/src/transaction_context.rs +++ b/sdk/src/transaction_context.rs @@ -1003,6 +1003,7 @@ impl<'a> BorrowedAccount<'a> { /// Returns whether this account is executable (transaction wide) #[inline] + #[deprecated(since = "2.1.0", note = "Use `get_owner` instead")] pub fn is_executable(&self) -> bool { self.account.executable() } @@ -1041,6 +1042,7 @@ impl<'a> BorrowedAccount<'a> { return Err(InstructionError::ExecutableModified); } // don't touch the account if the executable flag does not change + #[allow(deprecated)] if self.is_executable() == is_executable { return Ok(()); }