Skip to content

Commit

Permalink
take a snapshot of all bundle accounts before sim (jito-foundation#13) (
Browse files Browse the repository at this point in the history
  • Loading branch information
segfaultdoc authored May 27, 2024
1 parent 994b7d1 commit 477fedb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

17 changes: 15 additions & 2 deletions bundle/src/bundle_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ use {
transaction::{SanitizedTransaction, TransactionError, VersionedTransaction},
},
solana_svm::{
account_loader::TransactionLoadResult, account_overrides::AccountOverrides,
transaction_processor::ExecutionRecordingConfig,
account_loader::TransactionLoadResult,
account_overrides::AccountOverrides,
transaction_processor::{ExecutionRecordingConfig, TransactionProcessingCallback},
transaction_results::TransactionExecutionResult,
},
solana_transaction_status::{token_balances::TransactionTokenBalances, PreBalanceInfo},
Expand Down Expand Up @@ -264,6 +265,18 @@ pub fn load_and_execute_bundle<'a>(
account_overrides.upsert_account_overrides(
bank.get_account_overrides_for_simulation(&account_keys),
);

// An unfrozen bank's state is always changing.
// By taking a snapshot of the accounts we're mocking out grabbing their locks.
// **Note** this does not prevent race conditions, just mocks preventing them.
if !bank.is_frozen() {
for pk in account_keys.iter() {
// Save on a disk read.
if account_overrides.get(pk).is_none() {
account_overrides.set_account(pk, bank.get_account_shared_data(pk));
}
}
}
});
}

Expand Down
8 changes: 4 additions & 4 deletions programs/sbf/Cargo.lock

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

0 comments on commit 477fedb

Please sign in to comment.