Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/google.golang.org/prot…
Browse files Browse the repository at this point in the history
…obuf-1.32.0
  • Loading branch information
Unique-Divine authored Dec 29, 2023
2 parents 02bfd2a + 02d7e0b commit b64b7d9
Show file tree
Hide file tree
Showing 4 changed files with 420 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#1573](https://github.com/NibiruChain/nibiru/pull/1573) - feat(perp): Close markets and compute settlement price
* [#1705](https://github.com/NibiruChain/nibiru/pull/1705) - feat(perp): Add oracle pair to market object
* [#1718](https://github.com/NibiruChain/nibiru/pull/1718) - fix: fees does not require additional funds
* [#1755](https://github.com/NibiruChain/nibiru/pull/1755) - feat(oracle): Add more events on validator's performance

### Non-breaking/Compatible Improvements

Expand Down
22 changes: 22 additions & 0 deletions proto/nibiru/oracle/v1/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,25 @@ message EventAggregatePrevote {
// transaction messages on behalf of the voting validator.
string feeder = 2;
}


message EventValidatorPerformance{
// Validator is the Bech32 address to which the vote will be credited.
string validator = 1;

// Tendermint consensus voting power
int64 voting_power = 2;

// RewardWeight: Weight of rewards the validator should receive in units of
// consensus power.
int64 reward_weight = 3;

// Number of valid votes for which the validator will be rewarded
int64 win_count = 4;

// Number of abstained votes for which there will be no reward or punishment
int64 abstain_count = 5;

// Number of invalid/punishable votes
int64 miss_count = 6;
}
12 changes: 12 additions & 0 deletions x/oracle/keeper/update_exchange_rates.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ func (k Keeper) UpdateExchangeRates(ctx sdk.Context) types.ValidatorPerformances
params, _ := k.Params.Get(ctx)
k.clearVotesAndPrevotes(ctx, params.VotePeriod)
k.refreshWhitelist(ctx, params.Whitelist, whitelistedPairs)

for _, validatorPerformance := range validatorPerformances {
_ = ctx.EventManager().EmitTypedEvent(&types.EventValidatorPerformance{
Validator: validatorPerformance.ValAddress.String(),
VotingPower: validatorPerformance.Power,
RewardWeight: validatorPerformance.RewardWeight,
WinCount: validatorPerformance.WinCount,
AbstainCount: validatorPerformance.AbstainCount,
MissCount: validatorPerformance.MissCount,
})
}

return validatorPerformances
}

Expand Down
Loading

0 comments on commit b64b7d9

Please sign in to comment.