Fix parallel execution metrics and opcode tracing#11445
Conversation
|
Claude finished @benaadams's task in 4m 32s —— View job PR Review: Fix Processing stats for parallel and aggregation
SummaryThis PR fixes two distinct bugs in processing statistics:
FindingsNo Critical, High, or Medium issues. Low findings noted via inline comments:
What looks good
Mergeable. |
There was a problem hiding this comment.
Pull request overview
Updates processing statistics reporting to correctly handle batched/parallel block processing by aggregating totals across multiple processed blocks and preserving metric scope during parallel transaction execution.
Changes:
- Change
IProcessingStats.UpdateStatsto accept a list of processed blocks and aggregate gas/tx/blob totals per update. - Fix reporting window block-range (
BlockFrom) when multiple blocks are processed per stats update. - Preserve
ProcessingThread.IsBlockProcessingThreadacross parallel transaction-validation workers; add coverage tests for both stats aggregation and the processing-thread flag behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Nethermind/Nethermind.Consensus/Processing/ProcessingStats.cs | Aggregate stats across multiple blocks; track first block number in the reporting window. |
| src/Nethermind/Nethermind.Consensus/Processing/IProcessingStats.cs | Update API contract/docs to accept multiple processed blocks. |
| src/Nethermind/Nethermind.Consensus/Processing/BlockchainProcessor.cs | Pass the processed block batch into stats tracking. |
| src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.ParallelBlockValidationTransactionsExecutor.cs | Ensure ProcessingThread metric scope is preserved across parallel workers. |
| src/Nethermind/Nethermind.Consensus.Test/ProcessingStatsTests.cs | New tests validating multi-block aggregation/reporting behavior. |
| src/Nethermind/Nethermind.Blockchain.Test/BlockProcessorTests.cs | New tests for BAL parallel execution behavior and processing-thread flag propagation. |
Comments suppressed due to low confidence (1)
src/Nethermind/Nethermind.Consensus/Processing/ProcessingStats.cs:224
UpdateStatscan now batch multiple blocks, sochunkBlocksmay become >1 within a single call. The code later inGenerateReportstill performs MEV/reward detection and multiple state reads (HasStateForBlock/GetBalance) even though the logging path skips rewards whenchunkBlocks > 1. Consider short-circuiting those reward/state-root calculations whenchunkBlocks > 1to avoid unnecessary work during catch-up / parallel processing windows.
long chunkFirstBlockNumber = _chunkFirstBlockNumber;
if (chunkFirstBlockNumber == -1)
{
chunkFirstBlockNumber = data.FirstBlockNumber;
_chunkFirstBlockNumber = chunkFirstBlockNumber;
}
long chunkBlocks = (_chunkBlocks += data.BlockCount);
Metrics.Blocks = blockNumber;
Metrics.BlockchainHeight = blockNumber;
Metrics.Transactions += data.TransactionCount;
Metrics.TotalDifficulty = block.TotalDifficulty ?? UInt256.Zero;
Metrics.LastDifficulty = block.Difficulty;
Metrics.GasUsed = block.GasUsed;
Metrics.GasLimit = block.GasLimit;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@claude re-review |
|
Claude finished @benaadams's task in 3m 40s —— View job PR Re-Review: Fix Processing stats for parallel and aggregation
SummaryRe-review is clean. The three Low findings from the previous review are all addressed. No new issues found. Previous Low Findings — Resolved
Additional Verification (re-review specific)
Accumulation ordering is fully symmetric. All eight
No stale pool data. Mergeable. |
|
@claude re-review |
|
Claude finished @benaadams's task in 3m 37s —— View job PR Re-Review: Fix parallel execution metrics and opcode tracing
SummaryThis re-review covers the new additions since the last pass: OpcodeBlockTracer thread-safety analysisThe locking design is correct:
The FindingsNo Critical, High, or Medium issues. One Low finding (new code):
Detail — Low: What looks good
Mergeable (Low finding only). |
|
Fixed in #11436 |
Changes
ProcessingStatsover the actual report-window delta instead of the last processed block, keeping block count/range, MGas, transactions, blobs, and throughput aligned when multiple blocks are logged together.AsyncLocaland the shared transaction-completion lock, using thread-local active tx state plus one-shot atomic accumulation.ParallelUnbalancedWorkworker scheduling, Merge.Plugin payload-processing timeouts, and SnapSync server-state persistence.Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
dotnet test --project src/Nethermind/Nethermind.Consensus.Test/Nethermind.Consensus.Test.csproj -c release -- --filter FullyQualifiedName~ProcessingStatsTestsdotnet test --project src/Nethermind/Nethermind.Consensus.Test/Nethermind.Consensus.Test.csproj -c checked -- --filter FullyQualifiedName~ProcessingStatsTestsdotnet test --project src/Nethermind/Nethermind.Blockchain.Test/Nethermind.Blockchain.Test.csproj -c release -- --filter FullyQualifiedName~Parallel_validation_preserves_processing_thread_metric_scope_for_worker_transactionsdotnet test --project src/Nethermind/Nethermind.Blockchain.Test/Nethermind.Blockchain.Test.csproj -c release -- --filter FullyQualifiedName~Parallel_validation_forwards_parallel_safe_block_tracer_to_worker_transactionsdotnet test --project src/Nethermind/Nethermind.Blockchain.Test/Nethermind.Blockchain.Test.csproj -c release -- --filter "FullyQualifiedName~Parallel_validation_preserves_processing_thread_metric_scope_for_worker_transactions|FullyQualifiedName~PrepareForProcessing_keeps_parallel_bal_execution|FullyQualifiedName~IncrementalValidation_rejects_eip8037_tx_when_worst_case_exceeds_ordered_remaining_gas"dotnet test --project src/Nethermind/Nethermind.OpcodeTracing.Plugin.Test/Nethermind.OpcodeTracing.Plugin.Test.csproj -c releasedotnet test --project src/Nethermind/Nethermind.Core.Test/Nethermind.Core.Test.csproj -c checked -- --filter FullyQualifiedName~ParallelUnbalancedWorkTests.For_WhenWorkerFaults_OtherWorkersStopFetchingWorkdotnet build src/Nethermind/Nethermind.Merge.Plugin.Test/Nethermind.Merge.Plugin.Test.csproj -c releasedotnet build src/Nethermind/Nethermind.Consensus/Nethermind.Consensus.csproj -c releasedotnet build src/Nethermind/Nethermind.Synchronization.Test/Nethermind.Synchronization.Test.csproj -c release --no-restoreDocumentation
Requires documentation update
Requires explanation in Release Notes