-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rating improvement hard fork stuck shard #3545
Rating improvement hard fork stuck shard #3545
Conversation
Codecov Report
@@ Coverage Diff @@
## development #3545 +/- ##
===============================================
+ Coverage 73.94% 73.95% +0.01%
===============================================
Files 581 581
Lines 74780 74794 +14
===============================================
+ Hits 55293 55311 +18
+ Misses 15077 15075 -2
+ Partials 4410 4408 -2
Continue to review full report at Codecov.
|
cmd/node/config/enableEpochs.toml
Outdated
@@ -144,6 +144,9 @@ | |||
# RemoveNonUpdatedStorageEnableEpoch represents the epoch when the backward compatibility for removing non updated storage is enabled | |||
RemoveNonUpdatedStorageEnableEpoch = 2 | |||
|
|||
# StopDecreasingValidatorRatingWhenStuckEpoch represents the epoch when we should stop decreasing validator's rating if, for instance, a shard gets stuck | |||
StopDecreasingValidatorRatingWhenStuckEpoch = 1000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StopDecreasingValidatorRatingWhenStuckEnableEpoch to keep the same pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed it for consistency
config/epochConfig.go
Outdated
@@ -61,6 +61,7 @@ type EnableEpochs struct { | |||
FixOOGReturnCodeEnableEpoch uint32 | |||
RemoveNonUpdatedStorageEnableEpoch uint32 | |||
DeleteDelegatorAfterClaimRewardsEnableEpoch uint32 | |||
StopDecreasingValidatorRatingWhenStuckEpoch uint32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StopDecreasingValidatorRatingWhenStuckEnableEpoch to keep the same pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed it for consistency
process/peer/process.go
Outdated
SwitchJailWaitingEnableEpoch uint32 | ||
BelowSignedThresholdEnableEpoch uint32 | ||
StakingV2EnableEpoch uint32 | ||
StopDecreasingValidatorRatingWhenStuckEpoch uint32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StopDecreasingValidatorRatingWhenStuckEnableEpoch to keep the same pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed it for consistency
process/peer/process.go
Outdated
jailedEnableEpoch uint32 | ||
belowSignedThresholdEnableEpoch uint32 | ||
stakingV2EnableEpoch uint32 | ||
stopDecreasingValidatorRatingWhenStuckEpoch uint32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stopDecreasingValidatorRatingWhenStuckEpoch to keep the same pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed it for consistency
process/peer/process.go
Outdated
stopDecreasingValidatorRatingWhenStuckEpoch uint32 | ||
flagJailedEnabled atomic.Flag | ||
flagStakingV2Enabled atomic.Flag | ||
flagStopDecreasingValidatorRating atomic.Flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flagStopDecreasingValidatorRatingEnabled to keep the same pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed it for consistency
cmd/node/config/enableEpochs.toml
Outdated
@@ -144,6 +144,9 @@ | |||
# RemoveNonUpdatedStorageEnableEpoch represents the epoch when the backward compatibility for removing non updated storage is enabled | |||
RemoveNonUpdatedStorageEnableEpoch = 2 | |||
|
|||
# StopDecreasingValidatorRatingWhenStuckEnableEpoch represents the epoch when we should stop decreasing validator's rating if, for instance, a shard gets stuck | |||
StopDecreasingValidatorRatingWhenStuckEnableEpoch = 1000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have this enabled though?
you can set it to 2, then we can try to test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, changed it as requested
process/peer/process.go
Outdated
@@ -1230,4 +1243,6 @@ func (vs *validatorStatistics) EpochConfirmed(epoch uint32, _ uint64) { | |||
log.Debug("validatorStatistics: jailed", "enabled", vs.flagJailedEnabled.IsSet()) | |||
vs.flagStakingV2Enabled.Toggle(epoch > vs.stakingV2EnableEpoch) | |||
log.Debug("validatorStatistics: stakingV2", vs.flagStakingV2Enabled.IsSet()) | |||
vs.flagStopDecreasingValidatorRatingEnabled.Toggle(epoch >= vs.stopDecreasingValidatorRatingWhenStuckEnableEpoch) | |||
log.Debug("validatorStatistics: stop decreasing validator rating", vs.flagStopDecreasingValidatorRatingEnabled.IsSet()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you log also the maximum number of rounds?
in case we miss initializing it in the DTO and it ends up default = 0, there will never be any rating decrease.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good point!
Added a log for maxConsecutiveRoundsOfRatingDecrease
as well.
Also, I've added a check on constructor to check if maxConsecutiveRoundsOfRatingDecrease == 0
=> return error
cmd/node/config/config.toml
Outdated
@@ -23,6 +23,11 @@ | |||
# GenesisMaxNumberOfShards represents the maximum number of shards to be created at genesis (excluding metaChain shard) | |||
GenesisMaxNumberOfShards = 3 | |||
|
|||
# MaxConsecutiveRoundsOfRatingDecrease represents the max number of consecutive rounds in which a validator's rating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#MaxConsecutiveRoundsOfRatingDecrease representes the max number of consecutive rounds in which a block is not proposed on a shard and the validators' rating could be decreased. (...) then we should stop decreasing validator's rating so they won't get jailed => then the validators rating decrease should stop...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the description as suggested !
@@ -1333,6 +1337,43 @@ func TestValidatorStatisticsProcessor_CheckForMissedBlocksNoMissedBlocks(t *test | |||
assert.False(t, computeValidatorGroupCalled) | |||
} | |||
|
|||
func TestValidatorStatisticsProcessor_CheckForMissedBlocksMissedRoundsGreaterThanMaxConsecutiveRoundsOfRatingDecrease(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check for actual rating decrease before and after fix is missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I've changed the test.
…stuck_shard # Conflicts: # config/epochConfig.go
d1d3d9f
80a1304
…stuck_shard # Conflicts: # cmd/node/config/enableEpochs.toml # config/epochConfig.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System test passed.
MaxConsecutiveRoundsOfRatingDecrease
, which represents the max number of consecutive rounds in which a validator's rating can be decrease in case of not processing/signing a block. If, for instance, a shard gets stuck for more rounds than this value, then we should stop decreasing validator's rating so they won't get jailed.StopDecreasingValidatorRatingWhenStuckEnableEpoch
which represents the epoch when we should stop decreasing validator's rating if, for instance, a shard gets stuckMaxConsecutiveRoundsOfRatingDecrease
=> do not decrease validator rating