diff --git a/app/app.go b/app/app.go index 3f182259..2f71670c 100644 --- a/app/app.go +++ b/app/app.go @@ -571,6 +571,7 @@ func NewArchwayApp( app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.getSubspace(rewardsTypes.ModuleName), + govModuleAddr, ) // Note we set up mint keeper after the x/rewards keeper diff --git a/app/upgrades/latest/upgrades.go b/app/upgrades/latest/upgrades.go index b969e8a4..e1ea5f48 100644 --- a/app/upgrades/latest/upgrades.go +++ b/app/upgrades/latest/upgrades.go @@ -27,6 +27,7 @@ import ( "github.com/archway-network/archway/app/keepers" "github.com/archway-network/archway/app/upgrades" + rewardstypes "github.com/archway-network/archway/x/rewards/types" ) // This upgrade handler is used for all the current changes to the protocol @@ -78,6 +79,11 @@ var Upgrade = upgrades.Upgrade{ // wasm case wasmtypes.ModuleName: keyTable = wasmtypes.ParamKeyTable() //nolint:staticcheck + + // archway modules + case rewardstypes.ModuleName: + keyTable = rewardstypes.ParamKeyTable() + default: continue } diff --git a/proto/archway/rewards/v1/tx.proto b/proto/archway/rewards/v1/tx.proto index cf708daa..8368de97 100644 --- a/proto/archway/rewards/v1/tx.proto +++ b/proto/archway/rewards/v1/tx.proto @@ -23,6 +23,12 @@ service Msg { // SetFlatFee sets or updates or removes the flat fee to interact with the // contract Method is authorized to the contract owner. rpc SetFlatFee(MsgSetFlatFee) returns (MsgSetFlatFeeResponse); + + // UpdateParams defines a governance operation for updating the x/rewards + // module parameters. The authority is defined in the keeper. + // + // Since: archway v5 && cosmos-sdk 0.47 + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgSetContractMetadata is the request for Msg.SetContractMetadata. @@ -80,4 +86,26 @@ message MsgSetFlatFee { } // MsgSetFlatFeeResponse is the response for Msg.SetFlatFee. -message MsgSetFlatFeeResponse {} \ No newline at end of file +message MsgSetFlatFeeResponse {} + + +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: archway v5 && cosmos-sdk 0.47 +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1; + + // params defines the x/rewards parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "params,omitempty"]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: archway v5 && cosmos-sdk 0.47 +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/x/rewards/exported/exported.go b/x/rewards/exported/exported.go new file mode 100644 index 00000000..000114e6 --- /dev/null +++ b/x/rewards/exported/exported.go @@ -0,0 +1,18 @@ +package exported + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +type ( + ParamSet = paramtypes.ParamSet + + // Subspace defines an interface that implements the legacy x/params Subspace + // type. + // + // NOTE: This is used solely for migration of x/params managed parameters. + Subspace interface { + GetParamSet(ctx sdk.Context, ps ParamSet) + } +) diff --git a/x/rewards/keeper/genesis.go b/x/rewards/keeper/genesis.go index 2e280717..0e85eba6 100644 --- a/x/rewards/keeper/genesis.go +++ b/x/rewards/keeper/genesis.go @@ -26,7 +26,9 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { // InitGenesis initializes the module genesis state. func (k Keeper) InitGenesis(ctx sdk.Context, state *types.GenesisState) { - k.SetParams(ctx, state.Params) + if err := k.SetParams(ctx, state.Params); err != nil { + panic(err) + } k.state.ContractMetadataState(ctx).Import(state.ContractsMetadata) k.state.BlockRewardsState(ctx).Import(state.BlockRewards) k.state.TxRewardsState(ctx).Import(state.TxRewards) diff --git a/x/rewards/keeper/keeper.go b/x/rewards/keeper/keeper.go index e10b469e..42d0bd60 100644 --- a/x/rewards/keeper/keeper.go +++ b/x/rewards/keeper/keeper.go @@ -49,10 +49,11 @@ type Keeper struct { trackingKeeper TrackingKeeperExpected authKeeper AuthKeeperExpected bankKeeper BankKeeperExpected + authority string // this should be the x/gov module account } // NewKeeper creates a new Keeper instance. -func NewKeeper(cdc codec.Codec, key storetypes.StoreKey, contractInfoReader ContractInfoReaderExpected, trackingKeeper TrackingKeeperExpected, ak AuthKeeperExpected, bk BankKeeperExpected, ps paramTypes.Subspace) Keeper { +func NewKeeper(cdc codec.Codec, key storetypes.StoreKey, contractInfoReader ContractInfoReaderExpected, trackingKeeper TrackingKeeperExpected, ak AuthKeeperExpected, bk BankKeeperExpected, ps paramTypes.Subspace, authority string) Keeper { if !ps.HasKeyTable() { ps = ps.WithKeyTable(types.ParamKeyTable()) } @@ -65,6 +66,7 @@ func NewKeeper(cdc codec.Codec, key storetypes.StoreKey, contractInfoReader Cont trackingKeeper: trackingKeeper, authKeeper: ak, bankKeeper: bk, + authority: authority, } } @@ -105,3 +107,8 @@ func (k Keeper) GetRewardsRecords(ctx sdk.Context, rewardsAddr sdk.AccAddress, p return k.state.RewardsRecord(ctx).GetRewardsRecordByRewardsAddressPaginated(rewardsAddr, pageReq) } + +// GetAuthority returns the x/rewards module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/rewards/keeper/migrations.go b/x/rewards/keeper/migrations.go new file mode 100644 index 00000000..f69b7445 --- /dev/null +++ b/x/rewards/keeper/migrations.go @@ -0,0 +1,27 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + v2 "github.com/archway-network/archway/x/rewards/migrations/v2" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + keeper Keeper +} + +// NewMigrator returns a new Migrator. +func NewMigrator(keeper Keeper) Migrator { + return Migrator{ + keeper: keeper, + } +} + +// Migrate1to2 migrates the x/rewards module state from the consensus +// version 1 to version 2. Specifically, it takes the parameters that are currently stored +// and managed by the x/params module and stores them directly into the x/rewards +// module state. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + return v2.MigrateStore(ctx, m.keeper.state.key, m.keeper.paramStore, m.keeper.cdc) +} diff --git a/x/rewards/keeper/msg_server.go b/x/rewards/keeper/msg_server.go index 60df5a03..cd67952d 100644 --- a/x/rewards/keeper/msg_server.go +++ b/x/rewards/keeper/msg_server.go @@ -3,6 +3,7 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -112,3 +113,33 @@ func (s MsgServer) SetFlatFee(c context.Context, request *types.MsgSetFlatFee) ( return &types.MsgSetFlatFeeResponse{}, nil } + +// UpdateParams implements types.MsgServer. +func (s MsgServer) UpdateParams(c context.Context, request *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if request == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(c) + + _, err := sdk.AccAddressFromBech32(request.Authority) + if err != nil { + return nil, err // returning error "as is" since this should not happen due to the earlier ValidateBasic call + } + + if request.GetAuthority() != s.keeper.GetAuthority() { + return nil, errorsmod.Wrap(types.ErrUnauthorized, "sender address is not authorized address to update module params") + } + + err = request.GetParams().Validate() // need to explicitly validate as x/gov invokes this msg and it does not validate + if err != nil { + return nil, err + } + + err = s.keeper.SetParams(ctx, request.GetParams()) + if err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/rewards/keeper/msg_server_test.go b/x/rewards/keeper/msg_server_test.go index e4b137d4..26c04cf3 100644 --- a/x/rewards/keeper/msg_server_test.go +++ b/x/rewards/keeper/msg_server_test.go @@ -8,6 +8,7 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" e2eTesting "github.com/archway-network/archway/e2e/testing" "github.com/archway-network/archway/pkg/testutils" @@ -341,3 +342,74 @@ func (s *KeeperTestSuite) TestMsgServer_SetFlatFee() { }) } } + +func (s *KeeperTestSuite) TestMsgServer_UpdateParams() { + ctx, k := s.chain.GetContext(), s.chain.GetApp().Keepers.RewardsKeeper + account := s.chain.GetAccount(0) + + server := keeper.NewMsgServer(k) + + govAddress := s.chain.GetApp().Keepers.AccountKeeper.GetModuleAddress(govtypes.ModuleName) + + testCases := []struct { + testCase string + prepare func() *rewardstypes.MsgUpdateParams + expectError bool + }{ + { + testCase: "fail: invalid params", + prepare: func() *rewardstypes.MsgUpdateParams { + params := rewardstypes.DefaultParams() + params.InflationRewardsRatio = sdk.NewDecWithPrec(-2, 2) + return &rewardstypes.MsgUpdateParams{ + Authority: govAddress.String(), + Params: params, + } + }, + expectError: true, + }, + { + testCase: "fail: invalid authority address", + prepare: func() *rewardstypes.MsgUpdateParams { + return &rewardstypes.MsgUpdateParams{ + Authority: "👻", + Params: rewardstypes.DefaultParams(), + } + }, + expectError: true, + }, + { + testCase: "fail: authority address is not gov address", + prepare: func() *rewardstypes.MsgUpdateParams { + return &rewardstypes.MsgUpdateParams{ + Authority: account.Address.String(), + Params: rewardstypes.DefaultParams(), + } + }, + expectError: true, + }, + { + testCase: "ok: valid params with x/gov address", + prepare: func() *rewardstypes.MsgUpdateParams { + return &rewardstypes.MsgUpdateParams{ + Authority: govAddress.String(), + Params: rewardstypes.DefaultParams(), + } + }, + expectError: false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case: %s", tc.testCase), func() { + req := tc.prepare() + res, err := server.UpdateParams(sdk.WrapSDKContext(ctx), req) + if tc.expectError { + s.Require().Error(err) + } else { + s.Require().NoError(err) + s.Require().Equal(&rewardstypes.MsgUpdateParamsResponse{}, res) + } + }) + } +} diff --git a/x/rewards/keeper/params.go b/x/rewards/keeper/params.go index 3d4298ec..af3eec2c 100644 --- a/x/rewards/keeper/params.go +++ b/x/rewards/keeper/params.go @@ -8,39 +8,42 @@ import ( // InflationRewardsRatio return inflation rewards params ratio. func (k Keeper) InflationRewardsRatio(ctx sdk.Context) (res sdk.Dec) { - k.paramStore.Get(ctx, types.InflationRewardsRatioParamKey, &res) - return + return k.GetParams(ctx).InflationRewardsRatio } // TxFeeRebateRatio return tx fee rebate rewards params ratio. func (k Keeper) TxFeeRebateRatio(ctx sdk.Context) (res sdk.Dec) { - k.paramStore.Get(ctx, types.TxFeeRebateRatioParamKey, &res) - return + return k.GetParams(ctx).TxFeeRebateRatio } // MaxWithdrawRecords return the maximum number of types.RewardsRecord objects used for the withdrawal operation. func (k Keeper) MaxWithdrawRecords(ctx sdk.Context) (res uint64) { - k.paramStore.Get(ctx, types.MaxWithdrawRecordsParamKey, &res) - return + return k.GetParams(ctx).MaxWithdrawRecords } func (k Keeper) MinimumPriceOfGas(ctx sdk.Context) sdk.DecCoin { - var res sdk.DecCoin - k.paramStore.Get(ctx, types.MinPriceOfGasParamKey, &res) - return res + return k.GetParams(ctx).MinPriceOfGas } // GetParams return all module parameters. -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams( - k.InflationRewardsRatio(ctx), - k.TxFeeRebateRatio(ctx), - k.MaxWithdrawRecords(ctx), - k.MinimumPriceOfGas(ctx), - ) +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.state.key) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params } // SetParams sets all module parameters. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramStore.SetParamSet(ctx, ¶ms) +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { + store := ctx.KVStore(k.state.key) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + return nil } diff --git a/x/rewards/migrations/v2/migrate.go b/x/rewards/migrations/v2/migrate.go new file mode 100644 index 00000000..693bacd4 --- /dev/null +++ b/x/rewards/migrations/v2/migrate.go @@ -0,0 +1,33 @@ +package v2 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/archway-network/archway/x/rewards/exported" + "github.com/archway-network/archway/x/rewards/types" +) + +// MigrateStore migrates the x/rewards module state from the consensus version 1 to +// version 2. Specifically, it takes the parameters that are currently stored +// and managed by the x/params module and stores them directly into the x/rewards +// module state. +func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, legacySubspace exported.Subspace, cdc codec.BinaryCodec) error { + store := ctx.KVStore(storeKey) + var currParams types.Params + legacySubspace.GetParamSet(ctx, &currParams) + + if err := currParams.Validate(); err != nil { + return err + } + + bz, err := cdc.Marshal(&currParams) + if err != nil { + return err + } + + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/rewards/migrations/v2/migrate_test.go b/x/rewards/migrations/v2/migrate_test.go new file mode 100644 index 00000000..3b697846 --- /dev/null +++ b/x/rewards/migrations/v2/migrate_test.go @@ -0,0 +1,46 @@ +package v2_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/testutil" + sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + + "github.com/archway-network/archway/x/rewards" + "github.com/archway-network/archway/x/rewards/exported" + v2 "github.com/archway-network/archway/x/rewards/migrations/v2" + "github.com/archway-network/archway/x/rewards/types" +) + +type mockSubspace struct { + ps types.Params +} + +func newMockSubspace(ps types.Params) mockSubspace { + return mockSubspace{ps: ps} +} + +func (ms mockSubspace) GetParamSet(_ sdk.Context, ps exported.ParamSet) { + *ps.(*types.Params) = ms.ps +} + +func TestMigrateStore(t *testing.T) { + encCfg := moduletestutil.MakeTestEncodingConfig(rewards.AppModuleBasic{}) + cdc := encCfg.Codec + + storeKey := sdk.NewKVStoreKey(types.ModuleName) + tKey := sdk.NewTransientStoreKey("transient_test") + ctx := testutil.DefaultContext(storeKey, tKey) + store := ctx.KVStore(storeKey) + + legacySubspace := newMockSubspace(types.DefaultParams()) + require.NoError(t, v2.MigrateStore(ctx, storeKey, legacySubspace, cdc)) + + var res types.Params + bz := store.Get(types.ParamsKey) + require.NoError(t, cdc.Unmarshal(bz, &res)) + require.Equal(t, legacySubspace.ps, res) +} diff --git a/x/rewards/module.go b/x/rewards/module.go index a9cf3d00..117f8bb0 100644 --- a/x/rewards/module.go +++ b/x/rewards/module.go @@ -30,6 +30,9 @@ var ( _ module.AppModule = AppModule{} ) +// ConsensusVersion defines the current x/rewards module consensus version. +const ConsensusVersion = 2 + // AppModuleBasic defines the basic application module for this module. type AppModuleBasic struct { cdc codec.Codec @@ -108,6 +111,11 @@ func (a AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { func (a AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServer(a.keeper)) types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServer(a.keeper)) + + m := keeper.NewMigrator(a.keeper) + if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { + panic(fmt.Sprintf("failed to migrate x/%s from version 1 to 2: %v", types.ModuleName, err)) + } } // InitGenesis performs genesis initialization for the module. It returns no validator updates. @@ -128,7 +136,7 @@ func (a AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawM // ConsensusVersion implements AppModule/ConsensusVersion. func (a AppModule) ConsensusVersion() uint64 { - return 1 + return ConsensusVersion } // BeginBlock returns the begin blocker for the module. diff --git a/x/rewards/types/codec.go b/x/rewards/types/codec.go index acddda5f..35b9bca1 100644 --- a/x/rewards/types/codec.go +++ b/x/rewards/types/codec.go @@ -14,6 +14,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgSetContractMetadata{}, "rewards/MsgSetContractMetadata", nil) cdc.RegisterConcrete(&MsgWithdrawRewards{}, "rewards/MsgWithdrawRewards", nil) cdc.RegisterConcrete(&MsgSetFlatFee{}, "rewards/MsgSetFlatFee", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "rewards/MsgUpdateParams", nil) } // RegisterInterfaces registers interfaces types with the interface registry. @@ -22,6 +23,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgSetContractMetadata{}, &MsgWithdrawRewards{}, &MsgSetFlatFee{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/rewards/types/keys.go b/x/rewards/types/keys.go index e57c4017..0950e3d0 100644 --- a/x/rewards/types/keys.go +++ b/x/rewards/types/keys.go @@ -97,3 +97,8 @@ var ( // Value: sdk.Coin FlatFeePrefix = []byte{0x00} ) + +// ParamsKey stores the module params +var ( + ParamsKey = []byte{0x06} +) diff --git a/x/rewards/types/msg.go b/x/rewards/types/msg.go index 1f3c6544..955e1936 100644 --- a/x/rewards/types/msg.go +++ b/x/rewards/types/msg.go @@ -12,12 +12,14 @@ const ( TypeMsgSetContractMetadata = "set-contract-metadata" TypeMsgWithdrawRewards = "withdraw-rewards" TypeMsgFlatFee = "flat-fee" + TypeMsgUpdateParams = "update-params" ) var ( _ sdk.Msg = &MsgSetContractMetadata{} _ sdk.Msg = &MsgWithdrawRewards{} _ sdk.Msg = &MsgSetFlatFee{} + _ sdk.Msg = &MsgUpdateParams{} ) // NewMsgSetContractMetadata creates a new MsgSetContractMetadata instance. @@ -179,36 +181,65 @@ func NewMsgFlatFee(senderAddr, contractAddr sdk.AccAddress, flatFee sdk.Coin) *M return msg } +// GetSigners implements the sdk.Msg interface. +func (m MsgSetFlatFee) GetSigners() []sdk.AccAddress { + senderAddr, err := sdk.AccAddressFromBech32(m.SenderAddress) + if err != nil { + panic(fmt.Errorf("parsing sender address (%s): %w", m.SenderAddress, err)) + } + + return []sdk.AccAddress{senderAddr} +} + +// ValidateBasic implements the sdk.Msg interface. +func (m MsgSetFlatFee) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.SenderAddress); err != nil { + return errorsmod.Wrapf(sdkErrors.ErrInvalidAddress, "invalid sender address: %v", err) + } + if _, err := sdk.AccAddressFromBech32(m.ContractAddress); err != nil { + return errorsmod.Wrapf(sdkErrors.ErrInvalidAddress, "invalid contract address: %v", err) + } + + return nil +} + +// NewMsgUpdateParams creates a new MsgUpdateParams instance. +func NewMsgUpdateParams(senderAddr sdk.AccAddress, params Params) *MsgUpdateParams { + msg := &MsgUpdateParams{ + Authority: senderAddr.String(), + Params: params, + } + + return msg +} + // Route implements the sdk.Msg interface. -func (m MsgSetFlatFee) Route() string { return RouterKey } +func (m MsgUpdateParams) Route() string { return RouterKey } // Type implements the sdk.Msg interface. -func (m MsgSetFlatFee) Type() string { return TypeMsgFlatFee } +func (m MsgUpdateParams) Type() string { return TypeMsgFlatFee } // GetSigners implements the sdk.Msg interface. -func (m MsgSetFlatFee) GetSigners() []sdk.AccAddress { - senderAddr, err := sdk.AccAddressFromBech32(m.SenderAddress) +func (m MsgUpdateParams) GetSigners() []sdk.AccAddress { + senderAddr, err := sdk.AccAddressFromBech32(m.Authority) if err != nil { - panic(fmt.Errorf("parsing sender address (%s): %w", m.SenderAddress, err)) + panic(fmt.Errorf("parsing sender address (%s): %w", m.Authority, err)) } return []sdk.AccAddress{senderAddr} } // GetSignBytes implements the sdk.Msg interface. -func (m MsgSetFlatFee) GetSignBytes() []byte { +func (m MsgUpdateParams) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(&m) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. -func (m MsgSetFlatFee) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(m.SenderAddress); err != nil { +func (m MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { return errorsmod.Wrapf(sdkErrors.ErrInvalidAddress, "invalid sender address: %v", err) } - if _, err := sdk.AccAddressFromBech32(m.ContractAddress); err != nil { - return errorsmod.Wrapf(sdkErrors.ErrInvalidAddress, "invalid contract address: %v", err) - } return nil } diff --git a/x/rewards/types/tx.pb.go b/x/rewards/types/tx.pb.go index 5f06a873..b56132c3 100644 --- a/x/rewards/types/tx.pb.go +++ b/x/rewards/types/tx.pb.go @@ -465,6 +465,105 @@ func (m *MsgSetFlatFeeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetFlatFeeResponse proto.InternalMessageInfo +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: archway v5 && cosmos-sdk 0.47 +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/rewards parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_d5741d3c1465c0f5, []int{6} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: archway v5 && cosmos-sdk 0.47 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d5741d3c1465c0f5, []int{7} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgSetContractMetadata)(nil), "archway.rewards.v1.MsgSetContractMetadata") proto.RegisterType((*MsgSetContractMetadataResponse)(nil), "archway.rewards.v1.MsgSetContractMetadataResponse") @@ -474,52 +573,60 @@ func init() { proto.RegisterType((*MsgWithdrawRewardsResponse)(nil), "archway.rewards.v1.MsgWithdrawRewardsResponse") proto.RegisterType((*MsgSetFlatFee)(nil), "archway.rewards.v1.MsgSetFlatFee") proto.RegisterType((*MsgSetFlatFeeResponse)(nil), "archway.rewards.v1.MsgSetFlatFeeResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "archway.rewards.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "archway.rewards.v1.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("archway/rewards/v1/tx.proto", fileDescriptor_d5741d3c1465c0f5) } var fileDescriptor_d5741d3c1465c0f5 = []byte{ - // 627 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xb6, 0x93, 0x50, 0xd1, 0x69, 0xd3, 0x54, 0xdb, 0x42, 0x83, 0x11, 0xae, 0x89, 0x0a, 0xa4, - 0x95, 0x58, 0x93, 0xf4, 0xd6, 0x5b, 0x7f, 0x54, 0x5a, 0xa9, 0x41, 0xc2, 0x1c, 0x90, 0x7a, 0x89, - 0x36, 0xf6, 0xd6, 0xb5, 0x88, 0xbd, 0x95, 0x77, 0xd3, 0xb4, 0x57, 0x78, 0x01, 0x1e, 0x80, 0x87, - 0xe0, 0x0d, 0x38, 0x70, 0xe9, 0x8d, 0x1e, 0x39, 0x21, 0xd4, 0x1e, 0x78, 0x0d, 0x64, 0xef, 0xda, - 0x2a, 0x89, 0xab, 0x86, 0x9b, 0x77, 0xe7, 0x9b, 0xf9, 0xbe, 0x99, 0xf9, 0xbc, 0xf0, 0x98, 0xc4, - 0xee, 0xf1, 0x90, 0x9c, 0xdb, 0x31, 0x1d, 0x92, 0xd8, 0xe3, 0xf6, 0x69, 0xcb, 0x16, 0x67, 0xf8, - 0x24, 0x66, 0x82, 0x21, 0xa4, 0x82, 0x58, 0x05, 0xf1, 0x69, 0xcb, 0x58, 0xf4, 0x99, 0xcf, 0xd2, - 0xb0, 0x9d, 0x7c, 0x49, 0xa4, 0x61, 0xba, 0x8c, 0x87, 0x8c, 0xdb, 0x3d, 0xc2, 0xa9, 0x7d, 0xda, - 0xea, 0x51, 0x41, 0x5a, 0xb6, 0xcb, 0x82, 0x48, 0xc5, 0x97, 0x54, 0x3c, 0xe4, 0x7e, 0xc2, 0x10, - 0x72, 0x5f, 0x05, 0xac, 0x02, 0xfe, 0x8c, 0x2d, 0x45, 0x34, 0xbe, 0xe8, 0xf0, 0xb0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x72, 0xaa, 0x43, 0x80, 0x1b, - 0x0b, 0x7c, 0x7a, 0xbb, 0x58, 0x05, 0x31, 0x56, 0xef, 0x84, 0x64, 0xb5, 0xb7, 0x0e, 0x2e, 0xae, - 0x4c, 0xfd, 0xf2, 0xca, 0xd4, 0x7f, 0x5f, 0x99, 0xfa, 0xe7, 0x6b, 0x53, 0xbb, 0xbc, 0x36, 0xb5, - 0x9f, 0xd7, 0xa6, 0x76, 0xd8, 0xf6, 0x03, 0x71, 0x3c, 0xe8, 0x61, 0x97, 0x85, 0xb6, 0x2a, 0xf7, - 0x32, 0xa2, 0x62, 0xc8, 0xe2, 0x0f, 0xd9, 0xd9, 0x3e, 0xcb, 0x9f, 0x44, 0x71, 0x7e, 0x42, 0x79, - 0x6f, 0x2a, 0x7d, 0x0e, 0xd7, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x84, 0xd1, 0x1a, 0xb2, - 0x05, 0x00, 0x00, + // 722 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xc1, 0x6e, 0xd3, 0x4a, + 0x14, 0x8d, 0x93, 0xbc, 0xea, 0xe5, 0x36, 0x69, 0xaa, 0x69, 0xdf, 0x6b, 0x6a, 0xc0, 0x0d, 0xa1, + 0x40, 0x5a, 0xc0, 0x26, 0xe9, 0xae, 0xbb, 0xa6, 0x55, 0x69, 0xa5, 0x06, 0x81, 0x11, 0x42, 0xea, + 0x26, 0x4c, 0xe2, 0xa9, 0x63, 0x11, 0x7b, 0x22, 0xcf, 0xa4, 0x69, 0xb6, 0xb0, 0x46, 0xe2, 0x03, + 0xd8, 0xb2, 0xe7, 0x0f, 0xd8, 0x76, 0x47, 0x97, 0xac, 0x2a, 0xd4, 0x2e, 0x90, 0xf8, 0x0a, 0x64, + 0xcf, 0xd8, 0x4d, 0xd3, 0x54, 0x0d, 0x3b, 0xcf, 0xdc, 0x73, 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f, 0x21, 0x7b, 0xe9, 0xb2, + 0xef, 0x5d, 0xd3, 0x3a, 0x0c, 0x52, 0x1f, 0x4d, 0x00, 0x8a, 0x14, 0x6a, 0x7b, 0xc7, 0x67, 0x9a, + 0x72, 0x72, 0xa6, 0x29, 0x3f, 0xcf, 0x34, 0xe5, 0xd3, 0xb9, 0x96, 0x38, 0x39, 0xd7, 0x12, 0x3f, + 0xce, 0xb5, 0xc4, 0x7e, 0xd5, 0x76, 0x78, 0xbb, 0xd7, 0xd4, 0x5b, 0xd4, 0x35, 0x24, 0xe1, 0x13, + 0x8f, 0xf0, 0x3e, 0xf5, 0xdf, 0x45, 0x6b, 0xe3, 0x28, 0xfe, 0x3f, 0xf0, 0x41, 0x97, 0xb0, 0xe6, + 0x54, 0xf8, 0x6f, 0x58, 0xfb, 0x13, 0x00, 0x00, 0xff, 0xff, 0x64, 0xac, 0xd6, 0x01, 0xbf, 0x06, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -544,6 +651,11 @@ type MsgClient interface { // SetFlatFee sets or updates or removes the flat fee to interact with the // contract Method is authorized to the contract owner. SetFlatFee(ctx context.Context, in *MsgSetFlatFee, opts ...grpc.CallOption) (*MsgSetFlatFeeResponse, error) + // UpdateParams defines a governance operation for updating the x/rewards + // module parameters. The authority is defined in the keeper. + // + // Since: archway v5 && cosmos-sdk 0.47 + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -581,6 +693,15 @@ func (c *msgClient) SetFlatFee(ctx context.Context, in *MsgSetFlatFee, opts ...g return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/archway.rewards.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // SetContractMetadata creates or updates an existing contract metadata. @@ -593,6 +714,11 @@ type MsgServer interface { // SetFlatFee sets or updates or removes the flat fee to interact with the // contract Method is authorized to the contract owner. SetFlatFee(context.Context, *MsgSetFlatFee) (*MsgSetFlatFeeResponse, error) + // UpdateParams defines a governance operation for updating the x/rewards + // module parameters. The authority is defined in the keeper. + // + // Since: archway v5 && cosmos-sdk 0.47 + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -608,6 +734,9 @@ func (*UnimplementedMsgServer) WithdrawRewards(ctx context.Context, req *MsgWith func (*UnimplementedMsgServer) SetFlatFee(ctx context.Context, req *MsgSetFlatFee) (*MsgSetFlatFeeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetFlatFee not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -667,6 +796,24 @@ func _Msg_SetFlatFee_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/archway.rewards.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "archway.rewards.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -683,6 +830,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SetFlatFee", Handler: _Msg_SetFlatFee_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "archway/rewards/v1/tx.proto", @@ -1013,6 +1164,69 @@ func (m *MsgSetFlatFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) 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 = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) 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 @@ -1162,6 +1376,30 @@ func (m *MsgSetFlatFeeResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1980,6 +2218,171 @@ func (m *MsgSetFlatFeeResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(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 err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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 *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: 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 skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0