Move signature verification out of the write transaction and parallelize it - #5103
Open
RickiNano wants to merge 4 commits into
Open
Move signature verification out of the write transaction and parallelize it#5103RickiNano wants to merge 4 commits into
RickiNano wants to merge 4 commits into
Conversation
Test Results for Commit 8f2c2b4Pull Request 5103: Results Test Case Results
Last updated: 2026-07-09 23:23:52 UTC |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces ledger write-transaction hold time by pre-validating block signatures outside the transaction and (for eligible block types) doing that work in parallel, then threading the pre-validation result into ledger.process()/ledger_processor so the in-tx signature check can be skipped when conclusive.
Changes:
- Add
nano::signature_verificationand plumb it throughledger::process()intoledger_processor. - Add a configurable verification worker pool to
block_processorto pre-validate signatures for each batch before opening the write transaction. - Add config + stats + TOML coverage for the new
verification_threadssetting andblocks_verifiedstat.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| nano/secure/ledger.hpp | Extends ledger::process() API to accept optional pre-validation result. |
| nano/secure/ledger.cpp | Passes pre-validation result into ledger_processor. |
| nano/secure/ledger_processor.hpp | Extends ledger_processor to store a pre-validation result and adds validate_signature() helper. |
| nano/secure/ledger_processor.cpp | Implements validate_signature() and routes relevant signature checks through it. |
| nano/secure/common.hpp | Introduces signature_verification enum used for pre-validation. |
| nano/node/block_processor.hpp | Adds verification_threads config and declares batch verification helpers/pool. |
| nano/node/block_processor.cpp | Implements parallel batch signature verification, config serialization, and stats reporting. |
| nano/node/block_context.hpp | Stores per-block pre-validation result in block_context. |
| nano/lib/stats_enums.hpp | Adds blocks_verified stat detail. |
| nano/core_test/toml.cpp | Extends TOML config tests to include verification_threads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
I need to rebase this branch on develop to fix the conflicts |
RickiNano
force-pushed
the
mt-block-processor
branch
from
July 9, 2026 20:26
af03151 to
8f2c2b4
Compare
Contributor
Author
|
Rebased and ready for review @pwojcikdev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Block signature verification currently runs serially inside the ledger write transaction: the block processor opens a write tx per batch and each ledger.process() call does its ed25519 checks while holding it. This PR moves that CPU work out of the transaction and onto a small worker pool, so batches are pre-validated in parallel before the write tx is opened.
Benefits
How it works
Co-authored with Claude Fable