besu icon indicating copy to clipboard operation
besu copied to clipboard

BAL-based perfect parallelization of transaction execution

Open mirgee opened this issue 1 month ago • 0 comments

Adds --Xbal-perfect-parallelization-enabled config flag, enabled by default, which activates BAL-based perfect parallelization of transaction execution.

Adds a new interface, ParallelBlockTransactionProcessor, implemented by ParallelizedConcurrentTransactionProcessor (optimistic parallelization) and BalConcurrentTransactionProcessor (BAL-based parallelization), and used by ParallelTransactionPreprocessing to launch parallel block (pre)processing, which returns PreprocessingContext (unified for both processing types) currently containing only reference to the ParallelBlockTransactionProcessor used to obtain the transaction processing results later.

BalConcurrentTransactionProcessor launches and manages the futures processing individual transactions in the background. At the beginning of transaction processing, the prestate is loaded by applying corresponding state changes from the BAL. When the transaction processing result is ready, the state changes are imported to the block's accumulator in the main thread. Some categories of (pre)processing failures result in fallback to sequential processing.

The AbstractBlockProcessor trusts that the presence of absence of BALs in the block's body was validated before processBlock was called, and then uses the BALs if they are present, and, based on configuration, falls back to optimistic parallel or sequential processing. This is because the block may still be valid even if BALs are active and BAL is missing from the block body, e.g. in case of replaying a block older than BAL retention period.

These changes were tested by running a local devnet with spamoor and tx_fuzz, and it was verified all transactions are executed in parallel without conflicts.

An optional fail-fast transaction-wise validation of PartialBlockAccessListViews from TransactionProcessingResults against the blocks BlockAccessList (validating execution matches BAL) will be added separately, as well as BAL-based batch read prefetching.

Resolves #9079 .

mirgee avatar Dec 04 '25 15:12 mirgee