Skip to content

Commit

Permalink
Fix two typos, ensure nonnegative tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
cwgoes authored and ebuchman committed Jun 16, 2018
1 parent 902d066 commit 0a6d09e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/spec/slashing/end_block.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ where `evidence.Timestamp` is the timestamp in the block at height
`evidence.Height` and `block.Timestamp` is the current block timestamp.

If valid evidence is included in a block, the validator's stake is reduced by `SLASH_PROPORTION` of
what there stake was at the eqiuvocation occurred (rather than when it was found):
what their stake was when the equivocation occurred (rather than when the evidence was discovered):

```
curVal := validator
oldVal := loadValidator(evidence.Height, evidence.Address)
slashAmount := SLASH_PROPORTION * oldVal.Shares
curVal.Shares -= slashAmount
curVal.Shares = max(0, curVal.Shares - slashAmount)
```

This ensures that offending validators are punished the same amount whether they
Expand All @@ -50,7 +50,7 @@ for unbond in unbondings {
}
unbond.InitialTokens
burn := unbond.InitialTokens * SLASH_PROPORTION
unbond.Tokens -= burn
unbond.Tokens = max(0, unbond.Tokens - burn)
}
// only care if source gets slashed because we're already bonded to destination
Expand Down

0 comments on commit 0a6d09e

Please sign in to comment.