Skip to content

change check for meta notarizing shard headers#7658

Merged
sstanculeanu merged 2 commits into
feat/supernova-async-execfrom
fix-notarization-at-epoch-change
Feb 3, 2026
Merged

change check for meta notarizing shard headers#7658
sstanculeanu merged 2 commits into
feat/supernova-async-execfrom
fix-notarization-at-epoch-change

Conversation

@AdoAdoAdo

@AdoAdoAdo AdoAdoAdo commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Reasoning behind the pull request

This PR modifies the check for meta nodes notarizing shard headers during epoch change transitions. The main change adds a validation to prevent shard headers from being notarized between the time an epoch change is proposed and when the epoch start block is created.

Proposed changes

  • Added GetEpochChangeProposed() method to the EpochStartTriggerHandler interface and all implementing types
  • Introduced new error ErrShardHeadersShouldNotBeNotarized to signal invalid shard header notarization during epoch transitions
  • Modified meta block proposal creation logic to check the epoch change proposed state from the trigger handler instead of checking if it's epoch start
  • Added validation in checkShardHeadersValidityAndFinalityProposal to reject blocks with shard headers when epoch change is proposed

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?

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 modifies the check for meta nodes notarizing shard headers during epoch change transitions. The main change adds a validation to prevent shard headers from being notarized between the time an epoch change is proposed and when the epoch start block is created.

Changes:

  • Added GetEpochChangeProposed() method to the EpochStartTriggerHandler interface and all implementing types
  • Introduced new error ErrShardHeadersShouldNotBeNotarized to signal invalid shard header notarization during epoch transitions
  • Modified meta block proposal creation logic to check the epoch change proposed state from the trigger handler instead of checking if it's epoch start
  • Added validation in checkShardHeadersValidityAndFinalityProposal to reject blocks with shard headers when epoch change is proposed

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
process/interface.go Added GetEpochChangeProposed() method to EpochStartTriggerHandler interface
epochStart/interface.go Added GetEpochChangeProposed() method to TriggerHandler interface and reordered imports
process/errors.go Added new error ErrShardHeadersShouldNotBeNotarized
epochStart/metachain/trigger.go Implemented GetEpochChangeProposed() with proper locking to return the epoch change proposed flag
epochStart/shardchain/trigger.go Implemented GetEpochChangeProposed() to always return false for shard chain triggers
epochStart/bootstrap/disabled/disabledEpochStartTrigger.go Implemented stub GetEpochChangeProposed() returning false
process/block/metablockProposal.go Changed condition at line 114 to use GetEpochChangeProposed() and added validation at lines 981-984 to prevent notarizing shard headers during epoch transition
process/block/metablockProposal_test.go Updated test name and assertion to reflect the change from IsEpochStart() to GetEpochChangeProposed()
testscommon/epochStartTriggerStub.go Added GetEpochChangeProposedCalled field and implemented stub method
process/mock/endOfEpochTriggerStub.go Added GetEpochChangeProposedCalled field and implemented stub method
node/mock/endOfEpochTriggerStub.go Added GetEpochChangeProposedCalled field and implemented stub method
integrationTests/mock/endOfEpochTriggerStub.go Added GetEpochChangeProposedCalled field and implemented stub method
factory/mock/epochStartTriggerStub.go Added GetEpochChangeProposedCalled field and implemented stub method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +981 to +984
shouldNotHaveShardHeaders := metaHeaderHandler.IsStartOfEpochBlock() || metaHeaderHandler.IsEpochChangeProposed() || mp.epochStartTrigger.GetEpochChangeProposed()
if len(usedShardHeaders.orderedShardHeaders) > 0 && shouldNotHaveShardHeaders {
return fmt.Errorf("%w : between epoch change proposed and epoch start block", process.ErrShardHeadersShouldNotBeNotarized)
}

Copilot AI Feb 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new validation logic that checks if shard headers should not be notarized during epoch change is missing test coverage. There should be test cases in Test_checkShardHeadersValidityAndFinalityProposal that verify:

  1. When GetEpochChangeProposed() returns true and there are shard headers present, the error ErrShardHeadersShouldNotBeNotarized is returned
  2. When IsStartOfEpochBlock() returns true and there are shard headers present, the error is returned
  3. When IsEpochChangeProposed() returns true on the meta header and there are shard headers present, the error is returned

Copilot uses AI. Check for mistakes.
sstanculeanu
sstanculeanu previously approved these changes Feb 2, 2026
raduchis
raduchis previously approved these changes Feb 2, 2026
ssd04
ssd04 previously approved these changes Feb 2, 2026
Base automatically changed from header-cache to feat/supernova-async-exec February 2, 2026 13:04
@AdoAdoAdo AdoAdoAdo dismissed stale reviews from ssd04, raduchis, and sstanculeanu February 2, 2026 13:04

The base branch was changed.

@codecov

codecov Bot commented Feb 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.58%. Comparing base (c635e8b) to head (af7202f).
⚠️ Report is 3 commits behind head on feat/supernova-async-exec.

Files with missing lines Patch % Lines
epochStart/metachain/trigger.go 0.00% 4 Missing ⚠️
epochStart/shardchain/trigger.go 0.00% 2 Missing ⚠️
process/block/metablockProposal.go 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##           feat/supernova-async-exec    #7658      +/-   ##
=============================================================
- Coverage                      77.59%   77.58%   -0.01%     
=============================================================
  Files                            877      877              
  Lines                         121752   121761       +9     
=============================================================
- Hits                           94476    94474       -2     
- Misses                         21008    21017       +9     
- Partials                        6268     6270       +2     

☔ View full report in Codecov by Sentry.
📢 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.

@sstanculeanu sstanculeanu merged commit af3c476 into feat/supernova-async-exec Feb 3, 2026
9 of 11 checks passed
@sstanculeanu sstanculeanu deleted the fix-notarization-at-epoch-change branch February 3, 2026 08:12
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.

5 participants