feat: add stake weight histogram to validation stats#2508
Merged
rockysingh merged 6 commits intomainfrom Apr 10, 2026
Merged
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 138 |
| Duplication | 26 |
TIP This summary will be updated as you push new changes. Give us feedback
fd74b2c to
30c7d0f
Compare
jsync-swirlds
previously approved these changes
Apr 9, 2026
Contributor
jsync-swirlds
left a comment
There was a problem hiding this comment.
Just some possible improvements using a Formatter instead of combining StringBuilder and String.format.
Contributor
Author
Thanks. I took the commit proposed and then made a few adjustments to it after. |
Extract DayStatistics and SignatureStats from ValidateWithStats into reusable SignatureStatsCollector. Add SignatureBlockStats record for per-block signature data. Extend CSV output with 17 stake weight columns including validated stake percentages, threshold margins, signing node counts, stake distribution stats, and signer reliability. Wire stats collection into ValidateBlocksCommand, LiveSequential, and ToWrappedBlocksCommand with command-specific CSV filenames. Optimize SignatureValidation with lazy diagnostics (no string formatting on happy path) and cached total stake computation. Signed-off-by: Rocky Thind <harpender.t@swirldslabs.com>
Signed-off-by: Rocky Thind <harpender.t@swirldslabs.com>
Signed-off-by: Rocky Thind <harpender.t@swirldslabs.com>
…ks/validation/SignatureStatsCollector.java Co-authored-by: Joseph S. <121976561+jsync-swirlds@users.noreply.github.com> Signed-off-by: Rocky Singh <rockysingh@users.noreply.github.com>
Fix field vs method access (totalBlocks, totalValidSignatures), missing format argument in histogram loop, garbled format call for missing/reliable signers, restore else branch for empty stake columns, and update appendNodeStakeDistribution to accept Formatter. Signed-off-by: Rocky Thind <harpender.t@swirldslabs.com>
7832c0e to
cd38ab6
Compare
Nana-EC
reviewed
Apr 10, 2026
Contributor
Nana-EC
left a comment
There was a problem hiding this comment.
A few minor considerations
- ValidateBlocksCommand: fix stats output directory fallback when files[0] is a regular file (e.g. a .blk.zip) by using the file's parent directory instead of the file itself - ValidateBlocksCommand: wrap SignatureStatsCollector in try-with-resources so close() is guaranteed on all exit paths - SignatureValidation: remove the two-arg constructor to eliminate the hidden collectDetailedStats default; callers must now be explicit about whether they want stats collection Signed-off-by: Rocky Thind <harpender.t@swirldslabs.com>
ivannov
pushed a commit
to ivannov/hiero-block-node
that referenced
this pull request
Apr 20, 2026
Signed-off-by: Rocky Thind <harpender.t@swirldslabs.com> Signed-off-by: Rocky Singh <rockysingh@users.noreply.github.com> Co-authored-by: Joseph S. <121976561+jsync-swirlds@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #2508 +/- ##
============================================
- Coverage 81.27% 81.20% -0.08%
+ Complexity 1512 1509 -3
============================================
Files 139 139
Lines 7131 7131
Branches 754 754
============================================
- Hits 5796 5791 -5
- Misses 1010 1016 +6
+ Partials 325 324 -1 see 3 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
Summary
DayStatisticsandSignatureStatsfromValidateWithStatsinto reusableSignatureStatsCollectorclassSignatureBlockStatsrecord for per-block signature validation data withNodeResultenum andfromPreVerifiedData()factoryValidateBlocksCommand,LiveSequential, andToWrappedBlocksCommandwith command-specific CSV filenamesStakeMapWithTotaltoNodeStakeRegistryto avoid recomputing total stake per blockSignatureValidationwith lazy diagnostics — no string formatting on the happy pathcloses: #2504