Skip to content

Commit

Permalink
Set the slashingRate for prepDisqualification penalty to 100% on tran…
Browse files Browse the repository at this point in the history
…siting to RevIISS4R0

* Slash bonds only if the rate > 0 in DisqualifyPRep()
  • Loading branch information
goldworm committed Dec 11, 2023
1 parent a534e64 commit 5d6b0fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions icon/iiss/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,10 @@ func (es *ExtensionStateImpl) DisqualifyPRep(cc icmodule.CallContext, address mo
ps := es.State.GetPRepStatusByOwner(address, false)
// Record PenaltyImposed eventlog
EmitPenaltyImposedEvent(cc, ps, pt)
rate, _ := es.State.GetSlashingRate(cc.Revision().Value(), pt)
return es.slash(cc, address, rate)
if rate, _ := es.State.GetSlashingRate(cc.Revision().Value(), pt); rate > 0 {
return es.slash(cc, address, rate)
}
return nil
}

func (es *ExtensionStateImpl) PenalizeNonVoters(cc icmodule.CallContext, address module.Address) error {
Expand Down
3 changes: 1 addition & 2 deletions icon/revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@ func onRevIISS4R0(s *chainScore, rev, _ int) error {
}
}
}

return nil
return es.State.SetSlashingRate(rev, icmodule.PenaltyPRepDisqualification, icmodule.ToRate(100))
}

func onRevIISS4R1(s *chainScore, _, _ int) error {
Expand Down

0 comments on commit 5d6b0fe

Please sign in to comment.