Skip to content

Commit

Permalink
Backports #595: correctly initialize account overrides (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
segfaultdoc authored and buffalu committed Apr 13, 2024
1 parent a4f7fdf commit c16494d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 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.

18 changes: 15 additions & 3 deletions bundle/src/bundle_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ pub enum LoadAndExecuteBundleError {
ProcessingTimeExceeded(Duration),

#[error(
"A transaction in the bundle encountered a lock error: [signature={:?}, transaction_error={:?}]",
signature,
transaction_error
"A transaction in the bundle encountered a lock error: [signature={:?}, transaction_error={:?}]",
signature,
transaction_error
)]
LockError {
signature: Signature,
Expand Down 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
4 changes: 2 additions & 2 deletions programs/sbf/Cargo.lock

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

6 changes: 5 additions & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4412,7 +4412,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 c16494d

Please sign in to comment.