-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Slashing bugfixes (start height, handler registration) #1200
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1200 +/- ##
===========================================
+ Coverage 65.23% 65.46% +0.23%
===========================================
Files 87 87
Lines 4415 4428 +13
===========================================
+ Hits 2880 2899 +19
+ Misses 1356 1350 -6
Partials 179 179 |
so we found out the root cause of #1197? |
x/slashing/keeper_test.go
Outdated
@@ -129,3 +129,36 @@ func TestHandleAbsentValidator(t *testing.T) { | |||
validator, _ = sk.GetValidatorByPubKey(ctx, val) | |||
require.Equal(t, sdk.Unbonded, validator.GetStatus()) | |||
} | |||
|
|||
func TestHandleNewValidator(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.
Can we add a small description (couple sentences) explaining the intention of this test... looks cool, I'd like to better understand the scenario
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.
Added a few-line description to all tests in this file.
x/slashing/keeper.go
Outdated
if !found { | ||
// If this validator has never been seen before, set the start height | ||
signInfo.StartHeight = height | ||
} |
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.
I tend to think this isn't the best practice - it would be more clear to have a NewSignInfo
function where you pass in the height and we explicitly define signInfo with this function if !found
- this way we can remove that second comment there that rationalizes what is happening - it will just be implied by the code
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.
Agreed - that's clearer - changed to NewValidatorSigningInfo
.
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.
Looks good just a couple minor comments before merge
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.
Looks good just a couple minor comments before merge
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.
woot!
Closes #1199
Closes #1196
Can be cherry-picked for a testnet hotfix. This PR does change the state machine.