Skip to content

Commit

Permalink
Backports solana-labs#595: correctly initialize account overrides (so…
Browse files Browse the repository at this point in the history
  • Loading branch information
segfaultdoc authored and buffalu committed Mar 25, 2024
1 parent b54fd30 commit 37eed3a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions bundle/src/bundle_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,20 @@ pub fn load_and_execute_bundle<'a>(
metrics: BundleExecutionMetrics::default(),
};
}

let mut binding = AccountOverrides::default();
let account_overrides = account_overrides.unwrap_or(&mut binding);
if is_simulation {
bundle
.transactions
.iter()
.map(|tx| tx.message().account_keys())
.for_each(|account_keys| {
account_overrides.upsert_account_overrides(
bank.get_account_overrides_for_simulation(&account_keys),
);
});
}

let mut chunk_start = 0;
let start_time = Instant::now();
Expand Down
6 changes: 5 additions & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4489,7 +4489,11 @@ impl Bank {
}
}

fn get_account_overrides_for_simulation(&self, account_keys: &AccountKeys) -> AccountOverrides {
// NOTE: Do not revert this back to private during rebases.
pub fn get_account_overrides_for_simulation(
&self,
account_keys: &AccountKeys,
) -> AccountOverrides {
let mut account_overrides = AccountOverrides::default();
let slot_history_id = sysvar::slot_history::id();
if account_keys.iter().any(|pubkey| *pubkey == slot_history_id) {
Expand Down

0 comments on commit 37eed3a

Please sign in to comment.