From da76c39479d81c4957694a44ae78e39bfb5459de Mon Sep 17 00:00:00 2001 From: Kevin Yang <5478483+k-yang@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:47:26 -0700 Subject: [PATCH] fix: oracle keeper --- app/keepers.go | 2 +- proto/nibiru/oracle/v1/tx.proto | 103 +- x/oracle/keeper/msg_server.go | 44 +- x/oracle/keeper/params_test.go | 1 + x/oracle/keeper/sudo.go | 100 -- x/oracle/keeper/sudo_test.go | 95 -- x/oracle/keeper/test_utils.go | 4 +- x/oracle/keeper/update_exchange_rates_test.go | 2 +- x/oracle/types/tx.pb.go | 896 +++++++++++------- x/oracle/types/tx.pb.gw.go | 2 +- 10 files changed, 657 insertions(+), 592 deletions(-) delete mode 100644 x/oracle/keeper/sudo.go delete mode 100644 x/oracle/keeper/sudo_test.go diff --git a/app/keepers.go b/app/keepers.go index 6695a6194..9dd350536 100644 --- a/app/keepers.go +++ b/app/keepers.go @@ -617,7 +617,7 @@ func (app *NibiruApp) initAppModules( authzmodule.NewAppModule(appCodec, app.authzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), // Nibiru modules - oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper), + oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper, app.SudoKeeper), epochs.NewAppModule(appCodec, app.EpochsKeeper), inflation.NewAppModule(app.InflationKeeper, app.AccountKeeper, *app.StakingKeeper), sudo.NewAppModule(appCodec, app.SudoKeeper), diff --git a/proto/nibiru/oracle/v1/tx.proto b/proto/nibiru/oracle/v1/tx.proto index 4baa5402e..8fa0175e0 100644 --- a/proto/nibiru/oracle/v1/tx.proto +++ b/proto/nibiru/oracle/v1/tx.proto @@ -3,6 +3,7 @@ package nibiru.oracle.v1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; +import "google/protobuf/duration.proto"; import "nibiru/oracle/v1/oracle.proto"; option go_package = "github.com/NibiruChain/nibiru/v2/x/oracle/types"; @@ -33,7 +34,7 @@ service Msg { rpc EditOracleParams(MsgEditOracleParams) returns (MsgEditOracleParamsResponse) { - option (google.api.http).post = "/nibiru/oracle/edit-oracle-params"; + option (google.api.http).post = "/nibiru/oracle/params"; } } @@ -91,64 +92,100 @@ message MsgDelegateFeedConsent { // type. message MsgDelegateFeedConsentResponse {} -// MsgEditOracleParams: gRPC tx message for updating the x/oracle module params -// [SUDO] Only callable by sudoers. message MsgEditOracleParams { - string sender = 1; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + + OracleParamsMsg params = 2 [ (gogoproto.moretags) = "yaml:\"params\"" ]; +} - string vote_period = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", +message MsgEditOracleParamsResponse {} + +message OracleParamsMsg { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = true; + + // VotePeriod defines the number of blocks during which voting takes place. + uint64 vote_period = 1 [ + (gogoproto.moretags) = "yaml:\"vote_period\"", (gogoproto.nullable) = true ]; - // vote_threshold: [cosmossdk.io/math.LegacyDec] TODO: - string vote_threshold = 3 [ + // VoteThreshold specifies the minimum proportion of votes that must be + // received for a ballot to pass. + string vote_threshold = 2 [ + (gogoproto.moretags) = "yaml:\"vote_threshold\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = true ]; - - // reward_band: [cosmossdk.io/math.LegacyDec] TODO: - string reward_band = 4 [ + // RewardBand defines a maxium divergence that a price vote can have from the + // weighted median in the ballot. If a vote lies within the valid range + // defined by: + // μ := weightedMedian, + // validRange := μ ± (μ * rewardBand / 2), + // then rewards are added to the validator performance. + // Note that if the reward band is smaller than 1 standard + // deviation, the band is taken to be 1 standard deviation.a price + string reward_band = 3 [ + (gogoproto.moretags) = "yaml:\"reward_band\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = true ]; - - repeated string whitelist = 5 [ (gogoproto.nullable) = true ]; - - // slash_fraction: [cosmossdk.io/math.LegacyDec] TODO: - string slash_fraction = 6 [ + // The set of whitelisted markets, or asset pairs, for the module. + // Ex. '["unibi:uusd","ubtc:uusd"]' + repeated string whitelist = 4 [ + (gogoproto.moretags) = "yaml:\"whitelist\"", + (gogoproto.customtype) = "github.com/NibiruChain/nibiru/v2/x/common/asset.Pair", + (gogoproto.nullable) = true + ]; + // SlashFraction returns the proportion of an oracle's stake that gets + // slashed in the event of slashing. `SlashFraction` specifies the exact + // penalty for failing a voting period. + string slash_fraction = 5 [ + (gogoproto.moretags) = "yaml:\"slash_fraction\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = true ]; - - string slash_window = 7 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + // SlashWindow returns the number of voting periods that specify a + // "slash window". After each slash window, all oracles that have missed more + // than the penalty threshold are slashed. Missing the penalty threshold is + // synonymous with submitting fewer valid votes than `MinValidPerWindow`. + uint64 slash_window = 6 [ + (gogoproto.moretags) = "yaml:\"slash_window\"", (gogoproto.nullable) = true ]; - - // min_valid_per_window: [cosmossdk.io/math.LegacyDec] TODO: - string min_valid_per_window = 8 [ + string min_valid_per_window = 7 [ + (gogoproto.moretags) = "yaml:\"min_valid_per_window\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = true ]; - string twap_lookback_window = 9 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = true + // Amount of time to look back for TWAP calculations + google.protobuf.Duration twap_lookback_window = 8 [ + (gogoproto.nullable) = true, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "twap_lookback_window,omitempty", + (gogoproto.moretags) = "yaml:\"twap_lookback_window\"" ]; - string min_voters = 10 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + // The minimum number of voters (i.e. oracle validators) per pair for it to be + // considered a passing ballot. Recommended at least 4. + uint64 min_voters = 9 [ + (gogoproto.moretags) = "yaml:\"min_voters\"", (gogoproto.nullable) = true ]; - // VoteThreshold: [cosmossdk.io/math.LegacyDec] TODO: - string validator_fee_ratio = 11 [ + // The validator fee ratio that is given to validators every epoch. + string validator_fee_ratio = 10 [ + (gogoproto.moretags) = "yaml:\"validator_fee_ratio\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = true ]; -} -// MsgEditOracleParamsResponse defines the Msg/EditOracleParams response -// type. -message MsgEditOracleParamsResponse { nibiru.oracle.v1.Params new_params = 1; } + uint64 expiration_blocks = 11 [ + (gogoproto.moretags) = "yaml:\"expiration_blocks\"", + (gogoproto.nullable) = true + ]; +} \ No newline at end of file diff --git a/x/oracle/keeper/msg_server.go b/x/oracle/keeper/msg_server.go index 056340772..7e91bafaf 100644 --- a/x/oracle/keeper/msg_server.go +++ b/x/oracle/keeper/msg_server.go @@ -2,24 +2,27 @@ package keeper import ( "context" - - "github.com/cosmos/cosmos-sdk/types/errors" + "fmt" sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/errors" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/NibiruChain/nibiru/v2/x/oracle/types" + sudokeeper "github.com/NibiruChain/nibiru/v2/x/sudo/keeper" + sudotypes "github.com/NibiruChain/nibiru/v2/x/sudo/types" ) type msgServer struct { Keeper + SudoKeeper sudokeeper.Keeper } // NewMsgServerImpl returns an implementation of the oracle MsgServer interface // for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} +func NewMsgServerImpl(keeper Keeper, sudoKeeper sudokeeper.Keeper) types.MsgServer { + return &msgServer{Keeper: keeper, SudoKeeper: sudoKeeper} } func (ms msgServer) AggregateExchangeRatePrevote( @@ -170,18 +173,27 @@ func (ms msgServer) DelegateFeedConsent( // EditOracleParams: gRPC tx msg for editing the oracle module params. // [SUDO] Only callable by sudoers. -func (ms msgServer) EditOracleParams( - goCtx context.Context, msg *types.MsgEditOracleParams, -) (resp *types.MsgEditOracleParamsResponse, err error) { +func (ms msgServer) EditOracleParams(goCtx context.Context, msg *types.MsgEditOracleParams) (*types.MsgEditOracleParamsResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // Stateless field validation is already performed in msg.ValidateBasic() - // before the current scope is reached. - sender, _ := sdk.AccAddressFromBech32(msg.Sender) - newParams, err := ms.Sudo().EditOracleParams( - ctx, *msg, sender, - ) - resp = &types.MsgEditOracleParamsResponse{ - NewParams: &newParams, + + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, fmt.Errorf("invalid address") + } + + err = ms.SudoKeeper.CheckPermissions(sender, ctx) + if err != nil { + return nil, sudotypes.ErrUnauthorized + } + + params, err := ms.Keeper.Params.Get(ctx) + if err != nil { + return nil, fmt.Errorf("get oracle params error: %s", err.Error()) } - return resp, err + + mergedParams := mergeOracleParams(msg, params) + + ms.Keeper.UpdateParams(ctx, mergedParams) + + return &types.MsgEditOracleParamsResponse{}, nil } diff --git a/x/oracle/keeper/params_test.go b/x/oracle/keeper/params_test.go index 5dbb0535e..5b31887c2 100644 --- a/x/oracle/keeper/params_test.go +++ b/x/oracle/keeper/params_test.go @@ -5,6 +5,7 @@ import ( "time" "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/NibiruChain/nibiru/v2/x/common/asset" diff --git a/x/oracle/keeper/sudo.go b/x/oracle/keeper/sudo.go deleted file mode 100644 index 8af7dbf09..000000000 --- a/x/oracle/keeper/sudo.go +++ /dev/null @@ -1,100 +0,0 @@ -package keeper - -import ( - "fmt" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/NibiruChain/nibiru/v2/x/common/asset" - oracletypes "github.com/NibiruChain/nibiru/v2/x/oracle/types" -) - -// Sudo extends the Keeper with sudo functions. See sudo.go. Sudo is syntactic -// sugar to separate admin calls off from the other Keeper methods. -// -// These Sudo functions should: -// 1. Not be called in other methods in the x/perp module. -// 2. Only be callable by the x/sudo root or sudo contracts. -// -// The intention behind "Keeper.Sudo()" is to make it more obvious to the -// developer that an unsafe function is being used when it's called. -func (k Keeper) Sudo() sudoExtension { return sudoExtension{k} } - -type sudoExtension struct{ Keeper } - -// ------------------------------------------------------------------ -// Admin.EditOracleParams - -func (k sudoExtension) EditOracleParams( - ctx sdk.Context, newParams oracletypes.MsgEditOracleParams, - sender sdk.AccAddress, -) (paramsAfter oracletypes.Params, err error) { - if err := k.sudoKeeper.CheckPermissions(sender, ctx); err != nil { - return paramsAfter, err - } - - params, err := k.Params.Get(ctx) - if err != nil { - return paramsAfter, fmt.Errorf("%w: failed to read oracle params", err) - } - - paramsAfter = MergeOracleParams(newParams, params) - k.UpdateParams(ctx, paramsAfter) - return paramsAfter, paramsAfter.Validate() -} - -// MergeOracleParams: Takes the given oracle params and merges them into the -// existing partial params, keeping any existing values that are not set in the -// partial. -func MergeOracleParams( - partial oracletypes.MsgEditOracleParams, - oracleParams oracletypes.Params, -) oracletypes.Params { - if partial.VotePeriod != nil { - oracleParams.VotePeriod = partial.VotePeriod.Uint64() - } - - if partial.VoteThreshold != nil { - oracleParams.VoteThreshold = *partial.VoteThreshold - } - - if partial.RewardBand != nil { - oracleParams.RewardBand = *partial.RewardBand - } - - if partial.Whitelist != nil { - whitelist := make([]asset.Pair, len(partial.Whitelist)) - for i, pair := range partial.Whitelist { - whitelist[i] = asset.MustNewPair(pair) - } - - oracleParams.Whitelist = whitelist - } - - if partial.SlashFraction != nil { - oracleParams.SlashFraction = *partial.SlashFraction - } - - if partial.SlashWindow != nil { - oracleParams.SlashWindow = partial.SlashWindow.Uint64() - } - - if partial.MinValidPerWindow != nil { - oracleParams.MinValidPerWindow = *partial.MinValidPerWindow - } - - if partial.TwapLookbackWindow != nil { - oracleParams.TwapLookbackWindow = time.Duration(partial.TwapLookbackWindow.Int64()) - } - - if partial.MinVoters != nil { - oracleParams.MinVoters = partial.MinVoters.Uint64() - } - - if partial.ValidatorFeeRatio != nil { - oracleParams.ValidatorFeeRatio = *partial.ValidatorFeeRatio - } - - return oracleParams -} diff --git a/x/oracle/keeper/sudo_test.go b/x/oracle/keeper/sudo_test.go deleted file mode 100644 index f52d7f427..000000000 --- a/x/oracle/keeper/sudo_test.go +++ /dev/null @@ -1,95 +0,0 @@ -package keeper_test - -import ( - "testing" - "time" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" - - "github.com/NibiruChain/nibiru/v2/x/common/testutil" - "github.com/NibiruChain/nibiru/v2/x/common/testutil/testapp" - oraclekeeper "github.com/NibiruChain/nibiru/v2/x/oracle/keeper" - oracletypes "github.com/NibiruChain/nibiru/v2/x/oracle/types" -) - -// TestSuiteOracleSudo tests sudo-only functions in the oracle module. -func TestSuiteOracleSudo(t *testing.T) { - suite.Run(t, new(SuiteOracleSudo)) -} - -type SuiteOracleSudo struct { - suite.Suite -} - -// TestEditOracleParams tests the business logic for -// "oraclekeeper.Keeper.Sudo().EditOracleParams" -func (s *SuiteOracleSudo) TestEditOracleParams() { - nibiru, ctx := testapp.NewNibiruTestAppAndContext() - - // Change to all non-defaults to test EditOracleParams as a setter . - votePeriod := math.NewInt(1_234) - voteThreshold := math.LegacyMustNewDecFromStr("0.4") - rewardBand := math.LegacyMustNewDecFromStr("0.5") - whitelist := []string{"aave:usdc", "sol:usdc"} - slashFraction := math.LegacyMustNewDecFromStr("0.5") - slashWindow := math.NewInt(2_000) - minValidPerWindow := math.LegacyMustNewDecFromStr("0.5") - twapLookbackWindow := math.NewInt(int64(time.Second * 30)) - minVoters := math.NewInt(2) - validatorFeeRatio := math.LegacyMustNewDecFromStr("0.7") - msgEditParams := oracletypes.MsgEditOracleParams{ - VotePeriod: &votePeriod, - VoteThreshold: &voteThreshold, - RewardBand: &rewardBand, - Whitelist: whitelist, - SlashFraction: &slashFraction, - SlashWindow: &slashWindow, - MinValidPerWindow: &minValidPerWindow, - TwapLookbackWindow: &twapLookbackWindow, - MinVoters: &minVoters, - ValidatorFeeRatio: &validatorFeeRatio, - } - - s.T().Log("Params before MUST NOT be equal to default") - defaultParams := oracletypes.DefaultParams() - currParams, err := nibiru.OracleKeeper.Params.Get(ctx) - s.NoError(err) - s.Equal(currParams, defaultParams, - "Current params should be eqaul to defaults") - partialParams := msgEditParams - fullParams := oraclekeeper.MergeOracleParams(partialParams, defaultParams) - s.NotEqual(defaultParams, fullParams, - "new params after merge should not be defaults") - - invalidSender := testutil.AccAddress() - oracleMsgServer := oraclekeeper.NewMsgServerImpl(nibiru.OracleKeeper) - goCtx := sdk.WrapSDKContext(ctx) - msgEditParams.Sender = invalidSender.String() - _, err = oracleMsgServer.EditOracleParams( - goCtx, &msgEditParams, - ) - s.Error(err) - - s.T().Log("Params after MUST be equal to new ones with partialParams") - okSender := testapp.DefaultSudoRoot() - msgEditParams.Sender = okSender.String() - resp, err := oracleMsgServer.EditOracleParams( - goCtx, &msgEditParams, - ) - s.Require().NoError(err) - s.EqualValues(resp.NewParams.String(), fullParams.String()) - - s.T().Log("Changing to invalid params MUST fail") - slashWindow = math.NewInt(1_233) // slashWindow < vote period is not allowed. - msgEditParams = oracletypes.MsgEditOracleParams{ - Sender: okSender.String(), - SlashWindow: &slashWindow, - } - _, err = oracleMsgServer.EditOracleParams( - goCtx, &msgEditParams, - ) - s.Require().Error(err) - s.ErrorContains(err, "oracle parameter SlashWindow must be greater") -} diff --git a/x/oracle/keeper/test_utils.go b/x/oracle/keeper/test_utils.go index 692b52623..3944bb962 100644 --- a/x/oracle/keeper/test_utils.go +++ b/x/oracle/keeper/test_utils.go @@ -129,7 +129,7 @@ type TestFixture struct { OracleKeeper Keeper StakingKeeper stakingkeeper.Keeper DistrKeeper distrkeeper.Keeper - SudoKeeper types.SudoKeeper + SudoKeeper sudokeeper.Keeper } // CreateTestFixture nolint @@ -326,7 +326,7 @@ func Setup(t *testing.T) (TestFixture, types.MsgServer) { params, _ = fixture.OracleKeeper.Params.Get(fixture.Ctx) - h := NewMsgServerImpl(fixture.OracleKeeper) + h := NewMsgServerImpl(fixture.OracleKeeper, fixture.SudoKeeper) sh := stakingkeeper.NewMsgServerImpl(&fixture.StakingKeeper) // Validator created diff --git a/x/oracle/keeper/update_exchange_rates_test.go b/x/oracle/keeper/update_exchange_rates_test.go index 9c3ed2c95..77f10ce39 100644 --- a/x/oracle/keeper/update_exchange_rates_test.go +++ b/x/oracle/keeper/update_exchange_rates_test.go @@ -135,7 +135,7 @@ func TestOracleTally(t *testing.T) { votes := types.ExchangeRateVotes{} rates, valAddrs, stakingKeeper := types.GenerateRandomTestCase() fixture.OracleKeeper.StakingKeeper = stakingKeeper - h := NewMsgServerImpl(fixture.OracleKeeper) + h := NewMsgServerImpl(fixture.OracleKeeper, fixture.SudoKeeper) for i, rate := range rates { decExchangeRate := sdkmath.LegacyNewDecWithPrec(int64(rate*math.Pow10(OracleDecPrecision)), int64(OracleDecPrecision)) diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index 9c33a0e7f..aac5d9c01 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -6,23 +6,28 @@ package types import ( context "context" fmt "fmt" + github_com_NibiruChain_nibiru_v2_x_common_asset "github.com/NibiruChain/nibiru/v2/x/common/asset" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + _ "google.golang.org/protobuf/types/known/durationpb" io "io" math "math" math_bits "math/bits" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -277,25 +282,9 @@ func (m *MsgDelegateFeedConsentResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDelegateFeedConsentResponse proto.InternalMessageInfo -// MsgEditOracleParams: gRPC tx message for updating the x/oracle module params -// [SUDO] Only callable by sudoers. type MsgEditOracleParams struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - VotePeriod *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=vote_period,json=votePeriod,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"vote_period,omitempty"` - // vote_threshold: [cosmossdk.io/math.LegacyDec] TODO: - VoteThreshold *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_threshold,omitempty"` - // reward_band: [cosmossdk.io/math.LegacyDec] TODO: - RewardBand *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=reward_band,json=rewardBand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_band,omitempty"` - Whitelist []string `protobuf:"bytes,5,rep,name=whitelist,proto3" json:"whitelist,omitempty"` - // slash_fraction: [cosmossdk.io/math.LegacyDec] TODO: - SlashFraction *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=slash_fraction,json=slashFraction,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"slash_fraction,omitempty"` - SlashWindow *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=slash_window,json=slashWindow,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"slash_window,omitempty"` - // min_valid_per_window: [cosmossdk.io/math.LegacyDec] TODO: - MinValidPerWindow *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=min_valid_per_window,json=minValidPerWindow,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_valid_per_window,omitempty"` - TwapLookbackWindow *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=twap_lookback_window,json=twapLookbackWindow,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"twap_lookback_window,omitempty"` - MinVoters *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,10,opt,name=min_voters,json=minVoters,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_voters,omitempty"` - // VoteThreshold: [cosmossdk.io/math.LegacyDec] TODO: - ValidatorFeeRatio *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=validator_fee_ratio,json=validatorFeeRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"validator_fee_ratio,omitempty"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Params *OracleParamsMsg `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty" yaml:"params"` } func (m *MsgEditOracleParams) Reset() { *m = MsgEditOracleParams{} } @@ -331,24 +320,7 @@ func (m *MsgEditOracleParams) XXX_DiscardUnknown() { var xxx_messageInfo_MsgEditOracleParams proto.InternalMessageInfo -func (m *MsgEditOracleParams) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgEditOracleParams) GetWhitelist() []string { - if m != nil { - return m.Whitelist - } - return nil -} - -// MsgEditOracleParamsResponse defines the Msg/EditOracleParams response -// type. type MsgEditOracleParamsResponse struct { - NewParams *Params `protobuf:"bytes,1,opt,name=new_params,json=newParams,proto3" json:"new_params,omitempty"` } func (m *MsgEditOracleParamsResponse) Reset() { *m = MsgEditOracleParamsResponse{} } @@ -384,13 +356,112 @@ func (m *MsgEditOracleParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgEditOracleParamsResponse proto.InternalMessageInfo -func (m *MsgEditOracleParamsResponse) GetNewParams() *Params { +type OracleParamsMsg struct { + // VotePeriod defines the number of blocks during which voting takes place. + VotePeriod uint64 `protobuf:"varint,1,opt,name=vote_period,json=votePeriod,proto3" json:"vote_period,omitempty" yaml:"vote_period"` + // VoteThreshold specifies the minimum proportion of votes that must be + // received for a ballot to pass. + VoteThreshold *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_threshold,omitempty" yaml:"vote_threshold"` + // RewardBand defines a maxium divergence that a price vote can have from the + // weighted median in the ballot. If a vote lies within the valid range + // defined by: + // μ := weightedMedian, + // validRange := μ ± (μ * rewardBand / 2), + // then rewards are added to the validator performance. + // Note that if the reward band is smaller than 1 standard + // deviation, the band is taken to be 1 standard deviation.a price + RewardBand *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=reward_band,json=rewardBand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_band,omitempty" yaml:"reward_band"` + // The set of whitelisted markets, or asset pairs, for the module. + // Ex. '["unibi:uusd","ubtc:uusd"]' + Whitelist []github_com_NibiruChain_nibiru_v2_x_common_asset.Pair `protobuf:"bytes,4,rep,name=whitelist,proto3,customtype=github.com/NibiruChain/nibiru/v2/x/common/asset.Pair" json:"whitelist,omitempty" yaml:"whitelist"` + // SlashFraction returns the proportion of an oracle's stake that gets + // slashed in the event of slashing. `SlashFraction` specifies the exact + // penalty for failing a voting period. + SlashFraction *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=slash_fraction,json=slashFraction,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"slash_fraction,omitempty" yaml:"slash_fraction"` + // SlashWindow returns the number of voting periods that specify a + // "slash window". After each slash window, all oracles that have missed more + // than the penalty threshold are slashed. Missing the penalty threshold is + // synonymous with submitting fewer valid votes than `MinValidPerWindow`. + SlashWindow uint64 `protobuf:"varint,6,opt,name=slash_window,json=slashWindow,proto3" json:"slash_window,omitempty" yaml:"slash_window"` + MinValidPerWindow *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=min_valid_per_window,json=minValidPerWindow,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_valid_per_window,omitempty" yaml:"min_valid_per_window"` + // Amount of time to look back for TWAP calculations + TwapLookbackWindow *time.Duration `protobuf:"bytes,8,opt,name=twap_lookback_window,json=twapLookbackWindow,proto3,stdduration" json:"twap_lookback_window,omitempty" yaml:"twap_lookback_window"` + // The minimum number of voters (i.e. oracle validators) per pair for it to be + // considered a passing ballot. Recommended at least 4. + MinVoters uint64 `protobuf:"varint,9,opt,name=min_voters,json=minVoters,proto3" json:"min_voters,omitempty" yaml:"min_voters"` + // The validator fee ratio that is given to validators every epoch. + ValidatorFeeRatio *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=validator_fee_ratio,json=validatorFeeRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"validator_fee_ratio,omitempty" yaml:"validator_fee_ratio"` + ExpirationBlocks uint64 `protobuf:"varint,11,opt,name=expiration_blocks,json=expirationBlocks,proto3" json:"expiration_blocks,omitempty" yaml:"expiration_blocks"` +} + +func (m *OracleParamsMsg) Reset() { *m = OracleParamsMsg{} } +func (m *OracleParamsMsg) String() string { return proto.CompactTextString(m) } +func (*OracleParamsMsg) ProtoMessage() {} +func (*OracleParamsMsg) Descriptor() ([]byte, []int) { + return fileDescriptor_11e362c65eb610f4, []int{8} +} +func (m *OracleParamsMsg) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OracleParamsMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OracleParamsMsg.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 *OracleParamsMsg) XXX_Merge(src proto.Message) { + xxx_messageInfo_OracleParamsMsg.Merge(m, src) +} +func (m *OracleParamsMsg) XXX_Size() int { + return m.Size() +} +func (m *OracleParamsMsg) XXX_DiscardUnknown() { + xxx_messageInfo_OracleParamsMsg.DiscardUnknown(m) +} + +var xxx_messageInfo_OracleParamsMsg proto.InternalMessageInfo + +func (m *OracleParamsMsg) GetVotePeriod() uint64 { if m != nil { - return m.NewParams + return m.VotePeriod + } + return 0 +} + +func (m *OracleParamsMsg) GetSlashWindow() uint64 { + if m != nil { + return m.SlashWindow + } + return 0 +} + +func (m *OracleParamsMsg) GetTwapLookbackWindow() *time.Duration { + if m != nil { + return m.TwapLookbackWindow } return nil } +func (m *OracleParamsMsg) GetMinVoters() uint64 { + if m != nil { + return m.MinVoters + } + return 0 +} + +func (m *OracleParamsMsg) GetExpirationBlocks() uint64 { + if m != nil { + return m.ExpirationBlocks + } + return 0 +} + func init() { proto.RegisterType((*MsgAggregateExchangeRatePrevote)(nil), "nibiru.oracle.v1.MsgAggregateExchangeRatePrevote") proto.RegisterType((*MsgAggregateExchangeRatePrevoteResponse)(nil), "nibiru.oracle.v1.MsgAggregateExchangeRatePrevoteResponse") @@ -400,70 +471,168 @@ func init() { proto.RegisterType((*MsgDelegateFeedConsentResponse)(nil), "nibiru.oracle.v1.MsgDelegateFeedConsentResponse") proto.RegisterType((*MsgEditOracleParams)(nil), "nibiru.oracle.v1.MsgEditOracleParams") proto.RegisterType((*MsgEditOracleParamsResponse)(nil), "nibiru.oracle.v1.MsgEditOracleParamsResponse") + proto.RegisterType((*OracleParamsMsg)(nil), "nibiru.oracle.v1.OracleParamsMsg") } func init() { proto.RegisterFile("nibiru/oracle/v1/tx.proto", fileDescriptor_11e362c65eb610f4) } var fileDescriptor_11e362c65eb610f4 = []byte{ - // 917 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x96, 0x41, 0x6f, 0xdc, 0x44, - 0x14, 0xc7, 0xe3, 0x26, 0x5d, 0xb2, 0xb3, 0xa4, 0x4d, 0xbd, 0x69, 0xe4, 0x6c, 0x83, 0x1d, 0x5c, - 0x08, 0xc9, 0x61, 0x6d, 0x12, 0x24, 0x10, 0x3d, 0x41, 0xda, 0x46, 0xaa, 0xc4, 0xd2, 0x60, 0x41, - 0x90, 0x38, 0x60, 0x66, 0xd7, 0x2f, 0xb6, 0x15, 0xaf, 0xc7, 0x9a, 0x99, 0xee, 0xa6, 0x57, 0xc4, - 0x01, 0x6e, 0x48, 0x3d, 0x71, 0xcb, 0x07, 0x40, 0xe2, 0x6b, 0xf4, 0x58, 0x89, 0x0b, 0xe2, 0xb0, - 0x42, 0x09, 0x42, 0x9c, 0x38, 0xec, 0x27, 0x40, 0x33, 0x1e, 0xbb, 0xdb, 0xcd, 0xb6, 0xcd, 0xee, - 0x29, 0xce, 0xbc, 0xff, 0xfc, 0xde, 0xff, 0x3d, 0x7b, 0xde, 0x2c, 0x5a, 0x4b, 0xe3, 0x76, 0x4c, - 0x1f, 0xb9, 0x84, 0xe2, 0x4e, 0x02, 0x6e, 0x6f, 0xc7, 0xe5, 0x27, 0x4e, 0x46, 0x09, 0x27, 0xfa, - 0x72, 0x1e, 0x72, 0xf2, 0x90, 0xd3, 0xdb, 0x69, 0xac, 0x84, 0x24, 0x24, 0x32, 0xe8, 0x8a, 0xa7, - 0x5c, 0xd7, 0x58, 0x0f, 0x09, 0x09, 0x13, 0x70, 0x71, 0x16, 0xbb, 0x38, 0x4d, 0x09, 0xc7, 0x3c, - 0x26, 0x29, 0x53, 0xd1, 0xb7, 0x2e, 0x24, 0x50, 0x3c, 0x19, 0xb6, 0x7f, 0xd3, 0x90, 0xd5, 0x62, - 0xe1, 0xa7, 0x61, 0x48, 0x21, 0xc4, 0x1c, 0xee, 0x9f, 0x74, 0x22, 0x9c, 0x86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zipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x41, 0x6b, 0x24, 0x45, + 0x14, 0x4e, 0x6f, 0x62, 0xcc, 0xd4, 0x98, 0xdd, 0xa4, 0x27, 0x59, 0x3b, 0x93, 0xa4, 0x3b, 0x96, + 0x1a, 0xb3, 0x60, 0xba, 0x4d, 0x14, 0xd1, 0x08, 0xa2, 0xb3, 0xd9, 0xc8, 0x42, 0x46, 0x87, 0x42, + 0x56, 0xf0, 0x32, 0xd4, 0x4c, 0x57, 0x7a, 0x9a, 0x74, 0x77, 0x35, 0x5d, 0x95, 0x4c, 0x02, 0xe2, + 0x41, 0x04, 0x3d, 0x0a, 0x82, 0xc4, 0xdb, 0xfc, 0x00, 0xc1, 0xbf, 0xb1, 0xc7, 0x05, 0x2f, 0xe2, + 0x61, 0x94, 0xc4, 0xc3, 0xe2, 0x41, 0x61, 0xee, 0x82, 0x54, 0x75, 0x4d, 0x4f, 0x67, 0x32, 0xbb, + 0x9b, 0xc1, 0xd3, 0x4c, 0xbd, 0xef, 0xab, 0xf7, 0xbe, 0xf7, 0xaa, 0xea, 0xbd, 0x06, 0x4b, 0x91, + 0xdf, 0xf0, 0x93, 0x23, 0x87, 0x26, 0xb8, 0x19, 0x10, 0xe7, 0x78, 0xcb, 0xe1, 0x27, 0x76, 0x9c, + 0x50, 0x4e, 0xf5, 0xb9, 0x14, 0xb2, 0x53, 0xc8, 0x3e, 0xde, 0x2a, 0x2f, 0x78, 0xd4, 0xa3, 0x12, + 0x74, 0xc4, 0xbf, 0x94, 0x57, 0x5e, 0xf1, 0x28, 0xf5, 0x02, 0xe2, 0xe0, 0xd8, 0x77, 0x70, 0x14, + 0x51, 0x8e, 0xb9, 0x4f, 0x23, 0xa6, 0x50, 0x53, 0xa1, 0x72, 0xd5, 0x38, 0x3a, 0x70, 0xdc, 0xa3, + 0x44, 0x12, 0x14, 0xbe, 0x7a, 0x45, 0x80, 0x8a, 0x27, 0x61, 0xf8, 0xb3, 0x06, 0xac, 0x2a, 0xf3, + 0x3e, 0xf4, 0xbc, 0x84, 0x78, 0x98, 0x93, 0x7b, 0x27, 0xcd, 0x16, 0x8e, 0x3c, 0x82, 0x30, 0x27, + 0xb5, 0x84, 0x1c, 0x53, 0x4e, 0xf4, 0x97, 0xc1, 0x54, 0x0b, 0xb3, 0x96, 0xa1, 0xad, 0x69, 0x1b, + 0x85, 0xca, 0xad, 0x5e, 0xd7, 0x2a, 0x9e, 0xe2, 0x30, 0xd8, 0x81, 0xc2, 0x0a, 0x91, 0x04, 0xf5, + 0x3b, 0x60, 0xfa, 0x80, 0x10, 0x97, 0x24, 0xc6, 0x0d, 0x49, 0x9b, 0xef, 0x75, 0xad, 0xd9, 0x94, + 0x96, 0xda, 0x21, 0x52, 0x04, 0x7d, 0x1b, 0x14, 0x8e, 0x71, 0xe0, 0xbb, 0x98, 0xd3, 0xc4, 0x98, + 0x94, 0xec, 0x85, 0x5e, 0xd7, 0x9a, 0x4b, 0xd9, 0x19, 0x04, 0xd1, 0x80, 0xb6, 0x33, 0xf3, 0x6d, + 0xc7, 0x9a, 0x78, 0xdc, 0xb1, 0x26, 0xe0, 0x1d, 0xf0, 0xda, 0x33, 0x04, 0x23, 0xc2, 0x62, 0x1a, + 0x31, 0x02, 0xff, 0xd6, 0xc0, 0xca, 0x93, 0xb8, 0x0f, 0x54, 0x66, 0x0c, 0x07, 0xfc, 0x6a, 0x66, + 0xc2, 0x0a, 0x91, 0x04, 0xf5, 0x0f, 0xc0, 0x4d, 0xa2, 0x36, 0xd6, 0x13, 0xcc, 0x09, 0x53, 0x19, + 0x2e, 0xf5, 0xba, 0xd6, 0x62, 0x4a, 0xbf, 0x8c, 0x43, 0x34, 0x4b, 0x72, 0x91, 0x58, 0xae, 0x36, + 0x93, 0x63, 0xd5, 0x66, 0x6a, 0xdc, 0xda, 0xac, 0x83, 0x57, 0x9e, 0x96, 0x6f, 0x56, 0x98, 0xaf, + 0x35, 0x70, 0xbb, 0xca, 0xbc, 0x5d, 0x12, 0x48, 0xde, 0x1e, 0x21, 0xee, 0x5d, 0x01, 0x44, 0x5c, + 0x77, 0xc0, 0x0c, 0x8d, 0x49, 0x22, 0xe3, 0xa7, 0x65, 0x29, 0xf5, 0xba, 0xd6, 0xad, 0x34, 0x7e, + 0x1f, 0x81, 0x28, 0x23, 0x89, 0x0d, 0xae, 0xf2, 0xa3, 0x0a, 0x93, 0xdb, 0xd0, 0x47, 0x20, 0xca, + 0x48, 0x39, 0xb9, 0x6b, 0xc0, 0x1c, 0xad, 0x22, 0x13, 0x7a, 0xa6, 0x81, 0x52, 0x95, 0x79, 0xf7, + 0x5c, 0x9f, 0x7f, 0x22, 0xaf, 0x6d, 0x0d, 0x27, 0x38, 0x94, 0x15, 0x65, 0x24, 0x12, 0x15, 0xd5, + 0x86, 0x2b, 0x9a, 0xda, 0x21, 0x52, 0x04, 0x7d, 0x1f, 0x4c, 0xc7, 0x72, 0x93, 0x54, 0x57, 0xdc, + 0x7e, 0xc9, 0x1e, 0x7e, 0x77, 0x76, 0xde, 0x75, 0x95, 0x79, 0x79, 0x6f, 0xe9, 0x56, 0x88, 0x94, + 0x8f, 0x9c, 0xf8, 0x55, 0xb0, 0x3c, 0x42, 0x59, 0xa6, 0xfc, 0x9f, 0x19, 0x70, 0x6b, 0xc8, 0xaf, + 0xfe, 0x1e, 0x28, 0x8a, 0xfb, 0x59, 0x8f, 0x49, 0xe2, 0x53, 0x57, 0x4a, 0x9f, 0xaa, 0x94, 0x1f, + 0x76, 0x2d, 0xad, 0xd7, 0xb5, 0x74, 0x75, 0xc4, 0x03, 0x02, 0x44, 0x40, 0xac, 0x6a, 0x72, 0xa1, + 0x47, 0xe0, 0xa6, 0xc4, 0x78, 0x2b, 0x21, 0xac, 0x45, 0x03, 0x57, 0x55, 0xfb, 0x23, 0xb1, 0xff, + 0xb7, 0xae, 0xb5, 0xee, 0xf9, 0xbc, 0x75, 0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x0b, 0x00, 0x00, +} + +func (this *OracleParamsMsg) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*OracleParamsMsg) + if !ok { + that2, ok := that.(OracleParamsMsg) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.VotePeriod != that1.VotePeriod { + return false + } + if that1.VoteThreshold == nil { + if this.VoteThreshold != nil { + return false + } + } else if !this.VoteThreshold.Equal(*that1.VoteThreshold) { + return false + } + if that1.RewardBand == nil { + if this.RewardBand != nil { + return false + } + } else if !this.RewardBand.Equal(*that1.RewardBand) { + return false + } + if len(this.Whitelist) != len(that1.Whitelist) { + return false + } + for i := range this.Whitelist { + if !this.Whitelist[i].Equal(that1.Whitelist[i]) { + return false + } + } + if that1.SlashFraction == nil { + if this.SlashFraction != nil { + return false + } + } else if !this.SlashFraction.Equal(*that1.SlashFraction) { + return false + } + if this.SlashWindow != that1.SlashWindow { + return false + } + if that1.MinValidPerWindow == nil { + if this.MinValidPerWindow != nil { + return false + } + } else if !this.MinValidPerWindow.Equal(*that1.MinValidPerWindow) { + return false + } + if this.TwapLookbackWindow != nil && that1.TwapLookbackWindow != nil { + if *this.TwapLookbackWindow != *that1.TwapLookbackWindow { + return false + } + } else if this.TwapLookbackWindow != nil { + return false + } else if that1.TwapLookbackWindow != nil { + return false + } + if this.MinVoters != that1.MinVoters { + return false + } + if that1.ValidatorFeeRatio == nil { + if this.ValidatorFeeRatio != nil { + return false + } + } else if !this.ValidatorFeeRatio.Equal(*that1.ValidatorFeeRatio) { + return false + } + if this.ExpirationBlocks != that1.ExpirationBlocks { + return false + } + return true } // Reference imports to suppress errors if they are not otherwise used. @@ -889,23 +1058,81 @@ func (m *MsgEditOracleParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ValidatorFeeRatio != nil { + if m.Params != nil { { - size := m.ValidatorFeeRatio.Size() - i -= size - if _, err := m.ValidatorFeeRatio.MarshalTo(dAtA[i:]); err != nil { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { return 0, err } + i -= size i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x5a + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgEditOracleParamsResponse) 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 *MsgEditOracleParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditOracleParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *OracleParamsMsg) 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 *OracleParamsMsg) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OracleParamsMsg) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ExpirationBlocks != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ExpirationBlocks)) + i-- + dAtA[i] = 0x58 } - if m.MinVoters != nil { + if m.ValidatorFeeRatio != nil { { - size := m.MinVoters.Size() + size := m.ValidatorFeeRatio.Size() i -= size - if _, err := m.MinVoters.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.ValidatorFeeRatio.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintTx(dAtA, i, uint64(size)) @@ -913,17 +1140,20 @@ func (m *MsgEditOracleParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x52 } + if m.MinVoters != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.MinVoters)) + i-- + dAtA[i] = 0x48 + } if m.TwapLookbackWindow != nil { - { - size := m.TwapLookbackWindow.Size() - i -= size - if _, err := m.TwapLookbackWindow.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) + n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.TwapLookbackWindow, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.TwapLookbackWindow):]) + if err2 != nil { + return 0, err2 } + i -= n2 + i = encodeVarintTx(dAtA, i, uint64(n2)) i-- - dAtA[i] = 0x4a + dAtA[i] = 0x42 } if m.MinValidPerWindow != nil { { @@ -935,19 +1165,12 @@ func (m *MsgEditOracleParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x42 + dAtA[i] = 0x3a } - if m.SlashWindow != nil { - { - size := m.SlashWindow.Size() - i -= size - if _, err := m.SlashWindow.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } + if m.SlashWindow != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.SlashWindow)) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x30 } if m.SlashFraction != nil { { @@ -959,15 +1182,20 @@ func (m *MsgEditOracleParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } if len(m.Whitelist) > 0 { for iNdEx := len(m.Whitelist) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Whitelist[iNdEx]) - copy(dAtA[i:], m.Whitelist[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Whitelist[iNdEx]))) + { + size := m.Whitelist[iNdEx].Size() + i -= size + if _, err := m.Whitelist[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } } if m.RewardBand != nil { @@ -980,7 +1208,7 @@ func (m *MsgEditOracleParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } if m.VoteThreshold != nil { { @@ -992,61 +1220,12 @@ func (m *MsgEditOracleParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a - } - if m.VotePeriod != nil { - { - size := m.VotePeriod.Size() - i -= size - if _, err := m.VotePeriod.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0x12 } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + if m.VotePeriod != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.VotePeriod)) i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgEditOracleParamsResponse) 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 *MsgEditOracleParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEditOracleParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NewParams != nil { - { - size, err := m.NewParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -1162,10 +1341,31 @@ func (m *MsgEditOracleParams) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.VotePeriod != nil { - l = m.VotePeriod.Size() + if m.Params != nil { + l = m.Params.Size() n += 1 + l + sovTx(uint64(l)) } + return n +} + +func (m *MsgEditOracleParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *OracleParamsMsg) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VotePeriod != 0 { + n += 1 + sovTx(uint64(m.VotePeriod)) + } if m.VoteThreshold != nil { l = m.VoteThreshold.Size() n += 1 + l + sovTx(uint64(l)) @@ -1175,8 +1375,8 @@ func (m *MsgEditOracleParams) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } if len(m.Whitelist) > 0 { - for _, s := range m.Whitelist { - l = len(s) + for _, e := range m.Whitelist { + l = e.Size() n += 1 + l + sovTx(uint64(l)) } } @@ -1184,38 +1384,26 @@ func (m *MsgEditOracleParams) Size() (n int) { l = m.SlashFraction.Size() n += 1 + l + sovTx(uint64(l)) } - if m.SlashWindow != nil { - l = m.SlashWindow.Size() - n += 1 + l + sovTx(uint64(l)) + if m.SlashWindow != 0 { + n += 1 + sovTx(uint64(m.SlashWindow)) } if m.MinValidPerWindow != nil { l = m.MinValidPerWindow.Size() n += 1 + l + sovTx(uint64(l)) } if m.TwapLookbackWindow != nil { - l = m.TwapLookbackWindow.Size() + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.TwapLookbackWindow) n += 1 + l + sovTx(uint64(l)) } - if m.MinVoters != nil { - l = m.MinVoters.Size() - n += 1 + l + sovTx(uint64(l)) + if m.MinVoters != 0 { + n += 1 + sovTx(uint64(m.MinVoters)) } if m.ValidatorFeeRatio != nil { l = m.ValidatorFeeRatio.Size() n += 1 + l + sovTx(uint64(l)) } - return n -} - -func (m *MsgEditOracleParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NewParams != nil { - l = m.NewParams.Size() - n += 1 + l + sovTx(uint64(l)) + if m.ExpirationBlocks != 0 { + n += 1 + sovTx(uint64(m.ExpirationBlocks)) } return n } @@ -1877,9 +2065,9 @@ func (m *MsgEditOracleParams) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VotePeriod", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1889,29 +2077,148 @@ func (m *MsgEditOracleParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_cosmos_cosmos_sdk_types.Int - m.VotePeriod = &v - if err := m.VotePeriod.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Params == nil { + m.Params = &OracleParamsMsg{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: + 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 *MsgEditOracleParamsResponse) 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: MsgEditOracleParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditOracleParamsResponse: 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 *OracleParamsMsg) 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: OracleParamsMsg: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OracleParamsMsg: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VotePeriod", wireType) + } + m.VotePeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VotePeriod |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VoteThreshold", wireType) } @@ -1947,7 +2254,7 @@ func (m *MsgEditOracleParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RewardBand", wireType) } @@ -1983,7 +2290,7 @@ func (m *MsgEditOracleParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Whitelist", wireType) } @@ -2013,9 +2320,13 @@ func (m *MsgEditOracleParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Whitelist = append(m.Whitelist, string(dAtA[iNdEx:postIndex])) + var v github_com_NibiruChain_nibiru_v2_x_common_asset.Pair + m.Whitelist = append(m.Whitelist, v) + if err := m.Whitelist[len(m.Whitelist)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SlashFraction", wireType) } @@ -2051,11 +2362,11 @@ func (m *MsgEditOracleParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: - if wireType != 2 { + case 6: + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field SlashWindow", wireType) } - var stringLen uint64 + m.SlashWindow = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2065,29 +2376,12 @@ func (m *MsgEditOracleParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.SlashWindow |= 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 - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.SlashWindow = &v - if err := m.SlashWindow.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MinValidPerWindow", wireType) } @@ -2123,11 +2417,11 @@ func (m *MsgEditOracleParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 9: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TwapLookbackWindow", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2137,33 +2431,33 @@ func (m *MsgEditOracleParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_cosmos_cosmos_sdk_types.Int - m.TwapLookbackWindow = &v - if err := m.TwapLookbackWindow.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.TwapLookbackWindow == nil { + m.TwapLookbackWindow = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.TwapLookbackWindow, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 10: - if wireType != 2 { + case 9: + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MinVoters", wireType) } - var stringLen uint64 + m.MinVoters = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2173,29 +2467,12 @@ func (m *MsgEditOracleParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.MinVoters |= 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 - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.MinVoters = &v - if err := m.MinVoters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: + case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorFeeRatio", wireType) } @@ -2231,61 +2508,11 @@ func (m *MsgEditOracleParams) Unmarshal(dAtA []byte) error { return err } 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 *MsgEditOracleParamsResponse) 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: MsgEditOracleParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEditOracleParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewParams", wireType) + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationBlocks", wireType) } - var msglen int + m.ExpirationBlocks = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2295,28 +2522,11 @@ func (m *MsgEditOracleParamsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.ExpirationBlocks |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.NewParams == nil { - m.NewParams = &Params{} - } - if err := m.NewParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/oracle/types/tx.pb.gw.go b/x/oracle/types/tx.pb.gw.go index 5c9ddb424..46515660b 100644 --- a/x/oracle/types/tx.pb.gw.go +++ b/x/oracle/types/tx.pb.gw.go @@ -406,7 +406,7 @@ var ( pattern_Msg_DelegateFeedConsent_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "oracle", "feeder-delegate"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Msg_EditOracleParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "oracle", "edit-oracle-params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Msg_EditOracleParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "oracle", "params"}, "", runtime.AssumeColonVerbOpt(false))) ) var (