diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index e07ecc2a6..e172bf071 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -434,7 +434,9 @@ func (ak *SecretAppKeepers) InitCustomKeepers( ibcSwitchKeeper := ibcswitch.NewKeeper( ak.IbcFeeKeeper, - ak.GetSubspace(ibcswitch.ModuleName), + appCodec, + ak.keys[ibcswitchtypes.StoreKey], + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) ak.IbcSwitchKeeper = &ibcSwitchKeeper diff --git a/app/modules.go b/app/modules.go index 0d976b9a5..b2e5e903e 100644 --- a/app/modules.go +++ b/app/modules.go @@ -87,6 +87,6 @@ func Modules( ica.NewAppModule(app.AppKeepers.ICAControllerKeeper, app.AppKeepers.ICAHostKeeper), packetforward.NewAppModule(app.AppKeepers.PacketForwardKeeper, app.AppKeepers.GetSubspace(packetforwardtypes.ModuleName)), ibcfee.NewAppModule(app.AppKeepers.IbcFeeKeeper), - ibcswitch.NewAppModule(app.AppKeepers.IbcSwitchKeeper), + ibcswitch.NewAppModule(app.AppKeepers.IbcSwitchKeeper, app.AppKeepers.GetSubspace(ibcswitch.ModuleName)), } } diff --git a/app/upgrades/v1.15/upgrade.go b/app/upgrades/v1.15/upgrade.go index 4367f7de4..f2f0d0b5f 100644 --- a/app/upgrades/v1.15/upgrade.go +++ b/app/upgrades/v1.15/upgrade.go @@ -28,6 +28,7 @@ import ( ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ibcconntypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibcswitchtypes "github.com/scrtlabs/SecretNetwork/x/emergencybutton/types" "github.com/scrtlabs/SecretNetwork/app/keepers" "github.com/scrtlabs/SecretNetwork/app/upgrades" @@ -78,6 +79,8 @@ func createUpgradeHandler(mm *module.Manager, appKeepers *keepers.SecretAppKeepe keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck case govtypes.ModuleName: keyTable = govv1.ParamKeyTable() //nolint:staticcheck + case ibcswitchtypes.ModuleName: + keyTable = ibcswitchtypes.ParamKeyTable() //nolint:staticcheck case crisistypes.ModuleName: keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck case ibcexported.ModuleName: diff --git a/proto/secret/emergencybutton/v1beta1/tx.proto b/proto/secret/emergencybutton/v1beta1/tx.proto index b43b68fa4..5a7b80010 100644 --- a/proto/secret/emergencybutton/v1beta1/tx.proto +++ b/proto/secret/emergencybutton/v1beta1/tx.proto @@ -4,6 +4,7 @@ package secret.emergencybutton.v1beta1; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; +import "secret/emergencybutton/v1beta1/params.proto"; option go_package = "github.com/scrtlabs/SecretNetwork/x/emergencybutton/types"; @@ -14,6 +15,7 @@ service Msg { // ToggleIbcSwitch defines a method for toggling the status of the // emergencybutton. rpc ToggleIbcSwitch(MsgToggleIbcSwitch) returns (MsgToggleIbcSwitchResponse); + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgToggleIbcSwitch represents a message to toggle the emergencybutton status @@ -25,4 +27,18 @@ message MsgToggleIbcSwitch { } // MsgToggleIbcSwitchResponse defines the response type for the toggle. -message MsgToggleIbcSwitchResponse {} \ No newline at end of file +message MsgToggleIbcSwitchResponse {} + +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the x/emergencybutton parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +message MsgUpdateParamsResponse {} diff --git a/x/emergencybutton/exported/exported.go b/x/emergencybutton/exported/exported.go new file mode 100644 index 000000000..000114e61 --- /dev/null +++ b/x/emergencybutton/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/emergencybutton/keeper/keeper.go b/x/emergencybutton/keeper/keeper.go index 1c07defe5..fd4017ea4 100644 --- a/x/emergencybutton/keeper/keeper.go +++ b/x/emergencybutton/keeper/keeper.go @@ -2,10 +2,11 @@ package keeper import ( "cosmossdk.io/errors" + codec "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" //nolint:staticcheck + storetypes "cosmossdk.io/store/types" ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" "github.com/cosmos/ibc-go/v8/modules/core/exported" @@ -13,8 +14,10 @@ import ( ) type Keeper struct { - channel porttypes.ICS4Wrapper - paramSpace paramtypes.Subspace + cdc codec.BinaryCodec + channel porttypes.ICS4Wrapper + storeKey storetypes.StoreKey + authority string } func (i *Keeper) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { @@ -23,15 +26,15 @@ func (i *Keeper) GetAppVersion(ctx sdk.Context, portID, channelID string) (strin func NewKeeper( channel porttypes.ICS4Wrapper, - paramSpace paramtypes.Subspace, + cdc codec.BinaryCodec, + key storetypes.StoreKey, + authority string, ) Keeper { - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - return Keeper{ - channel: channel, - paramSpace: paramSpace, + channel: channel, + authority: authority, + cdc: cdc, + storeKey: key, } } @@ -56,3 +59,8 @@ func (i *Keeper) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes. func (i *Keeper) IsHalted(ctx sdk.Context) bool { return i.GetSwitchStatus(ctx) == types.IbcSwitchStatusOff } + +// GetAuthority returns the x/emergencybutton module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/emergencybutton/keeper/migrator.go b/x/emergencybutton/keeper/migrator.go new file mode 100644 index 000000000..156c35ce8 --- /dev/null +++ b/x/emergencybutton/keeper/migrator.go @@ -0,0 +1,28 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/scrtlabs/SecretNetwork/x/emergencybutton/exported" + v2 "github.com/scrtlabs/SecretNetwork/x/emergencybutton/migrations/v2" +) + +// Migrator is a struct for handling in-place state migrations. +type Migrator struct { + keeper Keeper + legacySubspace exported.Subspace +} + +func NewMigrator(k Keeper, ss exported.Subspace) Migrator { + return Migrator{ + keeper: k, + legacySubspace: ss, + } +} + +// Migrate1to2 migrates the x/emergencybutton 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 modules and stores them directly into the x/emergencybutton +// module state. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + return v2.Migrate(ctx, ctx.KVStore(m.keeper.storeKey), m.legacySubspace, m.keeper.cdc) +} diff --git a/x/emergencybutton/keeper/msg_server.go b/x/emergencybutton/keeper/msg_server.go index 1ec193968..7ab0681df 100644 --- a/x/emergencybutton/keeper/msg_server.go +++ b/x/emergencybutton/keeper/msg_server.go @@ -6,6 +6,7 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/scrtlabs/SecretNetwork/x/emergencybutton/types" ) @@ -43,3 +44,16 @@ func (m msgServer) ToggleIbcSwitch(goCtx context.Context, msg *types.MsgToggleIb return &types.MsgToggleIbcSwitchResponse{}, nil } + +func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if m.keeper.authority != req.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", m.keeper.authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := m.keeper.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/emergencybutton/keeper/params.go b/x/emergencybutton/keeper/params.go index a90d5c960..92cb8b7a7 100644 --- a/x/emergencybutton/keeper/params.go +++ b/x/emergencybutton/keeper/params.go @@ -9,33 +9,36 @@ func (i *Keeper) GetPauserAddress(ctx sdk.Context) (pauser string) { return i.GetParams(ctx).PauserAddress } -//func (i *Keeper) GetSwitchStatus(ctx sdk.Context) (status string) { -// return i.GetParams(ctx).SwitchStatus -//} - func (i *Keeper) GetParams(ctx sdk.Context) (params types.Params) { - // This was previously done via i.paramSpace.GetParamSet(ctx, ¶ms). That will - // panic if the params don't exist. This is a workaround to avoid that panic. - // Params should be refactored to just use a raw kvstore. - empty := types.Params{} - for _, pair := range params.ParamSetPairs() { - i.paramSpace.GetIfExists(ctx, pair.Key, pair.Value) - } - if params == empty { - return types.DefaultParams() + store := ctx.KVStore(i.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params } + + i.cdc.MustUnmarshal(bz, ¶ms) return params } func (i *Keeper) GetSwitchStatus(ctx sdk.Context) (status string) { - i.paramSpace.Get(ctx, types.KeySwitchStatus, &status) - return + return i.GetParams(ctx).SwitchStatus } func (i *Keeper) SetSwitchStatus(ctx sdk.Context, value string) { - i.paramSpace.Set(ctx, types.KeySwitchStatus, value) + params := i.GetParams(ctx) + params.SwitchStatus = value + i.SetParams(ctx, params) } -func (i *Keeper) SetParams(ctx sdk.Context, params types.Params) { - i.paramSpace.SetParamSet(ctx, ¶ms) +// SetParams sets the x/emergencybutton module parameters. +func (i *Keeper) SetParams(ctx sdk.Context, p types.Params) error { + if err := p.Validate(); err != nil { + return err + } + + store := ctx.KVStore(i.storeKey) + bz := i.cdc.MustMarshal(&p) + store.Set(types.ParamsKey, bz) + + return nil } diff --git a/x/emergencybutton/migrations/v2/migrate.go b/x/emergencybutton/migrations/v2/migrate.go new file mode 100644 index 000000000..85ad87ae5 --- /dev/null +++ b/x/emergencybutton/migrations/v2/migrate.go @@ -0,0 +1,40 @@ +package v2 + +import ( + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/scrtlabs/SecretNetwork/x/emergencybutton/exported" + "github.com/scrtlabs/SecretNetwork/x/emergencybutton/types" +) + +const ( + ModuleName = "emergencybutton" +) + +var ( + ParamsKey = []byte{0x01} +) + +// Migrate migrates the x/emergencybutton 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 modules and stores them directly into the x/emergencybutton +// module state. +func Migrate( + ctx sdk.Context, + store storetypes.KVStore, + legacySubspace exported.Subspace, + cdc codec.BinaryCodec, +) error { + var currParams types.Params + legacySubspace.GetParamSet(ctx, &currParams) + + if err := currParams.Validate(); err != nil { + return err + } + + bz := cdc.MustMarshal(&currParams) + store.Set(ParamsKey, bz) + + return nil +} diff --git a/x/emergencybutton/module.go b/x/emergencybutton/module.go index 4f1a86f2b..40d3cc437 100644 --- a/x/emergencybutton/module.go +++ b/x/emergencybutton/module.go @@ -15,7 +15,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" ibcswitchclient "github.com/scrtlabs/SecretNetwork/x/emergencybutton/client" - + "github.com/scrtlabs/SecretNetwork/x/emergencybutton/exported" + "github.com/scrtlabs/SecretNetwork/x/emergencybutton/keeper" "github.com/scrtlabs/SecretNetwork/x/emergencybutton/types" ) @@ -69,12 +70,15 @@ type AppModule struct { AppModuleBasic keeper *Keeper + + legacySubspace exported.Subspace } -func NewAppModule(keeper *Keeper) AppModule { +func NewAppModule(keeper *Keeper, ss exported.Subspace) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, keeper: keeper, + legacySubspace: ss, } } @@ -88,6 +92,12 @@ func (am AppModule) Name() string { func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), NewMsgServerImpl(*am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), grpc.Querier{Q: ibcswitchclient.Querier{K: *am.keeper}}) + + m := keeper.NewMigrator(*am.keeper, am.legacySubspace) + + 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 the txfees module's genesis initialization It returns @@ -106,7 +116,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return 2 } // IsAppModule implements the appmodule.AppModule interface. func (AppModule) IsAppModule() {} diff --git a/x/emergencybutton/types/codec.go b/x/emergencybutton/types/codec.go index e19c08519..d31a09146 100644 --- a/x/emergencybutton/types/codec.go +++ b/x/emergencybutton/types/codec.go @@ -11,6 +11,7 @@ import ( // LegacyAmino codec. These types are used for Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgToggleIbcSwitch{}, "emergencybutton/MsgToggleIbcSwitch", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "emergencybutton/MsgUpdateParams", nil) } // RegisterInterfaces registers interfaces and implementations of the incentives module. @@ -18,6 +19,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations( (*sdk.Msg)(nil), &MsgToggleIbcSwitch{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/emergencybutton/types/keys.go b/x/emergencybutton/types/keys.go index db85e257a..aeccb261b 100644 --- a/x/emergencybutton/types/keys.go +++ b/x/emergencybutton/types/keys.go @@ -9,7 +9,10 @@ const ( // RouterKey is the message route. Can only contain // alphanumeric characters. -var RouterKey = QuerierRoute +var ( + RouterKey = QuerierRoute + ParamsKey = []byte{0x01} +) const ( // IbcSwitchStatusOff - IBC messages halted diff --git a/x/emergencybutton/types/legacy_params.go b/x/emergencybutton/types/legacy_params.go new file mode 100644 index 000000000..88ae73c25 --- /dev/null +++ b/x/emergencybutton/types/legacy_params.go @@ -0,0 +1,25 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// Parameter store keys. +var _ paramtypes.ParamSet = &Params{} + +var ( + KeySwitchStatus = []byte("switchstatus") + KeyPauserAddress = []byte("pauseraddress") +) + +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// Implements params.ParamSet. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeySwitchStatus, &p.SwitchStatus, validateSwitchStatus), + paramtypes.NewParamSetPair(KeyPauserAddress, &p.PauserAddress, validatePauserAddress), + } +} diff --git a/x/emergencybutton/types/params.go b/x/emergencybutton/types/params.go index 6c052459f..5970a88d4 100644 --- a/x/emergencybutton/types/params.go +++ b/x/emergencybutton/types/params.go @@ -4,21 +4,8 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) -var ( - KeySwitchStatus = []byte("switchstatus") - KeyPauserAddress = []byte("pauseraddress") -) - -// Parameter store keys. -var _ paramtypes.ParamSet = &Params{} - -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - func NewParams(switchStatus string, pauserAddress string) Params { return Params{ SwitchStatus: switchStatus, @@ -36,14 +23,6 @@ func (p Params) Validate() error { return validatePauserAddress(p.PauserAddress) } -// Implements params.ParamSet. -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeySwitchStatus, &p.SwitchStatus, validateSwitchStatus), - paramtypes.NewParamSetPair(KeyPauserAddress, &p.PauserAddress, validatePauserAddress), - } -} - func validatePauserAddress(i interface{}) error { v, ok := i.(string) if !ok { diff --git a/x/emergencybutton/types/tx.pb.go b/x/emergencybutton/types/tx.pb.go index 07460dd0e..0d869c83e 100644 --- a/x/emergencybutton/types/tx.pb.go +++ b/x/emergencybutton/types/tx.pb.go @@ -113,9 +113,103 @@ func (m *MsgToggleIbcSwitchResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgToggleIbcSwitchResponse proto.InternalMessageInfo +type MsgUpdateParams struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/emergencybutton parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +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_72649c7fc51bf646, []int{2} +} +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{} +} + +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_72649c7fc51bf646, []int{3} +} +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((*MsgToggleIbcSwitch)(nil), "secret.emergencybutton.v1beta1.MsgToggleIbcSwitch") proto.RegisterType((*MsgToggleIbcSwitchResponse)(nil), "secret.emergencybutton.v1beta1.MsgToggleIbcSwitchResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "secret.emergencybutton.v1beta1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "secret.emergencybutton.v1beta1.MsgUpdateParamsResponse") } func init() { @@ -123,26 +217,33 @@ func init() { } var fileDescriptor_72649c7fc51bf646 = []byte{ - // 290 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2f, 0x4e, 0x4d, 0x2e, - 0x4a, 0x2d, 0xd1, 0x4f, 0xcd, 0x4d, 0x2d, 0x4a, 0x4f, 0xcd, 0x4b, 0xae, 0x4c, 0x2a, 0x2d, 0x29, - 0xc9, 0xcf, 0xd3, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x83, 0x28, 0xd4, 0x43, 0x53, 0xa8, 0x07, 0x55, 0x28, 0x25, 0x92, - 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xaa, 0x0f, 0x62, 0x41, 0x74, 0x49, 0x49, 0x26, 0xe7, 0x17, 0xe7, - 0xe6, 0x17, 0xc7, 0x43, 0x24, 0x20, 0x1c, 0xa8, 0x94, 0x38, 0x84, 0xa7, 0x9f, 0x5b, 0x9c, 0xae, - 0x5f, 0x66, 0x08, 0xa2, 0x20, 0x12, 0x4a, 0x96, 0x5c, 0x42, 0xbe, 0xc5, 0xe9, 0x21, 0xf9, 0xe9, - 0xe9, 0x39, 0xa9, 0x9e, 0x49, 0xc9, 0xc1, 0xe5, 0x99, 0x25, 0xc9, 0x19, 0x42, 0x62, 0x5c, 0x6c, - 0xc5, 0xa9, 0x79, 0x29, 0xa9, 0x45, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x50, 0x9e, 0x15, - 0x77, 0xd3, 0xf3, 0x0d, 0x5a, 0x50, 0x8e, 0x92, 0x0c, 0x97, 0x14, 0xa6, 0xd6, 0xa0, 0xd4, 0xe2, - 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x09, 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0x8d, 0x8c, - 0x5c, 0xfc, 0xe8, 0xc6, 0x1b, 0xe9, 0xe1, 0xf7, 0x9f, 0x1e, 0xa6, 0xb9, 0x52, 0x56, 0xa4, 0xeb, - 0x81, 0xb9, 0x45, 0x8a, 0xb5, 0xe1, 0xf9, 0x06, 0x2d, 0x46, 0xa7, 0xe0, 0x13, 0x8f, 0xe4, 0x18, - 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, - 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xb2, 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, - 0xcf, 0xd5, 0x2f, 0x4e, 0x2e, 0x2a, 0xc9, 0x49, 0x4c, 0x2a, 0xd6, 0x0f, 0x06, 0xdb, 0xe7, 0x97, - 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0xad, 0x5f, 0x81, 0x11, 0x6b, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, - 0x6c, 0xe0, 0x70, 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x4a, 0xe8, 0x3c, 0x8f, 0xdc, 0x01, - 0x00, 0x00, + // 416 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x4d, 0x8f, 0xd2, 0x40, + 0x18, 0xee, 0xa0, 0x92, 0x30, 0x18, 0x49, 0x1a, 0x22, 0xd0, 0x98, 0x4a, 0x7a, 0x50, 0x82, 0xb1, + 0x13, 0x30, 0xd1, 0xc0, 0x4d, 0xe2, 0xc5, 0x03, 0xc6, 0xb4, 0x7a, 0xf1, 0x62, 0xfa, 0x31, 0x19, + 0x1a, 0x69, 0xa7, 0x99, 0x19, 0xbe, 0x6e, 0xea, 0xd1, 0x93, 0xff, 0xc0, 0xbf, 0xc0, 0xc1, 0x1f, + 0xc1, 0x91, 0x78, 0xf2, 0xb4, 0xd9, 0xc0, 0x81, 0xbf, 0xb1, 0xa1, 0x33, 0x84, 0x5d, 0x48, 0x96, + 0xe5, 0xd4, 0xbe, 0x79, 0x9f, 0xaf, 0x79, 0xf2, 0xc2, 0xe7, 0x1c, 0x07, 0x0c, 0x0b, 0x84, 0x63, + 0xcc, 0x08, 0x4e, 0x82, 0x99, 0x3f, 0x12, 0x82, 0x26, 0x68, 0xdc, 0xf2, 0xb1, 0xf0, 0x5a, 0x48, + 0x4c, 0xed, 0x94, 0x51, 0x41, 0x75, 0x53, 0x02, 0xed, 0x03, 0xa0, 0xad, 0x80, 0x46, 0x99, 0x50, + 0x42, 0x33, 0x28, 0xda, 0xfe, 0x49, 0x96, 0x51, 0x0b, 0x28, 0x8f, 0x29, 0xff, 0x2a, 0x17, 0x72, + 0x50, 0xab, 0x8a, 0x9c, 0x50, 0xcc, 0x09, 0x1a, 0xb7, 0xb6, 0x1f, 0xb5, 0x78, 0x71, 0x22, 0x52, + 0xea, 0x31, 0x2f, 0x56, 0x2a, 0x56, 0x07, 0xea, 0x7d, 0x4e, 0x3e, 0x51, 0x42, 0x86, 0xf8, 0xbd, + 0x1f, 0xb8, 0x93, 0x48, 0x04, 0x03, 0xfd, 0x31, 0xcc, 0x73, 0x9c, 0x84, 0x98, 0x55, 0x41, 0x1d, + 0x34, 0x0a, 0x8e, 0x9a, 0xba, 0xc5, 0x9f, 0x9b, 0x79, 0x53, 0x0d, 0xd6, 0x13, 0x68, 0x1c, 0x53, + 0x1d, 0xcc, 0x53, 0x9a, 0x70, 0x6c, 0xfd, 0x01, 0xb0, 0xd4, 0xe7, 0xe4, 0x73, 0x1a, 0x7a, 0x02, + 0x7f, 0xcc, 0x2c, 0xf5, 0xd7, 0xb0, 0xe0, 0x8d, 0xc4, 0x80, 0xb2, 0x48, 0xcc, 0xa4, 0x72, 0xaf, + 0xfa, 0xef, 0xef, 0xcb, 0xb2, 0x7a, 0xd7, 0xdb, 0x30, 0x64, 0x98, 0x73, 0x57, 0xb0, 0x28, 0x21, + 0xce, 0x1e, 0xaa, 0xbf, 0x83, 0x79, 0x19, 0xba, 0x9a, 0xab, 0x83, 0x46, 0xb1, 0xfd, 0xcc, 0xbe, + 0xbd, 0x4c, 0x5b, 0xfa, 0xf5, 0xee, 0x2f, 0x2e, 0x9e, 0x6a, 0x8e, 0xe2, 0x76, 0x1f, 0x6d, 0xc3, + 0xef, 0x55, 0xad, 0x1a, 0xac, 0x1c, 0x04, 0xdc, 0x85, 0x6f, 0xff, 0xca, 0xc1, 0x7b, 0x7d, 0x4e, + 0xf4, 0x1f, 0x00, 0x96, 0x0e, 0xbb, 0x69, 0x9f, 0x32, 0x3f, 0x2e, 0xc5, 0xe8, 0x9e, 0xcf, 0xd9, + 0x65, 0xd1, 0xa7, 0xf0, 0xe1, 0x8d, 0x12, 0xd1, 0x1d, 0xb4, 0xae, 0x13, 0x8c, 0x37, 0x67, 0x12, + 0x76, 0xce, 0xc6, 0x83, 0xef, 0x9b, 0x79, 0x13, 0xf4, 0xdc, 0xc5, 0xca, 0x04, 0xcb, 0x95, 0x09, + 0x2e, 0x57, 0x26, 0xf8, 0xbd, 0x36, 0xb5, 0xe5, 0xda, 0xd4, 0xfe, 0xaf, 0x4d, 0xed, 0x4b, 0x87, + 0x44, 0x62, 0x30, 0xf2, 0xed, 0x80, 0xc6, 0x88, 0x07, 0x4c, 0x0c, 0x3d, 0x9f, 0x23, 0x37, 0x33, + 0xfb, 0x80, 0xc5, 0x84, 0xb2, 0x6f, 0x68, 0x7a, 0x74, 0x86, 0x62, 0x96, 0x62, 0xee, 0xe7, 0xb3, + 0xf3, 0x7b, 0x75, 0x15, 0x00, 0x00, 0xff, 0xff, 0x56, 0xa8, 0x28, 0x3b, 0x40, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -160,6 +261,7 @@ type MsgClient interface { // ToggleIbcSwitch defines a method for toggling the status of the // emergencybutton. ToggleIbcSwitch(ctx context.Context, in *MsgToggleIbcSwitch, opts ...grpc.CallOption) (*MsgToggleIbcSwitchResponse, error) + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -179,11 +281,21 @@ func (c *msgClient) ToggleIbcSwitch(ctx context.Context, in *MsgToggleIbcSwitch, 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, "/secret.emergencybutton.v1beta1.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 { // ToggleIbcSwitch defines a method for toggling the status of the // emergencybutton. ToggleIbcSwitch(context.Context, *MsgToggleIbcSwitch) (*MsgToggleIbcSwitchResponse, error) + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -193,6 +305,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) ToggleIbcSwitch(ctx context.Context, req *MsgToggleIbcSwitch) (*MsgToggleIbcSwitchResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ToggleIbcSwitch 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) @@ -216,6 +331,24 @@ func _Msg_ToggleIbcSwitch_Handler(srv interface{}, ctx context.Context, dec func 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: "/secret.emergencybutton.v1beta1.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: "secret.emergencybutton.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -224,6 +357,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ToggleIbcSwitch", Handler: _Msg_ToggleIbcSwitch_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "secret/emergencybutton/v1beta1/tx.proto", @@ -282,6 +419,69 @@ func (m *MsgToggleIbcSwitchResponse) MarshalToSizedBuffer(dAtA []byte) (int, err 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 @@ -315,6 +515,30 @@ func (m *MsgToggleIbcSwitchResponse) 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 } @@ -453,6 +677,171 @@ func (m *MsgToggleIbcSwitchResponse) 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