Replaces KeyedAccount by BorrowedAccount in system_instruction_processor. (#23217)

* Adds InstructionContext::check_number_of_instruction_accounts() and InstructionContext::get_instruction_account_key().
Bases check_sysvar_account() on instuction account indices.

* Adds instruction_account_indices enums to system_instruction_processor.

* Reorders parameters and adds InstructionContext.

* Replaces KeyedAccount by BorrowedAccount in system_instruction_processor (part 1).

* Replaces KeyedAccount by BorrowedAccount in system_instruction_processor (part 2).

* Replaces KeyedAccount by BorrowedAccount in system_instruction_processor (part 3).

* Replaces KeyedAccount by BorrowedAccount in system_instruction_processor (part 4).

* Replaces KeyedAccount by BorrowedAccount in system_instruction_processor (part 5).

* Code cleanup
This commit is contained in:
Alexander Meißner
2022-02-19 02:06:33 +01:00
committed by GitHub
parent 970f543ef6
commit ee7e411d68
4 changed files with 320 additions and 176 deletions

View File

@@ -12,9 +12,6 @@ use {
std::collections::HashSet,
};
pub const NONCE_ACCOUNT_INDEX: usize = 0;
pub const WITHDRAW_TO_ACCOUNT_INDEX: usize = 1;
pub fn advance_nonce_account(
invoke_context: &InvokeContext,
instruction_context: &InstructionContext,
@@ -353,6 +350,9 @@ mod test {
};
}
const NONCE_ACCOUNT_INDEX: usize = 0;
const WITHDRAW_TO_ACCOUNT_INDEX: usize = 1;
macro_rules! set_invoke_context_blockhash {
($invoke_context:expr, $seed:expr) => {
$invoke_context.blockhash = hash(&bincode::serialize(&$seed).unwrap());