Feature: TransactionContext, InstructionContext and BorrowedAccount (#21706)

* Adds TransactionContext, InstructionContext and BorrowedAccount.

* Redirects the usage of accounts in InvokeContext through TransactionContext.
Also use the types declared in transaction_context.rs everywhere.

* Adjusts all affected tests.
This commit is contained in:
Alexander Meißner
2021-12-27 18:49:32 +01:00
committed by GitHub
parent bb97c8fdcd
commit a06646631c
14 changed files with 926 additions and 530 deletions

View File

@ -42,6 +42,7 @@ use {
system_instruction::{self, SystemError},
system_program,
transaction::{Transaction, TransactionError},
transaction_context::TransactionContext,
},
std::{
fs::File,
@ -1990,7 +1991,8 @@ fn read_and_verify_elf(program_location: &str) -> Result<Vec<u8>, Box<dyn std::e
let mut program_data = Vec::new();
file.read_to_end(&mut program_data)
.map_err(|err| format!("Unable to read program file: {}", err))?;
let mut invoke_context = InvokeContext::new_mock(&[], &[]);
let transaction_context = TransactionContext::new(Vec::new(), 1);
let mut invoke_context = InvokeContext::new_mock(&transaction_context, &[]);
// Verify the program
Executable::<BpfError, ThisInstructionMeter>::from_elf(