Skip to content

[oracle] Modify vote penalty to not jail if validator abstains instead of misses#47

Merged
udpatil merged 9 commits intomasterfrom
oracle-abstain-nojail
Jun 20, 2022
Merged

[oracle] Modify vote penalty to not jail if validator abstains instead of misses#47
udpatil merged 9 commits intomasterfrom
oracle-abstain-nojail

Conversation

@udpatil
Copy link
Collaborator

@udpatil udpatil commented Jun 17, 2022

still need to resolve issues with simulation/decoder but the rest of the change is ready for review.

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick q, what's claim.WinCount here? any vote count or just correct vote count?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsPositive() here doesn't include 0 right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@LCyson
Copy link
Contributor

LCyson commented Jun 19, 2022

nit: can we add the command to test pre-vote and vote in this PR description

@udpatil
Copy link
Collaborator Author

udpatil commented Jun 19, 2022

prevote command example:
seid tx oracle aggregate-prevote $SALT 1uusdc,2uatom SEIVALOPER_ADDR --from $ACCOUNT_NAME --fees 2000usei

(the vote has to be in the next vote window)
vote command example:
seid tx oracle aggregate-vote $SALT 1uusdc,2uatom SEIVALOPER_ADDR --from $ACCOUNT_NAME --fees 2000usei

@udpatil udpatil merged commit 1f4ab2c into master Jun 20, 2022
@udpatil udpatil deleted the oracle-abstain-nojail branch June 20, 2022 04:52
masih pushed a commit that referenced this pull request Sep 26, 2025
masih pushed a commit that referenced this pull request Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants