Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions core/src/banking_stage/consume_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ pub(crate) mod external {
.map(|()| true);
}

let BankPair {
root_bank,
working_bank: _,
} = self.sharable_banks.load();
Comment thread
tao-stones marked this conversation as resolved.

// Loop here to avoid exposing internal error to external scheduler.
// In the vast majority of cases, this will iterate a single time;
// If we began execution when a slot was still in process, and could
Expand Down Expand Up @@ -385,7 +390,7 @@ pub(crate) mod external {
)
};
let (translation_results, transactions, max_ages) =
Self::translate_transaction_batch(&batch, bank);
Self::translate_transaction_batch(&batch, bank, &root_bank);

// Enforce all or nothing on translation_results.
let execution_flags = ExecutionFlags {
Expand Down Expand Up @@ -497,7 +502,7 @@ pub(crate) mod external {

// Do resolving next since we (currently) need resolved transactions for status checks.
let (parsing_and_resolve_results, txs, max_ages) =
Self::translate_transaction_batch(&batch, &root_bank);
Self::translate_transaction_batch(&batch, &working_bank, &root_bank);

if message.flags & check_flags::LOAD_ADDRESS_LOOKUP_TABLES != 0 {
self.check_resolve_pubkeys(
Expand Down Expand Up @@ -939,20 +944,22 @@ pub(crate) mod external {
/// Translate batch of transactions into usable
fn translate_transaction_batch(
batch: &TransactionPtrBatch,
bank: &Bank,
working_bank: &Bank,
root_bank: &Bank,
) -> (Vec<Result<(), PacketHandlingError>>, Vec<Tx>, Vec<MaxAge>) {
let enable_static_instruction_limit = bank
let enable_static_instruction_limit = root_bank
Comment thread
t-nelson marked this conversation as resolved.
.feature_set
.is_active(&agave_feature_set::static_instruction_limit::ID);
let transaction_account_lock_limit = bank.get_transaction_account_lock_limit();
let transaction_account_lock_limit = working_bank.get_transaction_account_lock_limit();
Comment thread
tao-stones marked this conversation as resolved.

let mut translation_results = Vec::with_capacity(MAX_TRANSACTIONS_PER_MESSAGE);
let mut transactions = Vec::with_capacity(MAX_TRANSACTIONS_PER_MESSAGE);
let mut max_ages = Vec::with_capacity(MAX_TRANSACTIONS_PER_MESSAGE);
for (transaction_ptr, _) in batch.iter() {
match Self::translate_transaction(
transaction_ptr,
bank,
working_bank,
root_bank,
enable_static_instruction_limit,
transaction_account_lock_limit,
) {
Expand All @@ -970,21 +977,23 @@ pub(crate) mod external {

fn translate_transaction(
transaction_ptr: TransactionPtr,
bank: &Bank,
working_bank: &Bank,
root_bank: &Bank,
enable_static_instruction_limit: bool,
transaction_account_lock_limit: usize,
) -> Result<(Tx, MaxAge), PacketHandlingError> {
translate_to_runtime_view(
transaction_ptr,
bank,
working_bank,
root_bank,
enable_static_instruction_limit,
transaction_account_lock_limit,
)
.map(|(view, deactivation_slot)| {
(
view,
MaxAge {
sanitized_epoch: bank.epoch(),
sanitized_epoch: root_bank.epoch(),
Comment thread
t-nelson marked this conversation as resolved.
alt_invalidation_slot: deactivation_slot,
},
)
Expand Down Expand Up @@ -1138,6 +1147,7 @@ pub(crate) mod external {
translate_to_runtime_view(
&simple_tx[..],
&bank,
&bank,
true,
bank.get_transaction_account_lock_limit(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ impl TransactionViewReceiveAndBuffer {
) -> Result<TransactionViewState, PacketHandlingError> {
let (view, deactivation_slot) = translate_to_runtime_view(
bytes,
working_bank,
root_bank,
enable_static_instruction_limit,
transaction_account_lock_limit,
Expand Down Expand Up @@ -445,7 +446,8 @@ impl TransactionViewReceiveAndBuffer {
/// ALT deactivation, if any. If no minimum slot, Slot::MAX is returned.
pub(crate) fn translate_to_runtime_view<D: TransactionData>(
data: D,
bank: &Bank,
working_bank: &Bank,
root_bank: &Bank,
enable_static_instruction_limit: bool,
transaction_account_lock_limit: usize,
) -> Result<(RuntimeTransaction<ResolvedTransactionView<D>>, u64), PacketHandlingError> {
Expand All @@ -465,20 +467,20 @@ pub(crate) fn translate_to_runtime_view<D: TransactionData>(
};

// Discard non-vote packets if in vote-only mode.
if bank.vote_only_bank() && !view.is_simple_vote_transaction() {
if working_bank.vote_only_bank() && !view.is_simple_vote_transaction() {
return Err(PacketHandlingError::Sanitization);
}

if usize::from(view.total_num_accounts()) > transaction_account_lock_limit {
return Err(PacketHandlingError::LockValidation);
}

let (loaded_addresses, deactivation_slot) = load_addresses_for_view(&view, bank)?;
let (loaded_addresses, deactivation_slot) = load_addresses_for_view(&view, root_bank)?;

let Ok(view) = RuntimeTransaction::<ResolvedTransactionView<_>>::try_new(
view,
loaded_addresses,
bank.get_reserved_account_keys(),
root_bank.get_reserved_account_keys(),
Comment thread
t-nelson marked this conversation as resolved.
) else {
return Err(PacketHandlingError::Sanitization);
};
Expand Down
Loading