cache executors on failed transactions (backport #22308) (#22327)

* cache executors on failed transactions (#22308)

(cherry picked from commit 12e160269e)

# Conflicts:
#	program-runtime/src/invoke_context.rs
#	programs/bpf_loader/src/lib.rs
#	runtime/src/bank.rs

* resolve conflicts

Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
mergify[bot]
2022-01-06 15:38:39 -08:00
committed by GitHub
parent c90fa6643e
commit cad0e7f04f
5 changed files with 1764 additions and 40 deletions

View File

@@ -85,6 +85,8 @@ pub trait InvokeContext {
/// Loaders may need to do work in order to execute a program. Cache
/// the work that can be re-used across executions
fn add_executor(&self, pubkey: &Pubkey, executor: Arc<dyn Executor>);
/// Cache an executor that has changed
fn update_executor(&self, pubkey: &Pubkey, executor: Arc<dyn Executor>);
/// Get the completed loader work that can be re-used across executions
fn get_executor(&self, pubkey: &Pubkey) -> Option<Arc<dyn Executor>>;
/// Record invoked instruction
@@ -493,6 +495,7 @@ impl<'a> InvokeContext for MockInvokeContext<'a> {
Rc::new(RefCell::new(self.compute_meter.clone()))
}
fn add_executor(&self, _pubkey: &Pubkey, _executor: Arc<dyn Executor>) {}
fn update_executor(&self, _pubkey: &Pubkey, _executor: Arc<dyn Executor>) {}
fn get_executor(&self, _pubkey: &Pubkey) -> Option<Arc<dyn Executor>> {
None
}