removes OrderedIterator and transaction batch iteration order (#16153)
In TransactionBatch, https://github.com/solana-labs/solana/blob/e50f59844/runtime/src/transaction_batch.rs#L4-L11 lock_results[i] is aligned with transactions[iteration_order[i]]: https://github.com/solana-labs/solana/blob/e50f59844/runtime/src/bank.rs#L2414-L2424 https://github.com/solana-labs/solana/blob/e50f59844/runtime/src/accounts.rs#L788-L817 However load_and_execute_transactions is iterating over lock_results[iteration_order[i]] https://github.com/solana-labs/solana/blob/e50f59844/runtime/src/bank.rs#L2878-L2889 and then returning i as for the index of the retryable transaction. If iteratorion_order is [1, 2, 0], and i is 0, then: lock_results[iteration_order[i]] = lock_results[1] which corresponds to transactions[iteration_order[1]] = transactions[2] so neither i = 0, nor iteration_order[i] = 1 gives the correct index for the corresponding transaction (which is 2). This commit removes OrderedIterator and transaction batch iteration order entirely. There is only one place in blockstore processor which the iteration order is not ordinal: https://github.com/solana-labs/solana/blob/e50f59844/ledger/src/blockstore_processor.rs#L269-L271 It seems like, instead of using an iteration order, that can shuffle entry transactions in-place.
This commit is contained in:
@ -1,18 +0,0 @@
|
||||
#![feature(test)]
|
||||
|
||||
extern crate test;
|
||||
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
use solana_runtime::transaction_utils::OrderedIterator;
|
||||
use test::Bencher;
|
||||
|
||||
#[bench]
|
||||
fn bench_ordered_iterator_with_order_shuffling(bencher: &mut Bencher) {
|
||||
let vec: Vec<usize> = (0..100_usize).collect();
|
||||
bencher.iter(|| {
|
||||
let mut order: Vec<usize> = (0..100_usize).collect();
|
||||
order.shuffle(&mut thread_rng());
|
||||
let _ordered_iterator_resp: Vec<(usize, &usize)> =
|
||||
OrderedIterator::new(&vec, Some(&order)).collect();
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user