-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
R4R: Implement slashing period #2122
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #2122 +/- ##
==========================================
+ Coverage 63.51% 63.6% +0.09%
==========================================
Files 136 139 +3
Lines 8370 8454 +84
==========================================
+ Hits 5316 5377 +61
- Misses 2692 2713 +21
- Partials 362 364 +2 |
Thinking about the best way to implement the slashing period hooks - do we have way for two keepers to mutually reference each other? Ideally the slashing period logic would live in the slashing module, and the staking module would call into it as described in the spec. Certainly we can do this with common types defined in a := newStakingKeeper(...)
b := newSlashingKeeper(a, ....)
a.setSlashingKeeper(b) but that's a bit ugly, and I wonder if we have any concerns with this pattern. |
Also, I think this is probably about the right time to split slashing into subpackages as per #1779 - but I'm going to do it in a separate PR, after the functionality changes, to make review easier. |
I think the code pattern you've described makes sense - especially so if
ideally the staking module actually defines what interface it needs for Yeah splitting up as a second PR makes sense |
This is not being written for Tendermint |
a99363c
to
3534a99
Compare
f3b0070
to
6ed552a
Compare
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.
hello!
x/slashing/hooks.go
Outdated
EndHeight: 0, | ||
SlashedSoFar: sdk.ZeroDec(), | ||
} | ||
k.setValidatorSlashingPeriod(ctx, slashingPeriod) |
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.
dummy question: is it only possible to have just one slashing period per keeper?
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.
No, it's possible to have one per validator per start height - the key is partially read from the ValidatorSlashingPeriod
struct.
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.
Ok, thanks. It's just the method name IMHO implies that there's only one period. addValidatorSlashingPeriod
would make more sense
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, changed to addOrUpdateValidatorSlashingPeriod
@cwgoes responded to all your comments from my review above ^ I've marked everything which I'm satisfied with as "resolved" (new github feature) everything that is not marked as resolved (including outdated comments) is worth a further comment |
Updated for #2040 which is an unfortunate confusion of concerns but there's no way around it. |
gah! attack of the untested merge! This merge broke develop working on a fix right now. It looks like it didn't have the most recent recent develop merged into it :( |
Implements #2001.
Depends on #2120.
Replaces #2121.
Closes #1990.
docs/
)PENDING.md
with issue #Files changed
in the github PR explorerFor Admin Use: