Skip to content

Parallelize transaction validation for transaction sets. - #5449

Merged
dmkozh merged 1 commit into
stellar:masterfrom
dmkozh:txset_par_checkvalid
Nov 24, 2026
Merged

dmkozh merged 1 commit into
stellar:masterfrom
dmkozh:txset_par_checkvalid

Conversation

@dmkozh

@dmkozh dmkozh commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Description

This affects both nominating a new transaction set, and validating the incoming transaction set. Thanks to the fact that most of the time we're either applying the ledger, or validating a transaction set, we can use the efficient CPU-pinned batch executor for this.

This speeds up the invalid transaction trimming step by ~20ms on large benchmarks, and in general should increase the transaction validation step proportionally to the number of cores.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

@dmkozh
dmkozh force-pushed the txset_par_checkvalid branch from 12192a2 to 443a838 Compare September 9, 2026 21:42
Comment thread src/ledger/ImmutableLedgerView.h Resolved
Comment thread src/ledger/ImmutableLedgerView.h Resolved
Comment thread src/transactions/TransactionFrame.cpp Resolved
Comment thread src/ledger/ImmutableLedgerView.h Resolved
@SirTyson SirTyson mentioned this pull request Sep 14, 2026
5 of 6 tasks
@dmkozh
dmkozh force-pushed the txset_par_checkvalid branch from 443a838 to ffe5411 Compare September 17, 2026 22:44
@dmkozh
dmkozh force-pushed the txset_par_checkvalid branch from ffe5411 to 0ba1f7a Compare October 14, 2026 23:53
@dmkozh
dmkozh marked this pull request as ready for review October 14, 2026 23:56
Copilot AI balanced review requested due to automatic review settings October 14, 2026 23:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Shared transaction frames can be validated concurrently, causing a data race on mutable state.

1 open finding
What changed in this PR

Parallelizes transaction-set validation during nomination and incoming-set checks using the batch executor.

Changes:

  • Adds parallel validation with sequential fallbacks.
  • Combines fee accounting and invalid-transaction collection.
  • Adds parallel-validation tests and updates fee-source expectations.
File Description
src/​herder/​TxSetUtils.cpp Batches validation and updates fee checks.
src/​herder/​test/​TxSetTests.cpp Tests validation across task counts.
src/​herder/​test/​HerderTests.cpp Updates shared-fee-source coverage.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/herder/TxSetUtils.cpp Resolved
@dmkozh
dmkozh force-pushed the txset_par_checkvalid branch from 0ba1f7a to f455d51 Compare October 15, 2026 15:53
Copilot AI balanced review requested due to automatic review settings October 15, 2026 15:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Consensus-critical threading and fee-trimming changes warrant human review and runtime validation.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Comment thread src/herder/TxSetUtils.h Resolved
Copilot AI balanced review requested due to automatic review settings October 15, 2026 16:15
@dmkozh
dmkozh force-pushed the txset_par_checkvalid branch from f455d51 to 5b99e0e Compare October 15, 2026 16:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Consensus-critical concurrency and fee-trimming changes warrant human review supported by runtime and thread-safety testing.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@dmkozh
dmkozh force-pushed the txset_par_checkvalid branch from 5b99e0e to 39e87b2 Compare November 20, 2026 20:06

@SirTyson SirTyson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM! A much smaller change than I was expecting tbh, I guess thanks to the last couple batches of refactors. I left a couple of nits and quesitons, only thing is I think the HerderTests family of unit tests doesn't actually hit the parallel case.

Comment thread src/herder/TxSetUtils.cpp Resolved
Comment thread src/herder/TxSetUtils.cpp Resolved
Comment thread src/herder/TxSetUtils.cpp Resolved
Comment thread src/herder/TxSetUtils.cpp Resolved
Comment thread src/herder/test/HerderTests.cpp Resolved
SirTyson
SirTyson previously approved these changes Nov 24, 2026
@dmkozh
dmkozh force-pushed the txset_par_checkvalid branch from a1b4fc7 to 7e9b49d Compare November 24, 2026 21:29
@dmkozh
dmkozh enabled auto-merge November 24, 2026 21:29
@dmkozh
dmkozh disabled auto-merge November 24, 2026 21:30
This affects both nominating a new transaction set, and validating the incoming transaction set. Thanks to the fact that most of the time we're either applying the ledger, or validating a transaction set, we can use the efficient CPU-pinned batch executor for this.

This speeds up the invalid transaction trimming step by ~20ms on large benchmarks, and in general should increase the transaction validation step proportionally to the number of cores.
@dmkozh
dmkozh added this pull request to the merge queue Nov 24, 2026
Merged via the queue into stellar:master with commit dfae112 Nov 24, 2026
63 of 65 checks passed
@dmkozh
dmkozh deleted the txset_par_checkvalid branch November 24, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants