From 9097a581ca54d949c0746d1772b1548619d63d0b Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Tue, 13 Sep 2022 16:26:48 -0700 Subject: [PATCH 1/3] [oracle] Remove oracle prevote --- app/antedecorators/gasless.go | 64 +- proto/oracle/genesis.proto | 1 - proto/oracle/oracle.proto | 10 - proto/oracle/query.proto | 36 - proto/oracle/tx.proto | 39 +- x/oracle/README.md | 6 +- x/oracle/abci_test.go | 237 ++---- x/oracle/ante.go | 58 +- x/oracle/client/cli/query.go | 59 +- x/oracle/client/cli/tx.go | 157 +--- x/oracle/client/rest/query.go | 46 -- x/oracle/client/rest/tx.go | 138 +--- x/oracle/exported/alias.go | 3 +- x/oracle/genesis.go | 16 - x/oracle/genesis_test.go | 1 - x/oracle/handler.go | 6 - x/oracle/handler_test.go | 61 +- x/oracle/keeper/ballot.go | 11 +- x/oracle/keeper/ballot_test.go | 22 - x/oracle/keeper/keeper.go | 62 +- x/oracle/keeper/keeper_test.go | 43 -- x/oracle/keeper/msg_server.go | 102 --- x/oracle/keeper/querier.go | 37 - x/oracle/keeper/querier_test.go | 49 -- x/oracle/simulation/decoder.go | 5 - x/oracle/simulation/decoder_test.go | 3 - x/oracle/simulation/genesis.go | 1 - x/oracle/simulation/operations.go | 97 +-- x/oracle/spec/02_state.md | 36 - x/oracle/spec/05_events.md | 22 +- x/oracle/types/codec.go | 9 - x/oracle/types/errors.go | 4 - x/oracle/types/events.go | 2 - x/oracle/types/genesis.go | 23 +- x/oracle/types/genesis.pb.go | 136 +--- x/oracle/types/hash.go | 120 --- x/oracle/types/hash_test.go | 40 - x/oracle/types/keys.go | 21 +- x/oracle/types/msgs.go | 174 +---- x/oracle/types/msgs_test.go | 45 +- x/oracle/types/oracle.pb.go | 373 ++------- x/oracle/types/querier.go | 25 - x/oracle/types/query.pb.go | 1005 ++++-------------------- x/oracle/types/query.pb.gw.go | 166 ---- x/oracle/types/tx.pb.go | 1105 ++------------------------- x/oracle/types/vote.go | 15 - 46 files changed, 456 insertions(+), 4235 deletions(-) delete mode 100755 x/oracle/types/hash.go delete mode 100755 x/oracle/types/hash_test.go diff --git a/app/antedecorators/gasless.go b/app/antedecorators/gasless.go index fb413ec158..6add85e167 100644 --- a/app/antedecorators/gasless.go +++ b/app/antedecorators/gasless.go @@ -55,21 +55,11 @@ func isTxGasless(tx sdk.Tx, ctx sdk.Context, oracleKeeper oraclekeeper.Keeper) b continue } return false - case *oracletypes.MsgAggregateExchangeRatePrevote: - if OraclePrevoteIsGasless(m, ctx, oracleKeeper) { - continue - } - return false case *oracletypes.MsgAggregateExchangeRateVote: if OracleVoteIsGasless(m, ctx, oracleKeeper) { continue } return false - case *oracletypes.MsgAggregateExchangeRateCombinedVote: - if OracleCombinedVoteIsGasless(m, ctx, oracleKeeper) { - continue - } - return false default: return false } @@ -104,34 +94,6 @@ func allSignersWhitelisted(msg *dextypes.MsgCancelOrders) bool { return true } -func OraclePrevoteIsGasless(msg *oracletypes.MsgAggregateExchangeRatePrevote, ctx sdk.Context, keeper oraclekeeper.Keeper) bool { - feederAddr, err := sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - return false - } - - valAddr, err := sdk.ValAddressFromBech32(msg.Validator) - if err != nil { - return false - } - - err = keeper.ValidateFeeder(ctx, feederAddr, valAddr) - if err != nil { - return false - } - - currHeight := ctx.BlockHeight() - votePeriod := keeper.VotePeriod(ctx) - lastPrevote, err := keeper.GetAggregateExchangeRatePrevote(ctx, valAddr) - if err != nil { - return true - } - - lastPrevoteWindow := lastPrevote.SubmitBlock / votePeriod - currPrevoteWindow := uint64(currHeight) / votePeriod - return currPrevoteWindow > lastPrevoteWindow -} - func OracleVoteIsGasless(msg *oracletypes.MsgAggregateExchangeRateVote, ctx sdk.Context, keeper oraclekeeper.Keeper) bool { feederAddr, err := sdk.AccAddressFromBech32(msg.Feeder) if err != nil { @@ -151,28 +113,6 @@ func OracleVoteIsGasless(msg *oracletypes.MsgAggregateExchangeRateVote, ctx sdk. // this returns an error IFF there is no vote present // this also gets cleared out after every vote window, so if there is no vote present, we may want to allow gasless tx _, err = keeper.GetAggregateExchangeRateVote(ctx, valAddr) - // if there is no error that means there is a vote present, so we dont allow gasless tx - if err == nil { - return false - } - - currHeight := ctx.BlockHeight() - votePeriod := keeper.VotePeriod(ctx) - // we expect a prevote from the previous window - lastPrevote, err := keeper.GetAggregateExchangeRatePrevote(ctx, valAddr) - if err != nil { - // if there is no prevote present, there shouldnt be a vote expected so we dont allow gasless - return false - } - - lastPrevoteWindow := lastPrevote.SubmitBlock / votePeriod - currPrevoteWindow := uint64(currHeight) / votePeriod - - // we allow gasless tx if the difference is exactly 1, since then the prevote is in the valid window - return currPrevoteWindow-lastPrevoteWindow == 1 -} - -func OracleCombinedVoteIsGasless(msg *oracletypes.MsgAggregateExchangeRateCombinedVote, ctx sdk.Context, keeper oraclekeeper.Keeper) bool { - return (OraclePrevoteIsGasless(msg.GetPrevoteFromCombinedVote(), ctx, keeper) || - OracleVoteIsGasless(msg.GetVoteFromCombinedVote(), ctx, keeper)) + // if there is no error that means there is a vote present, so we dont allow gasless tx otherwise we allow it + return err != nil } diff --git a/proto/oracle/genesis.proto b/proto/oracle/genesis.proto index 7939d69dbb..41a0fa7372 100644 --- a/proto/oracle/genesis.proto +++ b/proto/oracle/genesis.proto @@ -13,7 +13,6 @@ message GenesisState { repeated ExchangeRateTuple exchange_rates = 3 [(gogoproto.castrepeated) = "ExchangeRateTuples", (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]; } diff --git a/proto/oracle/oracle.proto b/proto/oracle/oracle.proto index ec9c62233d..255ff9e49e 100644 --- a/proto/oracle/oracle.proto +++ b/proto/oracle/oracle.proto @@ -50,16 +50,6 @@ message Denom { string name = 1 [(gogoproto.moretags) = "yaml:\"name\""]; } -message AggregateExchangeRatePrevote { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - string hash = 1 [(gogoproto.moretags) = "yaml:\"hash\""]; - string voter = 2 [(gogoproto.moretags) = "yaml:\"voter\""]; - uint64 submit_block = 3 [(gogoproto.moretags) = "yaml:\"submit_block\""]; -} - message AggregateExchangeRateVote { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; diff --git a/proto/oracle/query.proto b/proto/oracle/query.proto index 46fe5811b9..532b475a04 100644 --- a/proto/oracle/query.proto +++ b/proto/oracle/query.proto @@ -48,16 +48,6 @@ service Query { option (google.api.http).get = "/sei-protocol/sei-chain/oracle/validators/{validator_addr}/vote_penalty_counter"; } - // AggregatePrevote returns an aggregate prevote of a validator - rpc AggregatePrevote(QueryAggregatePrevoteRequest) returns (QueryAggregatePrevoteResponse) { - option (google.api.http).get = "/sei-protocol/sei-chain/oracle/validators/{validator_addr}/aggregate_prevote"; - } - - // AggregatePrevotes returns aggregate prevotes of all validators - rpc AggregatePrevotes(QueryAggregatePrevotesRequest) returns (QueryAggregatePrevotesResponse) { - option (google.api.http).get = "/sei-protocol/sei-chain/oracle/validators/aggregate_prevotes"; - } - // AggregateVote returns an aggregate vote of a validator rpc AggregateVote(QueryAggregateVoteRequest) returns (QueryAggregateVoteResponse) { option (google.api.http).get = "/sei-protocol/sei-chain/oracle/validators/{validator_addr}/aggregate_vote"; @@ -180,32 +170,6 @@ message QueryVotePenaltyCounterResponse { VotePenaltyCounter vote_penalty_counter = 1; } -// QueryAggregatePrevoteRequest is the request type for the Query/AggregatePrevote RPC method. -message QueryAggregatePrevoteRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // validator defines the validator address to query for. - string validator_addr = 1; -} - -// QueryAggregatePrevoteResponse is response type for the -// Query/AggregatePrevote RPC method. -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. -message QueryAggregatePrevotesRequest {} - -// QueryAggregatePrevotesResponse is response type for the -// Query/AggregatePrevotes RPC method. -message QueryAggregatePrevotesResponse { - // aggregate_prevotes defines all oracle aggregate prevotes submitted in the current vote period - repeated AggregateExchangeRatePrevote aggregate_prevotes = 1 [(gogoproto.nullable) = false]; -} - // QueryAggregateVoteRequest is the request type for the Query/AggregateVote RPC method. message QueryAggregateVoteRequest { option (gogoproto.equal) = false; diff --git a/proto/oracle/tx.proto b/proto/oracle/tx.proto index 2e0405d207..abf74736c8 100644 --- a/proto/oracle/tx.proto +++ b/proto/oracle/tx.proto @@ -7,42 +7,21 @@ option go_package = "github.com/sei-protocol/sei-chain/x/oracle/types"; // Msg defines the oracle Msg service. service Msg { - // AggregateExchangeRatePrevote defines a method for submitting - // aggregate exchange rate prevote - rpc AggregateExchangeRatePrevote(MsgAggregateExchangeRatePrevote) returns (MsgAggregateExchangeRatePrevoteResponse); - // AggregateExchangeRateVote defines a method for submitting // aggregate exchange rate vote rpc AggregateExchangeRateVote(MsgAggregateExchangeRateVote) returns (MsgAggregateExchangeRateVoteResponse); - // Aggregate vote and prevote combines the functionality of prevote and vote into one RPC - rpc AggregateExchangeRateCombinedVote(MsgAggregateExchangeRateCombinedVote) returns (MsgAggregateExchangeRateCombinedVoteResponse); - // DelegateFeedConsent defines a method for setting the feeder delegation rpc DelegateFeedConsent(MsgDelegateFeedConsent) returns (MsgDelegateFeedConsentResponse); } -// MsgAggregateExchangeRatePrevote represents a message to submit -// aggregate exchange rate prevote. -message MsgAggregateExchangeRatePrevote { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string hash = 1 [(gogoproto.moretags) = "yaml:\"hash\""]; - string feeder = 2 [(gogoproto.moretags) = "yaml:\"feeder\""]; - string validator = 3 [(gogoproto.moretags) = "yaml:\"validator\""]; -} - -// MsgAggregateExchangeRatePrevoteResponse defines the Msg/AggregateExchangeRatePrevote response type. -message MsgAggregateExchangeRatePrevoteResponse {} - // MsgAggregateExchangeRateVote represents a message to submit // aggregate exchange rate vote. message MsgAggregateExchangeRateVote { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string salt = 1 [(gogoproto.moretags) = "yaml:\"salt\""]; + // 1 reserved from old field `salt` string exchange_rates = 2 [(gogoproto.moretags) = "yaml:\"exchange_rates\""]; string feeder = 3 [(gogoproto.moretags) = "yaml:\"feeder\""]; string validator = 4 [(gogoproto.moretags) = "yaml:\"validator\""]; @@ -51,22 +30,6 @@ message MsgAggregateExchangeRateVote { // MsgAggregateExchangeRateVoteResponse defines the Msg/AggregateExchangeRateVote response type. message MsgAggregateExchangeRateVoteResponse {} -// MsgAggregateExchangeRateVote represents a message to submit -// aggregate exchange rate vote. -message MsgAggregateExchangeRateCombinedVote { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string vote_salt = 1 [(gogoproto.moretags) = "yaml:\"vote_salt\""]; - string vote_exchange_rates = 2 [(gogoproto.moretags) = "yaml:\"vote_exchange_rates\""]; - string prevote_hash = 3 [(gogoproto.moretags) = "yaml:\"prevote_hash\""]; - string feeder = 4 [(gogoproto.moretags) = "yaml:\"feeder\""]; - string validator = 5 [(gogoproto.moretags) = "yaml:\"validator\""]; -} - -// MsgAggregateExchangeRateVoteResponse defines the Msg/AggregateExchangeRateVote response type. -message MsgAggregateExchangeRateCombinedVoteResponse {} - // MsgDelegateFeedConsent represents a message to // delegate oracle voting rights to another address. message MsgDelegateFeedConsent { diff --git a/x/oracle/README.md b/x/oracle/README.md index fec9b37a9a..5438bba193 100644 --- a/x/oracle/README.md +++ b/x/oracle/README.md @@ -2,11 +2,7 @@ Sei Network has an `oracle` module to support asset exchange rate pricing for use by other modules and contracts. When validating for the network, participation as an Oracle is expected and required in order to ensure the most reliable and accurate pricing for assets. -For oracle pricing, the voting rounds have several steps to ensure integrity and consensus of pricing data prior to accepting the exchange rates as the source of truth. In each voting period, there are two aggregation steps that oracles must participate in. - -The prevote step is a step where a validator provides their oracle pricing submission during voting window X for the next voting window X+1. In this prevote step, the validator hashes their proposed exchange rates to prevent other validators from simply copying that validator's votes. - -In the vote step for window X, the validator provides their proposed exchange rates for the current window. These are hashed and compared with the prevotes from window X-1 to ensure that the voted values haven't changed across the voting window. At the end of the voting period, all of the exchange rate votes are accumulated and a weighted median is computed (weighted by validator voting power) to determine the true exchange rate for each asset. +In the vote step for window X, the validator provides their proposed exchange rates for the current window. At the end of the voting period, all of the exchange rate votes are accumulated and a weighted median is computed (weighted by validator voting power) to determine the true exchange rate for each asset. There are penalties for non-participation and participation with bad data. Validators have a miss count that tracks the number of voting windows in which a validator has either not provided data or provided data that deviated too much from the weighted median. In a given number of voting periods, if a validators miss count is too high, they are slashed as a penalty for misbehaving over an extended period of time. diff --git a/x/oracle/abci_test.go b/x/oracle/abci_test.go index 609ff1d349..85d09a38df 100755 --- a/x/oracle/abci_test.go +++ b/x/oracle/abci_test.go @@ -1,7 +1,6 @@ package oracle_test import ( - "fmt" "math" "sort" "testing" @@ -24,52 +23,31 @@ func TestOracleThreshold(t *testing.T) { // Case 1. // Less than the threshold signs, exchange rate consensus fails - salt := "1" - hash := types.GetAggregateVoteHash(salt, exchangeRateStr, keeper.ValAddrs[0]) - prevoteMsg := types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[0], keeper.ValAddrs[0]) - voteMsg := types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, keeper.Addrs[0], keeper.ValAddrs[0]) + voteMsg := types.NewMsgAggregateExchangeRateVote(exchangeRateStr, keeper.Addrs[0], keeper.ValAddrs[0]) - _, err1 := h(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 := h(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) + _, err := h(input.Ctx.WithBlockHeight(1), voteMsg) + require.NoError(t, err) oracle.EndBlocker(input.Ctx.WithBlockHeight(1), input.OracleKeeper) - _, _, err := input.OracleKeeper.GetBaseExchangeRate(input.Ctx.WithBlockHeight(1), utils.MicroAtomDenom) + _, _, err = input.OracleKeeper.GetBaseExchangeRate(input.Ctx.WithBlockHeight(1), utils.MicroAtomDenom) require.Error(t, err) // Case 2. // More than the threshold signs, exchange rate consensus succeeds - salt = "1" - hash = types.GetAggregateVoteHash(salt, exchangeRateStr, keeper.ValAddrs[0]) - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[0], keeper.ValAddrs[0]) - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, keeper.Addrs[0], keeper.ValAddrs[0]) - - _, err1 = h(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 = h(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) - - salt = "2" - hash = types.GetAggregateVoteHash(salt, exchangeRateStr, keeper.ValAddrs[1]) - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[1], keeper.ValAddrs[1]) - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, keeper.Addrs[1], keeper.ValAddrs[1]) - - _, err1 = h(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 = h(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) - - salt = "3" - hash = types.GetAggregateVoteHash(salt, exchangeRateStr, keeper.ValAddrs[2]) - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[2], keeper.ValAddrs[2]) - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, keeper.Addrs[2], keeper.ValAddrs[2]) - - _, err1 = h(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 = h(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) + voteMsg = types.NewMsgAggregateExchangeRateVote(exchangeRateStr, keeper.Addrs[0], keeper.ValAddrs[0]) + + _, err = h(input.Ctx.WithBlockHeight(1), voteMsg) + require.NoError(t, err) + + voteMsg = types.NewMsgAggregateExchangeRateVote(exchangeRateStr, keeper.Addrs[1], keeper.ValAddrs[1]) + + _, err = h(input.Ctx.WithBlockHeight(1), voteMsg) + require.NoError(t, err) + + voteMsg = types.NewMsgAggregateExchangeRateVote(exchangeRateStr, keeper.Addrs[2], keeper.ValAddrs[2]) + _, err = h(input.Ctx.WithBlockHeight(1), voteMsg) + require.NoError(t, err) oracle.EndBlocker(input.Ctx.WithBlockHeight(1), input.OracleKeeper) @@ -83,25 +61,13 @@ func TestOracleThreshold(t *testing.T) { val, _ := input.StakingKeeper.GetValidator(input.Ctx, keeper.ValAddrs[2]) input.StakingKeeper.Delegate(input.Ctx.WithBlockHeight(0), keeper.Addrs[2], stakingAmt.MulRaw(3), stakingtypes.Unbonded, val, false) - salt = "1" - hash = types.GetAggregateVoteHash(salt, exchangeRateStr, keeper.ValAddrs[0]) - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[0], keeper.ValAddrs[0]) - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, keeper.Addrs[0], keeper.ValAddrs[0]) - - _, err1 = h(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 = h(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) - - salt = "2" - hash = types.GetAggregateVoteHash(salt, exchangeRateStr, keeper.ValAddrs[1]) - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[1], keeper.ValAddrs[1]) - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, keeper.Addrs[1], keeper.ValAddrs[1]) + voteMsg = types.NewMsgAggregateExchangeRateVote(exchangeRateStr, keeper.Addrs[0], keeper.ValAddrs[0]) + _, err = h(input.Ctx.WithBlockHeight(1), voteMsg) + require.NoError(t, err) - _, err1 = h(input.Ctx.WithBlockHeight(2), prevoteMsg) - _, err2 = h(input.Ctx.WithBlockHeight(3), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) + voteMsg = types.NewMsgAggregateExchangeRateVote(exchangeRateStr, keeper.Addrs[1], keeper.ValAddrs[1]) + _, err = h(input.Ctx.WithBlockHeight(3), voteMsg) + require.NoError(t, err) oracle.EndBlocker(input.Ctx.WithBlockHeight(3), input.OracleKeeper) @@ -118,7 +84,7 @@ func TestOracleDrop(t *testing.T) { input.OracleKeeper.SetBaseExchangeRate(input.Ctx, utils.MicroAtomDenom, randomExchangeRate) // Account 1, KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) // Immediately swap halt after an illiquid oracle vote oracle.EndBlocker(input.Ctx, input.OracleKeeper) @@ -142,15 +108,10 @@ func TestOracleTally(t *testing.T) { decExchangeRate := sdk.NewDecWithPrec(int64(rate*math.Pow10(keeper.OracleDecPrecision)), int64(keeper.OracleDecPrecision)) exchangeRateStr := decExchangeRate.String() + utils.MicroAtomDenom - salt := fmt.Sprintf("%d", i) - hash := types.GetAggregateVoteHash(salt, exchangeRateStr, valAddrs[i]) - prevoteMsg := types.NewMsgAggregateExchangeRatePrevote(hash, sdk.AccAddress(valAddrs[i]), valAddrs[i]) - voteMsg := types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, sdk.AccAddress(valAddrs[i]), valAddrs[i]) + voteMsg := types.NewMsgAggregateExchangeRateVote(exchangeRateStr, sdk.AccAddress(valAddrs[i]), valAddrs[i]) - _, err1 := h(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 := h(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) + _, err := h(input.Ctx.WithBlockHeight(1), voteMsg) + require.NoError(t, err) power := stakingAmt.QuoRaw(utils.MicroUnit).Int64() if decExchangeRate.IsZero() { @@ -219,7 +180,7 @@ func TestOracleTallyTiming(t *testing.T) { // all the keeper.Addrs vote for the block ... not last period block yet, so tally fails for i := range keeper.Addrs[:2] { - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, i) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, i) } params := input.OracleKeeper.GetParams(input.Ctx) @@ -253,13 +214,13 @@ func TestInvalidVotesSlashing(t *testing.T) { input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) // Account 1, KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) // Account 2, KRW, miss vote - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate.Add(sdk.NewDec(100000000000000))}}, 1) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate.Add(sdk.NewDec(100000000000000))}}, 1) // Account 3, KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) oracle.EndBlocker(input.Ctx, input.OracleKeeper) require.Equal(t, uint64(0), input.OracleKeeper.GetAbstainCount(input.Ctx, keeper.ValAddrs[1])) @@ -271,13 +232,13 @@ func TestInvalidVotesSlashing(t *testing.T) { // one more miss vote will inccur keeper.ValAddrs[1] slashing // Account 1, KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) // Account 2, KRW, miss vote - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate.Add(sdk.NewDec(100000000000000))}}, 1) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate.Add(sdk.NewDec(100000000000000))}}, 1) // Account 3, KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) input.Ctx = input.Ctx.WithBlockHeight(votePeriodsPerWindow - 1) oracle.EndBlocker(input.Ctx, input.OracleKeeper) @@ -295,9 +256,9 @@ func TestWhitelistSlashing(t *testing.T) { input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) // Account 2, KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) // Account 3, KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) oracle.EndBlocker(input.Ctx, input.OracleKeeper) require.Equal(t, uint64(0), input.OracleKeeper.GetMissCount(input.Ctx, keeper.ValAddrs[0])) @@ -310,9 +271,9 @@ func TestWhitelistSlashing(t *testing.T) { // one more miss vote will not incur in slashing because of implicit abstaining // Account 2, KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) // Account 3, KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) input.Ctx = input.Ctx.WithBlockHeight(votePeriodsPerWindow - 1) oracle.EndBlocker(input.Ctx, input.OracleKeeper) @@ -333,7 +294,7 @@ func TestNotPassedBallotSlashing(t *testing.T) { input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) // Account 1, KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) + makeAggregateVote(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.GetMissCount(input.Ctx, keeper.ValAddrs[0])) @@ -357,11 +318,11 @@ func TestNotPassedBallotSlashingInvalidVotes(t *testing.T) { input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) // Account 1 - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) // Account 2 - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) // Account 3 - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate.Add(sdk.NewDec(100000000000000))}}, 2) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate.Add(sdk.NewDec(100000000000000))}}, 2) oracle.EndBlocker(input.Ctx, input.OracleKeeper) @@ -397,17 +358,17 @@ func TestInvalidVoteOnAssetUnderThresholdMisses(t *testing.T) { input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) // Account 1 - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: randomExchangeRate}}, 0) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: randomExchangeRate}}, 0) // Account 2 - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: randomExchangeRate}}, 1) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: randomExchangeRate}}, 1) // Account 3 - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: randomExchangeRate}}, 2) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: randomExchangeRate}}, 2) // rest of accounts - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: randomExchangeRate}}, 3) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: randomExchangeRate}}, 4) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 5) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 6) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: randomExchangeRate}}, 3) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: randomExchangeRate}}, 4) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 5) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 6) oracle.EndBlocker(input.Ctx, input.OracleKeeper) endBlockerHeight := input.Ctx.BlockHeight() @@ -436,17 +397,17 @@ func TestInvalidVoteOnAssetUnderThresholdMisses(t *testing.T) { input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) // Account 1 - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: anotherRandomExchangeRate}}, 0) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: anotherRandomExchangeRate}}, 0) // Account 2 - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: anotherRandomExchangeRate}}, 1) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: anotherRandomExchangeRate}}, 1) // Account 3 - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: anotherRandomExchangeRate.Add(sdk.NewDec(100000000000000))}}, 2) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}, {Denom: utils.MicroEthDenom, Amount: anotherRandomExchangeRate.Add(sdk.NewDec(100000000000000))}}, 2) // rest of accounts meet threshold only for one asset - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}}, 3) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}}, 4) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}}, 5) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}}, 6) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}}, 3) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}}, 4) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}}, 5) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: anotherRandomExchangeRate}}, 6) oracle.EndBlocker(input.Ctx, input.OracleKeeper) newEndBlockerHeight := input.Ctx.BlockHeight() @@ -494,13 +455,13 @@ func TestAbstainSlashing(t *testing.T) { input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) // Account 1, KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) // Account 2, KRW, abstain vote - should count as miss - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.ZeroDec()}}, 1) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.ZeroDec()}}, 1) // Account 3, KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) + makeAggregateVote(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])) @@ -525,9 +486,9 @@ func TestVoteTargets(t *testing.T) { input.OracleKeeper.SetVoteTarget(input.Ctx, utils.MicroAtomDenom) // KRW - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) oracle.EndBlocker(input.Ctx, input.OracleKeeper) @@ -547,9 +508,9 @@ func TestVoteTargets(t *testing.T) { input.OracleKeeper.SetParams(input.Ctx, params) // KRW, missing - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) oracle.EndBlocker(input.Ctx, input.OracleKeeper) @@ -567,9 +528,9 @@ func TestVoteTargets(t *testing.T) { input.OracleKeeper.SetParams(input.Ctx, params) // KRW, no missing - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) oracle.EndBlocker(input.Ctx, input.OracleKeeper) @@ -586,7 +547,7 @@ func TestAbstainWithSmallStakingPower(t *testing.T) { input.OracleKeeper.ClearVoteTargets(input.Ctx) input.OracleKeeper.SetVoteTarget(input.Ctx, utils.MicroAtomDenom) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.ZeroDec()}}, 0) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.ZeroDec()}}, 0) oracle.EndBlocker(input.Ctx, input.OracleKeeper) _, _, err := input.OracleKeeper.GetBaseExchangeRate(input.Ctx, utils.MicroAtomDenom) @@ -602,9 +563,9 @@ func TestOraclePriceSnapshot(t *testing.T) { input.OracleKeeper.SetBaseExchangeRate(input.Ctx, utils.MicroAtomDenom, randomExchangeRate) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 0) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 1) + makeAggregateVote(t, input, h, 0, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: randomExchangeRate}}, 2) oracle.EndBlocker(input.Ctx, input.OracleKeeper) @@ -647,56 +608,8 @@ func TestOraclePriceSnapshot(t *testing.T) { require.Equal(t, expected2, input.OracleKeeper.GetPriceSnapshot(input.Ctx, 200)) } -func TestOracleCombinedVote(t *testing.T) { - input, h := setup(t) - - input.Ctx = input.Ctx.WithBlockHeight(1) - input.OracleKeeper.SetBaseExchangeRate(input.Ctx, utils.MicroAtomDenom, randomExchangeRate) - - input.Ctx = input.Ctx.WithBlockHeight(2) - makeAggregateCombinedVote(t, input, h, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.NewDec(1)}}, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.NewDec(2)}}, 0) - makeAggregateCombinedVote(t, input, h, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.NewDec(1)}}, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.NewDec(2)}}, 1) - makeAggregateCombinedVote(t, input, h, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.NewDec(1)}}, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.NewDec(2)}}, 2) - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - - // we expect random exchange rate because the vote had no prevote - rate, height, err := input.OracleKeeper.GetBaseExchangeRate(input.Ctx, utils.MicroAtomDenom) - require.NoError(t, err) - require.Equal(t, randomExchangeRate, rate) - require.Equal(t, sdk.NewInt(1), height) - - input.Ctx = input.Ctx.WithBlockHeight(3) - makeAggregateCombinedVote(t, input, h, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.NewDec(2)}}, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.NewDec(3)}}, 0) - makeAggregateCombinedVote(t, input, h, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.NewDec(2)}}, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.NewDec(3)}}, 1) - makeAggregateCombinedVote(t, input, h, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.NewDec(2)}}, sdk.DecCoins{{Denom: utils.MicroAtomDenom, Amount: sdk.NewDec(3)}}, 2) - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - - // we expect exchange rate of 2 because the vote had a previous prevote - rate, height, err = input.OracleKeeper.GetBaseExchangeRate(input.Ctx, utils.MicroAtomDenom) - require.NoError(t, err) - require.Equal(t, sdk.NewDec(2), rate) - require.Equal(t, sdk.NewInt(3), height) -} - -func makeAggregatePrevoteAndVote(t *testing.T, input keeper.TestInput, h sdk.Handler, height int64, rates sdk.DecCoins, idx int) { - // Account 1, SDR - salt := "1" - hash := types.GetAggregateVoteHash(salt, rates.String(), keeper.ValAddrs[idx]) - - prevoteMsg := types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[idx], keeper.ValAddrs[idx]) - _, err := h(input.Ctx.WithBlockHeight(height), prevoteMsg) - require.NoError(t, err) - - voteMsg := types.NewMsgAggregateExchangeRateVote(salt, rates.String(), keeper.Addrs[idx], keeper.ValAddrs[idx]) - _, err = h(input.Ctx.WithBlockHeight(height+1), voteMsg) - require.NoError(t, err) -} - -func makeAggregateCombinedVote(t *testing.T, input keeper.TestInput, h sdk.Handler, vote_rates sdk.DecCoins, prevote_rates sdk.DecCoins, idx int) { - salt := "1" - - hash := types.GetAggregateVoteHash(salt, prevote_rates.String(), keeper.ValAddrs[idx]) - voteMsg := types.NewMsgAggregateExchangeRateCombinedVote(salt, vote_rates.String(), hash, keeper.Addrs[idx], keeper.ValAddrs[idx]) - _, err := h(input.Ctx, voteMsg) +func makeAggregateVote(t *testing.T, input keeper.TestInput, h sdk.Handler, height int64, rates sdk.DecCoins, idx int) { + voteMsg := types.NewMsgAggregateExchangeRateVote(rates.String(), keeper.Addrs[idx], keeper.ValAddrs[idx]) + _, err := h(input.Ctx.WithBlockHeight(height), voteMsg) require.NoError(t, err) } diff --git a/x/oracle/ante.go b/x/oracle/ante.go index 37fcf2feb8..8cd469fda5 100644 --- a/x/oracle/ante.go +++ b/x/oracle/ante.go @@ -13,19 +13,17 @@ import ( // SpammingPreventionDecorator will check if the transaction's gas is smaller than // configured hard cap type SpammingPreventionDecorator struct { - oracleKeeper keeper.Keeper - oraclePrevoteMap map[string]int64 - oracleVoteMap map[string]int64 - mu *sync.Mutex + oracleKeeper keeper.Keeper + oracleVoteMap map[string]int64 + mu *sync.Mutex } // NewSpammingPreventionDecorator returns new spamming prevention decorator instance func NewSpammingPreventionDecorator(oracleKeeper keeper.Keeper) SpammingPreventionDecorator { return SpammingPreventionDecorator{ - oracleKeeper: oracleKeeper, - oraclePrevoteMap: make(map[string]int64), - oracleVoteMap: make(map[string]int64), - mu: &sync.Mutex{}, + oracleKeeper: oracleKeeper, + oracleVoteMap: make(map[string]int64), + mu: &sync.Mutex{}, } } @@ -55,28 +53,6 @@ func (spd SpammingPreventionDecorator) CheckOracleSpamming(ctx sdk.Context, msgs curHeight := ctx.BlockHeight() for _, msg := range msgs { switch msg := msg.(type) { - case *types.MsgAggregateExchangeRatePrevote: - feederAddr, err := sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - return err - } - - valAddr, err := sdk.ValAddressFromBech32(msg.Validator) - if err != nil { - return err - } - - err = spd.oracleKeeper.ValidateFeeder(ctx, feederAddr, valAddr) - if err != nil { - return err - } - - if lastSubmittedHeight, ok := spd.oraclePrevoteMap[msg.Validator]; ok && lastSubmittedHeight == curHeight { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "the validator has already been submitted prevote at the current height") - } - - spd.oraclePrevoteMap[msg.Validator] = curHeight - continue case *types.MsgAggregateExchangeRateVote: feederAddr, err := sdk.AccAddressFromBech32(msg.Feeder) if err != nil { @@ -97,28 +73,6 @@ func (spd SpammingPreventionDecorator) CheckOracleSpamming(ctx sdk.Context, msgs return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "the validator has already been submitted vote at the current height") } - spd.oracleVoteMap[msg.Validator] = curHeight - continue - case *types.MsgAggregateExchangeRateCombinedVote: - feederAddr, err := sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - return err - } - - valAddr, err := sdk.ValAddressFromBech32(msg.Validator) - if err != nil { - return err - } - - err = spd.oracleKeeper.ValidateFeeder(ctx, feederAddr, valAddr) - if err != nil { - return err - } - - if lastSubmittedHeight, ok := spd.oracleVoteMap[msg.Validator]; ok && lastSubmittedHeight == curHeight { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "the validator has already been submitted vote at the current height") - } - spd.oracleVoteMap[msg.Validator] = curHeight continue default: diff --git a/x/oracle/client/cli/query.go b/x/oracle/client/cli/query.go index b05e6ecb4b..f88b04fad4 100755 --- a/x/oracle/client/cli/query.go +++ b/x/oracle/client/cli/query.go @@ -32,7 +32,6 @@ func GetQueryCmd() *cobra.Command { GetCmdQueryParams(), GetCmdQueryFeederDelegation(), GetCmdQueryVotePenaltyCounter(), - GetCmdQueryAggregatePrevote(), GetCmdQueryAggregateVote(), GetCmdQueryVoteTargets(), ) @@ -296,63 +295,7 @@ $ seid query oracle miss seivaloper... return cmd } -// GetCmdQueryAggregatePrevote implements the query aggregate prevote of the validator command -func GetCmdQueryAggregatePrevote() *cobra.Command { - cmd := &cobra.Command{ - Use: "aggregate-prevotes [validator]", - Args: cobra.RangeArgs(0, 1), - Short: "Query outstanding oracle aggregate prevotes.", - Long: strings.TrimSpace(` -Query outstanding oracle aggregate prevotes. - -$ terrad query oracle aggregate-prevotes - -Or, can filter with voter address - -$ terrad query oracle aggregate-prevotes terravaloper... -`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - if len(args) == 0 { - res, err := queryClient.AggregatePrevotes( - context.Background(), - &types.QueryAggregatePrevotesRequest{}, - ) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - } - - valString := args[0] - validator, err := sdk.ValAddressFromBech32(valString) - if err != nil { - return err - } - - res, err := queryClient.AggregatePrevote( - context.Background(), - &types.QueryAggregatePrevoteRequest{ValidatorAddr: validator.String()}, - ) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - -// GetCmdQueryAggregateVote implements the query aggregate prevote of the validator command +// GetCmdQueryAggregateVote implements the query aggregate vote of the validator command func GetCmdQueryAggregateVote() *cobra.Command { cmd := &cobra.Command{ Use: "aggregate-votes [validator]", diff --git a/x/oracle/client/cli/tx.go b/x/oracle/client/cli/tx.go index 0a286120a9..14d56f0c89 100755 --- a/x/oracle/client/cli/tx.go +++ b/x/oracle/client/cli/tx.go @@ -28,9 +28,7 @@ func GetTxCmd() *cobra.Command { oracleTxCmd.AddCommand( GetCmdDelegateFeederPermission(), - GetCmdAggregateExchangeRatePrevote(), GetCmdAggregateExchangeRateVote(), - GetCmdAggregateExchangeRateCombinedVote(), ) return oracleTxCmd @@ -85,85 +83,19 @@ where "terra1..." is the address you want to delegate your voting rights to. return cmd } -// GetCmdAggregateExchangeRatePrevote will create a aggregateExchangeRatePrevote tx and sign it with the given key. -func GetCmdAggregateExchangeRatePrevote() *cobra.Command { - cmd := &cobra.Command{ - Use: "aggregate-prevote [salt] [exchange-rates] [validator]", - Args: cobra.RangeArgs(2, 3), - Short: "Submit an oracle aggregate prevote for the exchange rates of Luna", - Long: strings.TrimSpace(` -Submit an oracle aggregate prevote for the exchange rates of Luna denominated in multiple denoms. -The purpose of aggregate prevote is to hide aggregate exchange rate vote with hash which is formatted -as hex string in SHA256("{salt}:{exchange_rate}{denom},...,{exchange_rate}{denom}:{voter}") - -# Aggregate Prevote -$ terrad tx oracle aggregate-prevote 1234 8888.0ukrw,1.243uusd,0.99usdr - -where "ukrw,uusd,usdr" is the denominating currencies, and "8888.0,1.243,0.99" is the exchange rates of micro Luna in micro denoms from the voter's point of view. - -If voting from a voting delegate, set "validator" to the address of the validator to vote on behalf of: -$ terrad tx oracle aggregate-prevote 1234 8888.0ukrw,1.243uusd,0.99usdr terravaloper1... -`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - salt := args[0] - exchangeRatesStr := args[1] - _, err = types.ParseExchangeRateTuples(exchangeRatesStr) - if err != nil { - return fmt.Errorf("given exchange_rates {%s} is not a valid format; exchange_rate should be formatted as DecCoins; %s", exchangeRatesStr, err.Error()) - } - - // Get from address - voter := clientCtx.GetFromAddress() - - // By default the voter is voting on behalf of itself - validator := sdk.ValAddress(voter) - - // Override validator if validator is given - if len(args) == 3 { - parsedVal, err := sdk.ValAddressFromBech32(args[2]) - if err != nil { - return errors.Wrap(err, "validator address is invalid") - } - validator = parsedVal - } - - hash := types.GetAggregateVoteHash(salt, exchangeRatesStr, validator) - msgs := []sdk.Msg{types.NewMsgAggregateExchangeRatePrevote(hash, voter, validator)} - for _, msg := range msgs { - if err := msg.ValidateBasic(); err != nil { - return err - } - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msgs...) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - // GetCmdAggregateExchangeRateVote will create a aggregateExchangeRateVote tx and sign it with the given key. func GetCmdAggregateExchangeRateVote() *cobra.Command { cmd := &cobra.Command{ - Use: "aggregate-vote [salt] [exchange-rates] [validator]", - Args: cobra.RangeArgs(2, 3), + Use: "aggregate-vote [exchange-rates] [validator]", + Args: cobra.RangeArgs(1, 2), Short: "Submit an oracle aggregate vote for the exchange_rates of the base denom", Long: strings.TrimSpace(` -Submit a aggregate vote for the exchange_rates of the base denom w.r.t the input denom. Companion to a prevote submitted in the previous vote period. +Submit a aggregate vote for the exchange_rates of the base denom w.r.t the input denom. -$ seid tx oracle aggregate-vote 1234 8888.0ukrw,1.243uusd,0.99usdr +$ seid tx oracle aggregate-vote 8888.0ukrw,1.243uusd,0.99usdr where "ukrw,uusd,usdr" is the denominating currencies, and "8888.0,1.243,0.99" is the exchange rates of micro Luna in micro denoms from the voter's point of view. -"salt" should match the salt used to generate the SHA256 hex in the aggregated pre-vote. - If voting from a voting delegate, set "validator" to the address of the validator to vote on behalf of: $ seid tx oracle aggregate-vote 1234 8888.0ukrw,1.243uusd,0.99usdr seivaloper1.... `), @@ -173,8 +105,7 @@ $ seid tx oracle aggregate-vote 1234 8888.0ukrw,1.243uusd,0.99usdr seivaloper1.. return err } - salt := args[0] - exchangeRatesStr := args[1] + exchangeRatesStr := args[0] _, err = types.ParseExchangeRateTuples(exchangeRatesStr) if err != nil { return fmt.Errorf("given exchange_rate {%s} is not a valid format; exchange rate should be formatted as DecCoin; %s", exchangeRatesStr, err.Error()) @@ -187,87 +118,15 @@ $ seid tx oracle aggregate-vote 1234 8888.0ukrw,1.243uusd,0.99usdr seivaloper1.. validator := sdk.ValAddress(voter) // Override validator if validator is given - if len(args) == 3 { - parsedVal, err := sdk.ValAddressFromBech32(args[2]) - if err != nil { - return errors.Wrap(err, "validator address is invalid") - } - validator = parsedVal - } - - msgs := []sdk.Msg{types.NewMsgAggregateExchangeRateVote(salt, exchangeRatesStr, voter, validator)} - for _, msg := range msgs { - if err := msg.ValidateBasic(); err != nil { - return err - } - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msgs...) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -// GetCmdAggregateExchangeRatePrevote will create a aggregateExchangeRatePrevote tx and sign it with the given key. -func GetCmdAggregateExchangeRateCombinedVote() *cobra.Command { - cmd := &cobra.Command{ - Use: "aggregate-combined-vote [vote-salt] [vote-exchange-rates] [prevote-salt] [prevote-exchange-rates] [validator]", - Args: cobra.RangeArgs(4, 5), - Short: "Submit an oracle aggregate vote AND prevote for the exchange rates", - Long: strings.TrimSpace(` -Submit an oracle aggregate vote and prevote for the exchange rates of the base denom denominated in multiple denoms. The vote is a companian to a prevote from the previous vote window. - -The purpose of aggregate prevote is to hide aggregate exchange rate vote with hash which is formatted -as hex string in SHA256("{salt}:{exchange_rate}{denom},...,{exchange_rate}{denom}:{voter}") - -# Aggregate Combined Vote -$ seid tx oracle aggregate-combined-vote 1234 8888.0ukrw,1.243uusd,0.99usdr 3456 9999.0ukrw,1.111uusd,0.95usdr - -where "ukrw,uusd,usdr" is the denominating currencies, and "8888.0,1.243,0.99" is the exchange rates of micro base denom in micro denoms from the voter's point of view. - -If voting from a voting delegate, set "validator" to the address of the validator to vote on behalf of: -$ terrad tx oracle aggregate-combined vote 1234 8888.0ukrw,1.243uusd,0.99usdr 3456 9999.0ukrw,1.111uusd,0.95usdr seivaloper1... -`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - voteSalt := args[0] - voteExchangeRatesStr := args[1] - prevoteSalt := args[2] - prevoteExchangeRatesStr := args[3] - _, err = types.ParseExchangeRateTuples(voteExchangeRatesStr) - if err != nil { - return fmt.Errorf("given vote exchange_rates {%s} is not a valid format; exchange_rate should be formatted as DecCoins; %s", voteExchangeRatesStr, err.Error()) - } - - _, err = types.ParseExchangeRateTuples(prevoteExchangeRatesStr) - if err != nil { - return fmt.Errorf("given prevote exchange_rates {%s} is not a valid format; exchange_rate should be formatted as DecCoins; %s", prevoteExchangeRatesStr, err.Error()) - } - - // Get from address - voter := clientCtx.GetFromAddress() - - // By default the voter is voting on behalf of itself - validator := sdk.ValAddress(voter) - - // Override validator if validator is given - if len(args) == 5 { - parsedVal, err := sdk.ValAddressFromBech32(args[4]) + if len(args) == 2 { + parsedVal, err := sdk.ValAddressFromBech32(args[1]) if err != nil { return errors.Wrap(err, "validator address is invalid") } validator = parsedVal } - hash := types.GetAggregateVoteHash(prevoteSalt, prevoteExchangeRatesStr, validator) - msgs := []sdk.Msg{types.NewMsgAggregateExchangeRateCombinedVote(voteSalt, voteExchangeRatesStr, hash, voter, validator)} + msgs := []sdk.Msg{types.NewMsgAggregateExchangeRateVote(exchangeRatesStr, voter, validator)} for _, msg := range msgs { if err := msg.ValidateBasic(); err != nil { return err diff --git a/x/oracle/client/rest/query.go b/x/oracle/client/rest/query.go index 3c4586cfdd..180ad69e68 100755 --- a/x/oracle/client/rest/query.go +++ b/x/oracle/client/rest/query.go @@ -23,9 +23,7 @@ func registerQueryRoutes(cliCtx client.Context, rtr *mux.Router) { 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}/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") rtr.HandleFunc("/oracle/voters/aggregate_votes", queryAggregateVotesHandlerFunction(cliCtx)).Methods("GET") rtr.HandleFunc("/oracle/parameters", queryParamsHandlerFunction(cliCtx)).Methods("GET") } @@ -207,33 +205,6 @@ func queryVotePenaltyCounterHandlerFunction(cliCtx client.Context) http.HandlerF } } -func queryAggregatePrevoteHandlerFunction(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) - if !ok { - return - } - - voterAddr, ok := checkVoterAddressVar(w, r) - if !ok { - return - } - - params := types.NewQueryAggregatePrevoteParams(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.QueryAggregatePrevote), bz) - if rest.CheckInternalServerError(w, err) { - return - } - - cliCtx = cliCtx.WithHeight(height) - rest.PostProcessResponse(w, cliCtx, res) - } -} - func queryAggregateVoteHandlerFunction(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) @@ -261,23 +232,6 @@ func queryAggregateVoteHandlerFunction(cliCtx client.Context) http.HandlerFunc { } } -func queryAggregatePrevotesHandlerFunction(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) - if !ok { - return - } - - res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryAggregatePrevotes), nil) - if rest.CheckInternalServerError(w, err) { - return - } - - cliCtx = cliCtx.WithHeight(height) - rest.PostProcessResponse(w, cliCtx, res) - } -} - func queryAggregateVotesHandlerFunction(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) diff --git a/x/oracle/client/rest/tx.go b/x/oracle/client/rest/tx.go index 1a92f4c2bf..d66b4850d6 100755 --- a/x/oracle/client/rest/tx.go +++ b/x/oracle/client/rest/tx.go @@ -16,9 +16,7 @@ import ( func registerTxHandlers(cliCtx client.Context, rtr *mux.Router) { rtr.HandleFunc(fmt.Sprintf("/oracle/voters/{%s}/feeder", RestVoter), newDelegateHandlerFunction(cliCtx)).Methods("POST") - rtr.HandleFunc(fmt.Sprintf("/oracle/voters/{%s}/aggregate_prevote", RestVoter), newAggregatePrevoteHandlerFunction(cliCtx)).Methods("POST") rtr.HandleFunc(fmt.Sprintf("/oracle/voters/{%s}/aggregate_vote", RestVoter), newAggregateVoteHandlerFunction(cliCtx)).Methods("POST") - rtr.HandleFunc(fmt.Sprintf("/oracle/voters/{%s}/aggregate_combined_vote", RestVoter), newAggregateCombinedVoteHandlerFunction(cliCtx)).Methods("POST") } type ( @@ -27,29 +25,10 @@ type ( Feeder sdk.AccAddress `json:"feeder" yaml:"feeder"` } - aggregatePrevoteReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - - Hash string `json:"hash" yaml:"hash"` - ExchangeRates string `json:"exchange_rates" yaml:"exchange_rates"` - Salt string `json:"salt" yaml:"salt"` - } - aggregateVoteReq struct { BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` ExchangeRates string `json:"exchange_rates" yaml:"exchange_rates"` - Salt string `json:"salt" yaml:"salt"` - } - - aggregateCombinedVoteReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - - VoteExchangeRates string `json:"vote_exchange_rates" yaml:"vote_exchange_rates"` - VoteSalt string `json:"vote_salt" yaml:"vote_salt"` - PrevoteHash string `json:"prevote_hash" yaml:"prevote_hash"` - PrevoteExchangeRates string `json:"prevote_exchange_rates" yaml:"prevote_exchange_rates"` - PrevoteSalt string `json:"prevote_salt" yaml:"prevote_salt"` } ) @@ -80,61 +59,6 @@ func newDelegateHandlerFunction(clientCtx client.Context) http.HandlerFunc { } } -func newAggregatePrevoteHandlerFunction(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req aggregatePrevoteReq - if !rest.ReadRESTReq(w, r, clientCtx.LegacyAmino, &req) { - return - } - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - feederAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) - if rest.CheckBadRequestError(w, err) { - return - } - - voterAddr, ok := checkVoterAddressVar(w, r) - if !ok { - return - } - - var hash types.AggregateVoteHash - - // If hash is not given, then retrieve hash from exchange_rate and salt - //nolint:gocritic // ignore for now - if len(req.Hash) == 0 && (len(req.ExchangeRates) > 0 && len(req.Salt) > 0) { - _, err := types.ParseExchangeRateTuples(req.ExchangeRates) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - hash = types.GetAggregateVoteHash(req.Salt, req.ExchangeRates, voterAddr) - } else if len(req.Hash) > 0 { - hash, err = types.AggregateVoteHashFromHexString(req.Hash) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - } else { - rest.WriteErrorResponse(w, http.StatusBadRequest, "must provide Hash or (ExchangeRates & Salt)") - return - } - - // create the message - msg := types.NewMsgAggregateExchangeRatePrevote(hash, feederAddr, voterAddr) - if rest.CheckBadRequestError(w, msg.ValidateBasic()) { - return - } - - tx.WriteGeneratedTxResponse(clientCtx, w, req.BaseReq, msg) - } -} - func newAggregateVoteHandlerFunction(clientCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req aggregateVoteReq @@ -165,67 +89,7 @@ func newAggregateVoteHandlerFunction(clientCtx client.Context) http.HandlerFunc } // create the message - msg := types.NewMsgAggregateExchangeRateVote(req.Salt, req.ExchangeRates, feederAddr, voterAddr) - if rest.CheckBadRequestError(w, msg.ValidateBasic()) { - return - } - - tx.WriteGeneratedTxResponse(clientCtx, w, req.BaseReq, msg) - } -} - -func newAggregateCombinedVoteHandlerFunction(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req aggregateCombinedVoteReq - if !rest.ReadRESTReq(w, r, clientCtx.LegacyAmino, &req) { - return - } - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - feederAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) - if rest.CheckBadRequestError(w, err) { - return - } - - voterAddr, ok := checkVoterAddressVar(w, r) - if !ok { - return - } - - // Check validation of tuples - _, err = types.ParseExchangeRateTuples(req.VoteExchangeRates) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - var prevoteHash types.AggregateVoteHash - - // If hash is not given, then retrieve hash from exchange_rate and salt - if len(req.PrevoteHash) == 0 && (len(req.PrevoteExchangeRates) > 0 && len(req.PrevoteSalt) > 0) { //nolint:gocritic // ignore for now (possible performance gains here) - _, err := types.ParseExchangeRateTuples(req.PrevoteExchangeRates) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - prevoteHash = types.GetAggregateVoteHash(req.PrevoteSalt, req.PrevoteExchangeRates, voterAddr) - } else if len(req.PrevoteHash) > 0 { - prevoteHash, err = types.AggregateVoteHashFromHexString(req.PrevoteHash) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - } else { - rest.WriteErrorResponse(w, http.StatusBadRequest, "must provide Hash or (ExchangeRates & Salt)") - return - } - - msg := types.NewMsgAggregateExchangeRateCombinedVote(req.VoteSalt, req.VoteExchangeRates, prevoteHash, feederAddr, voterAddr) + msg := types.NewMsgAggregateExchangeRateVote(req.ExchangeRates, feederAddr, voterAddr) if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } diff --git a/x/oracle/exported/alias.go b/x/oracle/exported/alias.go index 904ea8c947..a43c7cbb3f 100755 --- a/x/oracle/exported/alias.go +++ b/x/oracle/exported/alias.go @@ -4,6 +4,5 @@ package exported import "github.com/sei-protocol/sei-chain/x/oracle/types" type ( - MsgAggregateExchangeRatePrevote = types.MsgAggregateExchangeRatePrevote - MsgAggregateExchangeRateVote = types.MsgAggregateExchangeRateVote + MsgAggregateExchangeRateVote = types.MsgAggregateExchangeRateVote ) diff --git a/x/oracle/genesis.go b/x/oracle/genesis.go index bb75d99dcd..52ff1ce91e 100755 --- a/x/oracle/genesis.go +++ b/x/oracle/genesis.go @@ -39,15 +39,6 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState keeper.SetVotePenaltyCounter(ctx, operator, pc.VotePenaltyCounter.MissCount, pc.VotePenaltyCounter.AbstainCount) } - for _, ap := range data.AggregateExchangeRatePrevotes { - valAddr, err := sdk.ValAddressFromBech32(ap.Voter) - if err != nil { - panic(err) - } - - keeper.SetAggregateExchangeRatePrevote(ctx, valAddr, ap) - } - for _, av := range data.AggregateExchangeRateVotes { valAddr, err := sdk.ValAddressFromBech32(av.Voter) if err != nil { @@ -95,12 +86,6 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { return false }) - aggregateExchangeRatePrevotes := []types.AggregateExchangeRatePrevote{} - keeper.IterateAggregateExchangeRatePrevotes(ctx, func(_ sdk.ValAddress, aggregatePrevote types.AggregateExchangeRatePrevote) (stop bool) { - aggregateExchangeRatePrevotes = append(aggregateExchangeRatePrevotes, aggregatePrevote) - return false - }) - aggregateExchangeRateVotes := []types.AggregateExchangeRateVote{} keeper.IterateAggregateExchangeRateVotes(ctx, func(_ sdk.ValAddress, aggregateVote types.AggregateExchangeRateVote) bool { aggregateExchangeRateVotes = append(aggregateExchangeRateVotes, aggregateVote) @@ -111,6 +96,5 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { exchangeRates, feederDelegations, penaltyCounters, - aggregateExchangeRatePrevotes, aggregateExchangeRateVotes) } diff --git a/x/oracle/genesis_test.go b/x/oracle/genesis_test.go index 4d64487ad1..3491f54eae 100755 --- a/x/oracle/genesis_test.go +++ b/x/oracle/genesis_test.go @@ -17,7 +17,6 @@ func TestExportInitGenesis(t *testing.T) { input.OracleKeeper.SetFeederDelegation(input.Ctx, keeper.ValAddrs[0], keeper.Addrs[1]) input.OracleKeeper.SetBaseExchangeRate(input.Ctx, "denom", sdk.NewDec(123)) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, keeper.ValAddrs[0], types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{123}, keeper.ValAddrs[0], uint64(2))) input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, keeper.ValAddrs[0], types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Denom: "foo", ExchangeRate: sdk.NewDec(123)}}, keeper.ValAddrs[0])) input.OracleKeeper.SetVoteTarget(input.Ctx, "denom") input.OracleKeeper.SetVoteTarget(input.Ctx, "denom2") diff --git a/x/oracle/handler.go b/x/oracle/handler.go index fab99cd3bf..8490bcadc7 100755 --- a/x/oracle/handler.go +++ b/x/oracle/handler.go @@ -19,15 +19,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgDelegateFeedConsent: res, err := msgServer.DelegateFeedConsent(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgAggregateExchangeRatePrevote: - res, err := msgServer.AggregateExchangeRatePrevote(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) case *types.MsgAggregateExchangeRateVote: res, err := msgServer.AggregateExchangeRateVote(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgAggregateExchangeRateCombinedVote: - res, err := msgServer.AggregateExchangeRateCombinedVote(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) default: return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized oracle message type: %T", msg) } diff --git a/x/oracle/handler_test.go b/x/oracle/handler_test.go index 7c9c29a7ca..e29b5cb0bf 100755 --- a/x/oracle/handler_test.go +++ b/x/oracle/handler_test.go @@ -23,58 +23,33 @@ func TestOracleFilters(t *testing.T) { _, err := h(input.Ctx, &bankMsg) require.Error(t, err) - // Case 2: Normal MsgAggregateExchangeRatePrevote submission goes through - salt := "1" - - hash := types.GetAggregateVoteHash(salt, randomExchangeRate.String()+utils.MicroAtomDenom, keeper.ValAddrs[0]) - prevoteMsg := types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[0], keeper.ValAddrs[0]) - _, err = h(input.Ctx, prevoteMsg) - require.NoError(t, err) - - // // Case 3: Normal MsgAggregateExchangeRateVote submission goes through keeper.Addrs - voteMsg := types.NewMsgAggregateExchangeRateVote(salt, randomExchangeRate.String()+utils.MicroAtomDenom, keeper.Addrs[0], keeper.ValAddrs[0]) + // // Case 2: Normal MsgAggregateExchangeRateVote submission goes through keeper.Addrs + voteMsg := types.NewMsgAggregateExchangeRateVote(randomExchangeRate.String()+utils.MicroAtomDenom, keeper.Addrs[0], keeper.ValAddrs[0]) _, err = h(input.Ctx.WithBlockHeight(1), voteMsg) require.NoError(t, err) - // Case 4: a non-validator sending an oracle message fails + // Case 3: a non-validator sending an oracle message fails nonValidatorPub := secp256k1.GenPrivKey().PubKey() nonValidatorAddr := nonValidatorPub.Address() - salt = "2" - hash = types.GetAggregateVoteHash(salt, randomExchangeRate.String()+utils.MicroAtomDenom, sdk.ValAddress(nonValidatorAddr)) - - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, sdk.AccAddress(nonValidatorAddr), sdk.ValAddress(nonValidatorAddr)) - _, err = h(input.Ctx, prevoteMsg) + voteMsg = types.NewMsgAggregateExchangeRateVote(randomExchangeRate.String()+utils.MicroAtomDenom, sdk.AccAddress(nonValidatorAddr), sdk.ValAddress(nonValidatorAddr)) + _, err = h(input.Ctx, voteMsg) require.Error(t, err) } func TestFeederDelegation(t *testing.T) { input, h := setup(t) - - salt := "1" - hash := types.GetAggregateVoteHash(salt, randomExchangeRate.String()+utils.MicroAtomDenom, keeper.ValAddrs[0]) - // Case 1: empty message delegateFeedConsentMsg := types.MsgDelegateFeedConsent{} _, err := h(input.Ctx, &delegateFeedConsentMsg) require.Error(t, err) - // Case 2: Normal Prevote - without delegation - prevoteMsg := types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[0], keeper.ValAddrs[0]) - _, err = h(input.Ctx, prevoteMsg) - require.NoError(t, err) - - // Case 2.1: Normal Prevote - with delegation fails - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[1], keeper.ValAddrs[0]) - _, err = h(input.Ctx, prevoteMsg) - require.Error(t, err) - - // Case 2.2: Normal Vote - without delegation - voteMsg := types.NewMsgAggregateExchangeRateVote(salt, randomExchangeRate.String()+utils.MicroAtomDenom, keeper.Addrs[0], keeper.ValAddrs[0]) + // Case 2.1: Normal Vote - without delegation + voteMsg := types.NewMsgAggregateExchangeRateVote(randomExchangeRate.String()+utils.MicroAtomDenom, keeper.Addrs[0], keeper.ValAddrs[0]) _, err = h(input.Ctx.WithBlockHeight(1), voteMsg) require.NoError(t, err) - // Case 2.3: Normal Vote - with delegation fails - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, randomExchangeRate.String()+utils.MicroAtomDenom, keeper.Addrs[1], keeper.ValAddrs[0]) + // Case 2.2: Normal Vote - with delegation fails + voteMsg = types.NewMsgAggregateExchangeRateVote(randomExchangeRate.String()+utils.MicroAtomDenom, keeper.Addrs[1], keeper.ValAddrs[0]) _, err = h(input.Ctx.WithBlockHeight(1), voteMsg) require.Error(t, err) @@ -83,23 +58,13 @@ func TestFeederDelegation(t *testing.T) { _, err = h(input.Ctx, msg) require.NoError(t, err) - // Case 4.1: Normal Prevote - without delegation fails - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[2], keeper.ValAddrs[0]) - _, err = h(input.Ctx, prevoteMsg) - require.Error(t, err) - - // Case 4.2: Normal Prevote - with delegation succeeds - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[1], keeper.ValAddrs[0]) - _, err = h(input.Ctx, prevoteMsg) - require.NoError(t, err) - - // Case 4.3: Normal Vote - without delegation fails - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, randomExchangeRate.String()+utils.MicroAtomDenom, keeper.Addrs[2], keeper.ValAddrs[0]) + // Case 4.1: Normal Vote - without delegation fails + voteMsg = types.NewMsgAggregateExchangeRateVote(randomExchangeRate.String()+utils.MicroAtomDenom, keeper.Addrs[2], keeper.ValAddrs[0]) _, err = h(input.Ctx.WithBlockHeight(1), voteMsg) require.Error(t, err) - // Case 4.4: Normal Vote - with delegation succeeds - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, randomExchangeRate.String()+utils.MicroAtomDenom, keeper.Addrs[1], keeper.ValAddrs[0]) + // Case 4.2: Normal Vote - with delegation succeeds + voteMsg = types.NewMsgAggregateExchangeRateVote(randomExchangeRate.String()+utils.MicroAtomDenom, keeper.Addrs[1], keeper.ValAddrs[0]) _, err = h(input.Ctx.WithBlockHeight(1), voteMsg) require.NoError(t, err) } diff --git a/x/oracle/keeper/ballot.go b/x/oracle/keeper/ballot.go index 2db0f502b8..1825620e7a 100755 --- a/x/oracle/keeper/ballot.go +++ b/x/oracle/keeper/ballot.go @@ -55,17 +55,8 @@ func (k Keeper) OrganizeBallotByDenom(ctx sdk.Context, validatorClaimMap map[str return votes } -// ClearBallots clears all tallied prevotes and votes from the store +// ClearBallots clears all tallied votes from the store func (k Keeper) ClearBallots(ctx sdk.Context, votePeriod uint64) { - // Clear all aggregate prevotes - k.IterateAggregateExchangeRatePrevotes(ctx, func(voterAddr sdk.ValAddress, aggregatePrevote types.AggregateExchangeRatePrevote) (stop bool) { - if ctx.BlockHeight() > int64(aggregatePrevote.SubmitBlock+votePeriod) { - k.DeleteAggregateExchangeRatePrevote(ctx, voterAddr) - } - - return false - }) - // Clear all aggregate votes k.IterateAggregateExchangeRateVotes(ctx, func(voterAddr sdk.ValAddress, aggregateVote types.AggregateExchangeRateVote) (stop bool) { k.DeleteAggregateExchangeRateVote(ctx, voterAddr) diff --git a/x/oracle/keeper/ballot_test.go b/x/oracle/keeper/ballot_test.go index a093462b19..fb8e775bff 100755 --- a/x/oracle/keeper/ballot_test.go +++ b/x/oracle/keeper/ballot_test.go @@ -107,12 +107,6 @@ func TestClearBallots(t *testing.T) { } for i := range sdrBallot { - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, ValAddrs[i], types.AggregateExchangeRatePrevote{ - Hash: "", - Voter: ValAddrs[i].String(), - SubmitBlock: uint64(input.Ctx.BlockHeight()), - }) - input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, ValAddrs[i], types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{ {Denom: sdrBallot[i].Denom, ExchangeRate: sdrBallot[i].ExchangeRate}, @@ -122,28 +116,12 @@ func TestClearBallots(t *testing.T) { input.OracleKeeper.ClearBallots(input.Ctx, 5) - prevoteCounter := 0 voteCounter := 0 - input.OracleKeeper.IterateAggregateExchangeRatePrevotes(input.Ctx, func(_ sdk.ValAddress, _ types.AggregateExchangeRatePrevote) bool { - prevoteCounter++ - return false - }) input.OracleKeeper.IterateAggregateExchangeRateVotes(input.Ctx, func(_ sdk.ValAddress, _ types.AggregateExchangeRateVote) bool { voteCounter++ return false }) - - require.Equal(t, prevoteCounter, 3) require.Equal(t, voteCounter, 0) - - input.OracleKeeper.ClearBallots(input.Ctx.WithBlockHeight(input.Ctx.BlockHeight()+6), 5) - - prevoteCounter = 0 - input.OracleKeeper.IterateAggregateExchangeRatePrevotes(input.Ctx, func(_ sdk.ValAddress, _ types.AggregateExchangeRatePrevote) bool { - prevoteCounter++ - return false - }) - require.Equal(t, prevoteCounter, 0) } func TestApplyWhitelist(t *testing.T) { diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 4168270cc3..bffae7d721 100755 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -231,55 +231,10 @@ func (k Keeper) IterateVotePenaltyCounters(ctx sdk.Context, } } -//----------------------------------- -// AggregateExchangeRatePrevote logic - -// GetAggregateExchangeRatePrevote retrieves an oracle prevote from the store -func (k Keeper) GetAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress) (aggregatePrevote types.AggregateExchangeRatePrevote, err error) { - store := ctx.KVStore(k.storeKey) - b := store.Get(types.GetAggregateExchangeRatePrevoteKey(voter)) - if b == nil { - err = sdkerrors.Wrap(types.ErrNoAggregatePrevote, voter.String()) - return - } - k.cdc.MustUnmarshal(b, &aggregatePrevote) - return -} - -// SetAggregateExchangeRatePrevote set an oracle aggregate prevote to the store -func (k Keeper) SetAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress, prevote types.AggregateExchangeRatePrevote) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&prevote) - - store.Set(types.GetAggregateExchangeRatePrevoteKey(voter), bz) -} - -// DeleteAggregateExchangeRatePrevote deletes an oracle prevote from the store -func (k Keeper) DeleteAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.GetAggregateExchangeRatePrevoteKey(voter)) -} - -// IterateAggregateExchangeRatePrevotes iterates rate over prevotes in the store -func (k Keeper) IterateAggregateExchangeRatePrevotes(ctx sdk.Context, handler func(voterAddr sdk.ValAddress, aggregatePrevote types.AggregateExchangeRatePrevote) (stop bool)) { - store := ctx.KVStore(k.storeKey) - iter := sdk.KVStorePrefixIterator(store, types.AggregateExchangeRatePrevoteKey) - defer iter.Close() - for ; iter.Valid(); iter.Next() { - voterAddr := sdk.ValAddress(iter.Key()[2:]) - - var aggregatePrevote types.AggregateExchangeRatePrevote - k.cdc.MustUnmarshal(iter.Value(), &aggregatePrevote) - if handler(voterAddr, aggregatePrevote) { - break - } - } -} - //----------------------------------- // AggregateExchangeRateVote logic -// GetAggregateExchangeRateVote retrieves an oracle prevote from the store +// GetAggregateExchangeRateVote retrieves an oracle vote from the store func (k Keeper) GetAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress) (aggregateVote types.AggregateExchangeRateVote, err error) { store := ctx.KVStore(k.storeKey) b := store.Get(types.GetAggregateExchangeRateVoteKey(voter)) @@ -291,20 +246,20 @@ func (k Keeper) GetAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddre return } -// SetAggregateExchangeRateVote adds an oracle aggregate prevote to the store +// SetAggregateExchangeRateVote adds an oracle aggregate vote to the store func (k Keeper) SetAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress, vote types.AggregateExchangeRateVote) { store := ctx.KVStore(k.storeKey) bz := k.cdc.MustMarshal(&vote) store.Set(types.GetAggregateExchangeRateVoteKey(voter), bz) } -// DeleteAggregateExchangeRateVote deletes an oracle prevote from the store +// DeleteAggregateExchangeRateVote deletes an oracle vote from the store func (k Keeper) DeleteAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress) { store := ctx.KVStore(k.storeKey) store.Delete(types.GetAggregateExchangeRateVoteKey(voter)) } -// IterateAggregateExchangeRateVotes iterates rate over prevotes in the store +// IterateAggregateExchangeRateVotes iterates rate over votes in the store func (k Keeper) IterateAggregateExchangeRateVotes(ctx sdk.Context, handler func(voterAddr sdk.ValAddress, aggregateVote types.AggregateExchangeRateVote) (stop bool)) { store := ctx.KVStore(k.storeKey) iter := sdk.KVStorePrefixIterator(store, types.AggregateExchangeRateVoteKey) @@ -547,12 +502,3 @@ func (k Keeper) ValidateLookbackSeconds(ctx sdk.Context, lookbackSeconds int64) return nil } - -func (k Keeper) IsPrevoteFromPreviousWindow(ctx sdk.Context, valAddr sdk.ValAddress) bool { - votePeriod := k.VotePeriod(ctx) - prevote, err := k.GetAggregateExchangeRatePrevote(ctx, valAddr) - if err != nil { - return false - } - return (uint64(ctx.BlockHeight())/votePeriod)-(prevote.SubmitBlock/votePeriod) == 1 -} diff --git a/x/oracle/keeper/keeper_test.go b/x/oracle/keeper/keeper_test.go index 28602b3123..954d858830 100755 --- a/x/oracle/keeper/keeper_test.go +++ b/x/oracle/keeper/keeper_test.go @@ -249,49 +249,6 @@ func TestIterateMissCounters(t *testing.T) { require.Equal(t, missCounter, votePenaltyCounters[0].MissCount) } -func TestAggregatePrevoteAddDelete(t *testing.T) { - input := CreateTestInput(t) - - hash := types.GetAggregateVoteHash("salt", "100ukrw,1000uusd", sdk.ValAddress(Addrs[0])) - aggregatePrevote := types.NewAggregateExchangeRatePrevote(hash, sdk.ValAddress(Addrs[0]), 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, sdk.ValAddress(Addrs[0]), aggregatePrevote) - - KPrevote, err := input.OracleKeeper.GetAggregateExchangeRatePrevote(input.Ctx, sdk.ValAddress(Addrs[0])) - require.NoError(t, err) - require.Equal(t, aggregatePrevote, KPrevote) - - input.OracleKeeper.DeleteAggregateExchangeRatePrevote(input.Ctx, sdk.ValAddress(Addrs[0])) - _, err = input.OracleKeeper.GetAggregateExchangeRatePrevote(input.Ctx, sdk.ValAddress(Addrs[0])) - require.Error(t, err) -} - -func TestAggregatePrevoteIterate(t *testing.T) { - input := CreateTestInput(t) - - hash := types.GetAggregateVoteHash("salt", "100ukrw,1000uusd", sdk.ValAddress(Addrs[0])) - aggregatePrevote1 := types.NewAggregateExchangeRatePrevote(hash, sdk.ValAddress(Addrs[0]), 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, sdk.ValAddress(Addrs[0]), aggregatePrevote1) - - hash2 := types.GetAggregateVoteHash("salt", "100ukrw,1000uusd", sdk.ValAddress(Addrs[1])) - aggregatePrevote2 := types.NewAggregateExchangeRatePrevote(hash2, sdk.ValAddress(Addrs[1]), 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, sdk.ValAddress(Addrs[1]), aggregatePrevote2) - - i := 0 - bigger := bytes.Compare(Addrs[0], Addrs[1]) - input.OracleKeeper.IterateAggregateExchangeRatePrevotes(input.Ctx, func(voter sdk.ValAddress, p types.AggregateExchangeRatePrevote) (stop bool) { - if (i == 0 && bigger == -1) || (i == 1 && bigger == 1) { - require.Equal(t, aggregatePrevote1, p) - require.Equal(t, voter.String(), p.Voter) - } else { - require.Equal(t, aggregatePrevote2, p) - require.Equal(t, voter.String(), p.Voter) - } - - i++ - return false - }) -} - func TestAggregateVoteAddDelete(t *testing.T) { input := CreateTestInput(t) diff --git a/x/oracle/keeper/msg_server.go b/x/oracle/keeper/msg_server.go index db0d47da6a..e3a3059db1 100755 --- a/x/oracle/keeper/msg_server.go +++ b/x/oracle/keeper/msg_server.go @@ -20,47 +20,6 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { return &msgServer{Keeper: keeper} } -func (ms msgServer) AggregateExchangeRatePrevote(goCtx context.Context, msg *types.MsgAggregateExchangeRatePrevote) (*types.MsgAggregateExchangeRatePrevoteResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - valAddr, err := sdk.ValAddressFromBech32(msg.Validator) - if err != nil { - return nil, err - } - - feederAddr, err := sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - return nil, err - } - - if err := ms.ValidateFeeder(ctx, feederAddr, valAddr); err != nil { - return nil, err - } - - // Convert hex string to votehash - voteHash, err := types.AggregateVoteHashFromHexString(msg.Hash) - if err != nil { - return nil, sdkerrors.Wrap(types.ErrInvalidHash, err.Error()) - } - - aggregatePrevote := types.NewAggregateExchangeRatePrevote(voteHash, valAddr, uint64(ctx.BlockHeight())) - ms.SetAggregateExchangeRatePrevote(ctx, valAddr, aggregatePrevote) - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeAggregatePrevote, - sdk.NewAttribute(types.AttributeKeyVoter, msg.Validator), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Feeder), - ), - }) - - return &types.MsgAggregateExchangeRatePrevoteResponse{}, nil -} - func (ms msgServer) AggregateExchangeRateVote(goCtx context.Context, msg *types.MsgAggregateExchangeRateVote) (*types.MsgAggregateExchangeRateVoteResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -78,16 +37,6 @@ func (ms msgServer) AggregateExchangeRateVote(goCtx context.Context, msg *types. return nil, err } - aggregatePrevote, err := ms.GetAggregateExchangeRatePrevote(ctx, valAddr) - if err != nil { - return nil, sdkerrors.Wrap(types.ErrNoAggregatePrevote, msg.Validator) - } - - // Check a msg is submitted proper period - if !ms.IsPrevoteFromPreviousWindow(ctx, valAddr) { - return nil, types.ErrRevealPeriodMissMatch - } - exchangeRateTuples, err := types.ParseExchangeRateTuples(msg.ExchangeRates) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, err.Error()) @@ -100,15 +49,7 @@ func (ms msgServer) AggregateExchangeRateVote(goCtx context.Context, msg *types. } } - // Verify a exchange rate with aggregate prevote hash - hash := types.GetAggregateVoteHash(msg.Salt, msg.ExchangeRates, valAddr) - if aggregatePrevote.Hash != hash.String() { - return nil, sdkerrors.Wrapf(types.ErrVerificationFailed, "must be given %s not %s", aggregatePrevote.Hash, hash) - } - - // Move aggregate prevote to aggregate vote with given exchange rates ms.SetAggregateExchangeRateVote(ctx, valAddr, types.NewAggregateExchangeRateVote(exchangeRateTuples, valAddr)) - ms.DeleteAggregateExchangeRatePrevote(ctx, valAddr) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( @@ -126,49 +67,6 @@ func (ms msgServer) AggregateExchangeRateVote(goCtx context.Context, msg *types. return &types.MsgAggregateExchangeRateVoteResponse{}, nil } -func (ms msgServer) AggregateExchangeRateCombinedVote(goCtx context.Context, msg *types.MsgAggregateExchangeRateCombinedVote) (*types.MsgAggregateExchangeRateCombinedVoteResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - valAddr, err := sdk.ValAddressFromBech32(msg.Validator) - if err != nil { - return nil, err - } - - var voteErr error - // if there isn't a prevote, we want to no-op the vote so we don't get an error - // this way, it is safe to use combined vote regardless of a missed vote window - if err == nil && ms.IsPrevoteFromPreviousWindow(ctx, valAddr) { - _, voteErr = ms.AggregateExchangeRateVote(goCtx, msg.GetVoteFromCombinedVote()) - } - - _, prevoteErr := ms.AggregateExchangeRatePrevote(goCtx, msg.GetPrevoteFromCombinedVote()) - - if voteErr != nil { - return nil, voteErr - } - if prevoteErr != nil { - return nil, prevoteErr - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeAggregateVote, - sdk.NewAttribute(types.AttributeKeyVoter, msg.Validator), - sdk.NewAttribute(types.AttributeKeyExchangeRates, msg.VoteExchangeRates), - ), - sdk.NewEvent( - types.EventTypeAggregatePrevote, - sdk.NewAttribute(types.AttributeKeyVoter, msg.Validator), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Feeder), - ), - }) - - return &types.MsgAggregateExchangeRateCombinedVoteResponse{}, nil -} - func (ms msgServer) DelegateFeedConsent(goCtx context.Context, msg *types.MsgDelegateFeedConsent) (*types.MsgDelegateFeedConsentResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/oracle/keeper/querier.go b/x/oracle/keeper/querier.go index 273d253ed3..d60285eb07 100755 --- a/x/oracle/keeper/querier.go +++ b/x/oracle/keeper/querier.go @@ -165,43 +165,6 @@ func (q querier) VotePenaltyCounter(c context.Context, req *types.QueryVotePenal }, nil } -// AggregatePrevote queries an aggregate prevote of a validator -func (q querier) AggregatePrevote(c context.Context, req *types.QueryAggregatePrevoteRequest) (*types.QueryAggregatePrevoteResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - valAddr, err := sdk.ValAddressFromBech32(req.ValidatorAddr) - if err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - ctx := sdk.UnwrapSDKContext(c) - prevote, err := q.GetAggregateExchangeRatePrevote(ctx, valAddr) - if err != nil { - return nil, err - } - - return &types.QueryAggregatePrevoteResponse{ - AggregatePrevote: prevote, - }, nil -} - -// AggregatePrevotes queries aggregate prevotes of all validators -func (q querier) AggregatePrevotes(c context.Context, req *types.QueryAggregatePrevotesRequest) (*types.QueryAggregatePrevotesResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - var prevotes []types.AggregateExchangeRatePrevote - q.IterateAggregateExchangeRatePrevotes(ctx, func(_ sdk.ValAddress, prevote types.AggregateExchangeRatePrevote) bool { - prevotes = append(prevotes, prevote) - return false - }) - - return &types.QueryAggregatePrevotesResponse{ - AggregatePrevotes: prevotes, - }, nil -} - // AggregateVote queries an aggregate vote of a validator func (q querier) AggregateVote(c context.Context, req *types.QueryAggregateVoteRequest) (*types.QueryAggregateVoteResponse, error) { if req == nil { diff --git a/x/oracle/keeper/querier_test.go b/x/oracle/keeper/querier_test.go index 887d898b67..a3c73335d4 100755 --- a/x/oracle/keeper/querier_test.go +++ b/x/oracle/keeper/querier_test.go @@ -85,55 +85,6 @@ func TestQueryFeederDelegation(t *testing.T) { require.Equal(t, Addrs[1].String(), res.FeederAddr) } -func TestQueryAggregatePrevote(t *testing.T) { - input := CreateTestInput(t) - ctx := sdk.WrapSDKContext(input.Ctx) - querier := NewQuerier(input.OracleKeeper) - - prevote1 := types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{}, ValAddrs[0], 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, ValAddrs[0], prevote1) - prevote2 := types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{}, ValAddrs[1], 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, ValAddrs[1], prevote2) - - // validator 0 address params - res, err := querier.AggregatePrevote(ctx, &types.QueryAggregatePrevoteRequest{ - ValidatorAddr: ValAddrs[0].String(), - }) - require.NoError(t, err) - require.Equal(t, prevote1, res.AggregatePrevote) - - // validator 1 address params - res, err = querier.AggregatePrevote(ctx, &types.QueryAggregatePrevoteRequest{ - ValidatorAddr: ValAddrs[1].String(), - }) - require.NoError(t, err) - require.Equal(t, prevote2, res.AggregatePrevote) -} - -func TestQueryAggregatePrevotes(t *testing.T) { - input := CreateTestInput(t) - ctx := sdk.WrapSDKContext(input.Ctx) - querier := NewQuerier(input.OracleKeeper) - - prevote1 := types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{}, ValAddrs[0], 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, ValAddrs[0], prevote1) - prevote2 := types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{}, ValAddrs[1], 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, ValAddrs[1], prevote2) - prevote3 := types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{}, ValAddrs[2], 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, ValAddrs[2], prevote3) - - expectedPrevotes := []types.AggregateExchangeRatePrevote{prevote1, prevote2, prevote3} - sort.SliceStable(expectedPrevotes, func(i, j int) bool { - addr1, _ := sdk.ValAddressFromBech32(expectedPrevotes[i].Voter) - addr2, _ := sdk.ValAddressFromBech32(expectedPrevotes[j].Voter) - return bytes.Compare(addr1, addr2) == -1 - }) - - res, err := querier.AggregatePrevotes(ctx, &types.QueryAggregatePrevotesRequest{}) - require.NoError(t, err) - require.Equal(t, expectedPrevotes, res.AggregatePrevotes) -} - func TestQueryAggregateVote(t *testing.T) { input := CreateTestInput(t) ctx := sdk.WrapSDKContext(input.Ctx) diff --git a/x/oracle/simulation/decoder.go b/x/oracle/simulation/decoder.go index 1b3285d1a2..871409bc5b 100755 --- a/x/oracle/simulation/decoder.go +++ b/x/oracle/simulation/decoder.go @@ -28,11 +28,6 @@ func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { cdc.MustUnmarshal(kvA.Value, &counterA) cdc.MustUnmarshal(kvB.Value, &counterB) 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) - cdc.MustUnmarshal(kvB.Value, &prevoteB) - return fmt.Sprintf("%v\n%v", prevoteA, prevoteB) case bytes.Equal(kvA.Key[:1], types.AggregateExchangeRateVoteKey): var voteA, voteB types.AggregateExchangeRateVote cdc.MustUnmarshal(kvA.Value, &voteA) diff --git a/x/oracle/simulation/decoder_test.go b/x/oracle/simulation/decoder_test.go index 4b0b6110e7..321f208d7f 100755 --- a/x/oracle/simulation/decoder_test.go +++ b/x/oracle/simulation/decoder_test.go @@ -31,7 +31,6 @@ func TestDecodeDistributionStore(t *testing.T) { 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) @@ -44,7 +43,6 @@ func TestDecodeDistributionStore(t *testing.T) { {Key: types.ExchangeRateKey, Value: cdc.MustMarshal(&sdk.DecProto{Dec: exchangeRate})}, {Key: types.FeederDelegationKey, Value: feederAddr.Bytes()}, {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})}, {Key: []byte{0x99}, Value: []byte{0x99}}, @@ -58,7 +56,6 @@ func TestDecodeDistributionStore(t *testing.T) { {"ExchangeRate", fmt.Sprintf("%v\n%v", exchangeRate, exchangeRate)}, {"FeederDelegation", fmt.Sprintf("%v\n%v", feederAddr, feederAddr)}, {"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)}, {"other", ""}, diff --git a/x/oracle/simulation/genesis.go b/x/oracle/simulation/genesis.go index b61f6f3a93..911a2ba674 100755 --- a/x/oracle/simulation/genesis.go +++ b/x/oracle/simulation/genesis.go @@ -109,7 +109,6 @@ func RandomizedGenState(simState *module.SimulationState) { []types.ExchangeRateTuple{}, []types.FeederDelegation{}, []types.PenaltyCounter{}, - []types.AggregateExchangeRatePrevote{}, []types.AggregateExchangeRateVote{}, ) diff --git a/x/oracle/simulation/operations.go b/x/oracle/simulation/operations.go index 6b3dc6c946..a97b0f125e 100644 --- a/x/oracle/simulation/operations.go +++ b/x/oracle/simulation/operations.go @@ -4,7 +4,6 @@ package simulation import ( "math/rand" - "strings" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" @@ -23,11 +22,8 @@ import ( // //nolint:gosec const ( - OpWeightMsgAggregateExchangeRatePrevote = "op_weight_msg_exchange_rate_aggregate_prevote" - OpWeightMsgAggregateExchangeRateVote = "op_weight_msg_exchange_rate_aggregate_vote" - OpWeightMsgDelegateFeedConsent = "op_weight_msg_exchange_feed_consent" - - salt = "1234" + OpWeightMsgAggregateExchangeRateVote = "op_weight_msg_exchange_rate_aggregate_vote" + OpWeightMsgDelegateFeedConsent = "op_weight_msg_exchange_feed_consent" ) var ( @@ -44,14 +40,8 @@ func WeightedOperations( k keeper.Keeper, ) simulation.WeightedOperations { var ( - weightMsgAggregateExchangeRatePrevote int - weightMsgAggregateExchangeRateVote int - weightMsgDelegateFeedConsent int - ) - appParams.GetOrGenerate(cdc, OpWeightMsgAggregateExchangeRatePrevote, &weightMsgAggregateExchangeRatePrevote, nil, - func(_ *rand.Rand) { - weightMsgAggregateExchangeRatePrevote = simappparams.DefaultWeightMsgSend * 2 - }, + weightMsgAggregateExchangeRateVote int + weightMsgDelegateFeedConsent int ) appParams.GetOrGenerate(cdc, OpWeightMsgAggregateExchangeRateVote, &weightMsgAggregateExchangeRateVote, nil, @@ -67,10 +57,6 @@ func WeightedOperations( ) return simulation.WeightedOperations{ - simulation.NewWeightedOperation( - weightMsgAggregateExchangeRatePrevote, - SimulateMsgAggregateExchangeRatePrevote(ak, bk, k), - ), simulation.NewWeightedOperation( weightMsgAggregateExchangeRateVote, SimulateMsgAggregateExchangeRateVote(ak, bk, k), @@ -82,69 +68,6 @@ func WeightedOperations( } } -// SimulateMsgAggregateExchangeRatePrevote generates a MsgAggregateExchangeRatePrevote with random values. -//nolint: funlen -func SimulateMsgAggregateExchangeRatePrevote(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { - return func( - r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - address := sdk.ValAddress(simAccount.Address) - - // ensure the validator exists - val := k.StakingKeeper.Validator(ctx, address) - if val == nil || !val.IsBonded() { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRatePrevote, "unable to find validator"), nil, nil - } - - exchangeRatesStr := "" - for _, denom := range whitelist { - price := sdk.NewDecWithPrec(int64(simtypes.RandIntBetween(r, 1, 10000)), int64(1)) - exchangeRatesStr += price.String() + denom + "," - } - - exchangeRatesStr = strings.TrimRight(exchangeRatesStr, ",") - voteHash := types.GetAggregateVoteHash(salt, exchangeRatesStr, address) - - feederAddr := k.GetFeederDelegation(ctx, address) - feederSimAccount, _ := simtypes.FindAccount(accs, feederAddr) - - feederAccount := ak.GetAccount(ctx, feederAddr) - spendable := bk.SpendableCoins(ctx, feederAccount.GetAddress()) - - fees, err := simtypes.RandomFees(r, ctx, spendable) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRatePrevote, "unable to generate fees"), nil, err - } - - msg := types.NewMsgAggregateExchangeRatePrevote(voteHash, feederAddr, address) - - txGen := simappparams.MakeTestEncodingConfig().TxConfig - tx, err := helpers.GenTx( - txGen, - []sdk.Msg{msg}, - fees, - helpers.DefaultGenTxGas, - chainID, - []uint64{feederAccount.GetAccountNumber()}, - []uint64{feederAccount.GetSequence()}, - feederSimAccount.PrivKey, - ) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate mock tx"), nil, err - } - - _, _, err = app.Deliver(txGen.TxEncoder(), tx) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to deliver tx"), nil, err - } - - voteHashMap[address.String()] = exchangeRatesStr - - return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil - } -} - // SimulateMsgAggregateExchangeRateVote generates a MsgAggregateExchangeRateVote with random values. //nolint: funlen func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { @@ -166,16 +89,6 @@ func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankK return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRateVote, "vote hash not exists"), nil, nil } - // get prevote - _, err := k.GetAggregateExchangeRatePrevote(ctx, address) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRateVote, "prevote not found"), nil, nil - } - - if !k.IsPrevoteFromPreviousWindow(ctx, address) { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRateVote, "reveal period of submitted vote do not match with registered prevote"), nil, nil - } - feederAddr := k.GetFeederDelegation(ctx, address) feederSimAccount, _ := simtypes.FindAccount(accs, feederAddr) feederAccount := ak.GetAccount(ctx, feederAddr) @@ -186,7 +99,7 @@ func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankK return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRateVote, "unable to generate fees"), nil, err } - msg := types.NewMsgAggregateExchangeRateVote(salt, exchangeRatesStr, feederAddr, address) + msg := types.NewMsgAggregateExchangeRateVote(exchangeRatesStr, feederAddr, address) txGen := simappparams.MakeTestEncodingConfig().TxConfig tx, err := helpers.GenTx( diff --git a/x/oracle/spec/02_state.md b/x/oracle/spec/02_state.md index a937979dd9..7f92994c9f 100755 --- a/x/oracle/spec/02_state.md +++ b/x/oracle/spec/02_state.md @@ -4,24 +4,6 @@ order: 2 # State -## ExchangeRatePrevote - -`ExchangeRatePrevote` containing validator voter's prevote for a given denom for the current `VotePeriod`. - -- ExchangeRatePrevote: `0x01 -> amino(ExchangeRatePrevote)` - -```go -type ValAddress []byte -type VoteHash []byte - -type ExchangeRatePrevote struct { - Hash VoteHash // Vote hex hash to protect centralize data source problem - Denom string // Ticker name of target fiat currency - Voter sdk.ValAddress // Voter val address - SubmitBlock int64 -} -``` - ## ExchangeRateVote `ExchangeRateVote` containing validator voter's vote for a given denom for the current `VotePeriod`. @@ -56,24 +38,6 @@ An `int64` representing the number of `VotePeriods` that validator `operator` mi - MissCounter: `0x05 -> amino(int64)` -## AggregateExchangeRatePrevote - -`AggregateExchangeRatePrevote` containing validator voter's aggregated prevote for all denoms for the current `VotePeriod`. - -- AggregateExchangeRatePrevote: `0x06 -> amino(AggregateExchangeRatePrevote)` - -```go -// AggregateVoteHash is hash value to hide vote exchange rates -// which is formatted as hex string in SHA256("{salt}:{exchange rate}{denom},...,{exchange rate}{denom}:{voter}") -type AggregateVoteHash []byte - -type AggregateExchangeRatePrevote struct { - Hash AggregateVoteHash // Vote hex hash to protect centralize data source problem - Voter sdk.ValAddress // Voter val address - SubmitBlock int64 -} -``` - ## AggregateExchangeRateVote `AggregateExchangeRateVote` containing validator voter's aggregate vote for all denoms for the current `VotePeriod`. diff --git a/x/oracle/spec/05_events.md b/x/oracle/spec/05_events.md index 654d5fdba6..ec8538e20f 100755 --- a/x/oracle/spec/05_events.md +++ b/x/oracle/spec/05_events.md @@ -11,21 +11,10 @@ The oracle module emits the following events: | Type | Attribute Key | Attribute Value | |----------------------|---------------|-----------------| | exchange_rate_update | denom | {denom} | -| exchange_rate_update | exchange_rate | {exchangeRate} | +| exchange_rate_update | exchange_rate | {exchangeRate} | ## Handlers -### MsgExchangeRatePrevote - -| Type | Attribute Key | Attribute Value | -|---------|---------------|---------------------| -| prevote | denom | {denom} | -| prevote | voter | {validatorAddress} | -| prevote | feeder | {feederAddress} | -| message | module | oracle | -| message | action | exchangerateprevote | -| message | sender | {senderAddress} | - ### MsgExchangeRateVote | Type | Attribute Key | Attribute Value | @@ -49,15 +38,6 @@ The oracle module emits the following events: | message | action | delegatefeeder | | message | sender | {senderAddress} | -### MsgAggregateExchangeRatePrevote - -| Type | Attribute Key | Attribute Value | -|-------------------|---------------|------------------------------| -| aggregate_prevote | voter | {validatorAddress} | -| aggregate_prevote | feeder | {feederAddress} | -| message | module | oracle | -| message | action | aggregateexchangerateprevote | -| message | sender | {senderAddress} | ### MsgAggregateExchangeRateVote diff --git a/x/oracle/types/codec.go b/x/oracle/types/codec.go index ffc281b7d5..f0feaf2b0d 100755 --- a/x/oracle/types/codec.go +++ b/x/oracle/types/codec.go @@ -8,23 +8,14 @@ import ( ) func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgAggregateExchangeRatePrevote{}, "oracle/MsgAggregateExchangeRatePrevote", nil) cdc.RegisterConcrete(&MsgAggregateExchangeRateVote{}, "oracle/MsgAggregateExchangeRateVote", nil) - cdc.RegisterConcrete(&MsgAggregateExchangeRateCombinedVote{}, "oracle/MsgAggregateExchangeRateCombinedVote", nil) cdc.RegisterConcrete(&MsgDelegateFeedConsent{}, "oracle/MsgDelegateFeedConsent", nil) } -// TODO: update here for combined vote func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgAggregateExchangeRatePrevote{}, - ) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgAggregateExchangeRateVote{}, ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgAggregateExchangeRateCombinedVote{}, - ) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgDelegateFeedConsent{}, ) diff --git a/x/oracle/types/errors.go b/x/oracle/types/errors.go index 9aba1e38cd..a636f12924 100755 --- a/x/oracle/types/errors.go +++ b/x/oracle/types/errors.go @@ -11,15 +11,11 @@ import ( // Oracle Errors var ( ErrInvalidExchangeRate = sdkerrors.Register(ModuleName, 2, "invalid exchange rate") - ErrNoPrevote = sdkerrors.Register(ModuleName, 3, "no prevote") ErrNoVote = sdkerrors.Register(ModuleName, 4, "no vote") ErrNoVotingPermission = sdkerrors.Register(ModuleName, 5, "unauthorized voter") ErrInvalidHash = sdkerrors.Register(ModuleName, 6, "invalid hash") ErrInvalidHashLength = sdkerrors.Register(ModuleName, 7, fmt.Sprintf("invalid hash length; should equal %d", tmhash.TruncatedSize)) ErrVerificationFailed = sdkerrors.Register(ModuleName, 8, "hash verification failed") - ErrRevealPeriodMissMatch = sdkerrors.Register(ModuleName, 9, "reveal period of submitted vote do not match with registered prevote") - ErrInvalidSaltLength = sdkerrors.Register(ModuleName, 10, "invalid salt length; should be 1~4") - ErrNoAggregatePrevote = sdkerrors.Register(ModuleName, 11, "no aggregate prevote") ErrNoAggregateVote = sdkerrors.Register(ModuleName, 12, "no aggregate vote") ErrNoVoteTarget = sdkerrors.Register(ModuleName, 13, "no vote target") ErrUnknownDenom = sdkerrors.Register(ModuleName, 14, "unknown denom") diff --git a/x/oracle/types/events.go b/x/oracle/types/events.go index 2081edbb37..ea8a8c4c27 100755 --- a/x/oracle/types/events.go +++ b/x/oracle/types/events.go @@ -3,10 +3,8 @@ package types // Oracle module event types const ( EventTypeExchangeRateUpdate = "exchange_rate_update" - EventTypePrevote = "prevote" EventTypeVote = "vote" EventTypeFeedDelegate = "feed_delegate" - EventTypeAggregatePrevote = "aggregate_prevote" EventTypeAggregateVote = "aggregate_vote" EventTypeEndSlashWindow = "end_slash_window" diff --git a/x/oracle/types/genesis.go b/x/oracle/types/genesis.go index 5ca931f084..21ab0d7c21 100755 --- a/x/oracle/types/genesis.go +++ b/x/oracle/types/genesis.go @@ -10,28 +10,25 @@ import ( func NewGenesisState( params Params, rates []ExchangeRateTuple, feederDelegations []FeederDelegation, penaltyCounters []PenaltyCounter, - aggregateExchangeRatePrevotes []AggregateExchangeRatePrevote, aggregateExchangeRateVotes []AggregateExchangeRateVote, ) *GenesisState { return &GenesisState{ - Params: params, - ExchangeRates: rates, - FeederDelegations: feederDelegations, - PenaltyCounters: penaltyCounters, - AggregateExchangeRatePrevotes: aggregateExchangeRatePrevotes, - AggregateExchangeRateVotes: aggregateExchangeRateVotes, + Params: params, + ExchangeRates: rates, + FeederDelegations: feederDelegations, + PenaltyCounters: penaltyCounters, + AggregateExchangeRateVotes: aggregateExchangeRateVotes, } } // DefaultGenesisState - default GenesisState used by columbus-2 func DefaultGenesisState() *GenesisState { return &GenesisState{ - Params: DefaultParams(), - ExchangeRates: []ExchangeRateTuple{}, - FeederDelegations: []FeederDelegation{}, - PenaltyCounters: []PenaltyCounter{}, - AggregateExchangeRatePrevotes: []AggregateExchangeRatePrevote{}, - AggregateExchangeRateVotes: []AggregateExchangeRateVote{}, + Params: DefaultParams(), + ExchangeRates: []ExchangeRateTuple{}, + FeederDelegations: []FeederDelegation{}, + PenaltyCounters: []PenaltyCounter{}, + AggregateExchangeRateVotes: []AggregateExchangeRateVote{}, } } diff --git a/x/oracle/types/genesis.pb.go b/x/oracle/types/genesis.pb.go index c1b136e28e..217fe2faf1 100644 --- a/x/oracle/types/genesis.pb.go +++ b/x/oracle/types/genesis.pb.go @@ -25,12 +25,11 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 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"` - 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"` + 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"` + PenaltyCounters []PenaltyCounter `protobuf:"bytes,4,rep,name=penalty_counters,json=penaltyCounters,proto3" json:"penalty_counters"` + AggregateExchangeRateVotes []AggregateExchangeRateVote `protobuf:"bytes,6,rep,name=aggregate_exchange_rate_votes,json=aggregateExchangeRateVotes,proto3" json:"aggregate_exchange_rate_votes"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -94,13 +93,6 @@ func (m *GenesisState) GetPenaltyCounters() []PenaltyCounter { return nil } -func (m *GenesisState) GetAggregateExchangeRatePrevotes() []AggregateExchangeRatePrevote { - if m != nil { - return m.AggregateExchangeRatePrevotes - } - return nil -} - func (m *GenesisState) GetAggregateExchangeRateVotes() []AggregateExchangeRateVote { if m != nil { return m.AggregateExchangeRateVotes @@ -221,39 +213,37 @@ func init() { func init() { proto.RegisterFile("oracle/genesis.proto", fileDescriptor_ce0b3a2b4a184fc3) } var fileDescriptor_ce0b3a2b4a184fc3 = []byte{ - // 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, 0xe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c, 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, + // 476 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0x8e, 0xdb, 0x2a, 0x12, 0x1b, 0x1a, 0xd2, 0x25, 0x87, 0x28, 0x08, 0xb7, 0x0a, 0x42, 0xaa, + 0x54, 0xd5, 0xa6, 0x41, 0xe2, 0x9e, 0xf0, 0x27, 0x71, 0x42, 0x06, 0x71, 0x40, 0x48, 0xd6, 0xd8, + 0x9e, 0x38, 0x2b, 0x39, 0x5e, 0xe3, 0xd9, 0x44, 0xed, 0x89, 0x23, 0x57, 0x1e, 0x81, 0x33, 0x4f, + 0xd2, 0x63, 0x8f, 0x9c, 0x00, 0x25, 0x2f, 0x82, 0xbc, 0xbb, 0x2d, 0x4d, 0x5a, 0x7c, 0xca, 0xe6, + 0x9b, 0xef, 0xc7, 0xdf, 0xac, 0xcd, 0xba, 0xb2, 0x84, 0x38, 0x43, 0x3f, 0xc5, 0x1c, 0x49, 0x90, + 0x57, 0x94, 0x52, 0x49, 0xfe, 0x80, 0x50, 0xe8, 0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, 0xff, 0xff, 0x19, 0x42, 0xf6, 0xff, 0xe7, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -290,20 +280,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x32 } } - if len(m.AggregateExchangeRatePrevotes) > 0 { - for iNdEx := len(m.AggregateExchangeRatePrevotes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AggregateExchangeRatePrevotes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } if len(m.PenaltyCounters) > 0 { for iNdEx := len(m.PenaltyCounters) - 1; iNdEx >= 0; iNdEx-- { { @@ -475,12 +451,6 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.AggregateExchangeRatePrevotes) > 0 { - for _, e := range m.AggregateExchangeRatePrevotes { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } if len(m.AggregateExchangeRateVotes) > 0 { for _, e := range m.AggregateExchangeRateVotes { l = e.Size() @@ -694,40 +664,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregateExchangeRatePrevotes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - 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 - } - m.AggregateExchangeRatePrevotes = append(m.AggregateExchangeRatePrevotes, AggregateExchangeRatePrevote{}) - if err := m.AggregateExchangeRatePrevotes[len(m.AggregateExchangeRatePrevotes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AggregateExchangeRateVotes", wireType) diff --git a/x/oracle/types/hash.go b/x/oracle/types/hash.go deleted file mode 100755 index ce5fc8cdc1..0000000000 --- a/x/oracle/types/hash.go +++ /dev/null @@ -1,120 +0,0 @@ -package types - -import ( - "bytes" - "encoding/hex" - "encoding/json" - "fmt" - - "gopkg.in/yaml.v2" - - "github.com/tendermint/tendermint/crypto/tmhash" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var _ yaml.Marshaler = AggregateVoteHash{} - -// AggregateVoteHash is hash value to hide vote exchange rates -// which is formatted as hex string in SHA256("{salt}:{exchange rate}{denom},...,{exchange rate}{denom}:{voter}") -type AggregateVoteHash []byte - -// GetAggregateVoteHash computes hash value of ExchangeRateVote -// to avoid redundant DecCoins stringify operation, use string argument -func GetAggregateVoteHash(salt string, exchangeRatesStr string, voter sdk.ValAddress) AggregateVoteHash { - hash := tmhash.NewTruncated() - sourceStr := fmt.Sprintf("%s:%s:%s", salt, exchangeRatesStr, voter.String()) - _, err := hash.Write([]byte(sourceStr)) - if err != nil { - panic(err) - } - bz := hash.Sum(nil) - return bz -} - -// AggregateVoteHashFromHexString convert hex string to AggregateVoteHash -func AggregateVoteHashFromHexString(s string) (AggregateVoteHash, error) { - h, err := hex.DecodeString(s) - if err != nil { - return nil, err - } - - return h, nil -} - -// String implements fmt.Stringer interface -func (h AggregateVoteHash) String() string { - return hex.EncodeToString(h) -} - -// Equal does bytes equal check -func (h AggregateVoteHash) Equal(h2 AggregateVoteHash) bool { - return bytes.Equal(h, h2) -} - -// Empty check the name hash has zero length -func (h AggregateVoteHash) Empty() bool { - return len(h) == 0 -} - -// Bytes returns the raw address bytes. -func (h AggregateVoteHash) Bytes() []byte { - return h -} - -// Size returns the raw address bytes. -func (h AggregateVoteHash) Size() int { - return len(h) -} - -// Format implements the fmt.Formatter interface. -func (h AggregateVoteHash) Format(s fmt.State, verb rune) { - switch verb { - case 's': - _, _ = s.Write([]byte(h.String())) - case 'p': - _, _ = s.Write([]byte(fmt.Sprintf("%p", h))) - default: - _, _ = s.Write([]byte(fmt.Sprintf("%X", []byte(h)))) - } -} - -// Marshal returns the raw address bytes. It is needed for protobuf -// compatibility. -func (h AggregateVoteHash) Marshal() ([]byte, error) { - return h, nil -} - -// Unmarshal sets the address to the given data. It is needed for protobuf -// compatibility. -func (h *AggregateVoteHash) Unmarshal(data []byte) error { - *h = data - return nil -} - -// MarshalJSON marshals to JSON using Bech32. -func (h AggregateVoteHash) MarshalJSON() ([]byte, error) { - return json.Marshal(h.String()) -} - -// MarshalYAML marshals to YAML using Bech32. -func (h AggregateVoteHash) MarshalYAML() (interface{}, error) { - return h.String(), nil -} - -// UnmarshalJSON unmarshals from JSON assuming Bech32 encoding. -func (h *AggregateVoteHash) UnmarshalJSON(data []byte) error { - var s string - err := json.Unmarshal(data, &s) - if err != nil { - return err - } - - h2, err := AggregateVoteHashFromHexString(s) - if err != nil { - return err - } - - *h = h2 - return nil -} diff --git a/x/oracle/types/hash_test.go b/x/oracle/types/hash_test.go deleted file mode 100755 index 559828e75e..0000000000 --- a/x/oracle/types/hash_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package types - -import ( - "encoding/hex" - "testing" - - "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func TestAggregateVoteHash(t *testing.T) { - addrs := []sdk.AccAddress{ - sdk.AccAddress([]byte("addr1_______________")), - } - - aggregateVoteHash := GetAggregateVoteHash("salt", "100ukrw,200uusd", sdk.ValAddress(addrs[0])) - hexStr := hex.EncodeToString(aggregateVoteHash) - aggregateVoteHashRes, err := AggregateVoteHashFromHexString(hexStr) - require.NoError(t, err) - require.Equal(t, aggregateVoteHash, aggregateVoteHashRes) - require.True(t, aggregateVoteHash.Equal(aggregateVoteHash)) - require.True(t, AggregateVoteHash([]byte{}).Empty()) - - got, _ := yaml.Marshal(&aggregateVoteHash) - require.Equal(t, aggregateVoteHash.String()+"\n", string(got)) - - res := AggregateVoteHash{} - testMarshal(t, &aggregateVoteHash, &res, aggregateVoteHash.MarshalJSON, (&res).UnmarshalJSON) - testMarshal(t, &aggregateVoteHash, &res, aggregateVoteHash.Marshal, (&res).Unmarshal) -} - -func testMarshal(t *testing.T, original interface{}, res interface{}, marshal func() ([]byte, error), unmarshal func([]byte) error) { - bz, err := marshal() - require.Nil(t, err) - err = unmarshal(bz) - require.Nil(t, err) - require.Equal(t, original, res) -} diff --git a/x/oracle/types/keys.go b/x/oracle/types/keys.go index 2abd4a04e9..d42dc339c8 100755 --- a/x/oracle/types/keys.go +++ b/x/oracle/types/keys.go @@ -30,20 +30,20 @@ const ( // // - 0x03: int64 // -// - 0x04: AggregateExchangeRatePrevote +// - 0x04: DEPRECATED: AggregateExchangeRatePrevote // // - 0x05: AggregateExchangeRateVote // // - 0x06: sdk.Dec 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 - 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 - PriceSnapshotKey = []byte{0x07} // key for price snapshots history + ExchangeRateKey = []byte{0x01} // prefix for each key to a rate + FeederDelegationKey = []byte{0x02} // prefix for each key to a feeder delegation + VotePenaltyCounterKey = []byte{0x03} // prefix for each key to a miss counter + // DEPRECATED AggregateExchangeRatePrevoteKey = []byte{0x04} + AggregateExchangeRateVoteKey = []byte{0x05} // prefix for each key to a aggregate vote + VoteTargetKey = []byte{0x06} // prefix for each key to a vote target + PriceSnapshotKey = []byte{0x07} // key for price snapshots history ) // GetExchangeRateKey - stored by *denom* @@ -61,11 +61,6 @@ func GetVotePenaltyCounterKey(v sdk.ValAddress) []byte { return append(VotePenaltyCounterKey, address.MustLengthPrefix(v)...) } -// GetAggregateExchangeRatePrevoteKey - stored by *Validator* address -func GetAggregateExchangeRatePrevoteKey(v sdk.ValAddress) []byte { - return append(AggregateExchangeRatePrevoteKey, address.MustLengthPrefix(v)...) -} - // GetAggregateExchangeRateVoteKey - stored by *Validator* address func GetAggregateExchangeRateVoteKey(v sdk.ValAddress) []byte { return append(AggregateExchangeRateVoteKey, address.MustLengthPrefix(v)...) diff --git a/x/oracle/types/msgs.go b/x/oracle/types/msgs.go index f3c68f4565..965c597ffe 100755 --- a/x/oracle/types/msgs.go +++ b/x/oracle/types/msgs.go @@ -1,8 +1,6 @@ package types import ( - "github.com/tendermint/tendermint/crypto/tmhash" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -10,81 +8,21 @@ import ( // ensure Msg interface compliance at compile time var ( _ sdk.Msg = &MsgDelegateFeedConsent{} - _ sdk.Msg = &MsgAggregateExchangeRatePrevote{} _ sdk.Msg = &MsgAggregateExchangeRateVote{} - _ sdk.Msg = &MsgAggregateExchangeRateCombinedVote{} ) // oracle message types const ( - TypeMsgDelegateFeedConsent = "delegate_feeder" - TypeMsgAggregateExchangeRatePrevote = "aggregate_exchange_rate_prevote" - TypeMsgAggregateExchangeRateVote = "aggregate_exchange_rate_vote" - TypeMsgAggregateExchangeRateCombinedVote = "aggregate_exchange_rate_combined_vote" + TypeMsgDelegateFeedConsent = "delegate_feeder" + TypeMsgAggregateExchangeRateVote = "aggregate_exchange_rate_vote" ) //------------------------------------------------- //------------------------------------------------- -// NewMsgAggregateExchangeRatePrevote returns MsgAggregateExchangeRatePrevote instance -func NewMsgAggregateExchangeRatePrevote(hash AggregateVoteHash, feeder sdk.AccAddress, validator sdk.ValAddress) *MsgAggregateExchangeRatePrevote { - return &MsgAggregateExchangeRatePrevote{ - Hash: hash.String(), - Feeder: feeder.String(), - Validator: validator.String(), - } -} - -// Route implements sdk.Msg -func (msg MsgAggregateExchangeRatePrevote) Route() string { return RouterKey } - -// Type implements sdk.Msg -func (msg MsgAggregateExchangeRatePrevote) Type() string { return TypeMsgAggregateExchangeRatePrevote } - -// GetSignBytes implements sdk.Msg -func (msg MsgAggregateExchangeRatePrevote) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -// GetSigners implements sdk.Msg -func (msg MsgAggregateExchangeRatePrevote) GetSigners() []sdk.AccAddress { - feeder, err := sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - panic(err) - } - - return []sdk.AccAddress{feeder} -} - -// ValidateBasic Implements sdk.Msg -func (msg MsgAggregateExchangeRatePrevote) ValidateBasic() error { - _, err := AggregateVoteHashFromHexString(msg.Hash) - if err != nil { - return sdkerrors.Wrapf(ErrInvalidHash, "Invalid vote hash (%s)", err) - } - - // HEX encoding doubles the hash length - if len(msg.Hash) != tmhash.TruncatedSize*2 { - return ErrInvalidHashLength - } - - _, err = sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid feeder address (%s)", err) - } - - _, err = sdk.ValAddressFromBech32(msg.Validator) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid operator address (%s)", err) - } - - return nil -} - // NewMsgAggregateExchangeRateVote returns MsgAggregateExchangeRateVote instance -func NewMsgAggregateExchangeRateVote(salt string, exchangeRates string, feeder sdk.AccAddress, validator sdk.ValAddress) *MsgAggregateExchangeRateVote { +func NewMsgAggregateExchangeRateVote(exchangeRates string, feeder sdk.AccAddress, validator sdk.ValAddress) *MsgAggregateExchangeRateVote { return &MsgAggregateExchangeRateVote{ - Salt: salt, ExchangeRates: exchangeRates, Feeder: feeder.String(), Validator: validator.String(), @@ -141,112 +79,6 @@ func (msg MsgAggregateExchangeRateVote) ValidateBasic() error { return sdkerrors.Wrap(ErrInvalidExchangeRate, "overflow") } } - - if len(msg.Salt) > 4 || len(msg.Salt) < 1 { - return sdkerrors.Wrap(ErrInvalidSaltLength, "salt length must be [1, 4]") - } - - return nil -} - -// NewMsgAggregateExchangeRatePrevote returns MsgAggregateExchangeRatePrevote instance -func NewMsgAggregateExchangeRateCombinedVote(voteSalt string, voteExchangeRates string, prevoteHash AggregateVoteHash, feeder sdk.AccAddress, validator sdk.ValAddress) *MsgAggregateExchangeRateCombinedVote { - return &MsgAggregateExchangeRateCombinedVote{ - VoteSalt: voteSalt, - VoteExchangeRates: voteExchangeRates, - PrevoteHash: prevoteHash.String(), - Feeder: feeder.String(), - Validator: validator.String(), - } -} - -// Route implements sdk.Msg -func (msg MsgAggregateExchangeRateCombinedVote) Route() string { return RouterKey } - -// Type implements sdk.Msg -func (msg MsgAggregateExchangeRateCombinedVote) Type() string { - return TypeMsgAggregateExchangeRateCombinedVote -} - -// GetSignBytes implements sdk.Msg -func (msg MsgAggregateExchangeRateCombinedVote) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -// GetSigners implements sdk.Msg -func (msg MsgAggregateExchangeRateCombinedVote) GetSigners() []sdk.AccAddress { - feeder, err := sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - panic(err) - } - - return []sdk.AccAddress{feeder} -} - -func (msg MsgAggregateExchangeRateCombinedVote) GetVoteFromCombinedVote() *MsgAggregateExchangeRateVote { - return &MsgAggregateExchangeRateVote{ - Salt: msg.VoteSalt, - ExchangeRates: msg.VoteExchangeRates, - Feeder: msg.Feeder, - Validator: msg.Validator, - } -} - -func (msg MsgAggregateExchangeRateCombinedVote) GetPrevoteFromCombinedVote() *MsgAggregateExchangeRatePrevote { - return &MsgAggregateExchangeRatePrevote{ - Hash: msg.PrevoteHash, - Feeder: msg.Feeder, - Validator: msg.Validator, - } -} - -// ValidateBasic Implements sdk.Msg -func (msg MsgAggregateExchangeRateCombinedVote) ValidateBasic() error { - // validate feeder + validator - _, err := sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid feeder address (%s)", err) - } - - _, err = sdk.ValAddressFromBech32(msg.Validator) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid operator address (%s)", err) - } - - // validate the vote info - if l := len(msg.VoteExchangeRates); l == 0 { - return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "must provide at least one oracle exchange rate") - } else if l > 4096 { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "exchange rates string can not exceed 4096 characters") - } - - voteExchangeRates, err := ParseExchangeRateTuples(msg.VoteExchangeRates) - if err != nil { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, "failed to parse exchange rates string cause: "+err.Error()) - } - - for _, exchangeRate := range voteExchangeRates { - // Check overflow bit length - if exchangeRate.ExchangeRate.BigInt().BitLen() > 255+sdk.DecimalPrecisionBits { - return sdkerrors.Wrap(ErrInvalidExchangeRate, "overflow") - } - } - - if len(msg.VoteSalt) > 4 || len(msg.VoteSalt) < 1 { - return sdkerrors.Wrap(ErrInvalidSaltLength, "salt length must be [1, 4]") - } - - // validate the prevote hash - _, err = AggregateVoteHashFromHexString(msg.PrevoteHash) - if err != nil { - return sdkerrors.Wrapf(ErrInvalidHash, "Invalid vote hash (%s)", err) - } - - // HEX encoding doubles the hash length - if len(msg.PrevoteHash) != tmhash.TruncatedSize*2 { - return ErrInvalidHashLength - } - return nil } diff --git a/x/oracle/types/msgs_test.go b/x/oracle/types/msgs_test.go index 6ba2c15436..8fe3e058e2 100755 --- a/x/oracle/types/msgs_test.go +++ b/x/oracle/types/msgs_test.go @@ -3,7 +3,6 @@ package types import ( "testing" - "github.com/sei-protocol/sei-chain/x/oracle/utils" "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" @@ -36,36 +35,6 @@ func TestMsgFeederDelegation(t *testing.T) { } } -func TestMsgAggregateExchangeRatePrevote(t *testing.T) { - addrs := []sdk.AccAddress{ - sdk.AccAddress([]byte("addr1_______________")), - } - - exchangeRates := sdk.DecCoins{sdk.NewDecCoinFromDec(utils.MicroAtomDenom, sdk.OneDec())} - bz := GetAggregateVoteHash("1", exchangeRates.String(), sdk.ValAddress(addrs[0])) - - tests := []struct { - hash AggregateVoteHash - exchangeRates sdk.DecCoins - voter sdk.AccAddress - expectPass bool - }{ - {bz, exchangeRates, addrs[0], true}, - {bz[1:], exchangeRates, addrs[0], false}, - {bz, exchangeRates, sdk.AccAddress{}, false}, - {AggregateVoteHash{}, exchangeRates, addrs[0], false}, - } - - for i, tc := range tests { - msg := NewMsgAggregateExchangeRatePrevote(tc.hash, tc.voter, sdk.ValAddress(tc.voter)) - if tc.expectPass { - require.NoError(t, msg.ValidateBasic(), "test: %v", i) - } else { - require.Error(t, msg.ValidateBasic(), "test: %v", i) - } - } -} - func TestMsgAggregateExchangeRateVote(t *testing.T) { addrs := []sdk.AccAddress{ sdk.AccAddress([]byte("addr1_______________")), @@ -78,20 +47,18 @@ func TestMsgAggregateExchangeRateVote(t *testing.T) { tests := []struct { voter sdk.AccAddress - salt string exchangeRates string expectPass bool }{ - {addrs[0], "123", exchangeRates, true}, - {addrs[0], "123", invalidExchangeRates, false}, - {addrs[0], "123", abstainExchangeRates, true}, - {addrs[0], "123", overFlowExchangeRates, false}, - {sdk.AccAddress{}, "123", exchangeRates, false}, - {addrs[0], "", exchangeRates, false}, + {addrs[0], exchangeRates, true}, + {addrs[0], invalidExchangeRates, false}, + {addrs[0], abstainExchangeRates, true}, + {addrs[0], overFlowExchangeRates, false}, + {sdk.AccAddress{}, exchangeRates, false}, } for i, tc := range tests { - msg := NewMsgAggregateExchangeRateVote(tc.salt, tc.exchangeRates, tc.voter, sdk.ValAddress(tc.voter)) + msg := NewMsgAggregateExchangeRateVote(tc.exchangeRates, tc.voter, sdk.ValAddress(tc.voter)) if tc.expectPass { require.Nil(t, msg.ValidateBasic(), "test: %v", i) } else { diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index bc4183d94e..4ff1233ff2 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -132,44 +132,6 @@ func (m *Denom) XXX_DiscardUnknown() { var xxx_messageInfo_Denom proto.InternalMessageInfo -type AggregateExchangeRatePrevote struct { - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty" yaml:"hash"` - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty" yaml:"voter"` - SubmitBlock uint64 `protobuf:"varint,3,opt,name=submit_block,json=submitBlock,proto3" json:"submit_block,omitempty" yaml:"submit_block"` -} - -func (m *AggregateExchangeRatePrevote) Reset() { *m = AggregateExchangeRatePrevote{} } -func (*AggregateExchangeRatePrevote) ProtoMessage() {} -func (*AggregateExchangeRatePrevote) Descriptor() ([]byte, []int) { - return fileDescriptor_dc470b50b143d488, []int{2} -} -func (m *AggregateExchangeRatePrevote) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AggregateExchangeRatePrevote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AggregateExchangeRatePrevote.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 *AggregateExchangeRatePrevote) XXX_Merge(src proto.Message) { - xxx_messageInfo_AggregateExchangeRatePrevote.Merge(m, src) -} -func (m *AggregateExchangeRatePrevote) XXX_Size() int { - return m.Size() -} -func (m *AggregateExchangeRatePrevote) XXX_DiscardUnknown() { - xxx_messageInfo_AggregateExchangeRatePrevote.DiscardUnknown(m) -} - -var xxx_messageInfo_AggregateExchangeRatePrevote proto.InternalMessageInfo - type AggregateExchangeRateVote struct { ExchangeRateTuples ExchangeRateTuples `protobuf:"bytes,1,rep,name=exchange_rate_tuples,json=exchangeRateTuples,proto3,castrepeated=ExchangeRateTuples" json:"exchange_rate_tuples" yaml:"exchange_rate_tuples"` Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty" yaml:"voter"` @@ -178,7 +140,7 @@ type AggregateExchangeRateVote struct { func (m *AggregateExchangeRateVote) Reset() { *m = AggregateExchangeRateVote{} } func (*AggregateExchangeRateVote) ProtoMessage() {} func (*AggregateExchangeRateVote) Descriptor() ([]byte, []int) { - return fileDescriptor_dc470b50b143d488, []int{3} + return fileDescriptor_dc470b50b143d488, []int{2} } func (m *AggregateExchangeRateVote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -215,7 +177,7 @@ type ExchangeRateTuple struct { func (m *ExchangeRateTuple) Reset() { *m = ExchangeRateTuple{} } func (*ExchangeRateTuple) ProtoMessage() {} func (*ExchangeRateTuple) Descriptor() ([]byte, []int) { - return fileDescriptor_dc470b50b143d488, []int{4} + return fileDescriptor_dc470b50b143d488, []int{3} } func (m *ExchangeRateTuple) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -252,7 +214,7 @@ type OracleExchangeRate struct { func (m *OracleExchangeRate) Reset() { *m = OracleExchangeRate{} } func (*OracleExchangeRate) ProtoMessage() {} func (*OracleExchangeRate) Descriptor() ([]byte, []int) { - return fileDescriptor_dc470b50b143d488, []int{5} + return fileDescriptor_dc470b50b143d488, []int{4} } func (m *OracleExchangeRate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -290,7 +252,7 @@ func (m *PriceSnapshotItem) Reset() { *m = PriceSnapshotItem{} } func (m *PriceSnapshotItem) String() string { return proto.CompactTextString(m) } func (*PriceSnapshotItem) ProtoMessage() {} func (*PriceSnapshotItem) Descriptor() ([]byte, []int) { - return fileDescriptor_dc470b50b143d488, []int{6} + return fileDescriptor_dc470b50b143d488, []int{5} } func (m *PriceSnapshotItem) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -342,7 +304,7 @@ func (m *PriceSnapshot) Reset() { *m = PriceSnapshot{} } func (m *PriceSnapshot) String() string { return proto.CompactTextString(m) } func (*PriceSnapshot) ProtoMessage() {} func (*PriceSnapshot) Descriptor() ([]byte, []int) { - return fileDescriptor_dc470b50b143d488, []int{7} + return fileDescriptor_dc470b50b143d488, []int{6} } func (m *PriceSnapshot) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -395,7 +357,7 @@ func (m *OracleTwap) Reset() { *m = OracleTwap{} } func (m *OracleTwap) String() string { return proto.CompactTextString(m) } func (*OracleTwap) ProtoMessage() {} func (*OracleTwap) Descriptor() ([]byte, []int) { - return fileDescriptor_dc470b50b143d488, []int{8} + return fileDescriptor_dc470b50b143d488, []int{7} } func (m *OracleTwap) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -447,7 +409,7 @@ 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} + return fileDescriptor_dc470b50b143d488, []int{8} } func (m *VotePenaltyCounter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -493,7 +455,6 @@ func (m *VotePenaltyCounter) GetAbstainCount() uint64 { func init() { proto.RegisterType((*Params)(nil), "seiprotocol.seichain.oracle.Params") proto.RegisterType((*Denom)(nil), "seiprotocol.seichain.oracle.Denom") - proto.RegisterType((*AggregateExchangeRatePrevote)(nil), "seiprotocol.seichain.oracle.AggregateExchangeRatePrevote") proto.RegisterType((*AggregateExchangeRateVote)(nil), "seiprotocol.seichain.oracle.AggregateExchangeRateVote") proto.RegisterType((*ExchangeRateTuple)(nil), "seiprotocol.seichain.oracle.ExchangeRateTuple") proto.RegisterType((*OracleExchangeRate)(nil), "seiprotocol.seichain.oracle.OracleExchangeRate") @@ -506,70 +467,67 @@ func init() { func init() { proto.RegisterFile("oracle/oracle.proto", fileDescriptor_dc470b50b143d488) } var fileDescriptor_dc470b50b143d488 = []byte{ - // 1005 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xbd, 0x8f, 0xe3, 0x44, - 0x14, 0x8f, 0x6f, 0x3f, 0x20, 0x93, 0x0d, 0xb7, 0x99, 0x0b, 0x90, 0xfb, 0x8a, 0x57, 0x73, 0xe2, - 0xb4, 0x14, 0x97, 0x70, 0x47, 0x81, 0x88, 0x44, 0x81, 0x59, 0x0e, 0x2d, 0x1f, 0x22, 0xcc, 0x2d, - 0x0b, 0xa2, 0xb1, 0x26, 0xf6, 0x10, 0x8f, 0x62, 0x7b, 0x2c, 0xcf, 0x64, 0x73, 0xdb, 0x50, 0x50, - 0x51, 0x22, 0x2a, 0x24, 0x9a, 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, 0x1c, 0xf2, 0x21, 0xd7, 0xd6, 0xae, 0xfa, 0xcb, 0x43, - 0x6e, 0xb4, 0x3d, 0x2e, 0x22, 0x2e, 0xba, 0x03, 0x22, 0x68, 0xf7, 0xe8, 0xfe, 0x80, 0x4a, 0x72, - 0xbf, 0xeb, 0x71, 0x16, 0xe7, 0x76, 0xf4, 0xf5, 0x26, 0xd8, 0xec, 0x93, 0x94, 0x44, 0x02, 0xbe, - 0x01, 0x6a, 0x47, 0x5c, 0x52, 0x37, 0xa1, 0x29, 0xe3, 0x7e, 0xcb, 0xda, 0xb1, 0x76, 0xd7, 0x9d, - 0x97, 0xa6, 0x99, 0x0d, 0x8f, 0x49, 0x14, 0xf6, 0x50, 0xc1, 0x88, 0x30, 0x50, 0x52, 0x5f, 0x0b, - 0x30, 0x06, 0x2f, 0x68, 0x9b, 0x0c, 0x52, 0x2a, 0x02, 0x1e, 0xfa, 0xad, 0x2b, 0x3b, 0xd6, 0x6e, - 0xd5, 0x79, 0xef, 0x49, 0x66, 0x57, 0x7e, 0xcd, 0xec, 0xbb, 0x43, 0x26, 0x83, 0xf1, 0xa0, 0xe3, - 0xf1, 0xa8, 0x6b, 0xd2, 0xc9, 0x3f, 0xf7, 0x84, 0x3f, 0xea, 0xca, 0xe3, 0x84, 0x8a, 0xce, 0x1e, - 0xf5, 0xa6, 0x99, 0xfd, 0x62, 0xe1, 0xa4, 0x73, 0x34, 0x84, 0xeb, 0x4a, 0x71, 0x30, 0x93, 0x21, - 0x05, 0xb5, 0x94, 0x4e, 0x48, 0xea, 0xbb, 0x03, 0x12, 0xfb, 0xad, 0x35, 0x7d, 0xd8, 0xde, 0xca, - 0x87, 0x99, 0xb2, 0x0a, 0x50, 0x08, 0x83, 0x5c, 0x72, 0x48, 0xec, 0xc3, 0x21, 0xa8, 0x4e, 0x02, - 0x26, 0x69, 0xc8, 0x84, 0x6c, 0xad, 0xef, 0xac, 0xed, 0xd6, 0x1e, 0xa0, 0xce, 0x25, 0x0c, 0x74, - 0xf6, 0x68, 0xcc, 0x23, 0xe7, 0x15, 0x95, 0xc8, 0x34, 0xb3, 0xb7, 0x73, 0xf8, 0x73, 0x08, 0xf4, - 0xe3, 0x6f, 0x76, 0x55, 0xbb, 0x7c, 0xc8, 0x84, 0xc4, 0x17, 0xd8, 0xaa, 0x7f, 0x22, 0x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8, 0xdf, 0x26, 0x31, 0x09, 0xe5, 0xf1, 0x3b, 0x7c, 0x1c, 0xab, 0x8b, 0xf3, 0x36, 0x00, - 0x11, 0x13, 0xc2, 0xf5, 0x94, 0x9c, 0xbf, 0x6d, 0x70, 0x55, 0x69, 0xb4, 0x03, 0xbc, 0x03, 0xea, - 0x64, 0x20, 0x24, 0x61, 0xb1, 0xf1, 0xb8, 0xa2, 0x3d, 0xb6, 0x8c, 0x52, 0x3b, 0x39, 0xef, 0x3f, - 0x39, 0x6d, 0x5b, 0x4f, 0x4f, 0xdb, 0xd6, 0xef, 0xa7, 0x6d, 0xeb, 0xdb, 0xb3, 0x76, 0xe5, 0xe9, - 0x59, 0xbb, 0xf2, 0xcb, 0x59, 0xbb, 0xf2, 0xc5, 0x6b, 0x85, 0xda, 0x04, 0x65, 0xf7, 0x66, 0x04, - 0x69, 0x41, 0x33, 0xd4, 0x7d, 0x6c, 0x9e, 0x72, 0x79, 0xa5, 0x83, 0x4d, 0xed, 0xf2, 0xfa, 0x3f, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x3c, 0xf1, 0xaf, 0xb7, 0xe8, 0x09, 0x00, 0x00, + // 958 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xbd, 0x6f, 0x23, 0x45, + 0x14, 0xf7, 0xc6, 0x4e, 0xc0, 0x63, 0x9b, 0x8b, 0xe7, 0x0c, 0xf8, 0xee, 0x38, 0x6f, 0x34, 0x27, + 0x4e, 0xa1, 0x38, 0x9b, 0x3b, 0x0a, 0x84, 0x25, 0x0a, 0x96, 0x70, 0x28, 0x7c, 0x88, 0x30, 0x17, + 0x02, 0xa2, 0x59, 0x8d, 0x77, 0x07, 0x7b, 0x94, 0xdd, 0x9d, 0xd5, 0xce, 0x38, 0xbe, 0x34, 0x14, + 0x54, 0x94, 0x88, 0x0a, 0x89, 0x26, 0x35, 0x7f, 0x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, + 0xa6, 0x5a, 0xbb, 0x33, 0x92, 0xfe, 0x4b, 0x2b, 0x3e, 0x05, 0x35, 0x39, 0x23, 0xa9, 0x1d, 0x92, + 0xb7, 0x97, 0x9e, 0x47, 0x7b, 0x77, 0x29, 0x0e, 0x84, 0x35, 0x15, 0x7c, 0x0d, 0x9c, 0xde, 0x83, + 0xbe, 0xa0, 0x01, 0x4f, 0x42, 0xa1, 0xbf, 0x9f, 0x55, 0x7c, 0x6d, 0x81, 0x3f, 0x32, 0x30, 0xfa, + 0x02, 0xc0, 0x3d, 0xfd, 0x8d, 0x4f, 0x48, 0x24, 0x0f, 0xdf, 0xe5, 0xd3, 0x44, 0xd2, 0x0c, 0xde, + 0x06, 0x20, 0x66, 0x42, 0xf8, 0x81, 0x92, 0xcd, 0x3f, 0x02, 0xae, 0x2b, 0x44, 0x1b, 0xc0, 0x3b, + 0xa0, 0x45, 0x46, 0x42, 0x12, 0x96, 0x58, 0x8b, 0x15, 0x6d, 0xd1, 0xb4, 0xa0, 0x36, 0xf2, 0x3e, + 0x78, 0x72, 0xdc, 0x73, 0x9e, 0x1e, 0xf7, 0x9c, 0xdf, 0x8f, 0x7b, 0xce, 0x77, 0x27, 0xbd, 0xca, + 0xd3, 0x93, 0x5e, 0xe5, 0x97, 0x93, 0x5e, 0xe5, 0xcb, 0xd7, 0x0b, 0xb9, 0x09, 0xca, 0xee, 0x2d, + 0x1a, 0xa4, 0x05, 0xdd, 0xa1, 0xc1, 0x63, 0xfb, 0x4b, 0x64, 0x32, 0x1d, 0xad, 0x69, 0x93, 0x37, + 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xce, 0x42, 0xa9, 0xc2, 0x30, 0x09, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -744,48 +702,6 @@ func (m *Denom) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *AggregateExchangeRatePrevote) 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 *AggregateExchangeRatePrevote) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AggregateExchangeRatePrevote) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.SubmitBlock != 0 { - i = encodeVarintOracle(dAtA, i, uint64(m.SubmitBlock)) - i-- - dAtA[i] = 0x18 - } - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintOracle(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintOracle(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *AggregateExchangeRateVote) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1129,26 +1045,6 @@ func (m *Denom) Size() (n int) { return n } -func (m *AggregateExchangeRatePrevote) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovOracle(uint64(l)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovOracle(uint64(l)) - } - if m.SubmitBlock != 0 { - n += 1 + sovOracle(uint64(m.SubmitBlock)) - } - return n -} - func (m *AggregateExchangeRateVote) Size() (n int) { if m == nil { return 0 @@ -1627,139 +1523,6 @@ func (m *Denom) Unmarshal(dAtA []byte) error { } return nil } -func (m *AggregateExchangeRatePrevote) 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: AggregateExchangeRatePrevote: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AggregateExchangeRatePrevote: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthOracle - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthOracle - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SubmitBlock", wireType) - } - m.SubmitBlock = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SubmitBlock |= 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 (m *AggregateExchangeRateVote) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/oracle/types/querier.go b/x/oracle/types/querier.go index 20506a7568..11250923c8 100755 --- a/x/oracle/types/querier.go +++ b/x/oracle/types/querier.go @@ -14,8 +14,6 @@ const ( QueryActives = "actives" QueryFeederDelegation = "feederDelegation" QueryVotePenaltyCounter = "votePenaltyCounter" - QueryAggregatePrevote = "aggregatePrevote" - QueryAggregatePrevotes = "aggregatePrevotes" QueryAggregateVote = "aggregateVote" QueryAggregateVotes = "aggregateVotes" QueryVoteTargets = "voteTargets" @@ -43,18 +41,6 @@ func NewQueryTwapsParams(lookbackSeconds int64) QueryTwapsParams { return QueryTwapsParams{lookbackSeconds} } -// QueryPrevotesParams defines the params for the following queries: -// - 'custom/oracle/prevotes' -type QueryPrevotesParams struct { - Voter sdk.ValAddress - Denom string -} - -// NewQueryPrevotesParams returns params for exchange_rate prevotes query -func NewQueryPrevotesParams(voter sdk.ValAddress, denom string) QueryPrevotesParams { - return QueryPrevotesParams{voter, denom} -} - // QueryVotesParams defines the params for the following queries: // - 'custom/oracle/votes' type QueryVotesParams struct { @@ -89,17 +75,6 @@ func NewQueryVotePenaltyCounterParams(validator sdk.ValAddress) QueryVotePenalty return QueryVotePenaltyCounterParams{validator} } -// QueryAggregatePrevoteParams defines the params for the following queries: -// - 'custom/oracle/aggregatePrevote' -type QueryAggregatePrevoteParams struct { - Validator sdk.ValAddress -} - -// NewQueryAggregatePrevoteParams returns params for feeder delegation query -func NewQueryAggregatePrevoteParams(validator sdk.ValAddress) QueryAggregatePrevoteParams { - return QueryAggregatePrevoteParams{validator} -} - // QueryAggregateVoteParams defines the params for the following queries: // - 'custom/oracle/aggregateVote' type QueryAggregateVoteParams struct { diff --git a/x/oracle/types/query.pb.go b/x/oracle/types/query.pb.go index 565f5d26a5..27b25837d7 100644 --- a/x/oracle/types/query.pb.go +++ b/x/oracle/types/query.pb.go @@ -761,176 +761,6 @@ func (m *QueryVotePenaltyCounterResponse) GetVotePenaltyCounter() *VotePenaltyCo return nil } -// QueryAggregatePrevoteRequest is the request type for the Query/AggregatePrevote RPC method. -type QueryAggregatePrevoteRequest 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 *QueryAggregatePrevoteRequest) Reset() { *m = QueryAggregatePrevoteRequest{} } -func (m *QueryAggregatePrevoteRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAggregatePrevoteRequest) ProtoMessage() {} -func (*QueryAggregatePrevoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{17} -} -func (m *QueryAggregatePrevoteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAggregatePrevoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAggregatePrevoteRequest.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 *QueryAggregatePrevoteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAggregatePrevoteRequest.Merge(m, src) -} -func (m *QueryAggregatePrevoteRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAggregatePrevoteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAggregatePrevoteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAggregatePrevoteRequest proto.InternalMessageInfo - -// QueryAggregatePrevoteResponse is response type for the -// Query/AggregatePrevote RPC method. -type QueryAggregatePrevoteResponse struct { - // aggregate_prevote defines oracle aggregate prevote submitted by a validator in the current vote period - AggregatePrevote AggregateExchangeRatePrevote `protobuf:"bytes,1,opt,name=aggregate_prevote,json=aggregatePrevote,proto3" json:"aggregate_prevote"` -} - -func (m *QueryAggregatePrevoteResponse) Reset() { *m = QueryAggregatePrevoteResponse{} } -func (m *QueryAggregatePrevoteResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAggregatePrevoteResponse) ProtoMessage() {} -func (*QueryAggregatePrevoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{18} -} -func (m *QueryAggregatePrevoteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAggregatePrevoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAggregatePrevoteResponse.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 *QueryAggregatePrevoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAggregatePrevoteResponse.Merge(m, src) -} -func (m *QueryAggregatePrevoteResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAggregatePrevoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAggregatePrevoteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAggregatePrevoteResponse proto.InternalMessageInfo - -func (m *QueryAggregatePrevoteResponse) GetAggregatePrevote() AggregateExchangeRatePrevote { - if m != nil { - return m.AggregatePrevote - } - return AggregateExchangeRatePrevote{} -} - -// QueryAggregatePrevotesRequest is the request type for the Query/AggregatePrevotes RPC method. -type QueryAggregatePrevotesRequest struct { -} - -func (m *QueryAggregatePrevotesRequest) Reset() { *m = QueryAggregatePrevotesRequest{} } -func (m *QueryAggregatePrevotesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAggregatePrevotesRequest) ProtoMessage() {} -func (*QueryAggregatePrevotesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{19} -} -func (m *QueryAggregatePrevotesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAggregatePrevotesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAggregatePrevotesRequest.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 *QueryAggregatePrevotesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAggregatePrevotesRequest.Merge(m, src) -} -func (m *QueryAggregatePrevotesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAggregatePrevotesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAggregatePrevotesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAggregatePrevotesRequest proto.InternalMessageInfo - -// QueryAggregatePrevotesResponse is response type for the -// Query/AggregatePrevotes RPC method. -type QueryAggregatePrevotesResponse struct { - // aggregate_prevotes defines all oracle aggregate prevotes submitted in the current vote period - AggregatePrevotes []AggregateExchangeRatePrevote `protobuf:"bytes,1,rep,name=aggregate_prevotes,json=aggregatePrevotes,proto3" json:"aggregate_prevotes"` -} - -func (m *QueryAggregatePrevotesResponse) Reset() { *m = QueryAggregatePrevotesResponse{} } -func (m *QueryAggregatePrevotesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAggregatePrevotesResponse) ProtoMessage() {} -func (*QueryAggregatePrevotesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{20} -} -func (m *QueryAggregatePrevotesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAggregatePrevotesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAggregatePrevotesResponse.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 *QueryAggregatePrevotesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAggregatePrevotesResponse.Merge(m, src) -} -func (m *QueryAggregatePrevotesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAggregatePrevotesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAggregatePrevotesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAggregatePrevotesResponse proto.InternalMessageInfo - -func (m *QueryAggregatePrevotesResponse) GetAggregatePrevotes() []AggregateExchangeRatePrevote { - if m != nil { - return m.AggregatePrevotes - } - return nil -} - // QueryAggregateVoteRequest is the request type for the Query/AggregateVote RPC method. type QueryAggregateVoteRequest struct { // validator defines the validator address to query for. @@ -941,7 +771,7 @@ func (m *QueryAggregateVoteRequest) Reset() { *m = QueryAggregateVoteReq func (m *QueryAggregateVoteRequest) String() string { return proto.CompactTextString(m) } func (*QueryAggregateVoteRequest) ProtoMessage() {} func (*QueryAggregateVoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{21} + return fileDescriptor_562b782cb9ac197e, []int{17} } func (m *QueryAggregateVoteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -981,7 +811,7 @@ func (m *QueryAggregateVoteResponse) Reset() { *m = QueryAggregateVoteRe func (m *QueryAggregateVoteResponse) String() string { return proto.CompactTextString(m) } func (*QueryAggregateVoteResponse) ProtoMessage() {} func (*QueryAggregateVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{22} + return fileDescriptor_562b782cb9ac197e, []int{18} } func (m *QueryAggregateVoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1025,7 +855,7 @@ func (m *QueryAggregateVotesRequest) Reset() { *m = QueryAggregateVotesR func (m *QueryAggregateVotesRequest) String() string { return proto.CompactTextString(m) } func (*QueryAggregateVotesRequest) ProtoMessage() {} func (*QueryAggregateVotesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{23} + return fileDescriptor_562b782cb9ac197e, []int{19} } func (m *QueryAggregateVotesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1065,7 +895,7 @@ func (m *QueryAggregateVotesResponse) Reset() { *m = QueryAggregateVotes func (m *QueryAggregateVotesResponse) String() string { return proto.CompactTextString(m) } func (*QueryAggregateVotesResponse) ProtoMessage() {} func (*QueryAggregateVotesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{24} + return fileDescriptor_562b782cb9ac197e, []int{20} } func (m *QueryAggregateVotesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1109,7 +939,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{25} + return fileDescriptor_562b782cb9ac197e, []int{21} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1148,7 +978,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{26} + return fileDescriptor_562b782cb9ac197e, []int{22} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1202,10 +1032,6 @@ func init() { proto.RegisterType((*QueryFeederDelegationResponse)(nil), "seiprotocol.seichain.oracle.QueryFeederDelegationResponse") 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") - proto.RegisterType((*QueryAggregatePrevotesResponse)(nil), "seiprotocol.seichain.oracle.QueryAggregatePrevotesResponse") proto.RegisterType((*QueryAggregateVoteRequest)(nil), "seiprotocol.seichain.oracle.QueryAggregateVoteRequest") proto.RegisterType((*QueryAggregateVoteResponse)(nil), "seiprotocol.seichain.oracle.QueryAggregateVoteResponse") proto.RegisterType((*QueryAggregateVotesRequest)(nil), "seiprotocol.seichain.oracle.QueryAggregateVotesRequest") @@ -1217,87 +1043,80 @@ func init() { func init() { proto.RegisterFile("oracle/query.proto", fileDescriptor_562b782cb9ac197e) } var fileDescriptor_562b782cb9ac197e = []byte{ - // 1276 bytes of a gzipped FileDescriptorProto + // 1162 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, 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ference imports to suppress errors if they are not otherwise used. @@ -1327,10 +1146,6 @@ type QueryClient interface { FeederDelegation(ctx context.Context, in *QueryFeederDelegationRequest, opts ...grpc.CallOption) (*QueryFeederDelegationResponse, error) // MissCounter returns oracle miss counter of a validator 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 - AggregatePrevotes(ctx context.Context, in *QueryAggregatePrevotesRequest, opts ...grpc.CallOption) (*QueryAggregatePrevotesResponse, error) // AggregateVote returns an aggregate vote of a validator AggregateVote(ctx context.Context, in *QueryAggregateVoteRequest, opts ...grpc.CallOption) (*QueryAggregateVoteResponse, error) // AggregateVotes returns aggregate votes of all validators @@ -1419,24 +1234,6 @@ func (c *queryClient) VotePenaltyCounter(ctx context.Context, in *QueryVotePenal return out, nil } -func (c *queryClient) AggregatePrevote(ctx context.Context, in *QueryAggregatePrevoteRequest, opts ...grpc.CallOption) (*QueryAggregatePrevoteResponse, error) { - out := new(QueryAggregatePrevoteResponse) - err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/AggregatePrevote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AggregatePrevotes(ctx context.Context, in *QueryAggregatePrevotesRequest, opts ...grpc.CallOption) (*QueryAggregatePrevotesResponse, error) { - out := new(QueryAggregatePrevotesResponse) - err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/AggregatePrevotes", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) AggregateVote(ctx context.Context, in *QueryAggregateVoteRequest, opts ...grpc.CallOption) (*QueryAggregateVoteResponse, error) { out := new(QueryAggregateVoteResponse) err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Query/AggregateVote", in, out, opts...) @@ -1481,10 +1278,6 @@ type QueryServer interface { FeederDelegation(context.Context, *QueryFeederDelegationRequest) (*QueryFeederDelegationResponse, error) // MissCounter returns oracle miss counter of a validator 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 - AggregatePrevotes(context.Context, *QueryAggregatePrevotesRequest) (*QueryAggregatePrevotesResponse, error) // AggregateVote returns an aggregate vote of a validator AggregateVote(context.Context, *QueryAggregateVoteRequest) (*QueryAggregateVoteResponse, error) // AggregateVotes returns aggregate votes of all validators @@ -1521,12 +1314,6 @@ func (*UnimplementedQueryServer) FeederDelegation(ctx context.Context, req *Quer 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") -} -func (*UnimplementedQueryServer) AggregatePrevotes(ctx context.Context, req *QueryAggregatePrevotesRequest) (*QueryAggregatePrevotesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AggregatePrevotes not implemented") -} func (*UnimplementedQueryServer) AggregateVote(ctx context.Context, req *QueryAggregateVoteRequest) (*QueryAggregateVoteResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AggregateVote not implemented") } @@ -1685,42 +1472,6 @@ func _Query_VotePenaltyCounter_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _Query_AggregatePrevote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAggregatePrevoteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AggregatePrevote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/seiprotocol.seichain.oracle.Query/AggregatePrevote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AggregatePrevote(ctx, req.(*QueryAggregatePrevoteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AggregatePrevotes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAggregatePrevotesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AggregatePrevotes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/seiprotocol.seichain.oracle.Query/AggregatePrevotes", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AggregatePrevotes(ctx, req.(*QueryAggregatePrevotesRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_AggregateVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryAggregateVoteRequest) if err := dec(in); err != nil { @@ -1811,14 +1562,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "VotePenaltyCounter", Handler: _Query_VotePenaltyCounter_Handler, }, - { - MethodName: "AggregatePrevote", - Handler: _Query_AggregatePrevote_Handler, - }, - { - MethodName: "AggregatePrevotes", - Handler: _Query_AggregatePrevotes_Handler, - }, { MethodName: "AggregateVote", Handler: _Query_AggregateVote_Handler, @@ -2359,7 +2102,7 @@ func (m *QueryVotePenaltyCounterResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } -func (m *QueryAggregatePrevoteRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAggregateVoteRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2369,12 +2112,12 @@ func (m *QueryAggregatePrevoteRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAggregatePrevoteRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAggregateVoteRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAggregatePrevoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAggregateVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2389,7 +2132,7 @@ func (m *QueryAggregatePrevoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *QueryAggregatePrevoteResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAggregateVoteResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2399,18 +2142,18 @@ func (m *QueryAggregatePrevoteResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAggregatePrevoteResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAggregateVoteResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAggregatePrevoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAggregateVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.AggregatePrevote.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.AggregateVote.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2422,7 +2165,7 @@ func (m *QueryAggregatePrevoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryAggregatePrevotesRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAggregateVotesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2432,12 +2175,12 @@ func (m *QueryAggregatePrevotesRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAggregatePrevotesRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAggregateVotesRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAggregatePrevotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAggregateVotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2445,7 +2188,7 @@ func (m *QueryAggregatePrevotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryAggregatePrevotesResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAggregateVotesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2455,20 +2198,20 @@ func (m *QueryAggregatePrevotesResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAggregatePrevotesResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAggregateVotesResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAggregatePrevotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAggregateVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.AggregatePrevotes) > 0 { - for iNdEx := len(m.AggregatePrevotes) - 1; iNdEx >= 0; iNdEx-- { + if len(m.AggregateVotes) > 0 { + for iNdEx := len(m.AggregateVotes) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.AggregatePrevotes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.AggregateVotes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2482,7 +2225,7 @@ func (m *QueryAggregatePrevotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryAggregateVoteRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2492,27 +2235,20 @@ func (m *QueryAggregateVoteRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAggregateVoteRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAggregateVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0xa - } return len(dAtA) - i, nil } -func (m *QueryAggregateVoteResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2522,18 +2258,18 @@ func (m *QueryAggregateVoteResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAggregateVoteResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAggregateVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.AggregateVote.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2545,170 +2281,54 @@ func (m *QueryAggregateVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func (m *QueryAggregateVotesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return dAtA[:n], nil -} - -func (m *QueryAggregateVotesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + dAtA[offset] = uint8(v) + return base } - -func (m *QueryAggregateVotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryExchangeRateRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - return len(dAtA) - i, nil + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n } -func (m *QueryAggregateVotesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryExchangeRateResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil + var l int + _ = l + l = m.OracleExchangeRate.Size() + n += 1 + l + sovQuery(uint64(l)) + return n } -func (m *QueryAggregateVotesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryExchangeRatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n } -func (m *QueryAggregateVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.AggregateVotes) > 0 { - for iNdEx := len(m.AggregateVotes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AggregateVotes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryExchangeRateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryExchangeRateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.OracleExchangeRate.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryExchangeRatesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *DenomOracleExchangeRatePair) Size() (n int) { - if m == nil { - return 0 - } +func (m *DenomOracleExchangeRatePair) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Denom) @@ -2886,54 +2506,6 @@ func (m *QueryVotePenaltyCounterResponse) Size() (n int) { return n } -func (m *QueryAggregatePrevoteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAggregatePrevoteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.AggregatePrevote.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryAggregatePrevotesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryAggregatePrevotesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.AggregatePrevotes) > 0 { - for _, e := range m.AggregatePrevotes { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - func (m *QueryAggregateVoteRequest) Size() (n int) { if m == nil { return 0 @@ -4305,305 +3877,6 @@ func (m *QueryVotePenaltyCounterResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAggregatePrevoteRequest) 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 ErrIntOverflowQuery - } - 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: QueryAggregatePrevoteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAggregatePrevoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAggregatePrevoteResponse) 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 ErrIntOverflowQuery - } - 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: QueryAggregatePrevoteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAggregatePrevoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregatePrevote", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - 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 err := m.AggregatePrevote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAggregatePrevotesRequest) 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 ErrIntOverflowQuery - } - 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: QueryAggregatePrevotesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAggregatePrevotesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAggregatePrevotesResponse) 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 ErrIntOverflowQuery - } - 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: QueryAggregatePrevotesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAggregatePrevotesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregatePrevotes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - 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 - } - m.AggregatePrevotes = append(m.AggregatePrevotes, AggregateExchangeRatePrevote{}) - if err := m.AggregatePrevotes[len(m.AggregatePrevotes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryAggregateVoteRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/oracle/types/query.pb.gw.go b/x/oracle/types/query.pb.gw.go index c286305ed4..a3f0e9973c 100644 --- a/x/oracle/types/query.pb.gw.go +++ b/x/oracle/types/query.pb.gw.go @@ -303,78 +303,6 @@ func local_request_Query_VotePenaltyCounter_0(ctx context.Context, marshaler run } -func request_Query_AggregatePrevote_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAggregatePrevoteRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["validator_addr"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") - } - - protoReq.ValidatorAddr, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) - } - - msg, err := client.AggregatePrevote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AggregatePrevote_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAggregatePrevoteRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["validator_addr"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") - } - - protoReq.ValidatorAddr, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) - } - - msg, err := server.AggregatePrevote(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_AggregatePrevotes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAggregatePrevotesRequest - var metadata runtime.ServerMetadata - - msg, err := client.AggregatePrevotes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AggregatePrevotes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAggregatePrevotesRequest - var metadata runtime.ServerMetadata - - msg, err := server.AggregatePrevotes(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_AggregateVote_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAggregateVoteRequest var metadata runtime.ServerMetadata @@ -655,52 +583,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_AggregatePrevote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_AggregatePrevote_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 { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AggregatePrevote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AggregatePrevotes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_AggregatePrevotes_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 { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AggregatePrevotes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_AggregateVote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -971,46 +853,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_AggregatePrevote_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) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_AggregatePrevote_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_AggregatePrevote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AggregatePrevotes_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) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_AggregatePrevotes_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_AggregatePrevotes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_AggregateVote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1091,10 +933,6 @@ var ( 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))) - - pattern_Query_AggregatePrevotes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"sei-protocol", "sei-chain", "oracle", "validators", "aggregate_prevotes"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_AggregateVote_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_vote"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_AggregateVotes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"sei-protocol", "sei-chain", "oracle", "validators", "aggregate_votes"}, "", runtime.AssumeColonVerbOpt(true))) @@ -1119,10 +957,6 @@ var ( forward_Query_VotePenaltyCounter_0 = runtime.ForwardResponseMessage - forward_Query_AggregatePrevote_0 = runtime.ForwardResponseMessage - - forward_Query_AggregatePrevotes_0 = runtime.ForwardResponseMessage - forward_Query_AggregateVote_0 = runtime.ForwardResponseMessage forward_Query_AggregateVotes_0 = runtime.ForwardResponseMessage diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index 0809be2954..441abe509f 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -28,90 +28,10 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgAggregateExchangeRatePrevote represents a message to submit -// aggregate exchange rate prevote. -type MsgAggregateExchangeRatePrevote struct { - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty" yaml:"hash"` - Feeder string `protobuf:"bytes,2,opt,name=feeder,proto3" json:"feeder,omitempty" yaml:"feeder"` - Validator string `protobuf:"bytes,3,opt,name=validator,proto3" json:"validator,omitempty" yaml:"validator"` -} - -func (m *MsgAggregateExchangeRatePrevote) Reset() { *m = MsgAggregateExchangeRatePrevote{} } -func (m *MsgAggregateExchangeRatePrevote) String() string { return proto.CompactTextString(m) } -func (*MsgAggregateExchangeRatePrevote) ProtoMessage() {} -func (*MsgAggregateExchangeRatePrevote) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{0} -} -func (m *MsgAggregateExchangeRatePrevote) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAggregateExchangeRatePrevote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAggregateExchangeRatePrevote.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 *MsgAggregateExchangeRatePrevote) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAggregateExchangeRatePrevote.Merge(m, src) -} -func (m *MsgAggregateExchangeRatePrevote) XXX_Size() int { - return m.Size() -} -func (m *MsgAggregateExchangeRatePrevote) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAggregateExchangeRatePrevote.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAggregateExchangeRatePrevote proto.InternalMessageInfo - -// MsgAggregateExchangeRatePrevoteResponse defines the Msg/AggregateExchangeRatePrevote response type. -type MsgAggregateExchangeRatePrevoteResponse struct { -} - -func (m *MsgAggregateExchangeRatePrevoteResponse) Reset() { - *m = MsgAggregateExchangeRatePrevoteResponse{} -} -func (m *MsgAggregateExchangeRatePrevoteResponse) String() string { return proto.CompactTextString(m) } -func (*MsgAggregateExchangeRatePrevoteResponse) ProtoMessage() {} -func (*MsgAggregateExchangeRatePrevoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{1} -} -func (m *MsgAggregateExchangeRatePrevoteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAggregateExchangeRatePrevoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAggregateExchangeRatePrevoteResponse.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 *MsgAggregateExchangeRatePrevoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAggregateExchangeRatePrevoteResponse.Merge(m, src) -} -func (m *MsgAggregateExchangeRatePrevoteResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgAggregateExchangeRatePrevoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAggregateExchangeRatePrevoteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAggregateExchangeRatePrevoteResponse proto.InternalMessageInfo - // MsgAggregateExchangeRateVote represents a message to submit // aggregate exchange rate vote. type MsgAggregateExchangeRateVote struct { - Salt string `protobuf:"bytes,1,opt,name=salt,proto3" json:"salt,omitempty" yaml:"salt"` + // 1 reserved from old field `salt` ExchangeRates string `protobuf:"bytes,2,opt,name=exchange_rates,json=exchangeRates,proto3" json:"exchange_rates,omitempty" yaml:"exchange_rates"` Feeder string `protobuf:"bytes,3,opt,name=feeder,proto3" json:"feeder,omitempty" yaml:"feeder"` Validator string `protobuf:"bytes,4,opt,name=validator,proto3" json:"validator,omitempty" yaml:"validator"` @@ -121,7 +41,7 @@ func (m *MsgAggregateExchangeRateVote) Reset() { *m = MsgAggregateExchan func (m *MsgAggregateExchangeRateVote) String() string { return proto.CompactTextString(m) } func (*MsgAggregateExchangeRateVote) ProtoMessage() {} func (*MsgAggregateExchangeRateVote) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{2} + return fileDescriptor_cb5390096518ffda, []int{0} } func (m *MsgAggregateExchangeRateVote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -158,7 +78,7 @@ func (m *MsgAggregateExchangeRateVoteResponse) Reset() { *m = MsgAggrega func (m *MsgAggregateExchangeRateVoteResponse) String() string { return proto.CompactTextString(m) } func (*MsgAggregateExchangeRateVoteResponse) ProtoMessage() {} func (*MsgAggregateExchangeRateVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{3} + return fileDescriptor_cb5390096518ffda, []int{1} } func (m *MsgAggregateExchangeRateVoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -187,90 +107,6 @@ func (m *MsgAggregateExchangeRateVoteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAggregateExchangeRateVoteResponse proto.InternalMessageInfo -// MsgAggregateExchangeRateVote represents a message to submit -// aggregate exchange rate vote. -type MsgAggregateExchangeRateCombinedVote struct { - VoteSalt string `protobuf:"bytes,1,opt,name=vote_salt,json=voteSalt,proto3" json:"vote_salt,omitempty" yaml:"vote_salt"` - VoteExchangeRates string `protobuf:"bytes,2,opt,name=vote_exchange_rates,json=voteExchangeRates,proto3" json:"vote_exchange_rates,omitempty" yaml:"vote_exchange_rates"` - PrevoteHash string `protobuf:"bytes,3,opt,name=prevote_hash,json=prevoteHash,proto3" json:"prevote_hash,omitempty" yaml:"prevote_hash"` - Feeder string `protobuf:"bytes,4,opt,name=feeder,proto3" json:"feeder,omitempty" yaml:"feeder"` - Validator string `protobuf:"bytes,5,opt,name=validator,proto3" json:"validator,omitempty" yaml:"validator"` -} - -func (m *MsgAggregateExchangeRateCombinedVote) Reset() { *m = MsgAggregateExchangeRateCombinedVote{} } -func (m *MsgAggregateExchangeRateCombinedVote) String() string { return proto.CompactTextString(m) } -func (*MsgAggregateExchangeRateCombinedVote) ProtoMessage() {} -func (*MsgAggregateExchangeRateCombinedVote) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{4} -} -func (m *MsgAggregateExchangeRateCombinedVote) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAggregateExchangeRateCombinedVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAggregateExchangeRateCombinedVote.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 *MsgAggregateExchangeRateCombinedVote) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAggregateExchangeRateCombinedVote.Merge(m, src) -} -func (m *MsgAggregateExchangeRateCombinedVote) XXX_Size() int { - return m.Size() -} -func (m *MsgAggregateExchangeRateCombinedVote) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAggregateExchangeRateCombinedVote.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAggregateExchangeRateCombinedVote proto.InternalMessageInfo - -// MsgAggregateExchangeRateVoteResponse defines the Msg/AggregateExchangeRateVote response type. -type MsgAggregateExchangeRateCombinedVoteResponse struct { -} - -func (m *MsgAggregateExchangeRateCombinedVoteResponse) Reset() { - *m = MsgAggregateExchangeRateCombinedVoteResponse{} -} -func (m *MsgAggregateExchangeRateCombinedVoteResponse) String() string { - return proto.CompactTextString(m) -} -func (*MsgAggregateExchangeRateCombinedVoteResponse) ProtoMessage() {} -func (*MsgAggregateExchangeRateCombinedVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{5} -} -func (m *MsgAggregateExchangeRateCombinedVoteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAggregateExchangeRateCombinedVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAggregateExchangeRateCombinedVoteResponse.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 *MsgAggregateExchangeRateCombinedVoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAggregateExchangeRateCombinedVoteResponse.Merge(m, src) -} -func (m *MsgAggregateExchangeRateCombinedVoteResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgAggregateExchangeRateCombinedVoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAggregateExchangeRateCombinedVoteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAggregateExchangeRateCombinedVoteResponse proto.InternalMessageInfo - // MsgDelegateFeedConsent represents a message to // delegate oracle voting rights to another address. type MsgDelegateFeedConsent struct { @@ -282,7 +118,7 @@ func (m *MsgDelegateFeedConsent) Reset() { *m = MsgDelegateFeedConsent{} func (m *MsgDelegateFeedConsent) String() string { return proto.CompactTextString(m) } func (*MsgDelegateFeedConsent) ProtoMessage() {} func (*MsgDelegateFeedConsent) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{6} + return fileDescriptor_cb5390096518ffda, []int{2} } func (m *MsgDelegateFeedConsent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -319,7 +155,7 @@ func (m *MsgDelegateFeedConsentResponse) Reset() { *m = MsgDelegateFeedC func (m *MsgDelegateFeedConsentResponse) String() string { return proto.CompactTextString(m) } func (*MsgDelegateFeedConsentResponse) ProtoMessage() {} func (*MsgDelegateFeedConsentResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{7} + return fileDescriptor_cb5390096518ffda, []int{3} } func (m *MsgDelegateFeedConsentResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -349,12 +185,8 @@ func (m *MsgDelegateFeedConsentResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDelegateFeedConsentResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgAggregateExchangeRatePrevote)(nil), "seiprotocol.seichain.oracle.MsgAggregateExchangeRatePrevote") - proto.RegisterType((*MsgAggregateExchangeRatePrevoteResponse)(nil), "seiprotocol.seichain.oracle.MsgAggregateExchangeRatePrevoteResponse") proto.RegisterType((*MsgAggregateExchangeRateVote)(nil), "seiprotocol.seichain.oracle.MsgAggregateExchangeRateVote") proto.RegisterType((*MsgAggregateExchangeRateVoteResponse)(nil), "seiprotocol.seichain.oracle.MsgAggregateExchangeRateVoteResponse") - proto.RegisterType((*MsgAggregateExchangeRateCombinedVote)(nil), "seiprotocol.seichain.oracle.MsgAggregateExchangeRateCombinedVote") - proto.RegisterType((*MsgAggregateExchangeRateCombinedVoteResponse)(nil), "seiprotocol.seichain.oracle.MsgAggregateExchangeRateCombinedVoteResponse") proto.RegisterType((*MsgDelegateFeedConsent)(nil), "seiprotocol.seichain.oracle.MsgDelegateFeedConsent") proto.RegisterType((*MsgDelegateFeedConsentResponse)(nil), "seiprotocol.seichain.oracle.MsgDelegateFeedConsentResponse") } @@ -362,46 +194,34 @@ func init() { func init() { proto.RegisterFile("oracle/tx.proto", fileDescriptor_cb5390096518ffda) } var fileDescriptor_cb5390096518ffda = []byte{ - // 611 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xbf, 0x6f, 0xd3, 0x40, - 0x18, 0xcd, 0xb5, 0x69, 0x95, 0x5c, 0x29, 0xa1, 0x4e, 0x81, 0xd4, 0x54, 0x76, 0x39, 0x10, 0x50, - 0x09, 0x6c, 0x68, 0x27, 0x02, 0x03, 0xfd, 0x85, 0x00, 0x29, 0x08, 0x19, 0x89, 0x81, 0x25, 0x72, - 0x92, 0x0f, 0xc7, 0x92, 0x93, 0x8b, 0x7c, 0xa6, 0x4a, 0xf7, 0x4a, 0x30, 0xb2, 0xb2, 0x55, 0xfc, - 0x03, 0x88, 0xff, 0x82, 0x09, 0x75, 0x64, 0xb2, 0x50, 0xb2, 0x30, 0x31, 0xf8, 0x2f, 0x40, 0xbe, - 0xb3, 0x8d, 0x03, 0xf9, 0x41, 0xd2, 0xed, 0xfc, 0xbd, 0xf7, 0xee, 0x7b, 0xdf, 0xf3, 0x9d, 0x8d, - 0x0b, 0xd4, 0x35, 0xeb, 0x0e, 0xe8, 0x5e, 0x57, 0xeb, 0xb8, 0xd4, 0xa3, 0xd2, 0x15, 0x06, 0x36, - 0x5f, 0xd5,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0xf3, - 0xf1, 0xd1, 0x26, 0xdc, 0x58, 0x79, 0xff, 0x2c, 0xea, 0xd8, 0xac, 0xf4, 0x11, 0xe1, 0xb5, 0xd1, - 0x97, 0xfd, 0xfe, 0x4c, 0x3d, 0x42, 0xa9, 0xbc, 0x33, 0xb3, 0x34, 0xf1, 0xf6, 0x05, 0xe1, 0xab, - 0x93, 0xef, 0xdb, 0x6c, 0x8d, 0xd2, 0x5b, 0xc8, 0x4f, 0xcf, 0xbc, 0x45, 0xe2, 0xf9, 0x1d, 0xc2, - 0xc5, 0x61, 0x47, 0x74, 0x7b, 0x52, 0x8b, 0x21, 0x22, 0xf9, 0xc1, 0x0c, 0xa2, 0xd8, 0xc9, 0xee, - 0xb3, 0xaf, 0x3d, 0x05, 0x9d, 0xf6, 0x14, 0xf4, 0xa3, 0xa7, 0xa0, 0x0f, 0x7d, 0x25, 0x73, 0xda, - 0x57, 0x32, 0xdf, 0xfb, 0x4a, 0xe6, 0xf5, 0x5d, 0xcb, 0xf6, 0x9a, 0x6f, 0x6b, 0x5a, 0x9d, 0xb6, - 0x74, 0x06, 0xf6, 0x9d, 0xb8, 0x03, 0x7f, 0xe0, 0x2d, 0xf4, 0xae, 0x1e, 0xff, 0x28, 0x8f, 0x3a, - 0xc0, 0x6a, 0x8b, 0x9c, 0xb2, 0xfd, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x99, 0x4b, 0x0b, 0x32, 0x3f, - 0x07, 0x00, 0x00, + // 417 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xbf, 0xcf, 0xd2, 0x40, + 0x1c, 0xc6, 0x7b, 0x60, 0x08, 0x5c, 0x82, 0x68, 0x41, 0x03, 0x68, 0x5a, 0x72, 0x31, 0x46, 0x07, + 0x5b, 0x03, 0x93, 0xb8, 0x08, 0xfe, 0x18, 0x4c, 0x58, 0x3a, 0x38, 0xb8, 0x98, 0xa3, 0xfd, 0x7a, + 0x34, 0x29, 0xbd, 0xa6, 0x77, 0x1a, 0xd8, 0x4d, 0x74, 0x74, 0x75, 0x63, 0xf7, 0x1f, 0xd1, 0x8d, + 0xd1, 0xa9, 0x31, 0xb0, 0x38, 0xf7, 0x2f, 0x30, 0x5c, 0x5b, 0x5e, 0xde, 0x84, 0x97, 0x37, 0x61, + 0x3b, 0xee, 0xf9, 0x3c, 0xdf, 0xe7, 0xe1, 0x7b, 0x29, 0x6e, 0xf0, 0x98, 0xba, 0x01, 0xd8, 0x72, + 0x61, 0x45, 0x31, 0x97, 0x5c, 0xbf, 0x27, 0xc0, 0x57, 0x27, 0x97, 0x07, 0x96, 0x00, 0xdf, 0x9d, + 0x51, 0x3f, 0xb4, 0x32, 0xaa, 0xdb, 0x62, 0x9c, 0x71, 0xa5, 0xda, 0xbb, 0x53, 0x66, 0x21, 0xbf, + 0x11, 0xbe, 0x3f, 0x11, 0x6c, 0xc4, 0x58, 0x0c, 0x8c, 0x4a, 0x78, 0xbd, 0x70, 0x67, 0x34, 0x64, + 0xe0, 0x50, 0x09, 0xef, 0xb8, 0x04, 0xfd, 0x05, 0xbe, 0x09, 0xf9, 0xdd, 0x87, 0x98, 0x4a, 0x10, + 0xed, 0x52, 0x0f, 0x3d, 0xaa, 0x8d, 0x3b, 0x69, 0x62, 0xde, 0x59, 0xd2, 0x79, 0x30, 0x24, 0x97, + 0x75, 0xe2, 0xd4, 0xe1, 0x60, 0x88, 0xd0, 0x1f, 0xe3, 0xca, 0x47, 0x00, 0x0f, 0xe2, 0x76, 0x59, + 0x39, 0x6f, 0xa7, 0x89, 0x59, 0xcf, 0x9c, 0xd9, 0x3d, 0x71, 0x72, 0x40, 0xef, 0xe3, 0xda, 0x67, + 0x1a, 0xf8, 0x1e, 0x95, 0x3c, 0x6e, 0xdf, 0x50, 0x74, 0x2b, 0x4d, 0xcc, 0x5b, 0x19, 0xbd, 0x97, + 0x88, 0x73, 0x81, 0x0d, 0xab, 0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xa4, 0x0e, 0xd3, 0x63, 0x03, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -416,14 +236,9 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // AggregateExchangeRatePrevote defines a method for submitting - // aggregate exchange rate prevote - AggregateExchangeRatePrevote(ctx context.Context, in *MsgAggregateExchangeRatePrevote, opts ...grpc.CallOption) (*MsgAggregateExchangeRatePrevoteResponse, error) // AggregateExchangeRateVote defines a method for submitting // aggregate exchange rate vote AggregateExchangeRateVote(ctx context.Context, in *MsgAggregateExchangeRateVote, opts ...grpc.CallOption) (*MsgAggregateExchangeRateVoteResponse, error) - // Aggregate vote and prevote combines the functionality of prevote and vote into one RPC - AggregateExchangeRateCombinedVote(ctx context.Context, in *MsgAggregateExchangeRateCombinedVote, opts ...grpc.CallOption) (*MsgAggregateExchangeRateCombinedVoteResponse, error) // DelegateFeedConsent defines a method for setting the feeder delegation DelegateFeedConsent(ctx context.Context, in *MsgDelegateFeedConsent, opts ...grpc.CallOption) (*MsgDelegateFeedConsentResponse, error) } @@ -436,15 +251,6 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) AggregateExchangeRatePrevote(ctx context.Context, in *MsgAggregateExchangeRatePrevote, opts ...grpc.CallOption) (*MsgAggregateExchangeRatePrevoteResponse, error) { - out := new(MsgAggregateExchangeRatePrevoteResponse) - err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Msg/AggregateExchangeRatePrevote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) AggregateExchangeRateVote(ctx context.Context, in *MsgAggregateExchangeRateVote, opts ...grpc.CallOption) (*MsgAggregateExchangeRateVoteResponse, error) { out := new(MsgAggregateExchangeRateVoteResponse) err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Msg/AggregateExchangeRateVote", in, out, opts...) @@ -454,15 +260,6 @@ func (c *msgClient) AggregateExchangeRateVote(ctx context.Context, in *MsgAggreg return out, nil } -func (c *msgClient) AggregateExchangeRateCombinedVote(ctx context.Context, in *MsgAggregateExchangeRateCombinedVote, opts ...grpc.CallOption) (*MsgAggregateExchangeRateCombinedVoteResponse, error) { - out := new(MsgAggregateExchangeRateCombinedVoteResponse) - err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Msg/AggregateExchangeRateCombinedVote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) DelegateFeedConsent(ctx context.Context, in *MsgDelegateFeedConsent, opts ...grpc.CallOption) (*MsgDelegateFeedConsentResponse, error) { out := new(MsgDelegateFeedConsentResponse) err := c.cc.Invoke(ctx, "/seiprotocol.seichain.oracle.Msg/DelegateFeedConsent", in, out, opts...) @@ -474,14 +271,9 @@ func (c *msgClient) DelegateFeedConsent(ctx context.Context, in *MsgDelegateFeed // MsgServer is the server API for Msg service. type MsgServer interface { - // AggregateExchangeRatePrevote defines a method for submitting - // aggregate exchange rate prevote - AggregateExchangeRatePrevote(context.Context, *MsgAggregateExchangeRatePrevote) (*MsgAggregateExchangeRatePrevoteResponse, error) // AggregateExchangeRateVote defines a method for submitting // aggregate exchange rate vote AggregateExchangeRateVote(context.Context, *MsgAggregateExchangeRateVote) (*MsgAggregateExchangeRateVoteResponse, error) - // Aggregate vote and prevote combines the functionality of prevote and vote into one RPC - AggregateExchangeRateCombinedVote(context.Context, *MsgAggregateExchangeRateCombinedVote) (*MsgAggregateExchangeRateCombinedVoteResponse, error) // DelegateFeedConsent defines a method for setting the feeder delegation DelegateFeedConsent(context.Context, *MsgDelegateFeedConsent) (*MsgDelegateFeedConsentResponse, error) } @@ -490,15 +282,9 @@ type MsgServer interface { type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) AggregateExchangeRatePrevote(ctx context.Context, req *MsgAggregateExchangeRatePrevote) (*MsgAggregateExchangeRatePrevoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AggregateExchangeRatePrevote not implemented") -} func (*UnimplementedMsgServer) AggregateExchangeRateVote(ctx context.Context, req *MsgAggregateExchangeRateVote) (*MsgAggregateExchangeRateVoteResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AggregateExchangeRateVote not implemented") } -func (*UnimplementedMsgServer) AggregateExchangeRateCombinedVote(ctx context.Context, req *MsgAggregateExchangeRateCombinedVote) (*MsgAggregateExchangeRateCombinedVoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AggregateExchangeRateCombinedVote not implemented") -} func (*UnimplementedMsgServer) DelegateFeedConsent(ctx context.Context, req *MsgDelegateFeedConsent) (*MsgDelegateFeedConsentResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DelegateFeedConsent not implemented") } @@ -507,24 +293,6 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_AggregateExchangeRatePrevote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAggregateExchangeRatePrevote) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).AggregateExchangeRatePrevote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/seiprotocol.seichain.oracle.Msg/AggregateExchangeRatePrevote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AggregateExchangeRatePrevote(ctx, req.(*MsgAggregateExchangeRatePrevote)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_AggregateExchangeRateVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgAggregateExchangeRateVote) if err := dec(in); err != nil { @@ -543,24 +311,6 @@ func _Msg_AggregateExchangeRateVote_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } -func _Msg_AggregateExchangeRateCombinedVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAggregateExchangeRateCombinedVote) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).AggregateExchangeRateCombinedVote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/seiprotocol.seichain.oracle.Msg/AggregateExchangeRateCombinedVote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AggregateExchangeRateCombinedVote(ctx, req.(*MsgAggregateExchangeRateCombinedVote)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_DelegateFeedConsent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgDelegateFeedConsent) if err := dec(in); err != nil { @@ -583,18 +333,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "seiprotocol.seichain.oracle.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "AggregateExchangeRatePrevote", - Handler: _Msg_AggregateExchangeRatePrevote_Handler, - }, { MethodName: "AggregateExchangeRateVote", Handler: _Msg_AggregateExchangeRateVote_Handler, }, - { - MethodName: "AggregateExchangeRateCombinedVote", - Handler: _Msg_AggregateExchangeRateCombinedVote_Handler, - }, { MethodName: "DelegateFeedConsent", Handler: _Msg_DelegateFeedConsent_Handler, @@ -604,73 +346,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "oracle/tx.proto", } -func (m *MsgAggregateExchangeRatePrevote) 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 *MsgAggregateExchangeRatePrevote) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAggregateExchangeRatePrevote) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Validator) > 0 { - i -= len(m.Validator) - copy(dAtA[i:], m.Validator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Validator))) - i-- - dAtA[i] = 0x1a - } - if len(m.Feeder) > 0 { - i -= len(m.Feeder) - copy(dAtA[i:], m.Feeder) - i = encodeVarintTx(dAtA, i, uint64(len(m.Feeder))) - i-- - dAtA[i] = 0x12 - } - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintTx(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgAggregateExchangeRatePrevoteResponse) 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 *MsgAggregateExchangeRatePrevoteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAggregateExchangeRatePrevoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func (m *MsgAggregateExchangeRateVote) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -712,13 +387,6 @@ func (m *MsgAggregateExchangeRateVote) MarshalToSizedBuffer(dAtA []byte) (int, e i-- dAtA[i] = 0x12 } - if len(m.Salt) > 0 { - i -= len(m.Salt) - copy(dAtA[i:], m.Salt) - i = encodeVarintTx(dAtA, i, uint64(len(m.Salt))) - i-- - dAtA[i] = 0xa - } return len(dAtA) - i, nil } @@ -745,7 +413,7 @@ func (m *MsgAggregateExchangeRateVoteResponse) MarshalToSizedBuffer(dAtA []byte) return len(dAtA) - i, nil } -func (m *MsgAggregateExchangeRateCombinedVote) Marshal() (dAtA []byte, err error) { +func (m *MsgDelegateFeedConsent) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -755,55 +423,34 @@ func (m *MsgAggregateExchangeRateCombinedVote) Marshal() (dAtA []byte, err error return dAtA[:n], nil } -func (m *MsgAggregateExchangeRateCombinedVote) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgDelegateFeedConsent) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgAggregateExchangeRateCombinedVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgDelegateFeedConsent) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Validator) > 0 { - i -= len(m.Validator) - copy(dAtA[i:], m.Validator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Validator))) - i-- - dAtA[i] = 0x2a - } - if len(m.Feeder) > 0 { - i -= len(m.Feeder) - copy(dAtA[i:], m.Feeder) - i = encodeVarintTx(dAtA, i, uint64(len(m.Feeder))) - i-- - dAtA[i] = 0x22 - } - if len(m.PrevoteHash) > 0 { - i -= len(m.PrevoteHash) - copy(dAtA[i:], m.PrevoteHash) - i = encodeVarintTx(dAtA, i, uint64(len(m.PrevoteHash))) - i-- - dAtA[i] = 0x1a - } - if len(m.VoteExchangeRates) > 0 { - i -= len(m.VoteExchangeRates) - copy(dAtA[i:], m.VoteExchangeRates) - i = encodeVarintTx(dAtA, i, uint64(len(m.VoteExchangeRates))) + if len(m.Delegate) > 0 { + i -= len(m.Delegate) + copy(dAtA[i:], m.Delegate) + i = encodeVarintTx(dAtA, i, uint64(len(m.Delegate))) i-- dAtA[i] = 0x12 } - if len(m.VoteSalt) > 0 { - i -= len(m.VoteSalt) - copy(dAtA[i:], m.VoteSalt) - i = encodeVarintTx(dAtA, i, uint64(len(m.VoteSalt))) + if len(m.Operator) > 0 { + i -= len(m.Operator) + copy(dAtA[i:], m.Operator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Operator))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgAggregateExchangeRateCombinedVoteResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgDelegateFeedConsentResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -813,12 +460,12 @@ func (m *MsgAggregateExchangeRateCombinedVoteResponse) Marshal() (dAtA []byte, e return dAtA[:n], nil } -func (m *MsgAggregateExchangeRateCombinedVoteResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgDelegateFeedConsentResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgAggregateExchangeRateCombinedVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgDelegateFeedConsentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -826,117 +473,23 @@ func (m *MsgAggregateExchangeRateCombinedVoteResponse) MarshalToSizedBuffer(dAtA return len(dAtA) - i, nil } -func (m *MsgDelegateFeedConsent) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return dAtA[:n], nil -} - -func (m *MsgDelegateFeedConsent) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + dAtA[offset] = uint8(v) + return base } - -func (m *MsgDelegateFeedConsent) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Delegate) > 0 { - i -= len(m.Delegate) - copy(dAtA[i:], m.Delegate) - i = encodeVarintTx(dAtA, i, uint64(len(m.Delegate))) - i-- - dAtA[i] = 0x12 - } - if len(m.Operator) > 0 { - i -= len(m.Operator) - copy(dAtA[i:], m.Operator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Operator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgDelegateFeedConsentResponse) 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 *MsgDelegateFeedConsentResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDelegateFeedConsentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgAggregateExchangeRatePrevote) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Feeder) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Validator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgAggregateExchangeRatePrevoteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgAggregateExchangeRateVote) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Salt) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = len(m.ExchangeRates) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -961,44 +514,6 @@ func (m *MsgAggregateExchangeRateVoteResponse) Size() (n int) { return n } -func (m *MsgAggregateExchangeRateCombinedVote) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.VoteSalt) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.VoteExchangeRates) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.PrevoteHash) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Feeder) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Validator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgAggregateExchangeRateCombinedVoteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgDelegateFeedConsent) Size() (n int) { if m == nil { return 0 @@ -1031,7 +546,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgAggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { +func (m *MsgAggregateExchangeRateVote) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1054,15 +569,15 @@ func (m *MsgAggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAggregateExchangeRatePrevote: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAggregateExchangeRateVote: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAggregateExchangeRatePrevote: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAggregateExchangeRateVote: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRates", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1090,9 +605,9 @@ func (m *MsgAggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Hash = string(dAtA[iNdEx:postIndex]) + m.ExchangeRates = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Feeder", wireType) } @@ -1124,7 +639,7 @@ func (m *MsgAggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { } m.Feeder = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) } @@ -1177,57 +692,7 @@ func (m *MsgAggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAggregateExchangeRatePrevoteResponse) 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 ErrIntOverflowTx - } - 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: MsgAggregateExchangeRatePrevoteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAggregateExchangeRatePrevoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgAggregateExchangeRateVote) Unmarshal(dAtA []byte) error { +func (m *MsgAggregateExchangeRateVoteResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1250,185 +715,7 @@ func (m *MsgAggregateExchangeRateVote) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAggregateExchangeRateVote: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAggregateExchangeRateVote: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Salt = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRates", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExchangeRates = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Feeder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Feeder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Validator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgAggregateExchangeRateVoteResponse) 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 ErrIntOverflowTx - } - 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: MsgAggregateExchangeRateVoteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAggregateExchangeRateVoteResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: MsgAggregateExchangeRateVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) @@ -1455,266 +742,6 @@ func (m *MsgAggregateExchangeRateVoteResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAggregateExchangeRateCombinedVote) 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 ErrIntOverflowTx - } - 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: MsgAggregateExchangeRateCombinedVote: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAggregateExchangeRateCombinedVote: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VoteSalt", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VoteSalt = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VoteExchangeRates", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VoteExchangeRates = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevoteHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrevoteHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Feeder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Feeder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Validator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgAggregateExchangeRateCombinedVoteResponse) 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 ErrIntOverflowTx - } - 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: MsgAggregateExchangeRateCombinedVoteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAggregateExchangeRateCombinedVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *MsgDelegateFeedConsent) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/oracle/types/vote.go b/x/oracle/types/vote.go index 176aa7b16c..ddc1754949 100755 --- a/x/oracle/types/vote.go +++ b/x/oracle/types/vote.go @@ -9,21 +9,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// NewAggregateExchangeRatePrevote returns AggregateExchangeRatePrevote object -func NewAggregateExchangeRatePrevote(hash AggregateVoteHash, voter sdk.ValAddress, submitBlock uint64) AggregateExchangeRatePrevote { - return AggregateExchangeRatePrevote{ - Hash: hash.String(), - Voter: voter.String(), - SubmitBlock: submitBlock, - } -} - -// String implement stringify -func (v AggregateExchangeRatePrevote) String() string { - out, _ := yaml.Marshal(v) - return string(out) -} - // NewAggregateExchangeRateVote creates a AggregateExchangeRateVote instance func NewAggregateExchangeRateVote(exchangeRateTuples ExchangeRateTuples, voter sdk.ValAddress) AggregateExchangeRateVote { return AggregateExchangeRateVote{ From 698e751638cc52fba56d30e5f109c12023971673 Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Wed, 14 Sep 2022 10:12:28 -0700 Subject: [PATCH 2/3] lint --- x/oracle/simulation/operations.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/x/oracle/simulation/operations.go b/x/oracle/simulation/operations.go index a97b0f125e..3988c4b164 100644 --- a/x/oracle/simulation/operations.go +++ b/x/oracle/simulation/operations.go @@ -15,7 +15,6 @@ import ( "github.com/sei-protocol/sei-chain/x/oracle/keeper" "github.com/sei-protocol/sei-chain/x/oracle/types" - "github.com/sei-protocol/sei-chain/x/oracle/utils" ) // Simulation operation weights constants @@ -26,10 +25,7 @@ const ( OpWeightMsgDelegateFeedConsent = "op_weight_msg_exchange_feed_consent" ) -var ( - whitelist = []string{utils.MicroAtomDenom} - voteHashMap = make(map[string]string) -) +var voteHashMap = make(map[string]string) // WeightedOperations returns all the operations from the module with their respective weights func WeightedOperations( From 5405b0b84239783be3a4d04f238740f48d230a91 Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Wed, 14 Sep 2022 16:00:10 -0700 Subject: [PATCH 3/3] remove prevote from store --- x/oracle/keeper/migrations.go | 14 +++++++++++++ x/oracle/keeper/migrations_test.go | 32 ++++++++++++++++++++++++++++++ x/oracle/module.go | 3 ++- 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/x/oracle/keeper/migrations.go b/x/oracle/keeper/migrations.go index 4d4208d570..3b42ddb6fb 100644 --- a/x/oracle/keeper/migrations.go +++ b/x/oracle/keeper/migrations.go @@ -56,3 +56,17 @@ func (m Migrator) Migrate3to4(ctx sdk.Context) error { return nil } + +// Migrate3to4 migrates from version 4 to 5 +func (m Migrator) Migrate4to5(ctx sdk.Context) error { + // we remove the prevotes from store in this migration + store := ctx.KVStore(m.keeper.storeKey) + + oldPrevoteKey := []byte{0x04} + iter := sdk.KVStorePrefixIterator(store, oldPrevoteKey) + defer iter.Close() + for ; iter.Valid(); iter.Next() { + store.Delete(iter.Key()) + } + return nil +} diff --git a/x/oracle/keeper/migrations_test.go b/x/oracle/keeper/migrations_test.go index 76000138f6..40cbba16e2 100644 --- a/x/oracle/keeper/migrations_test.go +++ b/x/oracle/keeper/migrations_test.go @@ -10,6 +10,7 @@ import ( "github.com/sei-protocol/sei-chain/x/oracle/utils" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" ) func TestMigrate2to3(t *testing.T) { @@ -93,3 +94,34 @@ func TestMigrate3to4(t *testing.T) { require.True(t, numPenaltyCounters == 1) } + +func TestMigrate4to5(t *testing.T) { + input := CreateTestInput(t) + + addr := ValAddrs[0] + + missCounter := uint64(12) + oldPrevoteKey := []byte{0x04} + genPrevoteKey := func(v sdk.ValAddress) []byte { + return append(oldPrevoteKey, address.MustLengthPrefix(v)...) + } + + // store the value with legacy proto + store := input.Ctx.KVStore(input.OracleKeeper.storeKey) + // doesn't really matter what we set as the bytes so we're just using data from a previous test case + bz := input.OracleKeeper.cdc.MustMarshal(&gogotypes.UInt64Value{Value: missCounter}) + store.Set(genPrevoteKey(addr), bz) + + // set for second validator + store.Set(genPrevoteKey(ValAddrs[1]), bz) + + require.Equal(t, store.Has(genPrevoteKey(addr)), true) + require.Equal(t, store.Has(genPrevoteKey(ValAddrs[1])), true) + + // Migrate store + m := NewMigrator(input.OracleKeeper) + m.Migrate4to5(input.Ctx) + // should have been deleted from store + require.Equal(t, store.Has(genPrevoteKey(addr)), false) + require.Equal(t, store.Has(genPrevoteKey(ValAddrs[1])), false) +} diff --git a/x/oracle/module.go b/x/oracle/module.go index 52cae23203..05a13954d9 100644 --- a/x/oracle/module.go +++ b/x/oracle/module.go @@ -143,6 +143,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { _ = 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) + _ = cfg.RegisterMigration(types.ModuleName, 4, m.Migrate4to5) } // InitGenesis performs genesis initialization for the oracle module. It returns @@ -163,7 +164,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 4 } +func (AppModule) ConsensusVersion() uint64 { return 5 } // BeginBlock returns the begin blocker for the oracle module. func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}