check fields integrity#7863
Closed
ssd04 wants to merge 2 commits into
Closed
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/testnet-fixes #7863 +/- ##
======================================================
+ Coverage 77.58% 77.59% +0.01%
======================================================
Files 884 884
Lines 125259 125267 +8
======================================================
+ Hits 97182 97201 +19
+ Misses 21627 21618 -9
+ Partials 6450 6448 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sstanculeanu
approved these changes
May 29, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR strengthens validation of consensus-received block headers by adding an explicit “fields integrity” check in the SPoS worker and in the BLS v2 subround header reception path, along with tests covering invalid headers.
Changes:
- Call
CheckFieldsIntegrity()when processing received block headers inWorker.doJobOnMessageWithHeader. - Call
CheckFieldsIntegrity()whensubroundBlockreceives a block header, dropping invalid headers early. - Add/extend tests to assert invalid headers are rejected; add a test-only wrapper in
export_test.go.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
consensus/spos/worker.go |
Adds CheckFieldsIntegrity() validation in header message processing. |
consensus/spos/worker_test.go |
Adds tests ensuring invalid headers are rejected (nil fields + integrity failure). |
consensus/spos/export_test.go |
Adds an exported test wrapper for doJobOnMessageWithHeader. |
consensus/spos/bls/v2/subroundBlock.go |
Adds CheckFieldsIntegrity() validation for received headers before further processing. |
consensus/spos/bls/v2/subroundBlock_test.go |
Adds a test case asserting integrity-check failures are ignored (no data set). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+626
to
+630
| err = header.CheckFieldsIntegrity() | ||
| if err != nil { | ||
| return fmt.Errorf("%w : received header from consensus topic is invalid", | ||
| err) | ||
| } |
Comment on lines
+234
to
+237
| // DoJobOnMessageWithHeader - | ||
| func (wrk *Worker) DoJobOnMessageWithHeader(cnsMsg *consensus.Message) error { | ||
| return wrk.doJobOnMessageWithHeader(cnsMsg) | ||
| } |
Contributor
Author
|
duplicated checks, not needed for now |
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.
Reasoning behind the pull request
Proposed changes
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
featbranch created?featbranch merging, do all satellite projects have a proper tag insidego.mod?