[oracle] Modify vote penalty to not jail if validator abstains instead of misses#47
[oracle] Modify vote penalty to not jail if validator abstains instead of misses#47
Conversation
app/upgrades.go
Outdated
| return app.mm.RunMigrations(ctx, app.configurator, fromVM) | ||
| }) | ||
| app.UpgradeKeeper.SetUpgradeHandler(UpgradeOracleStaleIndicator, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||
| app.UpgradeKeeper.SetUpgradeHandler(UpgradeDexDataType, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { |
There was a problem hiding this comment.
we can safely remove this and IgniteCLIRemovalUpgradeHandler right (as long as we keep the N-1 upgrade handler) @philipsu522, if so let's remove them in this PR
| continue | ||
| } | ||
|
|
||
| if int(claim.WinCount+claim.AbstainCount) == totalTargets { |
There was a problem hiding this comment.
quick q, what's claim.WinCount here? any vote count or just correct vote count?
There was a problem hiding this comment.
WinCount is the count of votes that the validator made that are within the 1% range of the weighted median. So, if they win count is equal to total targets, that means the validator was in range on all of the targets, if they specifically abstained on some, we expect them to win the ones they didnt abstain to qualify as abstaining instead of miss
| // abstaining counts as out of range and will be eventually penalized | ||
| if vote.ExchangeRate.GTE(weightedMedian.Sub(rewardSpread)) && | ||
| // abstaining counts as out of range and will be eventually penalized but not jailed | ||
| if !vote.ExchangeRate.IsPositive() { |
There was a problem hiding this comment.
IsPositive() here doesn't include 0 right?
There was a problem hiding this comment.
no it doesn't, there is a specific sign corresponding to zero:
func (d Dec) IsZero() bool { return (d.i).Sign() == 0 } // is equal to zero
func (d Dec) IsNegative() bool { return (d.i).Sign() == -1 } // is negative
func (d Dec) IsPositive() bool { return (d.i).Sign() == 1 } // is positive
|
nit: can we add the command to test pre-vote and vote in this PR description |
|
prevote command example: (the vote has to be in the next vote window) |
still need to resolve issues with
simulation/decoderbut the rest of the change is ready for review.