diff --git a/CHANGELOG.md b/CHANGELOG.md index 0132dcdcd..b0b9d6f23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/proto/nibiru/oracle/v1/event.proto b/proto/nibiru/oracle/v1/event.proto index f9dda8853..82284e9b1 100644 --- a/proto/nibiru/oracle/v1/event.proto +++ b/proto/nibiru/oracle/v1/event.proto @@ -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; +} \ No newline at end of file diff --git a/x/oracle/keeper/update_exchange_rates.go b/x/oracle/keeper/update_exchange_rates.go index 99a1251b1..dff65f9dc 100644 --- a/x/oracle/keeper/update_exchange_rates.go +++ b/x/oracle/keeper/update_exchange_rates.go @@ -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 } diff --git a/x/oracle/types/event.pb.go b/x/oracle/types/event.pb.go index 085a6c8ef..fb48c177f 100644 --- a/x/oracle/types/event.pb.go +++ b/x/oracle/types/event.pb.go @@ -256,43 +256,141 @@ func (m *EventAggregatePrevote) GetFeeder() string { return "" } +type EventValidatorPerformance struct { + // Validator is the Bech32 address to which the vote will be credited. + Validator string `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` + // Tendermint consensus voting power + VotingPower int64 `protobuf:"varint,2,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` + // RewardWeight: Weight of rewards the validator should receive in units of + // consensus power. + RewardWeight int64 `protobuf:"varint,3,opt,name=reward_weight,json=rewardWeight,proto3" json:"reward_weight,omitempty"` + // Number of valid votes for which the validator will be rewarded + WinCount int64 `protobuf:"varint,4,opt,name=win_count,json=winCount,proto3" json:"win_count,omitempty"` + // Number of abstained votes for which there will be no reward or punishment + AbstainCount int64 `protobuf:"varint,5,opt,name=abstain_count,json=abstainCount,proto3" json:"abstain_count,omitempty"` + // Number of invalid/punishable votes + MissCount int64 `protobuf:"varint,6,opt,name=miss_count,json=missCount,proto3" json:"miss_count,omitempty"` +} + +func (m *EventValidatorPerformance) Reset() { *m = EventValidatorPerformance{} } +func (m *EventValidatorPerformance) String() string { return proto.CompactTextString(m) } +func (*EventValidatorPerformance) ProtoMessage() {} +func (*EventValidatorPerformance) Descriptor() ([]byte, []int) { + return fileDescriptor_94ec441b793fc0ea, []int{4} +} +func (m *EventValidatorPerformance) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventValidatorPerformance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventValidatorPerformance.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventValidatorPerformance) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventValidatorPerformance.Merge(m, src) +} +func (m *EventValidatorPerformance) XXX_Size() int { + return m.Size() +} +func (m *EventValidatorPerformance) XXX_DiscardUnknown() { + xxx_messageInfo_EventValidatorPerformance.DiscardUnknown(m) +} + +var xxx_messageInfo_EventValidatorPerformance proto.InternalMessageInfo + +func (m *EventValidatorPerformance) GetValidator() string { + if m != nil { + return m.Validator + } + return "" +} + +func (m *EventValidatorPerformance) GetVotingPower() int64 { + if m != nil { + return m.VotingPower + } + return 0 +} + +func (m *EventValidatorPerformance) GetRewardWeight() int64 { + if m != nil { + return m.RewardWeight + } + return 0 +} + +func (m *EventValidatorPerformance) GetWinCount() int64 { + if m != nil { + return m.WinCount + } + return 0 +} + +func (m *EventValidatorPerformance) GetAbstainCount() int64 { + if m != nil { + return m.AbstainCount + } + return 0 +} + +func (m *EventValidatorPerformance) GetMissCount() int64 { + if m != nil { + return m.MissCount + } + return 0 +} + func init() { proto.RegisterType((*EventPriceUpdate)(nil), "nibiru.oracle.v1.EventPriceUpdate") proto.RegisterType((*EventDelegateFeederConsent)(nil), "nibiru.oracle.v1.EventDelegateFeederConsent") proto.RegisterType((*EventAggregateVote)(nil), "nibiru.oracle.v1.EventAggregateVote") proto.RegisterType((*EventAggregatePrevote)(nil), "nibiru.oracle.v1.EventAggregatePrevote") + proto.RegisterType((*EventValidatorPerformance)(nil), "nibiru.oracle.v1.EventValidatorPerformance") } func init() { proto.RegisterFile("nibiru/oracle/v1/event.proto", fileDescriptor_94ec441b793fc0ea) } var fileDescriptor_94ec441b793fc0ea = []byte{ - // 407 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xcd, 0x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0xe7, 0x5c, 0x2a, 0xd6, 0xad, 0xd7, 0xd5, - 0x76, 0xc1, 0xc2, 0xf8, 0x66, 0xfd, 0xb0, 0x29, 0xcf, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x3b, - 0xea, 0x2b, 0x3c, 0xae, 0x02, 0x00, 0x00, + // 510 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xdd, 0x6e, 0xd3, 0x30, + 0x14, 0x6e, 0xe8, 0x56, 0x51, 0xb7, 0x48, 0x93, 0x05, 0xa8, 0x94, 0x2e, 0xdd, 0x3a, 0x09, 0xf5, + 0x02, 0x12, 0x0d, 0x9e, 0x80, 0xb6, 0xdb, 0xdd, 0x50, 0x15, 0xc1, 0x26, 0x71, 0x53, 0xb9, 0xc9, + 0x99, 0x6b, 0x91, 0xd8, 0x91, 0xed, 0x26, 0xe3, 0x29, 0xe0, 0x1d, 0xb8, 0xe3, 0x49, 0x76, 0xb9, + 0x4b, 0xc4, 0xc5, 0x40, 0xed, 0x8b, 0x20, 0x3b, 0xee, 0xf8, 0xd9, 0x05, 0xd2, 0xae, 0x72, 0xfc, + 0x7d, 0x9f, 0xbf, 0x7c, 0xc9, 0x39, 0x07, 0xf5, 0x38, 0x9b, 0x33, 0xb9, 0x0c, 0x85, 0x24, 0x71, + 0x0a, 0x61, 0x71, 0x18, 0x42, 0x01, 0x5c, 0x07, 0xb9, 0x14, 0x5a, 0xe0, 0x9d, 0x8a, 0x0d, 0x2a, + 0x36, 0x28, 0x0e, 0xbb, 0xbb, 0xb7, 0xf4, 0x8e, 0xb3, 0x17, 0xba, 0x0f, 0xa9, 0xa0, 0xc2, 0x96, + 0xa1, 0xa9, 0x1c, 0xda, 0xa3, 0x42, 0xd0, 0x14, 0x42, 0x92, 0xb3, 0x90, 0x70, 0x2e, 0x34, 0xd1, + 0x4c, 0x70, 0x55, 0xb1, 0x83, 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 0x3f, 0xfa, 0xf8, 0x16, + 0xa5, 0x22, 0x67, 0x37, 0x38, 0x41, 0x8f, 0xfe, 0x0e, 0x39, 0x95, 0x50, 0xdc, 0x39, 0xe7, 0x60, + 0xe5, 0xa1, 0x27, 0xd6, 0xef, 0x74, 0x23, 0x9d, 0x82, 0x3c, 0x17, 0x32, 0x23, 0x3c, 0xfe, 0x9f, + 0xe7, 0x3e, 0x6a, 0x17, 0x42, 0x33, 0x4e, 0x67, 0xb9, 0x28, 0x9d, 0x73, 0x3d, 0x6a, 0x55, 0xd8, + 0xd4, 0x40, 0xf8, 0x00, 0x3d, 0x90, 0x50, 0x12, 0x99, 0xcc, 0x4a, 0x60, 0x74, 0xa1, 0x5d, 0x2f, + 0xdb, 0x15, 0x78, 0x66, 0x31, 0xfc, 0x14, 0x35, 0x4b, 0xc6, 0x67, 0xb1, 0x58, 0x72, 0xdd, 0xd9, + 0xb2, 0x82, 0xfb, 0x25, 0xe3, 0x63, 0x73, 0x36, 0x0e, 0x64, 0xae, 0x34, 0xb9, 0x11, 0x6c, 0x57, + 0x0e, 0x0e, 0xac, 0x44, 0xbb, 0x08, 0x65, 0x4c, 0x29, 0xa7, 0x68, 0x58, 0x45, 0xd3, 0x20, 0x96, + 0x1e, 0x1d, 0x5f, 0xae, 0x7c, 0xef, 0x6a, 0xe5, 0x7b, 0x3f, 0x57, 0xbe, 0xf7, 0x79, 0xed, 0xd7, + 0xae, 0xd6, 0x7e, 0xed, 0xdb, 0xda, 0xaf, 0xbd, 0x7f, 0xfe, 0xc7, 0x64, 0xbe, 0xb1, 0x0d, 0x1a, + 0x2f, 0x08, 0xe3, 0xa1, 0xdb, 0xa1, 0x8b, 0xcd, 0x16, 0xd9, 0x19, 0x9d, 0x37, 0xec, 0x3a, 0xbc, + 0xfa, 0x15, 0x00, 0x00, 0xff, 0xff, 0x5f, 0xd7, 0x9a, 0x89, 0x93, 0x03, 0x00, 0x00, } func (m *EventPriceUpdate) Marshal() (dAtA []byte, err error) { @@ -465,6 +563,61 @@ func (m *EventAggregatePrevote) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventValidatorPerformance) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventValidatorPerformance) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventValidatorPerformance) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MissCount != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.MissCount)) + i-- + dAtA[i] = 0x30 + } + if m.AbstainCount != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.AbstainCount)) + i-- + dAtA[i] = 0x28 + } + if m.WinCount != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.WinCount)) + i-- + dAtA[i] = 0x20 + } + if m.RewardWeight != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.RewardWeight)) + i-- + dAtA[i] = 0x18 + } + if m.VotingPower != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.VotingPower)) + i-- + dAtA[i] = 0x10 + } + if len(m.Validator) > 0 { + i -= len(m.Validator) + copy(dAtA[i:], m.Validator) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Validator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { offset -= sovEvent(v) base := offset @@ -551,6 +704,34 @@ func (m *EventAggregatePrevote) Size() (n int) { return n } +func (m *EventValidatorPerformance) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Validator) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + if m.VotingPower != 0 { + n += 1 + sovEvent(uint64(m.VotingPower)) + } + if m.RewardWeight != 0 { + n += 1 + sovEvent(uint64(m.RewardWeight)) + } + if m.WinCount != 0 { + n += 1 + sovEvent(uint64(m.WinCount)) + } + if m.AbstainCount != 0 { + n += 1 + sovEvent(uint64(m.AbstainCount)) + } + if m.MissCount != 0 { + n += 1 + sovEvent(uint64(m.MissCount)) + } + return n +} + func sovEvent(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1068,6 +1249,183 @@ func (m *EventAggregatePrevote) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventValidatorPerformance) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventValidatorPerformance: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventValidatorPerformance: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Validator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingPower", wireType) + } + m.VotingPower = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VotingPower |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardWeight", wireType) + } + m.RewardWeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RewardWeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WinCount", wireType) + } + m.WinCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.WinCount |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AbstainCount", wireType) + } + m.AbstainCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AbstainCount |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MissCount", wireType) + } + m.MissCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MissCount |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvent(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0