|
99 | 99 | compute_budget_processor::process_compute_budget_instructions,
|
100 | 100 | invoke_context::BuiltinFunctionWithContext,
|
101 | 101 | loaded_programs::{
|
102 |
| - LoadedProgram, LoadedProgramType, LoadedPrograms, ProgramRuntimeEnvironments, |
| 102 | + LoadedProgram, LoadedProgramMatchCriteria, LoadedProgramType, LoadedPrograms, |
| 103 | + ProgramRuntimeEnvironments, |
103 | 104 | },
|
104 | 105 | runtime_config::RuntimeConfig,
|
105 | 106 | timings::{ExecuteTimingType, ExecuteTimings},
|
@@ -168,7 +169,8 @@ use {
|
168 | 169 | account_overrides::AccountOverrides,
|
169 | 170 | transaction_error_metrics::TransactionErrorMetrics,
|
170 | 171 | transaction_processor::{
|
171 |
| - TransactionBatchProcessor, TransactionLogMessages, TransactionProcessingCallback, |
| 172 | + ExecutionRecordingConfig, TransactionBatchProcessor, TransactionLogMessages, |
| 173 | + TransactionProcessingCallback, |
172 | 174 | },
|
173 | 175 | transaction_results::{
|
174 | 176 | TransactionExecutionDetails, TransactionExecutionResult, TransactionResults,
|
@@ -271,7 +273,6 @@ pub struct BankRc {
|
271 | 273 |
|
272 | 274 | #[cfg(RUSTC_WITH_SPECIALIZATION)]
|
273 | 275 | use solana_frozen_abi::abi_example::AbiExample;
|
274 |
| -use solana_svm::transaction_processor::ExecutionRecordingConfig; |
275 | 276 |
|
276 | 277 | #[cfg(RUSTC_WITH_SPECIALIZATION)]
|
277 | 278 | impl AbiExample for BankRc {
|
@@ -550,6 +551,7 @@ impl PartialEq for Bank {
|
550 | 551 | loaded_programs_cache: _,
|
551 | 552 | epoch_reward_status: _,
|
552 | 553 | transaction_processor: _,
|
| 554 | + check_program_modification_slot: _, |
553 | 555 | // Ignore new fields explicitly if they do not impact PartialEq.
|
554 | 556 | // Adding ".." will remove compile-time checks that if a new field
|
555 | 557 | // is added to the struct, this PartialEq is accordingly updated.
|
@@ -810,6 +812,8 @@ pub struct Bank {
|
810 | 812 | epoch_reward_status: EpochRewardStatus,
|
811 | 813 |
|
812 | 814 | transaction_processor: TransactionBatchProcessor<BankForks>,
|
| 815 | + |
| 816 | + check_program_modification_slot: bool, |
813 | 817 | }
|
814 | 818 |
|
815 | 819 | struct VoteWithStakeDelegations {
|
@@ -996,6 +1000,7 @@ impl Bank {
|
996 | 1000 | ))),
|
997 | 1001 | epoch_reward_status: EpochRewardStatus::default(),
|
998 | 1002 | transaction_processor: TransactionBatchProcessor::default(),
|
| 1003 | + check_program_modification_slot: false, |
999 | 1004 | };
|
1000 | 1005 |
|
1001 | 1006 | bank.transaction_processor = TransactionBatchProcessor::new(
|
@@ -1314,6 +1319,7 @@ impl Bank {
|
1314 | 1319 | loaded_programs_cache: parent.loaded_programs_cache.clone(),
|
1315 | 1320 | epoch_reward_status: parent.epoch_reward_status.clone(),
|
1316 | 1321 | transaction_processor: TransactionBatchProcessor::default(),
|
| 1322 | + check_program_modification_slot: false, |
1317 | 1323 | };
|
1318 | 1324 |
|
1319 | 1325 | new.transaction_processor = TransactionBatchProcessor::new(
|
@@ -1864,6 +1870,7 @@ impl Bank {
|
1864 | 1870 | ))),
|
1865 | 1871 | epoch_reward_status: fields.epoch_reward_status,
|
1866 | 1872 | transaction_processor: TransactionBatchProcessor::default(),
|
| 1873 | + check_program_modification_slot: false, |
1867 | 1874 | };
|
1868 | 1875 |
|
1869 | 1876 | bank.transaction_processor = TransactionBatchProcessor::new(
|
@@ -7517,7 +7524,7 @@ impl Bank {
|
7517 | 7524 | }
|
7518 | 7525 |
|
7519 | 7526 | pub fn check_program_modification_slot(&mut self) {
|
7520 |
| - self.transaction_processor.check_program_modification_slot = true; |
| 7527 | + self.check_program_modification_slot = true; |
7521 | 7528 | }
|
7522 | 7529 |
|
7523 | 7530 | pub fn load_program(
|
@@ -7579,6 +7586,18 @@ impl TransactionProcessingCallback for Bank {
|
7579 | 7586 | Ok(())
|
7580 | 7587 | }
|
7581 | 7588 | }
|
| 7589 | + |
| 7590 | + fn get_program_match_criteria(&self, program: &Pubkey) -> LoadedProgramMatchCriteria { |
| 7591 | + if self.check_program_modification_slot { |
| 7592 | + self.transaction_processor |
| 7593 | + .program_modification_slot(self, program) |
| 7594 | + .map_or(LoadedProgramMatchCriteria::Tombstone, |slot| { |
| 7595 | + LoadedProgramMatchCriteria::DeployedOnOrAfterSlot(slot) |
| 7596 | + }) |
| 7597 | + } else { |
| 7598 | + LoadedProgramMatchCriteria::NoCriteria |
| 7599 | + } |
| 7600 | + } |
7582 | 7601 | }
|
7583 | 7602 |
|
7584 | 7603 | #[cfg(feature = "dev-context-only-utils")]
|
|
0 commit comments