Skip to content

Commit

Permalink
Backports #595: correctly initialize account overrides (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
segfaultdoc authored and buffalu committed Mar 8, 2024
1 parent 97b8076 commit c5c4815
Show file tree
Hide file tree
Showing 4 changed files with 22 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
3 changes: 3 additions & 0 deletions ci/do-audit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ cargo_audit_ignores=(
--ignore RUSTSEC-2023-0001

--ignore RUSTSEC-2022-0093

# TODO (LB): remove after CI passes
--ignore RUSTSEC-2024-0019
)
scripts/cargo-for-all-lock-files.sh audit "${cargo_audit_ignores[@]}" | $dep_tree_filter
# we want the `cargo audit` exit code, not `$dep_tree_filter`'s
Expand Down
6 changes: 5 additions & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4486,7 +4486,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 c5c4815

Please sign in to comment.