diff --git a/program-runtime/src/invoke_context.rs b/program-runtime/src/invoke_context.rs index 9f5b40aa7088dc..ee22d369f617e2 100644 --- a/program-runtime/src/invoke_context.rs +++ b/program-runtime/src/invoke_context.rs @@ -168,6 +168,7 @@ pub struct InvokeContext<'a> { pub programs_loaded_for_tx_batch: &'a LoadedProgramsForTxBatch, pub programs_modified_by_tx: &'a mut LoadedProgramsForTxBatch, pub feature_set: Arc, + pub get_epoch_stake_callback: &'a dyn Fn(&'a Pubkey) -> u64, pub timings: ExecuteDetailsTimings, pub blockhash: Hash, pub lamports_per_signature: u64, @@ -185,6 +186,7 @@ impl<'a> InvokeContext<'a> { programs_loaded_for_tx_batch: &'a LoadedProgramsForTxBatch, programs_modified_by_tx: &'a mut LoadedProgramsForTxBatch, feature_set: Arc, + get_epoch_stake_callback: &'a dyn Fn(&'a Pubkey) -> u64, blockhash: Hash, lamports_per_signature: u64, ) -> Self { @@ -198,6 +200,7 @@ impl<'a> InvokeContext<'a> { programs_loaded_for_tx_batch, programs_modified_by_tx, feature_set, + get_epoch_stake_callback, timings: ExecuteDetailsTimings::default(), blockhash, lamports_per_signature, @@ -684,6 +687,7 @@ macro_rules! with_mock_invoke_context { &programs_loaded_for_tx_batch, &mut programs_modified_by_tx, Arc::new(FeatureSet::all_enabled()), + &|_| 0, Hash::default(), 0, ); diff --git a/runtime/src/bank/builtins/core_bpf_migration/mod.rs b/runtime/src/bank/builtins/core_bpf_migration/mod.rs index 3be7a8d8af987e..309a196417eeb8 100644 --- a/runtime/src/bank/builtins/core_bpf_migration/mod.rs +++ b/runtime/src/bank/builtins/core_bpf_migration/mod.rs @@ -195,6 +195,7 @@ impl Bank { &programs_loaded, &mut programs_modified, self.feature_set.clone(), + &|_| 0, Hash::default(), 0, ); diff --git a/svm/src/message_processor.rs b/svm/src/message_processor.rs index f6595b4450bce7..d52580c37e185e 100644 --- a/svm/src/message_processor.rs +++ b/svm/src/message_processor.rs @@ -280,6 +280,7 @@ mod tests { &programs_loaded_for_tx_batch, &mut programs_modified_by_tx, Arc::new(FeatureSet::all_enabled()), + &|_| 0, Hash::default(), 0, ); @@ -331,6 +332,7 @@ mod tests { &programs_loaded_for_tx_batch, &mut programs_modified_by_tx, Arc::new(FeatureSet::all_enabled()), + &|_| 0, Hash::default(), 0, ); @@ -372,6 +374,7 @@ mod tests { &programs_loaded_for_tx_batch, &mut programs_modified_by_tx, Arc::new(FeatureSet::all_enabled()), + &|_| 0, Hash::default(), 0, ); @@ -504,6 +507,7 @@ mod tests { &programs_loaded_for_tx_batch, &mut programs_modified_by_tx, Arc::new(FeatureSet::all_enabled()), + &|_| 0, Hash::default(), 0, ); @@ -540,6 +544,7 @@ mod tests { &programs_loaded_for_tx_batch, &mut programs_modified_by_tx, Arc::new(FeatureSet::all_enabled()), + &|_| 0, Hash::default(), 0, ); @@ -573,6 +578,7 @@ mod tests { &programs_loaded_for_tx_batch, &mut programs_modified_by_tx, Arc::new(FeatureSet::all_enabled()), + &|_| 0, Hash::default(), 0, ); @@ -667,6 +673,7 @@ mod tests { &programs_loaded_for_tx_batch, &mut programs_modified_by_tx, Arc::new(FeatureSet::all_enabled()), + &|_| 0, Hash::default(), 0, ); diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index 933fe4e35bed28..0e19635c41e385 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -673,6 +673,7 @@ impl TransactionBatchProcessor { programs_loaded_for_tx_batch.latest_root_epoch, ); let sysvar_cache = &self.sysvar_cache.read().unwrap(); + let epoch_stake_callback = |pubkey| callback.get_epoch_stake(pubkey); let mut invoke_context = InvokeContext::new( &mut transaction_context, @@ -682,6 +683,7 @@ impl TransactionBatchProcessor { programs_loaded_for_tx_batch, &mut programs_modified_by_tx, callback.get_feature_set(), + &epoch_stake_callback, blockhash, lamports_per_signature, );