Revert "Changes WIP" - we decided not to do this

This reverts commit 21be609f52.
This commit is contained in:
Christopher Goes 2018-08-20 15:01:18 +02:00
parent 21be609f52
commit 79e3c05367
2 changed files with 4 additions and 20 deletions

View File

@ -80,20 +80,6 @@ onValidatorUnbonded(address sdk.ValAddress)
return
```
#### Validator Power Changed
When a validator's power changes, we update the in-progress `SlashingPeriod` with the validator's current power:
```golang
onValidatorPowerChanged(address sdk.ValAddress, stakeBonded sdk.Rat)
slashingPeriod = getSlashingPeriod(address, CurrentHeight)
slashingPeriod.MaxStakeBonded = max(slashingPeriod.MaxStakeBonded, stakeBonded)
setSlashingPeriod(slashingPeriod)
return
```
#### Validator Slashed
When a validator is slashed, we look up the appropriate `SlashingPeriod` based on the validator
@ -104,11 +90,11 @@ address and the time of infraction, cap the fraction slashed as `max(SlashFracti
beforeValidatorSlashed(address sdk.ValAddress, fraction sdk.Rat, infractionHeight int64)
slashingPeriod = getSlashingPeriod(address, infractionHeight)
totalFractionToSlash = max(slashingPeriod.SlashedSoFar, fraction)
slashingPeriod.FractionSlashedSoFar = totalToSlash
totalToSlash = max(slashingPeriod.SlashedSoFar, fraction)
slashingPeriod.SlashedSoFar = totalToSlash
setSlashingPeriod(slashingPeriod)
remainderToSlash = slashingPeriod.FractionSlashedSoFar - totalToSlash
remainderToSlash = slashingPeriod.SlashedSoFar - totalToSlash
fraction = remainderToSlash
continue with slashing

View File

@ -75,8 +75,6 @@ type SlashingPeriod struct {
ValidatorAddr sdk.ValAddress // Tendermint address of the validator
StartHeight int64 // Block height at which slashing period begin
EndHeight int64 // Block height at which slashing period ended
MaxBondedStake sdk.Rat // Maximum bonded stake during period
StakeSlashedSoFar sdk.Rat // Amount of stake slashed so far
FractionSlashedSoFar sdk.Rat // Fraction slashed so far, cumulative
SlashedSoFar sdk.Rat // Fraction slashed so far, cumulative
}
```