From 92d3b6cc735b4f221c88288c2e349a907f9a36c0 Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Thu, 16 Jun 2022 18:26:12 -0700 Subject: [PATCH 1/9] [oracle] Modify vote penalty to not jail if validator abstains instead of misses --- proto/oracle/oracle.proto | 5 + proto/oracle/query.proto | 18 +- x/oracle/abci.go | 13 +- x/oracle/abci_test.go | 72 +++---- x/oracle/client/cli/query.go | 18 +- x/oracle/client/rest/query.go | 8 +- x/oracle/genesis.go | 6 +- x/oracle/keeper/keeper.go | 66 ++++--- x/oracle/keeper/keeper_test.go | 53 ++++-- x/oracle/keeper/querier.go | 9 +- x/oracle/keeper/slash.go | 31 ++- x/oracle/keeper/slash_test.go | 28 ++- x/oracle/tally.go | 11 +- x/oracle/types/ballot.go | 20 +- x/oracle/types/keys.go | 8 +- x/oracle/types/oracle.pb.go | 312 ++++++++++++++++++++++++------ x/oracle/types/querier.go | 10 +- x/oracle/types/query.pb.go | 336 ++++++++++++++++++--------------- x/oracle/types/query.pb.gw.go | 30 +-- x/oracle/types/vote.go | 3 + 20 files changed, 682 insertions(+), 375 deletions(-) diff --git a/proto/oracle/oracle.proto b/proto/oracle/oracle.proto index 98a97f676b..49aae112ba 100644 --- a/proto/oracle/oracle.proto +++ b/proto/oracle/oracle.proto @@ -129,3 +129,8 @@ message OracleTwap { ]; int64 lookbackSeconds = 3; } + +message VotePenaltyCounter { + uint64 miss_count = 1; + uint64 abstain_count = 2; +} \ No newline at end of file diff --git a/proto/oracle/query.proto b/proto/oracle/query.proto index ba79594469..46fe5811b9 100644 --- a/proto/oracle/query.proto +++ b/proto/oracle/query.proto @@ -44,8 +44,8 @@ service Query { } // MissCounter returns oracle miss counter of a validator - rpc MissCounter(QueryMissCounterRequest) returns (QueryMissCounterResponse) { - option (google.api.http).get = "/sei-protocol/sei-chain/oracle/validators/{validator_addr}/miss"; + rpc VotePenaltyCounter(QueryVotePenaltyCounterRequest) returns (QueryVotePenaltyCounterResponse) { + option (google.api.http).get = "/sei-protocol/sei-chain/oracle/validators/{validator_addr}/vote_penalty_counter"; } // AggregatePrevote returns an aggregate prevote of a validator @@ -165,8 +165,8 @@ message QueryFeederDelegationResponse { string feeder_addr = 1; } -// QueryMissCounterRequest is the request type for the Query/MissCounter RPC method. -message QueryMissCounterRequest { +// QueryVotePenaltyCounterRequest is the request type for the Query/MissCounter RPC method. +message QueryVotePenaltyCounterRequest { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -174,11 +174,10 @@ message QueryMissCounterRequest { string validator_addr = 1; } -// QueryMissCounterResponse is response type for the -// Query/MissCounter RPC method. -message QueryMissCounterResponse { - // miss_counter defines the oracle miss counter of a validator - uint64 miss_counter = 1; +// QueryVotePenaltyCounterResponse is response type for the +// Query/VotePenaltyCounter RPC method. +message QueryVotePenaltyCounterResponse { + VotePenaltyCounter vote_penalty_counter = 1; } // QueryAggregatePrevoteRequest is the request type for the Query/AggregatePrevote RPC method. @@ -195,7 +194,6 @@ message QueryAggregatePrevoteRequest { message QueryAggregatePrevoteResponse { // aggregate_prevote defines oracle aggregate prevote submitted by a validator in the current vote period AggregateExchangeRatePrevote aggregate_prevote = 1 [(gogoproto.nullable) = false]; - ; } // QueryAggregatePrevotesRequest is the request type for the Query/AggregatePrevotes RPC method. diff --git a/x/oracle/abci.go b/x/oracle/abci.go index 65ffa12211..d4f740909e 100755 --- a/x/oracle/abci.go +++ b/x/oracle/abci.go @@ -33,7 +33,7 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) { // Exclude not bonded validator if validator.IsBonded() { valAddr := validator.GetOperator() - validatorClaimMap[valAddr.String()] = types.NewClaim(validator.GetConsensusPower(powerReduction), 0, 0, valAddr) + validatorClaimMap[valAddr.String()] = types.NewClaim(validator.GetConsensusPower(powerReduction), 0, 0, 0, valAddr) i++ } } @@ -96,15 +96,20 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) { //--------------------------- // Do miss counting & slashing for _, claim := range validatorClaimMap { - // Skip abstain & valid voters // we require validator to have submitted in-range data // for all assets to not be counted as a miss if int(claim.WinCount) == totalTargets { continue } + if int(claim.WinCount+claim.AbstainCount) == totalTargets { + // if win count + abstain count == total targets then we increment abstain count instead of miss count + k.IncrementAbstainCount(ctx, claim.Recipient) + continue + } + // Increase miss counter - k.SetMissCounter(ctx, claim.Recipient, k.GetMissCounter(ctx, claim.Recipient)+1) + k.IncrementMissCount(ctx, claim.Recipient) } // Clear the ballot @@ -134,6 +139,6 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) { // Do slash who did miss voting over threshold and // reset miss counters of all validators at the last block of slash window if utils.IsPeriodLastBlock(ctx, params.SlashWindow) { - k.SlashAndResetMissCounters(ctx) + k.SlashAndResetCounters(ctx) } } diff --git a/x/oracle/abci_test.go b/x/oracle/abci_test.go index fc436f64c3..666ad46d81 100755 --- a/x/oracle/abci_test.go +++ b/x/oracle/abci_test.go @@ -261,7 +261,7 @@ func TestInvalidVotesSlashing(t *testing.T) { makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) oracle.EndBlocker(input.Ctx, input.OracleKeeper) - require.Equal(t, i+1, input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) + require.Equal(t, i+1, input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[1])) } validator := input.StakingKeeper.Validator(input.Ctx, keeper.ValAddrs[1]) @@ -299,7 +299,7 @@ func TestWhitelistSlashing(t *testing.T) { makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) oracle.EndBlocker(input.Ctx, input.OracleKeeper) - require.Equal(t, i+1, input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) + require.Equal(t, i+1, input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[0])) } validator := input.StakingKeeper.Validator(input.Ctx, keeper.ValAddrs[0]) @@ -333,9 +333,9 @@ func TestNotPassedBallotSlashing(t *testing.T) { makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) oracle.EndBlocker(input.Ctx, input.OracleKeeper) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[0])) + require.Equal(t, uint64(1), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[1])) + require.Equal(t, uint64(1), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[2])) } func TestNotPassedBallotSlashingInvalidVotes(t *testing.T) { @@ -360,13 +360,13 @@ func TestNotPassedBallotSlashingInvalidVotes(t *testing.T) { // 4-7 should be missed due to not voting // 3 should be missed due to out of bounds - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[3])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[4])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[5])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[6])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[0])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[1])) + require.Equal(t, uint64(1), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[2])) + require.Equal(t, uint64(1), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[3])) + require.Equal(t, uint64(1), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[4])) + require.Equal(t, uint64(1), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[5])) + require.Equal(t, uint64(1), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[6])) } func TestInvalidVoteOnAssetUnderThresholdMisses(t *testing.T) { @@ -398,13 +398,13 @@ func TestInvalidVoteOnAssetUnderThresholdMisses(t *testing.T) { endBlockerHeight := input.Ctx.BlockHeight() // 6 and 7 should be missed due to not voting on second asset - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[3])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[4])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[5])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[6])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[0])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[1])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[2])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[3])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[4])) + require.Equal(t, uint64(1), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[5])) + require.Equal(t, uint64(1), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[6])) input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) @@ -438,13 +438,13 @@ func TestInvalidVoteOnAssetUnderThresholdMisses(t *testing.T) { // 4-7 should be missed due to not voting on second asset // 3 should have missed due to out of bounds value even though it didnt meet voting threshold - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[3])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[4])) - require.Equal(t, uint64(2), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[5])) - require.Equal(t, uint64(2), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[6])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[0])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[1])) + require.Equal(t, uint64(1), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[2])) + require.Equal(t, uint64(1), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[3])) + require.Equal(t, uint64(1), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[4])) + require.Equal(t, uint64(2), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[5])) + require.Equal(t, uint64(2), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[6])) input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) @@ -488,7 +488,7 @@ func TestAbstainSlashing(t *testing.T) { makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) oracle.EndBlocker(input.Ctx, input.OracleKeeper) - require.Equal(t, uint64(i+1%limit), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) + require.Equal(t, uint64(i+1%limit), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[1])) } input.Ctx = input.Ctx.WithBlockHeight(votePeriodsPerWindow - 1) @@ -514,9 +514,9 @@ func TestVoteTargets(t *testing.T) { oracle.EndBlocker(input.Ctx, input.OracleKeeper) // no missing current - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[0])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[1])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[2])) // vote targets are {KRW, SDR} require.Equal(t, []string{utils.MicroAtomDenom}, input.OracleKeeper.GetVoteTargets(input.Ctx)) @@ -535,9 +535,9 @@ func TestVoteTargets(t *testing.T) { oracle.EndBlocker(input.Ctx, input.OracleKeeper) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[0])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[1])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[2])) // SDR must be deleted require.Equal(t, []string{utils.MicroAtomDenom}, input.OracleKeeper.GetVoteTargets(input.Ctx)) @@ -555,9 +555,9 @@ func TestVoteTargets(t *testing.T) { oracle.EndBlocker(input.Ctx, input.OracleKeeper) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[0])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[1])) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[2])) _, err = input.OracleKeeper.GetVoteTarget(input.Ctx, utils.MicroAtomDenom) require.NoError(t, err) diff --git a/x/oracle/client/cli/query.go b/x/oracle/client/cli/query.go index 5dc76b9431..008cb30adc 100755 --- a/x/oracle/client/cli/query.go +++ b/x/oracle/client/cli/query.go @@ -31,7 +31,7 @@ func GetQueryCmd() *cobra.Command { GetCmdQueryActives(), GetCmdQueryParams(), GetCmdQueryFeederDelegation(), - GetCmdQueryMissCounter(), + GetCmdQueryVotePenaltyCounter(), GetCmdQueryAggregatePrevote(), GetCmdQueryAggregateVote(), GetCmdQueryVoteTargets(), @@ -259,16 +259,16 @@ $ terrad query oracle feeder terravaloper... return cmd } -// GetCmdQueryMissCounter implements the query miss counter of the validator command -func GetCmdQueryMissCounter() *cobra.Command { +// GetCmdQueryVotePenaltyCounter implements the query vote penalty counter of the validator command +func GetCmdQueryVotePenaltyCounter() *cobra.Command { cmd := &cobra.Command{ - Use: "miss [validator]", + Use: "vote-penalty-counter [validator]", Args: cobra.ExactArgs(1), - Short: "Query the # of the miss count", + Short: "Query the # of the miss count and abstain count", Long: strings.TrimSpace(` -Query the # of vote periods missed in this oracle slash window. +Query the # of vote periods missed and abstained in this oracle slash window. -$ terrad query oracle miss terravaloper... +$ seid query oracle miss seivaloper... `), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -283,9 +283,9 @@ $ terrad query oracle miss terravaloper... return err } - res, err := queryClient.MissCounter( + res, err := queryClient.VotePenaltyCounter( context.Background(), - &types.QueryMissCounterRequest{ValidatorAddr: validator.String()}, + &types.QueryVotePenaltyCounterRequest{ValidatorAddr: validator.String()}, ) if err != nil { return err diff --git a/x/oracle/client/rest/query.go b/x/oracle/client/rest/query.go index a70caa6a97..c5004686e8 100755 --- a/x/oracle/client/rest/query.go +++ b/x/oracle/client/rest/query.go @@ -22,7 +22,7 @@ func registerQueryRoutes(cliCtx client.Context, rtr *mux.Router) { rtr.HandleFunc("/oracle/denoms/twaps", queryTwapsHandlerFunction(cliCtx)).Methods("GET") rtr.HandleFunc("/oracle/denoms/vote_targets", queryVoteTargetsHandlerFunction(cliCtx)).Methods("GET") rtr.HandleFunc(fmt.Sprintf("/oracle/voters/{%s}/feeder", RestVoter), queryFeederDelegationHandlerFunction(cliCtx)).Methods("GET") - rtr.HandleFunc(fmt.Sprintf("/oracle/voters/{%s}/miss", RestVoter), queryMissHandlerFunction(cliCtx)).Methods("GET") + rtr.HandleFunc(fmt.Sprintf("/oracle/voters/{%s}/vote_penalty_counter", RestVoter), queryVotePenaltyCounterHandlerFunction(cliCtx)).Methods("GET") rtr.HandleFunc(fmt.Sprintf("/oracle/voters/{%s}/aggregate_prevote", RestVoter), queryAggregatePrevoteHandlerFunction(cliCtx)).Methods("GET") rtr.HandleFunc(fmt.Sprintf("/oracle/voters/{%s}/aggregate_vote", RestVoter), queryAggregateVoteHandlerFunction(cliCtx)).Methods("GET") rtr.HandleFunc("/oracle/voters/aggregate_prevotes", queryAggregatePrevotesHandlerFunction(cliCtx)).Methods("GET") @@ -180,7 +180,7 @@ func queryFeederDelegationHandlerFunction(cliCtx client.Context) http.HandlerFun } } -func queryMissHandlerFunction(cliCtx client.Context) http.HandlerFunc { +func queryVotePenaltyCounterHandlerFunction(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) if !ok { @@ -192,12 +192,12 @@ func queryMissHandlerFunction(cliCtx client.Context) http.HandlerFunc { return } - params := types.NewQueryMissCounterParams(voterAddr) + params := types.NewQueryVotePenaltyCounterParams(voterAddr) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if rest.CheckBadRequestError(w, err) { return } - res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryMissCounter), bz) + res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryVotePenaltyCounter), bz) if rest.CheckInternalServerError(w, err) { return } diff --git a/x/oracle/genesis.go b/x/oracle/genesis.go index 3c8019e602..e4ed634db9 100755 --- a/x/oracle/genesis.go +++ b/x/oracle/genesis.go @@ -36,7 +36,7 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState panic(err) } - keeper.SetMissCounter(ctx, operator, mc.MissCounter) + keeper.SetVotePenaltyCounter(ctx, operator, mc.MissCounter, 0) } for _, ap := range data.AggregateExchangeRatePrevotes { @@ -87,10 +87,10 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { }) missCounters := []types.MissCounter{} - keeper.IterateMissCounters(ctx, func(operator sdk.ValAddress, missCounter uint64) (stop bool) { + keeper.IterateVotePenaltyCounters(ctx, func(operator sdk.ValAddress, votePenaltyCounter types.VotePenaltyCounter) (stop bool) { missCounters = append(missCounters, types.MissCounter{ ValidatorAddress: operator.String(), - MissCounter: missCounter, + MissCounter: votePenaltyCounter.MissCount, }) return false }) diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index e4b1935842..3186a56f19 100755 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -6,8 +6,6 @@ import ( "github.com/tendermint/tendermint/libs/log" - gogotypes "github.com/gogo/protobuf/types" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -167,47 +165,67 @@ func (k Keeper) IterateFeederDelegations(ctx sdk.Context, //----------------------------------- // Miss counter logic -// GetMissCounter retrieves the # of vote periods missed in this oracle slash window -func (k Keeper) GetMissCounter(ctx sdk.Context, operator sdk.ValAddress) uint64 { +// GetVotePenaltyCounter retrieves the # of vote periods missed and abstained in this oracle slash window +func (k Keeper) GetVotePenaltyCounter(ctx sdk.Context, operator sdk.ValAddress) types.VotePenaltyCounter { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.GetMissCounterKey(operator)) + bz := store.Get(types.GetVotePenaltyCounterKey(operator)) if bz == nil { - // By default the counter is zero - return 0 + // By default the empty counter has values of 0 + return types.VotePenaltyCounter{} } - var missCounter gogotypes.UInt64Value - k.cdc.MustUnmarshal(bz, &missCounter) - return missCounter.Value + var votePenaltyCounter types.VotePenaltyCounter + k.cdc.MustUnmarshal(bz, &votePenaltyCounter) + return votePenaltyCounter } -// SetMissCounter updates the # of vote periods missed in this oracle slash window -func (k Keeper) SetMissCounter(ctx sdk.Context, operator sdk.ValAddress, missCounter uint64) { +// SetVotePenaltyCounter updates the # of vote periods missed in this oracle slash window +func (k Keeper) SetVotePenaltyCounter(ctx sdk.Context, operator sdk.ValAddress, missCount uint64, abstainCount uint64) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&gogotypes.UInt64Value{Value: missCounter}) - store.Set(types.GetMissCounterKey(operator), bz) + bz := k.cdc.MustMarshal(&types.VotePenaltyCounter{MissCount: missCount, AbstainCount: abstainCount}) + store.Set(types.GetVotePenaltyCounterKey(operator), bz) +} + +func (k Keeper) IncrementMissCount(ctx sdk.Context, operator sdk.ValAddress) { + votePenaltyCounter := k.GetVotePenaltyCounter(ctx, operator) + k.SetVotePenaltyCounter(ctx, operator, votePenaltyCounter.MissCount+1, votePenaltyCounter.AbstainCount) +} + +func (k Keeper) IncrementAbstainCount(ctx sdk.Context, operator sdk.ValAddress) { + votePenaltyCounter := k.GetVotePenaltyCounter(ctx, operator) + k.SetVotePenaltyCounter(ctx, operator, votePenaltyCounter.MissCount, votePenaltyCounter.AbstainCount+1) +} + +func (k Keeper) GetMissCount(ctx sdk.Context, operator sdk.ValAddress) uint64 { + votePenaltyCounter := k.GetVotePenaltyCounter(ctx, operator) + return votePenaltyCounter.MissCount +} + +func (k Keeper) GetAbstainCount(ctx sdk.Context, operator sdk.ValAddress) uint64 { + votePenaltyCounter := k.GetVotePenaltyCounter(ctx, operator) + return votePenaltyCounter.AbstainCount } -// DeleteMissCounter removes miss counter for the validator -func (k Keeper) DeleteMissCounter(ctx sdk.Context, operator sdk.ValAddress) { +// DeleteVotePenaltyCounter removes miss counter for the validator +func (k Keeper) DeleteVotePenaltyCounter(ctx sdk.Context, operator sdk.ValAddress) { store := ctx.KVStore(k.storeKey) - store.Delete(types.GetMissCounterKey(operator)) + store.Delete(types.GetVotePenaltyCounterKey(operator)) } -// IterateMissCounters iterates over the miss counters and performs a callback function. -func (k Keeper) IterateMissCounters(ctx sdk.Context, - handler func(operator sdk.ValAddress, missCounter uint64) (stop bool)) { +// IterateVotePenaltyCounters iterates over the miss counters and performs a callback function. +func (k Keeper) IterateVotePenaltyCounters(ctx sdk.Context, + handler func(operator sdk.ValAddress, votePenaltyCounter types.VotePenaltyCounter) (stop bool)) { store := ctx.KVStore(k.storeKey) - iter := sdk.KVStorePrefixIterator(store, types.MissCounterKey) + iter := sdk.KVStorePrefixIterator(store, types.VotePenaltyCounterKey) defer iter.Close() for ; iter.Valid(); iter.Next() { operator := sdk.ValAddress(iter.Key()[2:]) - var missCounter gogotypes.UInt64Value - k.cdc.MustUnmarshal(iter.Value(), &missCounter) + var votePenaltyCounter types.VotePenaltyCounter + k.cdc.MustUnmarshal(iter.Value(), &votePenaltyCounter) - if handler(operator, missCounter.Value) { + if handler(operator, votePenaltyCounter) { break } } diff --git a/x/oracle/keeper/keeper_test.go b/x/oracle/keeper/keeper_test.go index edee08b8d5..ebe7fe0784 100755 --- a/x/oracle/keeper/keeper_test.go +++ b/x/oracle/keeper/keeper_test.go @@ -192,45 +192,62 @@ func TestIterateFeederDelegations(t *testing.T) { require.Equal(t, Addrs[1], delegates[0]) } -func TestMissCounter(t *testing.T) { +func TestVotePenaltyCounter(t *testing.T) { input := CreateTestInput(t) // Test default getters and setters - counter := input.OracleKeeper.GetMissCounter(input.Ctx, ValAddrs[0]) - require.Equal(t, uint64(0), counter) + counter := input.OracleKeeper.GetVotePenaltyCounter(input.Ctx, ValAddrs[0]) + require.Equal(t, uint64(0), counter.MissCount) + require.Equal(t, uint64(0), counter.AbstainCount) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, ValAddrs[0])) + require.Equal(t, uint64(0), input.OracleKeeper.GetAbstainCount(input.Ctx, ValAddrs[0])) missCounter := uint64(10) - input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], missCounter) - counter = input.OracleKeeper.GetMissCounter(input.Ctx, ValAddrs[0]) - require.Equal(t, missCounter, counter) - - input.OracleKeeper.DeleteMissCounter(input.Ctx, ValAddrs[0]) - counter = input.OracleKeeper.GetMissCounter(input.Ctx, ValAddrs[0]) - require.Equal(t, uint64(0), counter) + input.OracleKeeper.SetVotePenaltyCounter(input.Ctx, ValAddrs[0], missCounter, 0) + counter = input.OracleKeeper.GetVotePenaltyCounter(input.Ctx, ValAddrs[0]) + require.Equal(t, missCounter, counter.MissCount) + require.Equal(t, uint64(0), counter.AbstainCount) + require.Equal(t, missCounter, input.OracleKeeper.GetMissCount(input.Ctx, ValAddrs[0])) + require.Equal(t, uint64(0), input.OracleKeeper.GetAbstainCount(input.Ctx, ValAddrs[0])) + + input.OracleKeeper.SetVotePenaltyCounter(input.Ctx, ValAddrs[0], missCounter, missCounter) + counter = input.OracleKeeper.GetVotePenaltyCounter(input.Ctx, ValAddrs[0]) + require.Equal(t, missCounter, counter.MissCount) + require.Equal(t, missCounter, counter.AbstainCount) + require.Equal(t, missCounter, input.OracleKeeper.GetMissCount(input.Ctx, ValAddrs[0])) + require.Equal(t, missCounter, input.OracleKeeper.GetAbstainCount(input.Ctx, ValAddrs[0])) + + input.OracleKeeper.DeleteVotePenaltyCounter(input.Ctx, ValAddrs[0]) + counter = input.OracleKeeper.GetVotePenaltyCounter(input.Ctx, ValAddrs[0]) + require.Equal(t, uint64(0), counter.MissCount) + require.Equal(t, uint64(0), counter.AbstainCount) + require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, ValAddrs[0])) + require.Equal(t, uint64(0), input.OracleKeeper.GetAbstainCount(input.Ctx, ValAddrs[0])) } func TestIterateMissCounters(t *testing.T) { input := CreateTestInput(t) // Test default getters and setters - counter := input.OracleKeeper.GetMissCounter(input.Ctx, ValAddrs[0]) - require.Equal(t, uint64(0), counter) + counter := input.OracleKeeper.GetVotePenaltyCounter(input.Ctx, ValAddrs[0]) + require.Equal(t, uint64(0), counter.MissCount) + require.Equal(t, uint64(0), counter.MissCount) missCounter := uint64(10) - input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[1], missCounter) + input.OracleKeeper.SetVotePenaltyCounter(input.Ctx, ValAddrs[1], missCounter, missCounter) var operators []sdk.ValAddress - var missCounters []uint64 - input.OracleKeeper.IterateMissCounters(input.Ctx, func(delegator sdk.ValAddress, missCounter uint64) (stop bool) { + var votePenaltyCounters types.VotePenaltyCounters + input.OracleKeeper.IterateVotePenaltyCounters(input.Ctx, func(delegator sdk.ValAddress, votePenaltyCounter types.VotePenaltyCounter) (stop bool) { operators = append(operators, delegator) - missCounters = append(missCounters, missCounter) + votePenaltyCounters = append(votePenaltyCounters, votePenaltyCounter) return false }) require.Equal(t, 1, len(operators)) - require.Equal(t, 1, len(missCounters)) + require.Equal(t, 1, len(votePenaltyCounters)) require.Equal(t, ValAddrs[1], operators[0]) - require.Equal(t, missCounter, missCounters[0]) + require.Equal(t, missCounter, votePenaltyCounters[0].MissCount) } func TestAggregatePrevoteAddDelete(t *testing.T) { diff --git a/x/oracle/keeper/querier.go b/x/oracle/keeper/querier.go index c5cb3b48cd..aa44bccbc5 100755 --- a/x/oracle/keeper/querier.go +++ b/x/oracle/keeper/querier.go @@ -146,7 +146,7 @@ func (q querier) FeederDelegation(c context.Context, req *types.QueryFeederDeleg } // MissCounter queries oracle miss counter of a validator -func (q querier) MissCounter(c context.Context, req *types.QueryMissCounterRequest) (*types.QueryMissCounterResponse, error) { +func (q querier) VotePenaltyCounter(c context.Context, req *types.QueryVotePenaltyCounterRequest) (*types.QueryVotePenaltyCounterResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -157,8 +157,11 @@ func (q querier) MissCounter(c context.Context, req *types.QueryMissCounterReque } ctx := sdk.UnwrapSDKContext(c) - return &types.QueryMissCounterResponse{ - MissCounter: q.GetMissCounter(ctx, valAddr), + return &types.QueryVotePenaltyCounterResponse{ + VotePenaltyCounter: &types.VotePenaltyCounter{ + MissCount: q.GetMissCount(ctx, valAddr), + AbstainCount: q.GetMissCount(ctx, valAddr), + }, }, nil } diff --git a/x/oracle/keeper/slash.go b/x/oracle/keeper/slash.go index 7ff89712c3..318020a013 100755 --- a/x/oracle/keeper/slash.go +++ b/x/oracle/keeper/slash.go @@ -2,10 +2,11 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/sei-protocol/sei-chain/x/oracle/types" ) -// SlashAndResetMissCounters do slash any operator who over criteria & clear all operators miss counter to zero -func (k Keeper) SlashAndResetMissCounters(ctx sdk.Context) { +// SlashAndResetCounters do slash any operator who over criteria & clear all operators miss counter to zero +func (k Keeper) SlashAndResetCounters(ctx sdk.Context) { height := ctx.BlockHeight() distributionHeight := height - sdk.ValidatorUpdateDelay - 1 @@ -19,11 +20,16 @@ func (k Keeper) SlashAndResetMissCounters(ctx sdk.Context) { slashFraction := k.SlashFraction(ctx) powerReduction := k.StakingKeeper.PowerReduction(ctx) - k.IterateMissCounters(ctx, func(operator sdk.ValAddress, missCounter uint64) bool { + k.IterateVotePenaltyCounters(ctx, func(operator sdk.ValAddress, votePenaltyCounter types.VotePenaltyCounter) bool { // Calculate valid vote rate; (SlashWindow - MissCounter)/SlashWindow validVoteRate := sdk.NewDecFromInt( - sdk.NewInt(int64(votePeriodsPerWindow - missCounter))). + sdk.NewInt(int64(votePeriodsPerWindow - votePenaltyCounter.MissCount))). + QuoInt64(int64(votePeriodsPerWindow)) + + // Calculate valid vote rate; (SlashWindow - AbstainCounter)/SlashWindow + validNonAbstainVoteRate := sdk.NewDecFromInt( + sdk.NewInt(int64(votePeriodsPerWindow - votePenaltyCounter.AbstainCount))). QuoInt64(int64(votePeriodsPerWindow)) // Penalize the validator whose the valid vote rate is smaller than min threshold @@ -41,9 +47,24 @@ func (k Keeper) SlashAndResetMissCounters(ctx sdk.Context) { ) k.StakingKeeper.Jail(ctx, consAddr) } + } else if validNonAbstainVoteRate.LT(minValidPerWindow) { + // if we dont slash + jail for missing, we still need to evaluate for abstaining + // this way, we dont penalize for both misses and abstaining in one vote period + validator := k.StakingKeeper.Validator(ctx, operator) + if validator.IsBonded() && !validator.IsJailed() { + consAddr, err := validator.GetConsAddr() + if err != nil { + panic(err) + } + + k.StakingKeeper.Slash( + ctx, consAddr, + distributionHeight, validator.GetConsensusPower(powerReduction), slashFraction, + ) + } } - k.DeleteMissCounter(ctx, operator) + k.DeleteVotePenaltyCounter(ctx, operator) return false }) } diff --git a/x/oracle/keeper/slash_test.go b/x/oracle/keeper/slash_test.go index 6bc8f640d5..9b3460b951 100755 --- a/x/oracle/keeper/slash_test.go +++ b/x/oracle/keeper/slash_test.go @@ -41,20 +41,32 @@ func TestSlashAndResetMissCounters(t *testing.T) { slashFraction := input.OracleKeeper.SlashFraction(input.Ctx) minValidVotes := input.OracleKeeper.MinValidPerWindow(input.Ctx).MulInt64(votePeriodsPerWindow).TruncateInt64() // Case 1, no slash - input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], uint64(votePeriodsPerWindow-minValidVotes)) - input.OracleKeeper.SlashAndResetMissCounters(input.Ctx) + input.OracleKeeper.SetVotePenaltyCounter(input.Ctx, ValAddrs[0], uint64(votePeriodsPerWindow-minValidVotes), 0) + input.OracleKeeper.SlashAndResetCounters(input.Ctx) staking.EndBlocker(input.Ctx, input.StakingKeeper) validator, _ := input.StakingKeeper.GetValidator(input.Ctx, ValAddrs[0]) require.Equal(t, amt, validator.GetBondedTokens()) // Case 2, slash - input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], uint64(votePeriodsPerWindow-minValidVotes+1)) - input.OracleKeeper.SlashAndResetMissCounters(input.Ctx) + input.OracleKeeper.SetVotePenaltyCounter(input.Ctx, ValAddrs[0], uint64(votePeriodsPerWindow-minValidVotes+1), 0) + input.OracleKeeper.SlashAndResetCounters(input.Ctx) validator, _ = input.StakingKeeper.GetValidator(input.Ctx, ValAddrs[0]) require.Equal(t, amt.Sub(slashFraction.MulInt(amt).TruncateInt()), validator.GetBondedTokens()) require.True(t, validator.IsJailed()) + // Case 2.5, slash w/ no jail for abstaining + validator, _ = input.StakingKeeper.GetValidator(input.Ctx, ValAddrs[0]) + validator.Jailed = false + validator.Tokens = amt + input.StakingKeeper.SetValidator(input.Ctx, validator) + require.Equal(t, amt, validator.GetBondedTokens()) + input.OracleKeeper.SetVotePenaltyCounter(input.Ctx, ValAddrs[0], 0, uint64(votePeriodsPerWindow-minValidVotes+1)) + input.OracleKeeper.SlashAndResetCounters(input.Ctx) + validator, _ = input.StakingKeeper.GetValidator(input.Ctx, ValAddrs[0]) + require.Equal(t, amt.Sub(slashFraction.MulInt(amt).TruncateInt()), validator.GetBondedTokens()) + require.False(t, validator.IsJailed()) + // Case 3, slash unbonded validator validator, _ = input.StakingKeeper.GetValidator(input.Ctx, ValAddrs[0]) validator.Status = stakingtypes.Unbonded @@ -62,8 +74,8 @@ func TestSlashAndResetMissCounters(t *testing.T) { validator.Tokens = amt input.StakingKeeper.SetValidator(input.Ctx, validator) - input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], uint64(votePeriodsPerWindow-minValidVotes+1)) - input.OracleKeeper.SlashAndResetMissCounters(input.Ctx) + input.OracleKeeper.SetVotePenaltyCounter(input.Ctx, ValAddrs[0], uint64(votePeriodsPerWindow-minValidVotes+1), 0) + input.OracleKeeper.SlashAndResetCounters(input.Ctx) validator, _ = input.StakingKeeper.GetValidator(input.Ctx, ValAddrs[0]) require.Equal(t, amt, validator.Tokens) require.False(t, validator.IsJailed()) @@ -75,8 +87,8 @@ func TestSlashAndResetMissCounters(t *testing.T) { validator.Tokens = amt input.StakingKeeper.SetValidator(input.Ctx, validator) - input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], uint64(votePeriodsPerWindow-minValidVotes+1)) - input.OracleKeeper.SlashAndResetMissCounters(input.Ctx) + input.OracleKeeper.SetVotePenaltyCounter(input.Ctx, ValAddrs[0], uint64(votePeriodsPerWindow-minValidVotes+1), 0) + input.OracleKeeper.SlashAndResetCounters(input.Ctx) validator, _ = input.StakingKeeper.GetValidator(input.Ctx, ValAddrs[0]) require.Equal(t, amt, validator.Tokens) } diff --git a/x/oracle/tally.go b/x/oracle/tally.go index 187572e6d2..79cb240ebf 100755 --- a/x/oracle/tally.go +++ b/x/oracle/tally.go @@ -22,8 +22,15 @@ func Tally(ctx sdk.Context, pb types.ExchangeRateBallot, rewardBand sdk.Dec, val for _, vote := range pb { // Filter ballot winners - // 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() { + key := vote.Voter.String() + claim := validatorClaimMap[key] + claim.Weight += vote.Power + claim.AbstainCount++ + validatorClaimMap[key] = claim + // handle abstain + } else if vote.ExchangeRate.GTE(weightedMedian.Sub(rewardSpread)) && vote.ExchangeRate.LTE(weightedMedian.Add(rewardSpread)) { key := vote.Voter.String() diff --git a/x/oracle/types/ballot.go b/x/oracle/types/ballot.go index fc811cda82..142a6ba003 100755 --- a/x/oracle/types/ballot.go +++ b/x/oracle/types/ballot.go @@ -179,18 +179,20 @@ func (pb ExchangeRateBallot) Swap(i, j int) { // Claim is an interface that directs its rewards to an attached bank account. type Claim struct { - Power int64 - Weight int64 - WinCount int64 - Recipient sdk.ValAddress + Power int64 + Weight int64 + WinCount int64 + AbstainCount int64 + Recipient sdk.ValAddress } // NewClaim generates a Claim instance. -func NewClaim(power, weight, winCount int64, recipient sdk.ValAddress) Claim { +func NewClaim(power, weight, winCount int64, abstainCount int64, recipient sdk.ValAddress) Claim { return Claim{ - Power: power, - Weight: weight, - WinCount: winCount, - Recipient: recipient, + Power: power, + Weight: weight, + WinCount: winCount, + AbstainCount: abstainCount, + Recipient: recipient, } } diff --git a/x/oracle/types/keys.go b/x/oracle/types/keys.go index 9e3310e1d0..2abd4a04e9 100755 --- a/x/oracle/types/keys.go +++ b/x/oracle/types/keys.go @@ -39,7 +39,7 @@ var ( // Keys for store prefixes ExchangeRateKey = []byte{0x01} // prefix for each key to a rate FeederDelegationKey = []byte{0x02} // prefix for each key to a feeder delegation - MissCounterKey = []byte{0x03} // prefix for each key to a miss counter + VotePenaltyCounterKey = []byte{0x03} // prefix for each key to a miss counter AggregateExchangeRatePrevoteKey = []byte{0x04} // prefix for each key to a aggregate prevote AggregateExchangeRateVoteKey = []byte{0x05} // prefix for each key to a aggregate vote VoteTargetKey = []byte{0x06} // prefix for each key to a vote target @@ -56,9 +56,9 @@ func GetFeederDelegationKey(v sdk.ValAddress) []byte { return append(FeederDelegationKey, address.MustLengthPrefix(v)...) } -// GetMissCounterKey - stored by *Validator* address -func GetMissCounterKey(v sdk.ValAddress) []byte { - return append(MissCounterKey, address.MustLengthPrefix(v)...) +// GetVotePenaltyCounterKey - stored by *Validator* address +func GetVotePenaltyCounterKey(v sdk.ValAddress) []byte { + return append(VotePenaltyCounterKey, address.MustLengthPrefix(v)...) } // GetAggregateExchangeRatePrevoteKey - stored by *Validator* address diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index 6ebdd5d167..bd594af5fe 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -438,6 +438,58 @@ func (m *OracleTwap) GetLookbackSeconds() int64 { return 0 } +type VotePenaltyCounter struct { + MissCount uint64 `protobuf:"varint,1,opt,name=miss_count,json=missCount,proto3" json:"miss_count,omitempty"` + AbstainCount uint64 `protobuf:"varint,2,opt,name=abstain_count,json=abstainCount,proto3" json:"abstain_count,omitempty"` +} + +func (m *VotePenaltyCounter) Reset() { *m = VotePenaltyCounter{} } +func (m *VotePenaltyCounter) String() string { return proto.CompactTextString(m) } +func (*VotePenaltyCounter) ProtoMessage() {} +func (*VotePenaltyCounter) Descriptor() ([]byte, []int) { + return fileDescriptor_dc470b50b143d488, []int{9} +} +func (m *VotePenaltyCounter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VotePenaltyCounter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VotePenaltyCounter.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 *VotePenaltyCounter) XXX_Merge(src proto.Message) { + xxx_messageInfo_VotePenaltyCounter.Merge(m, src) +} +func (m *VotePenaltyCounter) XXX_Size() int { + return m.Size() +} +func (m *VotePenaltyCounter) XXX_DiscardUnknown() { + xxx_messageInfo_VotePenaltyCounter.DiscardUnknown(m) +} + +var xxx_messageInfo_VotePenaltyCounter proto.InternalMessageInfo + +func (m *VotePenaltyCounter) GetMissCount() uint64 { + if m != nil { + return m.MissCount + } + return 0 +} + +func (m *VotePenaltyCounter) GetAbstainCount() uint64 { + if m != nil { + return m.AbstainCount + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "seiprotocol.seichain.oracle.Params") proto.RegisterType((*Denom)(nil), "seiprotocol.seichain.oracle.Denom") @@ -448,72 +500,76 @@ func init() { proto.RegisterType((*PriceSnapshotItem)(nil), "seiprotocol.seichain.oracle.PriceSnapshotItem") proto.RegisterType((*PriceSnapshot)(nil), "seiprotocol.seichain.oracle.PriceSnapshot") proto.RegisterType((*OracleTwap)(nil), "seiprotocol.seichain.oracle.OracleTwap") + proto.RegisterType((*VotePenaltyCounter)(nil), "seiprotocol.seichain.oracle.VotePenaltyCounter") } func init() { proto.RegisterFile("oracle/oracle.proto", fileDescriptor_dc470b50b143d488) } var fileDescriptor_dc470b50b143d488 = []byte{ - // 953 bytes of a gzipped FileDescriptorProto + // 1002 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xbd, 0x8f, 0xe3, 0x44, - 0x14, 0x8f, 0x2f, 0xd9, 0x85, 0x4c, 0x76, 0xb9, 0xcd, 0x5c, 0x80, 0xdc, 0x07, 0xf1, 0x6a, 0x10, - 0xa7, 0x34, 0x97, 0x70, 0x47, 0x81, 0x88, 0x44, 0x81, 0xb5, 0x1c, 0x5a, 0x3e, 0x44, 0x98, 0x5b, - 0x0e, 0x89, 0xc6, 0x9a, 0xd8, 0x43, 0x3c, 0x8a, 0xed, 0xb1, 0x3c, 0x93, 0xcd, 0x5d, 0x43, 0x41, - 0x45, 0x89, 0xa8, 0x90, 0x28, 0xd8, 0x9a, 0x1e, 0xfe, 0x86, 0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d, 0xc4, 0xa3, 0xd8, 0x1e, 0xcb, 0x33, 0xd9, 0xdc, 0x36, 0x14, 0x54, + 0x94, 0x88, 0x0a, 0x89, 0x82, 0xad, 0xe9, 0xe1, 0x6f, 0xb8, 0xf2, 0x4a, 0x44, 0x61, 0xd0, 0x6e, + 0x43, 0x87, 0x94, 0x82, 0x82, 0x0a, 0xcd, 0x78, 0xb2, 0xeb, 0xc4, 0x61, 0x75, 0x11, 0xa2, 0xb2, + 0xdf, 0xd7, 0x6f, 0xde, 0x7b, 0xbf, 0xf7, 0x46, 0x03, 0xae, 0xf1, 0x94, 0x78, 0x21, 0xed, 0xe6, + 0x9f, 0x4e, 0x92, 0x72, 0xc9, 0xe1, 0x4d, 0x41, 0x99, 0xfe, 0xf3, 0x78, 0xd8, 0x11, 0x94, 0x79, + 0x01, 0x61, 0x71, 0x27, 0x77, 0xb9, 0xd1, 0x18, 0xf2, 0x21, 0xd7, 0xd6, 0xae, 0xfa, 0xcb, 0x43, + 0x6e, 0xb4, 0x3c, 0x2e, 0x22, 0x2e, 0xba, 0x03, 0x22, 0x68, 0xf7, 0xe8, 0xfe, 0x80, 0x4a, 0x72, + 0xbf, 0xeb, 0x71, 0x16, 0xe7, 0x76, 0xf4, 0xd5, 0x26, 0xd8, 0xec, 0x93, 0x94, 0x44, 0x02, 0xbe, + 0x0e, 0x6a, 0x47, 0x5c, 0x52, 0x37, 0xa1, 0x29, 0xe3, 0x7e, 0xd3, 0xda, 0xb5, 0xda, 0xeb, 0xce, + 0x4b, 0xd3, 0xcc, 0x86, 0xc7, 0x24, 0x0a, 0x7b, 0xa8, 0x60, 0x44, 0x18, 0x28, 0xa9, 0xaf, 0x05, + 0x18, 0x83, 0x17, 0xb4, 0x4d, 0x06, 0x29, 0x15, 0x01, 0x0f, 0xfd, 0xe6, 0x95, 0x5d, 0xab, 0x5d, + 0x75, 0xde, 0x7d, 0x92, 0xd9, 0x95, 0x5f, 0x33, 0xfb, 0xee, 0x90, 0xc9, 0x60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 0x85, 0xd2, 0x04, 0x65, 0xf7, 0x66, 0xfc, 0x68, 0x41, 0x13, + 0xd4, 0x7d, 0x6c, 0x5e, 0x72, 0x79, 0xa1, 0x83, 0x4d, 0xed, 0xf2, 0xda, 0x3f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x90, 0x3d, 0x64, 0xad, 0xe7, 0x09, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -984,6 +1040,39 @@ func (m *OracleTwap) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *VotePenaltyCounter) 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 *VotePenaltyCounter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VotePenaltyCounter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AbstainCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.AbstainCount)) + i-- + dAtA[i] = 0x10 + } + if m.MissCount != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.MissCount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintOracle(dAtA []byte, offset int, v uint64) int { offset -= sovOracle(v) base := offset @@ -1158,6 +1247,21 @@ func (m *OracleTwap) Size() (n int) { return n } +func (m *VotePenaltyCounter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MissCount != 0 { + n += 1 + sovOracle(uint64(m.MissCount)) + } + if m.AbstainCount != 0 { + n += 1 + sovOracle(uint64(m.AbstainCount)) + } + return n +} + func sovOracle(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2359,6 +2463,94 @@ func (m *OracleTwap) Unmarshal(dAtA []byte) error { } return nil } +func (m *VotePenaltyCounter) 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 ErrIntOverflowOracle + } + 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: VotePenaltyCounter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VotePenaltyCounter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MissCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + 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 ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AbstainCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipOracle(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/oracle/types/querier.go b/x/oracle/types/querier.go index d64ee50cfa..20506a7568 100755 --- a/x/oracle/types/querier.go +++ b/x/oracle/types/querier.go @@ -13,7 +13,7 @@ const ( QueryTwaps = "twaps" QueryActives = "actives" QueryFeederDelegation = "feederDelegation" - QueryMissCounter = "missCounter" + QueryVotePenaltyCounter = "votePenaltyCounter" QueryAggregatePrevote = "aggregatePrevote" QueryAggregatePrevotes = "aggregatePrevotes" QueryAggregateVote = "aggregateVote" @@ -80,13 +80,13 @@ func NewQueryFeederDelegationParams(validator sdk.ValAddress) QueryFeederDelegat // QueryMissCounterParams defines the params for the following queries: // - 'custom/oracle/missCounter' -type QueryMissCounterParams struct { +type QueryVotePenaltyCounterParams struct { Validator sdk.ValAddress } -// NewQueryMissCounterParams returns params for feeder delegation query -func NewQueryMissCounterParams(validator sdk.ValAddress) QueryMissCounterParams { - return QueryMissCounterParams{validator} +// NewQueryVotePenaltyCounterParams returns params for feeder delegation query +func NewQueryVotePenaltyCounterParams(validator sdk.ValAddress) QueryVotePenaltyCounterParams { + return QueryVotePenaltyCounterParams{validator} } // QueryAggregatePrevoteParams defines the params for the following queries: diff --git a/x/oracle/types/query.pb.go b/x/oracle/types/query.pb.go index 71b9a8d032..565f5d26a5 100644 --- a/x/oracle/types/query.pb.go +++ b/x/oracle/types/query.pb.go @@ -676,24 +676,24 @@ func (m *QueryFeederDelegationResponse) GetFeederAddr() string { return "" } -// QueryMissCounterRequest is the request type for the Query/MissCounter RPC method. -type QueryMissCounterRequest struct { +// QueryVotePenaltyCounterRequest is the request type for the Query/MissCounter RPC method. +type QueryVotePenaltyCounterRequest struct { // validator defines the validator address to query for. ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` } -func (m *QueryMissCounterRequest) Reset() { *m = QueryMissCounterRequest{} } -func (m *QueryMissCounterRequest) String() string { return proto.CompactTextString(m) } -func (*QueryMissCounterRequest) ProtoMessage() {} -func (*QueryMissCounterRequest) Descriptor() ([]byte, []int) { +func (m *QueryVotePenaltyCounterRequest) Reset() { *m = QueryVotePenaltyCounterRequest{} } +func (m *QueryVotePenaltyCounterRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVotePenaltyCounterRequest) ProtoMessage() {} +func (*QueryVotePenaltyCounterRequest) Descriptor() ([]byte, []int) { return fileDescriptor_562b782cb9ac197e, []int{15} } -func (m *QueryMissCounterRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryVotePenaltyCounterRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryMissCounterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryVotePenaltyCounterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryMissCounterRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryVotePenaltyCounterRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -703,37 +703,36 @@ func (m *QueryMissCounterRequest) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *QueryMissCounterRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryMissCounterRequest.Merge(m, src) +func (m *QueryVotePenaltyCounterRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVotePenaltyCounterRequest.Merge(m, src) } -func (m *QueryMissCounterRequest) XXX_Size() int { +func (m *QueryVotePenaltyCounterRequest) XXX_Size() int { return m.Size() } -func (m *QueryMissCounterRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryMissCounterRequest.DiscardUnknown(m) +func (m *QueryVotePenaltyCounterRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVotePenaltyCounterRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryMissCounterRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryVotePenaltyCounterRequest proto.InternalMessageInfo -// QueryMissCounterResponse is response type for the -// Query/MissCounter RPC method. -type QueryMissCounterResponse struct { - // miss_counter defines the oracle miss counter of a validator - MissCounter uint64 `protobuf:"varint,1,opt,name=miss_counter,json=missCounter,proto3" json:"miss_counter,omitempty"` +// QueryVotePenaltyCounterResponse is response type for the +// Query/VotePenaltyCounter RPC method. +type QueryVotePenaltyCounterResponse struct { + VotePenaltyCounter *VotePenaltyCounter `protobuf:"bytes,1,opt,name=vote_penalty_counter,json=votePenaltyCounter,proto3" json:"vote_penalty_counter,omitempty"` } -func (m *QueryMissCounterResponse) Reset() { *m = QueryMissCounterResponse{} } -func (m *QueryMissCounterResponse) String() string { return proto.CompactTextString(m) } -func (*QueryMissCounterResponse) ProtoMessage() {} -func (*QueryMissCounterResponse) Descriptor() ([]byte, []int) { +func (m *QueryVotePenaltyCounterResponse) Reset() { *m = QueryVotePenaltyCounterResponse{} } +func (m *QueryVotePenaltyCounterResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVotePenaltyCounterResponse) ProtoMessage() {} +func (*QueryVotePenaltyCounterResponse) Descriptor() ([]byte, []int) { return fileDescriptor_562b782cb9ac197e, []int{16} } -func (m *QueryMissCounterResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryVotePenaltyCounterResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryMissCounterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryVotePenaltyCounterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryMissCounterResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryVotePenaltyCounterResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -743,23 +742,23 @@ func (m *QueryMissCounterResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *QueryMissCounterResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryMissCounterResponse.Merge(m, src) +func (m *QueryVotePenaltyCounterResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVotePenaltyCounterResponse.Merge(m, src) } -func (m *QueryMissCounterResponse) XXX_Size() int { +func (m *QueryVotePenaltyCounterResponse) XXX_Size() int { return m.Size() } -func (m *QueryMissCounterResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryMissCounterResponse.DiscardUnknown(m) +func (m *QueryVotePenaltyCounterResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVotePenaltyCounterResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryMissCounterResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryVotePenaltyCounterResponse proto.InternalMessageInfo -func (m *QueryMissCounterResponse) GetMissCounter() uint64 { +func (m *QueryVotePenaltyCounterResponse) GetVotePenaltyCounter() *VotePenaltyCounter { if m != nil { - return m.MissCounter + return m.VotePenaltyCounter } - return 0 + return nil } // QueryAggregatePrevoteRequest is the request type for the Query/AggregatePrevote RPC method. @@ -1201,8 +1200,8 @@ func init() { proto.RegisterType((*QueryTwapsResponse)(nil), "seiprotocol.seichain.oracle.QueryTwapsResponse") proto.RegisterType((*QueryFeederDelegationRequest)(nil), "seiprotocol.seichain.oracle.QueryFeederDelegationRequest") proto.RegisterType((*QueryFeederDelegationResponse)(nil), "seiprotocol.seichain.oracle.QueryFeederDelegationResponse") - proto.RegisterType((*QueryMissCounterRequest)(nil), "seiprotocol.seichain.oracle.QueryMissCounterRequest") - proto.RegisterType((*QueryMissCounterResponse)(nil), "seiprotocol.seichain.oracle.QueryMissCounterResponse") + proto.RegisterType((*QueryVotePenaltyCounterRequest)(nil), "seiprotocol.seichain.oracle.QueryVotePenaltyCounterRequest") + proto.RegisterType((*QueryVotePenaltyCounterResponse)(nil), "seiprotocol.seichain.oracle.QueryVotePenaltyCounterResponse") proto.RegisterType((*QueryAggregatePrevoteRequest)(nil), "seiprotocol.seichain.oracle.QueryAggregatePrevoteRequest") proto.RegisterType((*QueryAggregatePrevoteResponse)(nil), "seiprotocol.seichain.oracle.QueryAggregatePrevoteResponse") proto.RegisterType((*QueryAggregatePrevotesRequest)(nil), "seiprotocol.seichain.oracle.QueryAggregatePrevotesRequest") @@ -1218,87 +1217,87 @@ func init() { func init() { proto.RegisterFile("oracle/query.proto", fileDescriptor_562b782cb9ac197e) } var fileDescriptor_562b782cb9ac197e = []byte{ - // 1268 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0xfd, 0x91, 0xd2, 0xe7, 0xc4, 0x49, 0x26, 0x06, 0x52, 0x27, 0xd8, 0xe9, 0x42, - 0xd5, 0x52, 0x11, 0x6f, 0x08, 0x49, 0x68, 0x92, 0x26, 0xe0, 0x24, 0xfc, 0x68, 0x29, 0x34, 0x75, - 0xa3, 0x08, 0x71, 0x59, 0x4d, 0xec, 0xc1, 0x59, 0xc5, 0xf1, 0xb8, 0x3b, 0x9b, 0xd0, 0xa8, 0xea, - 0x01, 0xd4, 0x03, 0x17, 0xa4, 0x4a, 0xdc, 0x50, 0x0f, 0xbd, 0xc0, 0x81, 0x3f, 0x80, 0x23, 0x07, - 0x10, 0xa8, 0xc7, 0x8a, 0x72, 0x40, 0x42, 0xa2, 0x28, 0xe1, 0xc0, 0xff, 0xc0, 0x05, 0xed, 0xec, - 0x5b, 0x7b, 0x37, 0xb6, 0xd7, 0x6b, 0xa7, 0x27, 0x7b, 0xdf, 0xcc, 0x7b, 0xf3, 0xf9, 0xce, 0xcf, - 0x2f, 0x50, 0x61, 0xb1, 0x42, 0x99, 0xeb, 0xb7, 0x76, 0xb8, 0xb5, 0x97, 0xad, 0x5a, 0xc2, 0x16, - 0x74, 0x44, 0x72, 0x53, 0xfd, 0x2b, 0x88, 0x72, 0x56, 0x72, 0xb3, 0xb0, 0xc9, 0xcc, 0x4a, 0xd6, - 0xed, 0x98, 0x4a, 0x96, 0x44, 0x49, 0xa8, 0x56, 0xdd, 0xf9, 0xe7, 0xa6, 0xa4, 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7b, 0xaf, 0xca, - 0xe5, 0x46, 0x8f, 0xea, 0xf2, 0xc6, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd5, 0x3a, 0xae, 0x5b, - 0xbe, 0x13, 0x00, 0x00, + // 1276 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xb4, 0xb4, 0xa5, 0xcf, 0x8d, 0x93, 0x4c, 0x0c, 0xa4, 0x9b, 0x60, 0xa7, 0x0b, 0x55, + 0x0b, 0x28, 0xde, 0x90, 0x26, 0xa1, 0xf9, 0x29, 0x9c, 0x04, 0x44, 0xa1, 0x22, 0x89, 0x1b, 0x05, + 0xc4, 0x65, 0x35, 0xb1, 0x07, 0x67, 0x15, 0x67, 0x77, 0xbb, 0xb3, 0x09, 0x8d, 0xaa, 0x1e, 0x40, + 0x39, 0x70, 0x41, 0xaa, 0xc4, 0x0d, 0x81, 0x54, 0x0e, 0x70, 0xe0, 0x0f, 0xe0, 0xc8, 0x01, 0x09, + 0xd4, 0x63, 0x45, 0x39, 0x20, 0x21, 0x51, 0x94, 0x70, 0xe8, 0x9f, 0x81, 0x3c, 0xfb, 0xd6, 0xde, + 0x8d, 0xd7, 0xf6, 0xda, 0xe9, 0xc9, 0x9e, 0xf7, 0xe6, 0x7d, 0xf3, 0x7d, 0xf3, 0x66, 0x67, 0x3e, + 0xa0, 0x96, 0xc3, 0x8a, 0x15, 0xae, 0xdd, 0xde, 0xe5, 0xce, 0x7e, 0xce, 0x76, 0x2c, 0xd7, 0xa2, + 0x43, 0x82, 0x1b, 0xf2, 0x5f, 0xd1, 0xaa, 0xe4, 0x04, 0x37, 0x8a, 0x5b, 0xcc, 0x30, 0x73, 0xde, + 0x44, 0x25, 0x5d, 0xb6, 0xca, 0x96, 0xcc, 0x6a, 0xd5, 0x7f, 0x5e, 0x89, 0x32, 0x5c, 0xb6, 0xac, + 0x72, 0x85, 0x6b, 0xcc, 0x36, 0x34, 0x66, 0x9a, 0x96, 0xcb, 0x5c, 0xc3, 0x32, 0x05, 0x66, 0x07, + 0x70, 0x11, 0xef, 0xc7, 0x0b, 0xaa, 0x33, 0x30, 0xb8, 0x56, 0x5d, 0xf4, 0x9d, 0x3b, 0xc5, 0x2d, + 0x66, 0x96, 0x79, 0x81, 0xb9, 0xbc, 0xc0, 0x6f, 0xef, 0x72, 0xe1, 0xd2, 0x34, 0x9c, 0x29, 0x71, + 0xd3, 0xda, 0x19, 0x24, 0x23, 0xe4, 0xea, 0xf9, 0x82, 0x37, 0x98, 0x79, 0xfe, 0xcb, 0x07, 0xd9, + 0xc4, 0xd3, 0x07, 0xd9, 0x84, 0x7a, 0x40, 0xe0, 0x62, 0x44, 0xb1, 0xb0, 0x2d, 0x53, 0x70, 0x5a, + 0x86, 0xb4, 0xb7, 0x92, 0xce, 0x31, 0xad, 0x3b, 0xcc, 0xe5, 0x12, 0x2c, 0x39, 0xae, 0xe5, 0x5a, + 0xc8, 0xcb, 0xad, 0xc8, 0x9f, 0x20, 0xec, 0xe2, 0x73, 0x0f, 0xff, 0xc9, 0x26, 0x0a, 0xb8, 0x51, + 0xc1, 0x8c, 0x3a, 0x14, 0xc1, 0x42, 0xa0, 0x06, 0xf5, 0x5b, 0x02, 0x43, 0xcb, 0x55, 0xde, 0x8d, + 0x90, 0xab, 0xcc, 0x70, 0xa2, 0x35, 0x36, 0xe5, 0x7e, 0xea, 0x59, 0x73, 0xff, 0x8d, 0x80, 0x12, + 0x45, 0x1e, 0xf7, 0xf0, 0x47, 0x02, 0x23, 0x92, 0x91, 0x1e, 0x45, 0x47, 0xb7, 0x99, 0xe1, 0x88, + 0x41, 0x32, 0x72, 0xfa, 0x6a, 0x72, 0xfc, 0x7a, 0x4b, 0x52, 0x2d, 0xb6, 0x60, 0xf1, 0xd5, 0x2a, + 0xbb, 0x9f, 0x9e, 0x64, 0x87, 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, 0xa0, 0xee, 0xf8, 0x60, 0xee, 0xbe, 0xcd, 0xc5, 0xe6, 0x59, 0x39, 0xe5, 0xda, 0xff, 0x01, + 0x00, 0x00, 0xff, 0xff, 0xc5, 0x4d, 0x5e, 0xdb, 0x33, 0x14, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1327,7 +1326,7 @@ type QueryClient interface { // FeederDelegation returns feeder delegation of a validator FeederDelegation(ctx context.Context, in *QueryFeederDelegationRequest, opts ...grpc.CallOption) (*QueryFeederDelegationResponse, error) // MissCounter returns oracle miss counter of a validator - MissCounter(ctx context.Context, in *QueryMissCounterRequest, opts ...grpc.CallOption) (*QueryMissCounterResponse, error) + VotePenaltyCounter(ctx context.Context, in *QueryVotePenaltyCounterRequest, opts ...grpc.CallOption) (*QueryVotePenaltyCounterResponse, error) // AggregatePrevote returns an aggregate prevote of a validator AggregatePrevote(ctx context.Context, in *QueryAggregatePrevoteRequest, opts ...grpc.CallOption) (*QueryAggregatePrevoteResponse, error) // AggregatePrevotes returns aggregate prevotes of all validators @@ -1411,9 +1410,9 @@ func (c *queryClient) FeederDelegation(ctx context.Context, in *QueryFeederDeleg return out, nil } -func (c *queryClient) MissCounter(ctx context.Context, in *QueryMissCounterRequest, opts ...grpc.CallOption) (*QueryMissCounterResponse, error) { - out := new(QueryMissCounterResponse) - err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/MissCounter", in, out, opts...) +func (c *queryClient) VotePenaltyCounter(ctx context.Context, in *QueryVotePenaltyCounterRequest, opts ...grpc.CallOption) (*QueryVotePenaltyCounterResponse, error) { + out := new(QueryVotePenaltyCounterResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/VotePenaltyCounter", in, out, opts...) if err != nil { return nil, err } @@ -1481,7 +1480,7 @@ type QueryServer interface { // FeederDelegation returns feeder delegation of a validator FeederDelegation(context.Context, *QueryFeederDelegationRequest) (*QueryFeederDelegationResponse, error) // MissCounter returns oracle miss counter of a validator - MissCounter(context.Context, *QueryMissCounterRequest) (*QueryMissCounterResponse, error) + VotePenaltyCounter(context.Context, *QueryVotePenaltyCounterRequest) (*QueryVotePenaltyCounterResponse, error) // AggregatePrevote returns an aggregate prevote of a validator AggregatePrevote(context.Context, *QueryAggregatePrevoteRequest) (*QueryAggregatePrevoteResponse, error) // AggregatePrevotes returns aggregate prevotes of all validators @@ -1519,8 +1518,8 @@ func (*UnimplementedQueryServer) Twaps(ctx context.Context, req *QueryTwapsReque func (*UnimplementedQueryServer) FeederDelegation(ctx context.Context, req *QueryFeederDelegationRequest) (*QueryFeederDelegationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FeederDelegation not implemented") } -func (*UnimplementedQueryServer) MissCounter(ctx context.Context, req *QueryMissCounterRequest) (*QueryMissCounterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MissCounter not implemented") +func (*UnimplementedQueryServer) VotePenaltyCounter(ctx context.Context, req *QueryVotePenaltyCounterRequest) (*QueryVotePenaltyCounterResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VotePenaltyCounter not implemented") } func (*UnimplementedQueryServer) AggregatePrevote(ctx context.Context, req *QueryAggregatePrevoteRequest) (*QueryAggregatePrevoteResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AggregatePrevote not implemented") @@ -1668,20 +1667,20 @@ func _Query_FeederDelegation_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } -func _Query_MissCounter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryMissCounterRequest) +func _Query_VotePenaltyCounter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVotePenaltyCounterRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).MissCounter(ctx, in) + return srv.(QueryServer).VotePenaltyCounter(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/seiprotocol.seichain.oracle.Query/MissCounter", + FullMethod: "/seiprotocol.seichain.oracle.Query/VotePenaltyCounter", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).MissCounter(ctx, req.(*QueryMissCounterRequest)) + return srv.(QueryServer).VotePenaltyCounter(ctx, req.(*QueryVotePenaltyCounterRequest)) } return interceptor(ctx, in, info, handler) } @@ -1809,8 +1808,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_FeederDelegation_Handler, }, { - MethodName: "MissCounter", - Handler: _Query_MissCounter_Handler, + MethodName: "VotePenaltyCounter", + Handler: _Query_VotePenaltyCounter_Handler, }, { MethodName: "AggregatePrevote", @@ -2295,7 +2294,7 @@ func (m *QueryFeederDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryMissCounterRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryVotePenaltyCounterRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2305,12 +2304,12 @@ func (m *QueryMissCounterRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryMissCounterRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryVotePenaltyCounterRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryMissCounterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryVotePenaltyCounterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2325,7 +2324,7 @@ func (m *QueryMissCounterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryMissCounterResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryVotePenaltyCounterResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2335,20 +2334,27 @@ func (m *QueryMissCounterResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryMissCounterResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryVotePenaltyCounterResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryMissCounterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryVotePenaltyCounterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.MissCounter != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.MissCounter)) + if m.VotePenaltyCounter != nil { + { + size, err := m.VotePenaltyCounter.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -2854,7 +2860,7 @@ func (m *QueryFeederDelegationResponse) Size() (n int) { return n } -func (m *QueryMissCounterRequest) Size() (n int) { +func (m *QueryVotePenaltyCounterRequest) Size() (n int) { if m == nil { return 0 } @@ -2867,14 +2873,15 @@ func (m *QueryMissCounterRequest) Size() (n int) { return n } -func (m *QueryMissCounterResponse) Size() (n int) { +func (m *QueryVotePenaltyCounterResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MissCounter != 0 { - n += 1 + sovQuery(uint64(m.MissCounter)) + if m.VotePenaltyCounter != nil { + l = m.VotePenaltyCounter.Size() + n += 1 + l + sovQuery(uint64(l)) } return n } @@ -4130,7 +4137,7 @@ func (m *QueryFeederDelegationResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryMissCounterRequest) Unmarshal(dAtA []byte) error { +func (m *QueryVotePenaltyCounterRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4153,10 +4160,10 @@ func (m *QueryMissCounterRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryMissCounterRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryVotePenaltyCounterRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryMissCounterRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryVotePenaltyCounterRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4212,7 +4219,7 @@ func (m *QueryMissCounterRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryMissCounterResponse) Unmarshal(dAtA []byte) error { +func (m *QueryVotePenaltyCounterResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4235,17 +4242,17 @@ func (m *QueryMissCounterResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryMissCounterResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryVotePenaltyCounterResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryMissCounterResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryVotePenaltyCounterResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MissCounter", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotePenaltyCounter", wireType) } - m.MissCounter = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4255,11 +4262,28 @@ func (m *QueryMissCounterResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MissCounter |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotePenaltyCounter == nil { + m.VotePenaltyCounter = &VotePenaltyCounter{} + } + if err := m.VotePenaltyCounter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/oracle/types/query.pb.gw.go b/x/oracle/types/query.pb.gw.go index e5736cd92d..c286305ed4 100644 --- a/x/oracle/types/query.pb.gw.go +++ b/x/oracle/types/query.pb.gw.go @@ -249,8 +249,8 @@ func local_request_Query_FeederDelegation_0(ctx context.Context, marshaler runti } -func request_Query_MissCounter_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryMissCounterRequest +func request_Query_VotePenaltyCounter_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVotePenaltyCounterRequest var metadata runtime.ServerMetadata var ( @@ -271,13 +271,13 @@ func request_Query_MissCounter_0(ctx context.Context, marshaler runtime.Marshale return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) } - msg, err := client.MissCounter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.VotePenaltyCounter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_MissCounter_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryMissCounterRequest +func local_request_Query_VotePenaltyCounter_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVotePenaltyCounterRequest var metadata runtime.ServerMetadata var ( @@ -298,7 +298,7 @@ func local_request_Query_MissCounter_0(ctx context.Context, marshaler runtime.Ma return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) } - msg, err := server.MissCounter(ctx, &protoReq) + msg, err := server.VotePenaltyCounter(ctx, &protoReq) return msg, metadata, err } @@ -632,7 +632,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_MissCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_VotePenaltyCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -643,7 +643,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_MissCounter_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_VotePenaltyCounter_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -651,7 +651,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_MissCounter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_VotePenaltyCounter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -951,7 +951,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_MissCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_VotePenaltyCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -960,14 +960,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_MissCounter_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_VotePenaltyCounter_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_MissCounter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_VotePenaltyCounter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1085,11 +1085,11 @@ var ( pattern_Query_PriceSnapshotHistory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"sei-protocol", "sei-chain", "oracle", "denoms", "price_snapshot_history"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_Twaps_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"sei-protocol", "sei-chain", "oracle", "denoms", "twap"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_Twaps_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"sei-protocol", "sei-chain", "oracle", "denoms", "twaps"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_FeederDelegation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"sei-protocol", "sei-chain", "oracle", "validators", "validator_addr", "feeder"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_MissCounter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"sei-protocol", "sei-chain", "oracle", "validators", "validator_addr", "miss"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_VotePenaltyCounter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"sei-protocol", "sei-chain", "oracle", "validators", "validator_addr", "vote_penalty_counter"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_AggregatePrevote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"sei-protocol", "sei-chain", "oracle", "validators", "validator_addr", "aggregate_prevote"}, "", runtime.AssumeColonVerbOpt(true))) @@ -1117,7 +1117,7 @@ var ( forward_Query_FeederDelegation_0 = runtime.ForwardResponseMessage - forward_Query_MissCounter_0 = runtime.ForwardResponseMessage + forward_Query_VotePenaltyCounter_0 = runtime.ForwardResponseMessage forward_Query_AggregatePrevote_0 = runtime.ForwardResponseMessage diff --git a/x/oracle/types/vote.go b/x/oracle/types/vote.go index 1c4eab7c5b..176aa7b16c 100755 --- a/x/oracle/types/vote.go +++ b/x/oracle/types/vote.go @@ -116,3 +116,6 @@ func NewDenomOracleExchangeRatePair(denom string, exchangeRate sdk.Dec, lastUpda }, } } + +// VotePenaltyCounter - array of VotePenaltyCounter +type VotePenaltyCounters []VotePenaltyCounter From 99789bb6e040c9e2ba87b4cc6b926b81be73d69f Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Thu, 16 Jun 2022 19:13:44 -0700 Subject: [PATCH 2/9] [oracle] Add genesis import export handling for new penalty counter format --- proto/oracle/genesis.proto | 6 +- x/oracle/genesis.go | 16 +-- x/oracle/types/genesis.go | 6 +- x/oracle/types/genesis.pb.go | 186 ++++++++++++++++++++--------------- 4 files changed, 120 insertions(+), 94 deletions(-) diff --git a/proto/oracle/genesis.proto b/proto/oracle/genesis.proto index 8ca9dcb621..7939d69dbb 100644 --- a/proto/oracle/genesis.proto +++ b/proto/oracle/genesis.proto @@ -12,7 +12,7 @@ message GenesisState { repeated FeederDelegation feeder_delegations = 2 [(gogoproto.nullable) = false]; repeated ExchangeRateTuple exchange_rates = 3 [(gogoproto.castrepeated) = "ExchangeRateTuples", (gogoproto.nullable) = false]; - repeated MissCounter miss_counters = 4 [(gogoproto.nullable) = false]; + repeated PenaltyCounter penalty_counters = 4 [(gogoproto.nullable) = false]; repeated AggregateExchangeRatePrevote aggregate_exchange_rate_prevotes = 5 [(gogoproto.nullable) = false]; repeated AggregateExchangeRateVote aggregate_exchange_rate_votes = 6 [(gogoproto.nullable) = false]; } @@ -22,7 +22,7 @@ message FeederDelegation { string validator_address = 2; } -message MissCounter { +message PenaltyCounter { string validator_address = 1; - uint64 miss_counter = 2; + VotePenaltyCounter vote_penalty_counter = 2; } diff --git a/x/oracle/genesis.go b/x/oracle/genesis.go index e4ed634db9..bb75d99dcd 100755 --- a/x/oracle/genesis.go +++ b/x/oracle/genesis.go @@ -30,13 +30,13 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState keeper.SetBaseExchangeRate(ctx, ex.Denom, ex.ExchangeRate) } - for _, mc := range data.MissCounters { - operator, err := sdk.ValAddressFromBech32(mc.ValidatorAddress) + for _, pc := range data.PenaltyCounters { + operator, err := sdk.ValAddressFromBech32(pc.ValidatorAddress) if err != nil { panic(err) } - keeper.SetVotePenaltyCounter(ctx, operator, mc.MissCounter, 0) + keeper.SetVotePenaltyCounter(ctx, operator, pc.VotePenaltyCounter.MissCount, pc.VotePenaltyCounter.AbstainCount) } for _, ap := range data.AggregateExchangeRatePrevotes { @@ -86,11 +86,11 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { return false }) - missCounters := []types.MissCounter{} + penaltyCounters := []types.PenaltyCounter{} keeper.IterateVotePenaltyCounters(ctx, func(operator sdk.ValAddress, votePenaltyCounter types.VotePenaltyCounter) (stop bool) { - missCounters = append(missCounters, types.MissCounter{ - ValidatorAddress: operator.String(), - MissCounter: votePenaltyCounter.MissCount, + penaltyCounters = append(penaltyCounters, types.PenaltyCounter{ + ValidatorAddress: operator.String(), + VotePenaltyCounter: &votePenaltyCounter, }) return false }) @@ -110,7 +110,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { return types.NewGenesisState(params, exchangeRates, feederDelegations, - missCounters, + penaltyCounters, aggregateExchangeRatePrevotes, aggregateExchangeRateVotes) } diff --git a/x/oracle/types/genesis.go b/x/oracle/types/genesis.go index 2f2ba40b6d..a3151c319b 100755 --- a/x/oracle/types/genesis.go +++ b/x/oracle/types/genesis.go @@ -9,7 +9,7 @@ import ( // NewGenesisState creates a new GenesisState object func NewGenesisState( params Params, rates []ExchangeRateTuple, - feederDelegations []FeederDelegation, missCounters []MissCounter, + feederDelegations []FeederDelegation, penaltyCounters []PenaltyCounter, aggregateExchangeRatePrevotes []AggregateExchangeRatePrevote, aggregateExchangeRateVotes []AggregateExchangeRateVote, ) *GenesisState { @@ -18,7 +18,7 @@ func NewGenesisState( Params: params, ExchangeRates: rates, FeederDelegations: feederDelegations, - MissCounters: missCounters, + PenaltyCounters: penaltyCounters, AggregateExchangeRatePrevotes: aggregateExchangeRatePrevotes, AggregateExchangeRateVotes: aggregateExchangeRateVotes, } @@ -30,7 +30,7 @@ func DefaultGenesisState() *GenesisState { Params: DefaultParams(), ExchangeRates: []ExchangeRateTuple{}, FeederDelegations: []FeederDelegation{}, - MissCounters: []MissCounter{}, + PenaltyCounters: []PenaltyCounter{}, AggregateExchangeRatePrevotes: []AggregateExchangeRatePrevote{}, AggregateExchangeRateVotes: []AggregateExchangeRateVote{}, } diff --git a/x/oracle/types/genesis.pb.go b/x/oracle/types/genesis.pb.go index 718ee51d85..c1b136e28e 100644 --- a/x/oracle/types/genesis.pb.go +++ b/x/oracle/types/genesis.pb.go @@ -28,7 +28,7 @@ type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` FeederDelegations []FeederDelegation `protobuf:"bytes,2,rep,name=feeder_delegations,json=feederDelegations,proto3" json:"feeder_delegations"` ExchangeRates ExchangeRateTuples `protobuf:"bytes,3,rep,name=exchange_rates,json=exchangeRates,proto3,castrepeated=ExchangeRateTuples" json:"exchange_rates"` - MissCounters []MissCounter `protobuf:"bytes,4,rep,name=miss_counters,json=missCounters,proto3" json:"miss_counters"` + PenaltyCounters []PenaltyCounter `protobuf:"bytes,4,rep,name=penalty_counters,json=penaltyCounters,proto3" json:"penalty_counters"` AggregateExchangeRatePrevotes []AggregateExchangeRatePrevote `protobuf:"bytes,5,rep,name=aggregate_exchange_rate_prevotes,json=aggregateExchangeRatePrevotes,proto3" json:"aggregate_exchange_rate_prevotes"` AggregateExchangeRateVotes []AggregateExchangeRateVote `protobuf:"bytes,6,rep,name=aggregate_exchange_rate_votes,json=aggregateExchangeRateVotes,proto3" json:"aggregate_exchange_rate_votes"` } @@ -87,9 +87,9 @@ func (m *GenesisState) GetExchangeRates() ExchangeRateTuples { return nil } -func (m *GenesisState) GetMissCounters() []MissCounter { +func (m *GenesisState) GetPenaltyCounters() []PenaltyCounter { if m != nil { - return m.MissCounters + return m.PenaltyCounters } return nil } @@ -160,23 +160,23 @@ func (m *FeederDelegation) GetValidatorAddress() string { return "" } -type MissCounter struct { - ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - MissCounter uint64 `protobuf:"varint,2,opt,name=miss_counter,json=missCounter,proto3" json:"miss_counter,omitempty"` +type PenaltyCounter struct { + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + VotePenaltyCounter *VotePenaltyCounter `protobuf:"bytes,2,opt,name=vote_penalty_counter,json=votePenaltyCounter,proto3" json:"vote_penalty_counter,omitempty"` } -func (m *MissCounter) Reset() { *m = MissCounter{} } -func (m *MissCounter) String() string { return proto.CompactTextString(m) } -func (*MissCounter) ProtoMessage() {} -func (*MissCounter) Descriptor() ([]byte, []int) { +func (m *PenaltyCounter) Reset() { *m = PenaltyCounter{} } +func (m *PenaltyCounter) String() string { return proto.CompactTextString(m) } +func (*PenaltyCounter) ProtoMessage() {} +func (*PenaltyCounter) Descriptor() ([]byte, []int) { return fileDescriptor_ce0b3a2b4a184fc3, []int{2} } -func (m *MissCounter) XXX_Unmarshal(b []byte) error { +func (m *PenaltyCounter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MissCounter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PenaltyCounter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MissCounter.Marshal(b, m, deterministic) + return xxx_messageInfo_PenaltyCounter.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -186,73 +186,74 @@ func (m *MissCounter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *MissCounter) XXX_Merge(src proto.Message) { - xxx_messageInfo_MissCounter.Merge(m, src) +func (m *PenaltyCounter) XXX_Merge(src proto.Message) { + xxx_messageInfo_PenaltyCounter.Merge(m, src) } -func (m *MissCounter) XXX_Size() int { +func (m *PenaltyCounter) XXX_Size() int { return m.Size() } -func (m *MissCounter) XXX_DiscardUnknown() { - xxx_messageInfo_MissCounter.DiscardUnknown(m) +func (m *PenaltyCounter) XXX_DiscardUnknown() { + xxx_messageInfo_PenaltyCounter.DiscardUnknown(m) } -var xxx_messageInfo_MissCounter proto.InternalMessageInfo +var xxx_messageInfo_PenaltyCounter proto.InternalMessageInfo -func (m *MissCounter) GetValidatorAddress() string { +func (m *PenaltyCounter) GetValidatorAddress() string { if m != nil { return m.ValidatorAddress } return "" } -func (m *MissCounter) GetMissCounter() uint64 { +func (m *PenaltyCounter) GetVotePenaltyCounter() *VotePenaltyCounter { if m != nil { - return m.MissCounter + return m.VotePenaltyCounter } - return 0 + return nil } func init() { proto.RegisterType((*GenesisState)(nil), "seiprotocol.seichain.oracle.GenesisState") proto.RegisterType((*FeederDelegation)(nil), "seiprotocol.seichain.oracle.FeederDelegation") - proto.RegisterType((*MissCounter)(nil), "seiprotocol.seichain.oracle.MissCounter") + proto.RegisterType((*PenaltyCounter)(nil), "seiprotocol.seichain.oracle.PenaltyCounter") } func init() { proto.RegisterFile("oracle/genesis.proto", fileDescriptor_ce0b3a2b4a184fc3) } var fileDescriptor_ce0b3a2b4a184fc3 = []byte{ - // 491 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4f, 0x6b, 0x13, 0x41, - 0x14, 0xcf, 0xb6, 0x69, 0xc0, 0x49, 0x52, 0xda, 0xb1, 0x87, 0x10, 0xe9, 0x36, 0x46, 0x84, 0x80, - 0x74, 0xd7, 0x56, 0x10, 0x3c, 0x26, 0xfe, 0x03, 0x41, 0x28, 0x5b, 0xf1, 0x20, 0xc8, 0x32, 0xbb, - 0xfb, 0xb2, 0x19, 0xd8, 0xdd, 0x59, 0xf7, 0x4d, 0x42, 0x3d, 0x79, 0xd5, 0x9b, 0x9f, 0xc3, 0x4f, - 0xd2, 0x63, 0x8f, 0x9e, 0x54, 0x92, 0x2f, 0x22, 0x99, 0x99, 0x36, 0x6b, 0x6d, 0x16, 0x7a, 0xca, - 0xe4, 0xbd, 0xdf, 0xbf, 0x37, 0xf3, 0x96, 0xec, 0x89, 0x82, 0x85, 0x09, 0xb8, 0x31, 0x64, 0x80, - 0x1c, 0x9d, 0xbc, 0x10, 0x52, 0xd0, 0x7b, 0x08, 0x5c, 0x9d,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0c, 0x1a, 0x0a, 0xf2, 0xe4, 0x6f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xe1, 0xc5, 0x36, 0x34, 0x25, 0x04, 0x00, 0x00, + // 505 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4b, 0x6b, 0xdb, 0x40, + 0x10, 0xb6, 0xf2, 0x30, 0x74, 0xdd, 0xb8, 0xce, 0xd6, 0x07, 0xe3, 0x12, 0xc5, 0xb8, 0x14, 0x02, + 0x21, 0x52, 0xe3, 0x42, 0xa1, 0x47, 0xbb, 0x2f, 0xe8, 0x29, 0xb8, 0xa5, 0x87, 0x52, 0x10, 0x23, + 0x69, 0x2c, 0x0b, 0x64, 0xad, 0xaa, 0x59, 0x9b, 0xe4, 0xd4, 0x6b, 0x8f, 0xa5, 0xbf, 0xa0, 0xe7, + 0xfe, 0x92, 0x1c, 0x73, 0xec, 0xa9, 0x2d, 0xf6, 0x1f, 0x29, 0xda, 0xdd, 0x3c, 0xec, 0x24, 0x82, + 0x9c, 0xb4, 0xfa, 0xe6, 0x7b, 0xcc, 0xac, 0x06, 0xb1, 0xa6, 0xc8, 0x21, 0x48, 0xd0, 0x8d, 0x30, + 0x45, 0x8a, 0xc9, 0xc9, 0x72, 0x21, 0x05, 0x7f, 0x44, 0x18, 0xab, 0x53, 0x20, 0x12, 0x87, 0x30, + 0x0e, 0xc6, 0x10, 0xa7, 0x8e, 0xa6, 0xb6, 0x9b, 0x91, 0x88, 0x84, 0xaa, 0xba, 0xc5, 0x49, 0x4b, + 0xda, 0x0f, 0x8d, 0x91, 0x7e, 0x18, 0xd0, 0x0e, 0x04, 0x4d, 0x04, 0xb9, 0x3e, 0x10, 0xba, 0xb3, + 0x43, 0x1f, 0x25, 0x1c, 0xba, 0x81, 0x88, 0x53, 0x5d, 0xef, 0xfe, 0xd8, 0x64, 0xf7, 0xdf, 0xea, + 0xe4, 0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, 0xe8, 0x36, 0xaa, 0xaa, 0x8d, 0xe7, 0x77, + 0x6f, 0xe3, 0xe3, 0x65, 0x0f, 0x6d, 0xb8, 0x8d, 0x40, 0xdd, 0x11, 0x6b, 0xac, 0x6e, 0x02, 0x7f, + 0xc2, 0xea, 0x66, 0xa9, 0x20, 0x0c, 0x73, 0x24, 0xbd, 0x9f, 0xf7, 0x86, 0x5b, 0x1a, 0xed, 0x6b, + 0x90, 0xef, 0xb3, 0xed, 0x19, 0x24, 0x71, 0x08, 0x52, 0x5c, 0x32, 0xd7, 0x14, 0xb3, 0x71, 0x51, + 0x30, 0xe4, 0xee, 0x4f, 0x8b, 0xd5, 0x97, 0xbf, 0xce, 0xcd, 0x7a, 0xeb, 0x66, 0x3d, 0x07, 0xd6, + 0x2c, 0x2e, 0xc4, 0x5b, 0x59, 0x0b, 0x95, 0x57, 0xeb, 0xb9, 0xa5, 0xf7, 0x53, 0x4c, 0xba, 0x9c, + 0x3d, 0xe4, 0xb3, 0x6b, 0xd8, 0xe0, 0xdd, 0xe9, 0xdc, 0xb6, 0xce, 0xe6, 0xb6, 0xf5, 0x6f, 0x6e, + 0x5b, 0xdf, 0x17, 0x76, 0xe5, 0x6c, 0x61, 0x57, 0x7e, 0x2f, 0xec, 0xca, 0xa7, 0xa7, 0x51, 0x2c, + 0xc7, 0x53, 0xdf, 0x09, 0xc4, 0xc4, 0x25, 0x8c, 0x0f, 0xce, 0x93, 0xd4, 0x8b, 0x8a, 0x72, 0x8f, + 0xcd, 0xbf, 0xc0, 0x95, 0x27, 0x19, 0x92, 0x5f, 0x55, 0x94, 0x67, 0xff, 0x03, 0x00, 0x00, 0xff, + 0xff, 0x78, 0xbe, 0x25, 0x64, 0x72, 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -303,10 +304,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x2a } } - if len(m.MissCounters) > 0 { - for iNdEx := len(m.MissCounters) - 1; iNdEx >= 0; iNdEx-- { + if len(m.PenaltyCounters) > 0 { + for iNdEx := len(m.PenaltyCounters) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.MissCounters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.PenaltyCounters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -395,7 +396,7 @@ func (m *FeederDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MissCounter) Marshal() (dAtA []byte, err error) { +func (m *PenaltyCounter) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -405,20 +406,27 @@ func (m *MissCounter) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MissCounter) MarshalTo(dAtA []byte) (int, error) { +func (m *PenaltyCounter) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MissCounter) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PenaltyCounter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.MissCounter != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.MissCounter)) + if m.VotePenaltyCounter != nil { + { + size, err := m.VotePenaltyCounter.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } if len(m.ValidatorAddress) > 0 { i -= len(m.ValidatorAddress) @@ -461,8 +469,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.MissCounters) > 0 { - for _, e := range m.MissCounters { + if len(m.PenaltyCounters) > 0 { + for _, e := range m.PenaltyCounters { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -499,7 +507,7 @@ func (m *FeederDelegation) Size() (n int) { return n } -func (m *MissCounter) Size() (n int) { +func (m *PenaltyCounter) Size() (n int) { if m == nil { return 0 } @@ -509,8 +517,9 @@ func (m *MissCounter) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } - if m.MissCounter != 0 { - n += 1 + sovGenesis(uint64(m.MissCounter)) + if m.VotePenaltyCounter != nil { + l = m.VotePenaltyCounter.Size() + n += 1 + l + sovGenesis(uint64(l)) } return n } @@ -653,7 +662,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MissCounters", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PenaltyCounters", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -680,8 +689,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MissCounters = append(m.MissCounters, MissCounter{}) - if err := m.MissCounters[len(m.MissCounters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.PenaltyCounters = append(m.PenaltyCounters, PenaltyCounter{}) + if err := m.PenaltyCounters[len(m.PenaltyCounters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -888,7 +897,7 @@ func (m *FeederDelegation) Unmarshal(dAtA []byte) error { } return nil } -func (m *MissCounter) Unmarshal(dAtA []byte) error { +func (m *PenaltyCounter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -911,10 +920,10 @@ func (m *MissCounter) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MissCounter: wiretype end group for non-group") + return fmt.Errorf("proto: PenaltyCounter: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MissCounter: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PenaltyCounter: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -950,10 +959,10 @@ func (m *MissCounter) Unmarshal(dAtA []byte) error { m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MissCounter", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotePenaltyCounter", wireType) } - m.MissCounter = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenesis @@ -963,11 +972,28 @@ func (m *MissCounter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MissCounter |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotePenaltyCounter == nil { + m.VotePenaltyCounter = &VotePenaltyCounter{} + } + if err := m.VotePenaltyCounter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) From f90eb84c1165a27e29caa4906a4656f073c873e7 Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Thu, 16 Jun 2022 19:21:58 -0700 Subject: [PATCH 3/9] [oracle] Fix simulation package behavior to be consistent with penalty count format --- x/oracle/simulation/decoder.go | 8 +++----- x/oracle/simulation/decoder_test.go | 7 ++++--- x/oracle/simulation/genesis.go | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/x/oracle/simulation/decoder.go b/x/oracle/simulation/decoder.go index ef1495299c..1b3285d1a2 100755 --- a/x/oracle/simulation/decoder.go +++ b/x/oracle/simulation/decoder.go @@ -4,8 +4,6 @@ import ( "bytes" "fmt" - gogotypes "github.com/gogo/protobuf/types" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" @@ -25,11 +23,11 @@ func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { return fmt.Sprintf("%v\n%v", exchangeRateA, exchangeRateB) case bytes.Equal(kvA.Key[:1], types.FeederDelegationKey): return fmt.Sprintf("%v\n%v", sdk.AccAddress(kvA.Value), sdk.AccAddress(kvB.Value)) - case bytes.Equal(kvA.Key[:1], types.MissCounterKey): - var counterA, counterB gogotypes.UInt64Value + case bytes.Equal(kvA.Key[:1], types.VotePenaltyCounterKey): + var counterA, counterB types.VotePenaltyCounter cdc.MustUnmarshal(kvA.Value, &counterA) cdc.MustUnmarshal(kvB.Value, &counterB) - return fmt.Sprintf("%v\n%v", counterA.Value, counterB.Value) + return fmt.Sprintf("%v\n%v", counterA, counterB) case bytes.Equal(kvA.Key[:1], types.AggregateExchangeRatePrevoteKey): var prevoteA, prevoteB types.AggregateExchangeRatePrevote cdc.MustUnmarshal(kvA.Value, &prevoteA) diff --git a/x/oracle/simulation/decoder_test.go b/x/oracle/simulation/decoder_test.go index 951d9e9155..4b0b6110e7 100755 --- a/x/oracle/simulation/decoder_test.go +++ b/x/oracle/simulation/decoder_test.go @@ -4,7 +4,6 @@ import ( "fmt" "testing" - gogotypes "github.com/gogo/protobuf/types" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto/ed25519" @@ -30,11 +29,13 @@ func TestDecodeDistributionStore(t *testing.T) { exchangeRate := sdk.NewDecWithPrec(1234, 1) missCounter := uint64(23) + abstainCounter := uint64(21) aggregatePrevote := types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash([]byte("12345")), valAddr, 123) aggregateVote := types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{ {Denom: utils.MicroAtomDenom, ExchangeRate: sdk.NewDecWithPrec(1234, 1)}, }, valAddr) + votePenaltyCounter := types.VotePenaltyCounter{MissCount: missCounter, AbstainCount: abstainCounter} denom := "usei" @@ -42,7 +43,7 @@ func TestDecodeDistributionStore(t *testing.T) { Pairs: []kv.Pair{ {Key: types.ExchangeRateKey, Value: cdc.MustMarshal(&sdk.DecProto{Dec: exchangeRate})}, {Key: types.FeederDelegationKey, Value: feederAddr.Bytes()}, - {Key: types.MissCounterKey, Value: cdc.MustMarshal(&gogotypes.UInt64Value{Value: missCounter})}, + {Key: types.VotePenaltyCounterKey, Value: cdc.MustMarshal(&votePenaltyCounter)}, {Key: types.AggregateExchangeRatePrevoteKey, Value: cdc.MustMarshal(&aggregatePrevote)}, {Key: types.AggregateExchangeRateVoteKey, Value: cdc.MustMarshal(&aggregateVote)}, {Key: types.VoteTargetKey, Value: cdc.MustMarshal(&types.Denom{Name: denom})}, @@ -56,7 +57,7 @@ func TestDecodeDistributionStore(t *testing.T) { }{ {"ExchangeRate", fmt.Sprintf("%v\n%v", exchangeRate, exchangeRate)}, {"FeederDelegation", fmt.Sprintf("%v\n%v", feederAddr, feederAddr)}, - {"MissCounter", fmt.Sprintf("%v\n%v", missCounter, missCounter)}, + {"VotePenaltyCounter", fmt.Sprintf("%v\n%v", votePenaltyCounter, votePenaltyCounter)}, {"AggregatePrevote", fmt.Sprintf("%v\n%v", aggregatePrevote, aggregatePrevote)}, {"AggregateVote", fmt.Sprintf("%v\n%v", aggregateVote, aggregateVote)}, {"VoteTarget", fmt.Sprintf("name: %v\n\nname: %v\n", denom, denom)}, diff --git a/x/oracle/simulation/genesis.go b/x/oracle/simulation/genesis.go index 23a3d55791..d6cf43ef57 100755 --- a/x/oracle/simulation/genesis.go +++ b/x/oracle/simulation/genesis.go @@ -109,7 +109,7 @@ func RandomizedGenState(simState *module.SimulationState) { }, []types.ExchangeRateTuple{}, []types.FeederDelegation{}, - []types.MissCounter{}, + []types.PenaltyCounter{}, []types.AggregateExchangeRatePrevote{}, []types.AggregateExchangeRateVote{}, ) From e99489c222c1a48bc3e1c235a5e69768a9ec222f Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Thu, 16 Jun 2022 19:32:32 -0700 Subject: [PATCH 4/9] [oracle] Fix abstain slash abci test --- x/oracle/abci_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/oracle/abci_test.go b/x/oracle/abci_test.go index 666ad46d81..177fec5c5a 100755 --- a/x/oracle/abci_test.go +++ b/x/oracle/abci_test.go @@ -488,13 +488,14 @@ func TestAbstainSlashing(t *testing.T) { makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) oracle.EndBlocker(input.Ctx, input.OracleKeeper) - require.Equal(t, uint64(i+1%limit), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[1])) + require.Equal(t, uint64(i+1%limit), input.OracleKeeper.GetAbstainCount(input.Ctx, keeper.ValAddrs[1])) } input.Ctx = input.Ctx.WithBlockHeight(votePeriodsPerWindow - 1) oracle.EndBlocker(input.Ctx, input.OracleKeeper) validator := input.StakingKeeper.Validator(input.Ctx, keeper.ValAddrs[1]) require.Equal(t, sdk.OneDec().Sub(slashFraction).MulInt(stakingAmt).TruncateInt(), validator.GetBondedTokens()) + require.False(t, validator.IsJailed()) } func TestVoteTargets(t *testing.T) { From 424d5473acf497ebfadcf7b5e66156ace5d747c7 Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Thu, 16 Jun 2022 20:59:52 -0700 Subject: [PATCH 5/9] [oracle] Add migration handlers for miss counter store migration --- x/oracle/keeper/migrations.go | 22 +++++++++++++++ x/oracle/keeper/migrations_test.go | 43 ++++++++++++++++++++++++++++++ x/oracle/module.go | 3 ++- 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/x/oracle/keeper/migrations.go b/x/oracle/keeper/migrations.go index f2208d47d4..bf74bbfed8 100644 --- a/x/oracle/keeper/migrations.go +++ b/x/oracle/keeper/migrations.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + gogotypes "github.com/gogo/protobuf/types" "github.com/sei-protocol/sei-chain/x/oracle/types" ) @@ -34,3 +35,24 @@ func (m Migrator) Migrate2to3(ctx sdk.Context) error { return nil } + +// Migrate3to3 migrates from version 3 to 4 +func (m Migrator) Migrate3to4(ctx sdk.Context) error { + // we need to migrate the miss counters to be stored as VotePenaltyCounter to introduce abstain count logic + store := ctx.KVStore(m.keeper.storeKey) + + // previously the data was stored as uint64, now it is VotePenaltyCounter proto + iter := sdk.KVStorePrefixIterator(store, types.VotePenaltyCounterKey) + defer iter.Close() + for ; iter.Valid(); iter.Next() { + var missCounter gogotypes.UInt64Value + m.keeper.cdc.MustUnmarshal(iter.Value(), &missCounter) + // create proto for new data value + // because we don't have a lastUpdate, we set it to 0 + votePenaltyCounter := types.VotePenaltyCounter{MissCount: missCounter.Value, AbstainCount: 0} + bz := m.keeper.cdc.MustMarshal(&votePenaltyCounter) + store.Set(iter.Key(), bz) + } + + return nil +} diff --git a/x/oracle/keeper/migrations_test.go b/x/oracle/keeper/migrations_test.go index 04bcc03a13..86feff55b4 100644 --- a/x/oracle/keeper/migrations_test.go +++ b/x/oracle/keeper/migrations_test.go @@ -3,6 +3,7 @@ package keeper import ( "testing" + gogotypes "github.com/gogo/protobuf/types" "github.com/stretchr/testify/require" "github.com/sei-protocol/sei-chain/x/oracle/types" @@ -50,3 +51,45 @@ func TestMigrate2to3(t *testing.T) { require.True(t, numExchangeRates == 1) } + +func TestMigrate3to4(t *testing.T) { + input := CreateTestInput(t) + + addr := ValAddrs[0] + + missCounter := uint64(12) + + // store the value with legacy proto + store := input.Ctx.KVStore(input.OracleKeeper.storeKey) + bz := input.OracleKeeper.cdc.MustMarshal(&gogotypes.UInt64Value{Value: missCounter}) + store.Set(types.GetVotePenaltyCounterKey(addr), bz) + + // set for second validator + store.Set(types.GetVotePenaltyCounterKey(ValAddrs[1]), bz) + + // confirm legacy store value + b := store.Get(types.GetVotePenaltyCounterKey(addr)) + mc := gogotypes.UInt64Value{} + input.OracleKeeper.cdc.MustUnmarshal(b, &mc) + require.Equal(t, missCounter, mc.Value) + + // Migrate store + m := NewMigrator(input.OracleKeeper) + m.Migrate3to4(input.Ctx) + + // Get rate + votePenaltyCounter := input.OracleKeeper.GetVotePenaltyCounter(input.Ctx, addr) + require.Equal(t, types.VotePenaltyCounter{MissCount: missCounter, AbstainCount: 0}, votePenaltyCounter) + + input.OracleKeeper.DeleteVotePenaltyCounter(input.Ctx, addr) + votePenaltyCounter = input.OracleKeeper.GetVotePenaltyCounter(input.Ctx, addr) + + numPenaltyCounters := 0 + handler := func(operators sdk.ValAddress, votePenaltyCounter types.VotePenaltyCounter) (stop bool) { + numPenaltyCounters++ + return false + } + input.OracleKeeper.IterateVotePenaltyCounters(input.Ctx, handler) + + require.True(t, numPenaltyCounters == 1) +} diff --git a/x/oracle/module.go b/x/oracle/module.go index 0f18131669..aa6c93fe45 100755 --- a/x/oracle/module.go +++ b/x/oracle/module.go @@ -141,6 +141,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { m := keeper.NewMigrator(am.keeper) cfg.RegisterMigration(types.ModuleName, 1, func(ctx sdk.Context) error { return nil }) cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3) + cfg.RegisterMigration(types.ModuleName, 3, m.Migrate3to4) } // InitGenesis performs genesis initialization for the oracle module. It returns @@ -161,7 +162,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 3 } +func (AppModule) ConsensusVersion() uint64 { return 4 } // BeginBlock returns the begin blocker for the oracle module. func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} From 9554efca7a9b532a525ee297a1c12e1287029abf Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Fri, 17 Jun 2022 12:43:37 -0700 Subject: [PATCH 6/9] [app] Add upgrade handler for oracle miss counter migration --- app/upgrades.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/upgrades.go b/app/upgrades.go index 0dd955e639..534be6ac10 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -13,6 +13,7 @@ const UpgradeNameOracleModule = "create-oracle-mod" const UpgradeOracleStaleIndicator = "upgrade-oracle-stale-indicator" const IgniteCLIRemovalUpgradeHandler = "ignite-cli-removal-upgrade" const UpgradeDexDataType = "upgrade-dex-data-type" +const UpgradeOracleMissCounters = "upgrade-oracle-miss-counters" func (app App) RegisterUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler(UpgradeNameOracleModule, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { @@ -27,4 +28,7 @@ func (app App) RegisterUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler(UpgradeDexDataType, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { return app.mm.RunMigrations(ctx, app.configurator, fromVM) }) + app.UpgradeKeeper.SetUpgradeHandler(UpgradeOracleMissCounters, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return app.mm.RunMigrations(ctx, app.configurator, fromVM) + }) } From b61c818877cc3ae1ac03c51a2858c6dcb7caa0f6 Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Fri, 17 Jun 2022 16:41:35 -0700 Subject: [PATCH 7/9] [oracle] Modify querier logic to properly return abstain value --- x/oracle/keeper/querier.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/oracle/keeper/querier.go b/x/oracle/keeper/querier.go index aa44bccbc5..7a881508a8 100755 --- a/x/oracle/keeper/querier.go +++ b/x/oracle/keeper/querier.go @@ -160,7 +160,7 @@ func (q querier) VotePenaltyCounter(c context.Context, req *types.QueryVotePenal return &types.QueryVotePenaltyCounterResponse{ VotePenaltyCounter: &types.VotePenaltyCounter{ MissCount: q.GetMissCount(ctx, valAddr), - AbstainCount: q.GetMissCount(ctx, valAddr), + AbstainCount: q.GetAbstainCount(ctx, valAddr), }, }, nil } From be8bdbf2d3c057c70b3934445878beae4e88e1f7 Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Sun, 19 Jun 2022 09:33:28 -0700 Subject: [PATCH 8/9] [upgrades] Remove some oracle upgrades and introduce upgrade 1.0.4 with oracle module --- app/app.go | 2 +- app/upgrades.go | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/app/app.go b/app/app.go index ebcb04bd3b..fdee04b458 100644 --- a/app/app.go +++ b/app/app.go @@ -655,7 +655,7 @@ func New( panic(err) } - if upgradeInfo.Name == UpgradeNameOracleModule && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + if upgradeInfo.Name == Upgrade104 && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := storetypes.StoreUpgrades{ Added: []string{oracletypes.StoreKey}, } diff --git a/app/upgrades.go b/app/upgrades.go index 534be6ac10..2863c0737d 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -9,26 +9,37 @@ import ( // NOTE: When performing upgrades, make sure to keep / register the handlers // for both the current (n) and the previous (n-1) upgrade name. There is a bug // in a missing value in a log statement for which the fix is not released -const UpgradeNameOracleModule = "create-oracle-mod" -const UpgradeOracleStaleIndicator = "upgrade-oracle-stale-indicator" const IgniteCLIRemovalUpgradeHandler = "ignite-cli-removal-upgrade" const UpgradeDexDataType = "upgrade-dex-data-type" -const UpgradeOracleMissCounters = "upgrade-oracle-miss-counters" + +// 1.0.2beta upgrades +const Upgrade102 = "1.0.2beta" +const Upgrade102CommitTimeout = "1.0.2beta-commit-timeout" + +// 1.0.3beta +const Upgrade103 = "1.0.3beta" + +// 1.0.4beta +// this will introduce the oracle module as well +const Upgrade104 = "1.0.4beta" func (app App) RegisterUpgradeHandlers() { - app.UpgradeKeeper.SetUpgradeHandler(UpgradeNameOracleModule, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + app.UpgradeKeeper.SetUpgradeHandler(IgniteCLIRemovalUpgradeHandler, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { 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) { return app.mm.RunMigrations(ctx, app.configurator, fromVM) }) - app.UpgradeKeeper.SetUpgradeHandler(IgniteCLIRemovalUpgradeHandler, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + app.UpgradeKeeper.SetUpgradeHandler(Upgrade102, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { return app.mm.RunMigrations(ctx, app.configurator, fromVM) }) - app.UpgradeKeeper.SetUpgradeHandler(UpgradeDexDataType, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + app.UpgradeKeeper.SetUpgradeHandler(Upgrade102CommitTimeout, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return app.mm.RunMigrations(ctx, app.configurator, fromVM) + }) + app.UpgradeKeeper.SetUpgradeHandler(Upgrade103, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { return app.mm.RunMigrations(ctx, app.configurator, fromVM) }) - app.UpgradeKeeper.SetUpgradeHandler(UpgradeOracleMissCounters, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + app.UpgradeKeeper.SetUpgradeHandler(Upgrade104, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { return app.mm.RunMigrations(ctx, app.configurator, fromVM) }) } From 5e00e483345cd775deadb17c1ef5cfcb072d5601 Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Sun, 19 Jun 2022 21:46:58 -0700 Subject: [PATCH 9/9] [upgrades] Remove irrelevant upgrades --- app/upgrades.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/upgrades.go b/app/upgrades.go index 2863c0737d..afbd3568ce 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -9,8 +9,6 @@ import ( // NOTE: When performing upgrades, make sure to keep / register the handlers // for both the current (n) and the previous (n-1) upgrade name. There is a bug // in a missing value in a log statement for which the fix is not released -const IgniteCLIRemovalUpgradeHandler = "ignite-cli-removal-upgrade" -const UpgradeDexDataType = "upgrade-dex-data-type" // 1.0.2beta upgrades const Upgrade102 = "1.0.2beta" @@ -24,12 +22,6 @@ const Upgrade103 = "1.0.3beta" const Upgrade104 = "1.0.4beta" func (app App) RegisterUpgradeHandlers() { - app.UpgradeKeeper.SetUpgradeHandler(IgniteCLIRemovalUpgradeHandler, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - return app.mm.RunMigrations(ctx, app.configurator, fromVM) - }) - app.UpgradeKeeper.SetUpgradeHandler(UpgradeDexDataType, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - return app.mm.RunMigrations(ctx, app.configurator, fromVM) - }) app.UpgradeKeeper.SetUpgradeHandler(Upgrade102, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { return app.mm.RunMigrations(ctx, app.configurator, fromVM) })