Skip to content

Commit 477fedb

Browse files
authored
take a snapshot of all bundle accounts before sim (#13) (#615)
1 parent 994b7d1 commit 477fedb

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/src/bundle_execution.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use {
1717
transaction::{SanitizedTransaction, TransactionError, VersionedTransaction},
1818
},
1919
solana_svm::{
20-
account_loader::TransactionLoadResult, account_overrides::AccountOverrides,
21-
transaction_processor::ExecutionRecordingConfig,
20+
account_loader::TransactionLoadResult,
21+
account_overrides::AccountOverrides,
22+
transaction_processor::{ExecutionRecordingConfig, TransactionProcessingCallback},
2223
transaction_results::TransactionExecutionResult,
2324
},
2425
solana_transaction_status::{token_balances::TransactionTokenBalances, PreBalanceInfo},
@@ -264,6 +265,18 @@ pub fn load_and_execute_bundle<'a>(
264265
account_overrides.upsert_account_overrides(
265266
bank.get_account_overrides_for_simulation(&account_keys),
266267
);
268+
269+
// An unfrozen bank's state is always changing.
270+
// By taking a snapshot of the accounts we're mocking out grabbing their locks.
271+
// **Note** this does not prevent race conditions, just mocks preventing them.
272+
if !bank.is_frozen() {
273+
for pk in account_keys.iter() {
274+
// Save on a disk read.
275+
if account_overrides.get(pk).is_none() {
276+
account_overrides.set_account(pk, bank.get_account_shared_data(pk));
277+
}
278+
}
279+
}
267280
});
268281
}
269282

programs/sbf/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)