Skip to content

check fields integrity#7863

Closed
ssd04 wants to merge 2 commits into
feat/testnet-fixesfrom
consensus-extra-header-checks
Closed

check fields integrity#7863
ssd04 wants to merge 2 commits into
feat/testnet-fixesfrom
consensus-extra-header-checks

Conversation

@ssd04

@ssd04 ssd04 commented May 28, 2026

Copy link
Copy Markdown
Contributor

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:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@ssd04 ssd04 self-assigned this May 28, 2026
@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.59%. Comparing base (70698ac) to head (50bf732).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ssd04 ssd04 marked this pull request as ready for review June 17, 2026 09:05
@AdoAdoAdo AdoAdoAdo requested a review from Copilot June 17, 2026 09:44

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.

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 in Worker.doJobOnMessageWithHeader.
  • Call CheckFieldsIntegrity() when subroundBlock receives 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 thread consensus/spos/worker.go
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)
}
@ssd04

ssd04 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

duplicated checks, not needed for now

@ssd04 ssd04 closed this Jun 17, 2026
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