Refactor verify_and_update write privileges check (#18468) (#18484)

Co-authored-by: Justin Starry <justin@solana.com>
This commit is contained in:
mergify[bot]
2021-07-07 21:46:07 +00:00
committed by GitHub
parent edd6ae588a
commit 2f633cdfb7
2 changed files with 17 additions and 27 deletions

View File

@@ -2,7 +2,6 @@ use solana_sdk::{
account::AccountSharedData,
instruction::{CompiledInstruction, Instruction, InstructionError},
keyed_account::{create_keyed_accounts_unified, KeyedAccount},
message::Message,
pubkey::Pubkey,
sysvar::Sysvar,
};
@@ -62,10 +61,9 @@ pub trait InvokeContext {
/// Verify and update PreAccount state based on program execution
fn verify_and_update(
&mut self,
message: &Message,
instruction: &CompiledInstruction,
accounts: &[(Pubkey, Rc<RefCell<AccountSharedData>>)],
caller_pivileges: Option<&[bool]>,
write_privileges: &[bool],
) -> Result<(), InstructionError>;
/// Get the program ID of the currently executing program
fn get_caller(&self) -> Result<&Pubkey, InstructionError>;
@@ -393,10 +391,9 @@ impl<'a> InvokeContext for MockInvokeContext<'a> {
}
fn verify_and_update(
&mut self,
_message: &Message,
_instruction: &CompiledInstruction,
_accounts: &[(Pubkey, Rc<RefCell<AccountSharedData>>)],
_caller_pivileges: Option<&[bool]>,
_write_pivileges: &[bool],
) -> Result<(), InstructionError> {
Ok(())
}