HIGH 019 - Add StartRound check#7698
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds a validation check to ensure that the supernova start round is not lower than the regular start round during node initialization. This prevents configuration mismatches that could occur when a node starts after a hardfork, ensuring proper temporal alignment between genesis time and supernova activation time.
Changes:
- Added validation in core components factory to check that
supernovaStartRound >= startRound - Returns descriptive error when validation fails
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if supernovaStartRound < startRound { | ||
| return nil, fmt.Errorf("supernovaStartRound %d lower then startRound %d", | ||
| supernovaStartRound, | ||
| startRound, | ||
| ) | ||
| } |
There was a problem hiding this comment.
The new validation for supernovaStartRound vs startRound lacks test coverage. Based on the existing test patterns in factory/core/coreComponents_test.go (which includes tests for other validation errors), consider adding a test case that verifies this validation by setting AfterHardFork to true with a StartRound value greater than the SupernovaEnableRound. This would ensure the validation works correctly and prevent regressions.
| return nil, fmt.Errorf("supernovaStartRound %d lower then startRound %d", | ||
| supernovaStartRound, | ||
| startRound, | ||
| ) | ||
| } | ||
|
|
||
| if supernovaGenesisTime.Compare(genesisTime) < 0 { | ||
| return nil, fmt.Errorf("supernovaGenesisTime %d lower then genesisTime %d", |
There was a problem hiding this comment.
Spelling error: "lower then" should be "lower than". The word "then" refers to time or sequence, while "than" is used for comparisons.
| return nil, fmt.Errorf("supernovaStartRound %d lower then startRound %d", | |
| supernovaStartRound, | |
| startRound, | |
| ) | |
| } | |
| if supernovaGenesisTime.Compare(genesisTime) < 0 { | |
| return nil, fmt.Errorf("supernovaGenesisTime %d lower then genesisTime %d", | |
| return nil, fmt.Errorf("supernovaStartRound %d lower than startRound %d", | |
| supernovaStartRound, | |
| startRound, | |
| ) | |
| } | |
| if supernovaGenesisTime.Compare(genesisTime) < 0 { | |
| return nil, fmt.Errorf("supernovaGenesisTime %d lower than genesisTime %d", |
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?