Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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] Slash locked gold #2317
[Slashing] Slash locked gold #2317
Changes from all commits
26e271b
6e412a3
a992063
16721f1
fbcd917
cb79559
5a99b80
7fa4baf
9f265c0
b57534a
cec7646
4d44719
f814e66
62b1a5d
8046174
6c984ec
65b6d2b
e050be2
9fa1aa7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Emit an event
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.
should I emit one event
AccountSlashed(account, penalty, reporter, reward)
or two events to split account/penalty and reporter/reward. Or is the reporter/reward not as importantThere 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.
one event is ok imo
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.
What should we do if there's not enough to slash anymore?
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 believe we would want to just slash all of the
account
's gold, I'm assuming this is handled on the caller side (Slasher
contract) by passing in forpenalty
max(normalSlashPenalty, totalGoldOwnedByAccount)
wherenormalSlashPenalty
is the default penalty andtotalGoldOwnedByAccount
is the total balance + voting balance for the account.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.
Now that the other PRs are in, we can update e.g. https://github.com/celo-org/celo-monorepo/blob/master/packages/protocol/contracts/governance/SlasherUtil.sol#L81 to do the
max(normalSlashPenalty, totalGoldOwnedByAccount)
.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.
Perhaps it's easier to handle in LockedGold, because the needed balances are stored there.
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.
Based on this I am changing
LockedGold.slash
to only slashmin(totalLockedGold, penalty)
. A problematic implication is that iftotalLockedGold
is somehow less than thereward
passed in to slash, the call will revert. However, without doing a bunch of wasteful calculations (adjustingreward
based on its original proportion or something similar)slash
doesn't have the right info to changereward
properly. Just something to keep in mindThere 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 think this is OK for now, but i would follow the discussion on this.
My concern is that Given the
min()
i will be considered "slashed" and thus can't be slashed again for the same thing, but i wouldn't be really paying the penalty that i'm due... i wonder if i can use that to shield me from penalties somehow.But to analyze this we need to see the bigger picture...