Revert "Changes WIP" - we decided not to do this
This reverts commit 21be609f52
.
This commit is contained in:
parent
21be609f52
commit
79e3c05367
|
@ -80,20 +80,6 @@ onValidatorUnbonded(address sdk.ValAddress)
|
||||||
return
|
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
|
#### Validator Slashed
|
||||||
|
|
||||||
When a validator is slashed, we look up the appropriate `SlashingPeriod` based on the validator
|
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)
|
beforeValidatorSlashed(address sdk.ValAddress, fraction sdk.Rat, infractionHeight int64)
|
||||||
|
|
||||||
slashingPeriod = getSlashingPeriod(address, infractionHeight)
|
slashingPeriod = getSlashingPeriod(address, infractionHeight)
|
||||||
totalFractionToSlash = max(slashingPeriod.SlashedSoFar, fraction)
|
totalToSlash = max(slashingPeriod.SlashedSoFar, fraction)
|
||||||
slashingPeriod.FractionSlashedSoFar = totalToSlash
|
slashingPeriod.SlashedSoFar = totalToSlash
|
||||||
setSlashingPeriod(slashingPeriod)
|
setSlashingPeriod(slashingPeriod)
|
||||||
|
|
||||||
remainderToSlash = slashingPeriod.FractionSlashedSoFar - totalToSlash
|
remainderToSlash = slashingPeriod.SlashedSoFar - totalToSlash
|
||||||
fraction = remainderToSlash
|
fraction = remainderToSlash
|
||||||
|
|
||||||
continue with slashing
|
continue with slashing
|
||||||
|
|
|
@ -75,8 +75,6 @@ type SlashingPeriod struct {
|
||||||
ValidatorAddr sdk.ValAddress // Tendermint address of the validator
|
ValidatorAddr sdk.ValAddress // Tendermint address of the validator
|
||||||
StartHeight int64 // Block height at which slashing period begin
|
StartHeight int64 // Block height at which slashing period begin
|
||||||
EndHeight int64 // Block height at which slashing period ended
|
EndHeight int64 // Block height at which slashing period ended
|
||||||
MaxBondedStake sdk.Rat // Maximum bonded stake during period
|
SlashedSoFar sdk.Rat // Fraction slashed so far, cumulative
|
||||||
StakeSlashedSoFar sdk.Rat // Amount of stake slashed so far
|
|
||||||
FractionSlashedSoFar sdk.Rat // Fraction slashed so far, cumulative
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue