Skip to content

Commit

Permalink
correctly initialize account overrides (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
segfaultdoc authored Feb 27, 2024
1 parent 37cfbe5 commit a9ebfdd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
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 @@ -4411,7 +4411,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 a9ebfdd

Please sign in to comment.