From eb380f41204dd42e35e922df7f75cae6217b5380 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 6 Jul 2023 16:50:55 +0200 Subject: [PATCH 1/9] feat: emergency group ugov proto --- proto/umee/ugov/v1/genesis.proto | 4 + proto/umee/ugov/v1/query.proto | 18 +- proto/umee/ugov/v1/tx.proto | 20 +- x/ugov/genesis.pb.go | 82 +++++-- x/ugov/query.pb.go | 372 +++++++++++++++++++++++++++-- x/ugov/query.pb.gw.go | 65 +++++ x/ugov/tx.pb.go | 392 ++++++++++++++++++++++++++++++- 7 files changed, 901 insertions(+), 52 deletions(-) diff --git a/proto/umee/ugov/v1/genesis.proto b/proto/umee/ugov/v1/genesis.proto index 8e2e0aef3d..8f7684c1b6 100644 --- a/proto/umee/ugov/v1/genesis.proto +++ b/proto/umee/ugov/v1/genesis.proto @@ -3,6 +3,7 @@ package umee.ugov.v1; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/umee-network/umee/v5/x/ugov"; option (gogoproto.goproto_getters_all) = false; @@ -10,4 +11,7 @@ option (gogoproto.goproto_getters_all) = false; // GenesisState of the ugov module. message GenesisState { cosmos.base.v1beta1.DecCoin min_gas_price = 1 [(gogoproto.nullable) = false]; + + // Emergency Group address + string emergency_group = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } diff --git a/proto/umee/ugov/v1/query.proto b/proto/umee/ugov/v1/query.proto index e71fa52f3e..685593805c 100644 --- a/proto/umee/ugov/v1/query.proto +++ b/proto/umee/ugov/v1/query.proto @@ -1,9 +1,10 @@ syntax = "proto3"; package umee.ugov.v1; -import "google/api/annotations.proto"; -import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; option go_package = "github.com/umee-network/umee/v5/x/ugov"; @@ -15,6 +16,11 @@ service Query { rpc MinGasPrice(QueryMinGasPrice) returns (QueryMinGasPriceResponse) { option (google.api.http).get = "/umee/ugov/v1/min-gas-price"; } + + // EmergencyGroup returns emergency group address + rpc EmergencyGroup(QueryEmergencyGroup) returns (QueryEmergencyGroupResponse) { + option (google.api.http).get = "/umee/ugov/v1/emergency-group"; + } } // QueryMinGasPrice is a request type. @@ -24,3 +30,11 @@ message QueryMinGasPrice {} message QueryMinGasPriceResponse { cosmos.base.v1beta1.DecCoin min_gas_price = 1 [(gogoproto.nullable) = false]; } + +// QueryEmergencyGroup request type. +message QueryEmergencyGroup {} + +// QueryEmergencyGroupResponse response type. +message QueryEmergencyGroupResponse { + string emergency_group = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} diff --git a/proto/umee/ugov/v1/tx.proto b/proto/umee/ugov/v1/tx.proto index 311a9e370c..ec69902b76 100644 --- a/proto/umee/ugov/v1/tx.proto +++ b/proto/umee/ugov/v1/tx.proto @@ -14,9 +14,12 @@ option (gogoproto.goproto_getters_all) = false; service Msg { // GovUpdateMinGasPrice sets protocol controlled tx min fees. rpc GovUpdateMinGasPrice(MsgGovUpdateMinGasPrice) returns (MsgGovUpdateMinGasPriceResponse); + + // GovSetEmergencyGroup sets protocol controlled tx min fees. + rpc GovSetEmergencyGroup(MsgGovSetEmergencyGroup) returns (MsgGovSetEmergencyGroupResponse); } -// MsgGovUpdateMinGasPrice is a request type for the Msg/GovUpdateMinGasPrice. +// MsgGovUpdateMinGasPrice request type. message MsgGovUpdateMinGasPrice { option (gogoproto.goproto_stringer) = false; option (cosmos.msg.v1.signer) = "authority"; @@ -26,5 +29,18 @@ message MsgGovUpdateMinGasPrice { cosmos.base.v1beta1.DecCoin min_gas_price = 2 [(gogoproto.nullable) = false]; } -// MsgGovUpdateMinGasPriceResponse is a response type for the Msg/GovUpdateMinGasPrice. +// MsgGovUpdateMinGasPriceResponse response type. message MsgGovUpdateMinGasPriceResponse {}; + +// MsgGovSetEmergencyGroup request type. +message MsgGovSetEmergencyGroup { + option (gogoproto.goproto_stringer) = false; + option (cosmos.msg.v1.signer) = "authority"; + + // authority must be the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string emergency_group = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgGovSetEmergencyGroupResponse response type. +message MsgGovSetEmergencyGroupResponse {}; diff --git a/x/ugov/genesis.pb.go b/x/ugov/genesis.pb.go index 1a9390b4d7..fd19fa093e 100644 --- a/x/ugov/genesis.pb.go +++ b/x/ugov/genesis.pb.go @@ -5,6 +5,7 @@ package ugov import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -27,6 +28,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState of the ugov module. type GenesisState struct { MinGasPrice types.DecCoin `protobuf:"bytes,1,opt,name=min_gas_price,json=minGasPrice,proto3" json:"min_gas_price"` + // Emergency Group address + EmergencyGroup string `protobuf:"bytes,2,opt,name=emergency_group,json=emergencyGroup,proto3" json:"emergency_group,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -69,22 +72,26 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/genesis.proto", fileDescriptor_82f39cd8e8ede8c7) } var fileDescriptor_82f39cd8e8ede8c7 = []byte{ - // 240 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x2c, 0x8f, 0xb1, 0x4a, 0x04, 0x31, - 0x10, 0x86, 0x13, 0x10, 0x8b, 0xbd, 0xb3, 0x39, 0x2c, 0x64, 0x91, 0x28, 0x16, 0x62, 0x63, 0x86, - 0x55, 0x7c, 0x81, 0xf3, 0xf0, 0x5a, 0x51, 0xb0, 0xb0, 0x39, 0xb2, 0x61, 0x88, 0x41, 0x92, 0x39, - 0x36, 0xd9, 0xe8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6e, 0xba, 0x74, 0x96, 0x06, 0x01, 0x00, 0x00, + // 296 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x90, 0x41, 0x4a, 0x03, 0x31, + 0x14, 0x86, 0x27, 0x22, 0x82, 0xd3, 0xaa, 0x50, 0xba, 0xa8, 0x45, 0x62, 0x71, 0x21, 0xdd, 0x34, + 0x61, 0x14, 0x0f, 0xd0, 0x5a, 0xec, 0x56, 0xda, 0x9d, 0x9b, 0x32, 0x33, 0x7d, 0xc4, 0x20, 0xc9, + 0x2b, 0x49, 0x66, 0xd4, 0x5b, 0xb8, 0xf5, 0x1e, 0x1e, 0xa2, 0xcb, 0xe2, 0xca, 0x95, 0x68, 0xe7, + 0x22, 0x92, 0xc9, 0xe0, 0x2e, 0x8f, 0xef, 0xff, 0xf2, 0xf3, 0x5e, 0xdc, 0x2f, 0x14, 0x00, 0x2f, + 0x04, 0x96, 0xbc, 0x4c, 0xb8, 0x00, 0x0d, 0x56, 0x5a, 0xb6, 0x36, 0xe8, 0xb0, 0xd3, 0xf6, 0x8c, + 0x79, 0xc6, 0xca, 0xa4, 0xdf, 0x15, 0x28, 0xb0, 0x06, 0xdc, 0xbf, 0x42, 0xa6, 0x4f, 0x73, 0xb4, + 0x0a, 0x2d, 0xcf, 0x52, 0x0b, 0xbc, 0x4c, 0x32, 0x70, 0x69, 0xc2, 0x73, 0x94, 0xba, 0xe1, 0xa7, + 0x81, 0x2f, 0x83, 0x18, 0x86, 0x80, 0x2e, 0xde, 0x49, 0xdc, 0x9e, 0x85, 0xc2, 0x85, 0x4b, 0x1d, + 0x74, 0xee, 0xe2, 0x23, 0x25, 0xf5, 0x52, 0xa4, 0x3e, 0x2e, 0x73, 0xe8, 0x91, 0x01, 0x19, 0xb6, + 0xae, 0xce, 0x58, 0xa3, 0xf9, 0x0e, 0xd6, 0x74, 0xb0, 0x29, 0xe4, 0xb7, 0x28, 0xf5, 0x64, 0x7f, + 0xf3, 0x7d, 0x1e, 0xcd, 0x5b, 0x4a, 0xea, 0x59, 0x6a, 0xef, 0xbd, 0xd6, 0x19, 0xc7, 0x27, 0xa0, + 0xc0, 0x08, 0xd0, 0xf9, 0xeb, 0x52, 0x18, 0x2c, 0xd6, 0xbd, 0xbd, 0x01, 0x19, 0x1e, 0x4e, 0x7a, + 0x9f, 0x1f, 0xa3, 0x6e, 0xf3, 0xd9, 0x78, 0xb5, 0x32, 0x60, 0xed, 0xc2, 0x19, 0xa9, 0xc5, 0xfc, + 0xf8, 0x5f, 0x98, 0xf9, 0xfc, 0x64, 0xba, 0xf9, 0xa5, 0xd1, 0x66, 0x47, 0xc9, 0x76, 0x47, 0xc9, + 0xcf, 0x8e, 0x92, 0xb7, 0x8a, 0x46, 0xdb, 0x8a, 0x46, 0x5f, 0x15, 0x8d, 0x1e, 0x2e, 0x85, 0x74, + 0x8f, 0x45, 0xc6, 0x72, 0x54, 0xdc, 0xdf, 0x68, 0xa4, 0xc1, 0x3d, 0xa3, 0x79, 0xaa, 0x07, 0x5e, + 0xde, 0xf0, 0x97, 0xfa, 0xa2, 0xd9, 0x41, 0xbd, 0xe8, 0xf5, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xfc, 0x94, 0x81, 0x77, 0x65, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -107,6 +114,13 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.EmergencyGroup) > 0 { + i -= len(m.EmergencyGroup) + copy(dAtA[i:], m.EmergencyGroup) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.EmergencyGroup))) + i-- + dAtA[i] = 0x12 + } { size, err := m.MinGasPrice.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -139,6 +153,10 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.MinGasPrice.Size() n += 1 + l + sovGenesis(uint64(l)) + l = len(m.EmergencyGroup) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } return n } @@ -210,6 +228,38 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EmergencyGroup", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EmergencyGroup = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/ugov/query.pb.go b/x/ugov/query.pb.go index bf8e61e819..c1238cff22 100644 --- a/x/ugov/query.pb.go +++ b/x/ugov/query.pb.go @@ -6,6 +6,7 @@ package ugov import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" @@ -105,35 +106,119 @@ func (m *QueryMinGasPriceResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryMinGasPriceResponse proto.InternalMessageInfo +// QueryEmergencyGroup request type. +type QueryEmergencyGroup struct { +} + +func (m *QueryEmergencyGroup) Reset() { *m = QueryEmergencyGroup{} } +func (m *QueryEmergencyGroup) String() string { return proto.CompactTextString(m) } +func (*QueryEmergencyGroup) ProtoMessage() {} +func (*QueryEmergencyGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_25fa04679024a47d, []int{2} +} +func (m *QueryEmergencyGroup) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEmergencyGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEmergencyGroup.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 *QueryEmergencyGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEmergencyGroup.Merge(m, src) +} +func (m *QueryEmergencyGroup) XXX_Size() int { + return m.Size() +} +func (m *QueryEmergencyGroup) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEmergencyGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryEmergencyGroup proto.InternalMessageInfo + +// QueryEmergencyGroupResponse response type. +type QueryEmergencyGroupResponse struct { + EmergencyGroup string `protobuf:"bytes,1,opt,name=emergency_group,json=emergencyGroup,proto3" json:"emergency_group,omitempty"` +} + +func (m *QueryEmergencyGroupResponse) Reset() { *m = QueryEmergencyGroupResponse{} } +func (m *QueryEmergencyGroupResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEmergencyGroupResponse) ProtoMessage() {} +func (*QueryEmergencyGroupResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_25fa04679024a47d, []int{3} +} +func (m *QueryEmergencyGroupResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEmergencyGroupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEmergencyGroupResponse.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 *QueryEmergencyGroupResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEmergencyGroupResponse.Merge(m, src) +} +func (m *QueryEmergencyGroupResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryEmergencyGroupResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEmergencyGroupResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryEmergencyGroupResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryMinGasPrice)(nil), "umee.ugov.v1.QueryMinGasPrice") proto.RegisterType((*QueryMinGasPriceResponse)(nil), "umee.ugov.v1.QueryMinGasPriceResponse") + proto.RegisterType((*QueryEmergencyGroup)(nil), "umee.ugov.v1.QueryEmergencyGroup") + proto.RegisterType((*QueryEmergencyGroupResponse)(nil), "umee.ugov.v1.QueryEmergencyGroupResponse") } func init() { proto.RegisterFile("umee/ugov/v1/query.proto", fileDescriptor_25fa04679024a47d) } var fileDescriptor_25fa04679024a47d = []byte{ - // 320 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xcd, 0x4a, 0x03, 0x31, - 0x14, 0x85, 0x67, 0x44, 0x5d, 0x4c, 0x15, 0x24, 0xb8, 0x28, 0xb5, 0x46, 0xa9, 0x50, 0xdc, 0x34, - 0x61, 0x2a, 0xbe, 0x40, 0x2d, 0xba, 0x12, 0xb4, 0x4b, 0x37, 0x25, 0x33, 0x84, 0x18, 0x34, 0xb9, - 0xe3, 0x24, 0x33, 0xfe, 0x2c, 0xf5, 0x05, 0x04, 0x5f, 0xaa, 0xcb, 0x82, 0x1b, 0x57, 0xa2, 0xad, - 0x0f, 0x22, 0xc9, 0x54, 0xac, 0x5d, 0xb8, 0xbb, 0xdc, 0x2f, 0x9c, 0xef, 0xe4, 0x46, 0xf5, 0x42, - 0x71, 0x4e, 0x0b, 0x01, 0x25, 0x2d, 0x63, 0x7a, 0x53, 0xf0, 0xfc, 0x9e, 0x64, 0x39, 0x58, 0x40, - 0x6b, 0x8e, 0x10, 0x47, 0x48, 0x19, 0x37, 0x9a, 0x02, 0x40, 0x5c, 0x73, 0xca, 0x32, 0x49, 0x99, - 0xd6, 0x60, 0x99, 0x95, 0xa0, 0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, 0x48, 0xef, 0x7c, 0x6c, 0xb2, 0xea, - 0x4f, 0x79, 0xf0, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x90, 0xf5, 0xc5, 0x4e, 0xc8, 0x01, 0x00, 0x00, + // 430 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0x6e, 0xd4, 0x30, + 0x10, 0x86, 0x93, 0x0a, 0x90, 0xf0, 0x42, 0x41, 0xa6, 0x48, 0xcb, 0xb6, 0x75, 0x61, 0x11, 0x15, + 0x1c, 0x62, 0x2b, 0x45, 0x3c, 0x40, 0x97, 0x42, 0x4f, 0x48, 0xb0, 0xdc, 0xb8, 0x2c, 0x4e, 0x3a, + 0x32, 0x16, 0xc4, 0x13, 0xec, 0x24, 0x50, 0x8e, 0x48, 0x9c, 0xb8, 0x20, 0xf1, 0x2a, 0x3c, 0xc4, + 0x1e, 0x2b, 0xb8, 0x70, 0x42, 0xb0, 0xcb, 0x83, 0xa0, 0x38, 0xe9, 0x6a, 0x53, 0x55, 0xf4, 0x16, + 0xcf, 0x3f, 0xf9, 0xff, 0xcf, 0x33, 0x26, 0xfd, 0x32, 0x03, 0x10, 0xa5, 0xc2, 0x4a, 0x54, 0xb1, + 0x78, 0x5b, 0x82, 0x3d, 0xe4, 0xb9, 0xc5, 0x02, 0xe9, 0xa5, 0x5a, 0xe1, 0xb5, 0xc2, 0xab, 0x78, + 0xc0, 0x52, 0x74, 0x19, 0x3a, 0x91, 0x48, 0x07, 0xa2, 0x8a, 0x13, 0x28, 0x64, 0x2c, 0x52, 0xd4, + 0xa6, 0xe9, 0x1e, 0xdc, 0x68, 0xf4, 0x89, 0x3f, 0x89, 0xe6, 0xd0, 0x4a, 0x6b, 0x0a, 0x15, 0x36, + 0xf5, 0xfa, 0xab, 0xad, 0x6e, 0x28, 0x44, 0xf5, 0x06, 0x84, 0xcc, 0xb5, 0x90, 0xc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9, 0xad, 0x53, 0xfc, 0xbb, 0x2d, 0x83, 0x7b, 0x67, 0xb6, 0x2c, 0x28, 0xee, 0x78, 0x8a, + 0x2d, 0xba, 0xd9, 0xa5, 0x58, 0x0c, 0x23, 0xf2, 0xd3, 0x1b, 0xed, 0x4d, 0xff, 0xb0, 0x60, 0x3a, + 0x63, 0xe1, 0xd1, 0x8c, 0x85, 0xbf, 0x67, 0x2c, 0xfc, 0x32, 0x67, 0xc1, 0xd1, 0x9c, 0x05, 0x3f, + 0xe7, 0x2c, 0x78, 0xb1, 0xad, 0x74, 0xf1, 0xaa, 0x4c, 0x78, 0x8a, 0x99, 0xb7, 0x89, 0x0c, 0x14, + 0xef, 0xd0, 0xbe, 0x6e, 0x3c, 0xab, 0x07, 0xe2, 0xbd, 0x37, 0x4e, 0x2e, 0xf8, 0xb7, 0x74, 0xff, + 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x09, 0xc1, 0x74, 0x1a, 0xe4, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -150,6 +235,8 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // MinGasPrice returns minimum transaction fees. MinGasPrice(ctx context.Context, in *QueryMinGasPrice, opts ...grpc.CallOption) (*QueryMinGasPriceResponse, error) + // EmergencyGroup returns emergency group address + EmergencyGroup(ctx context.Context, in *QueryEmergencyGroup, opts ...grpc.CallOption) (*QueryEmergencyGroupResponse, error) } type queryClient struct { @@ -169,10 +256,21 @@ func (c *queryClient) MinGasPrice(ctx context.Context, in *QueryMinGasPrice, opt return out, nil } +func (c *queryClient) EmergencyGroup(ctx context.Context, in *QueryEmergencyGroup, opts ...grpc.CallOption) (*QueryEmergencyGroupResponse, error) { + out := new(QueryEmergencyGroupResponse) + err := c.cc.Invoke(ctx, "/umee.ugov.v1.Query/EmergencyGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // MinGasPrice returns minimum transaction fees. MinGasPrice(context.Context, *QueryMinGasPrice) (*QueryMinGasPriceResponse, error) + // EmergencyGroup returns emergency group address + EmergencyGroup(context.Context, *QueryEmergencyGroup) (*QueryEmergencyGroupResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -182,6 +280,9 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) MinGasPrice(ctx context.Context, req *QueryMinGasPrice) (*QueryMinGasPriceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MinGasPrice not implemented") } +func (*UnimplementedQueryServer) EmergencyGroup(ctx context.Context, req *QueryEmergencyGroup) (*QueryEmergencyGroupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EmergencyGroup not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -205,6 +306,24 @@ func _Query_MinGasPrice_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_EmergencyGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEmergencyGroup) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).EmergencyGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/umee.ugov.v1.Query/EmergencyGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EmergencyGroup(ctx, req.(*QueryEmergencyGroup)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "umee.ugov.v1.Query", HandlerType: (*QueryServer)(nil), @@ -213,6 +332,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "MinGasPrice", Handler: _Query_MinGasPrice_Handler, }, + { + MethodName: "EmergencyGroup", + Handler: _Query_EmergencyGroup_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "umee/ugov/v1/query.proto", @@ -274,6 +397,59 @@ func (m *QueryMinGasPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *QueryEmergencyGroup) 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 *QueryEmergencyGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEmergencyGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryEmergencyGroupResponse) 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 *QueryEmergencyGroupResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEmergencyGroupResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EmergencyGroup) > 0 { + i -= len(m.EmergencyGroup) + copy(dAtA[i:], m.EmergencyGroup) + i = encodeVarintQuery(dAtA, i, uint64(len(m.EmergencyGroup))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -305,6 +481,28 @@ func (m *QueryMinGasPriceResponse) Size() (n int) { return n } +func (m *QueryEmergencyGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryEmergencyGroupResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.EmergencyGroup) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -444,6 +642,138 @@ func (m *QueryMinGasPriceResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryEmergencyGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryEmergencyGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEmergencyGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEmergencyGroupResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryEmergencyGroupResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEmergencyGroupResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EmergencyGroup", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EmergencyGroup = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ugov/query.pb.gw.go b/x/ugov/query.pb.gw.go index f0582d2971..c541046c98 100644 --- a/x/ugov/query.pb.gw.go +++ b/x/ugov/query.pb.gw.go @@ -51,6 +51,24 @@ func local_request_Query_MinGasPrice_0(ctx context.Context, marshaler runtime.Ma } +func request_Query_EmergencyGroup_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEmergencyGroup + var metadata runtime.ServerMetadata + + msg, err := client.EmergencyGroup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EmergencyGroup_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEmergencyGroup + var metadata runtime.ServerMetadata + + msg, err := server.EmergencyGroup(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -80,6 +98,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_EmergencyGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_EmergencyGroup_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EmergencyGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -141,13 +182,37 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_EmergencyGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_EmergencyGroup_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EmergencyGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_Query_MinGasPrice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "min-gas-price"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_EmergencyGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "emergency-group"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_MinGasPrice_0 = runtime.ForwardResponseMessage + + forward_Query_EmergencyGroup_0 = runtime.ForwardResponseMessage ) diff --git a/x/ugov/tx.pb.go b/x/ugov/tx.pb.go index 6a76d018ed..f6e82d22e9 100644 --- a/x/ugov/tx.pb.go +++ b/x/ugov/tx.pb.go @@ -31,7 +31,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgGovUpdateMinGasPrice is a request type for the Msg/GovUpdateMinGasPrice. +// MsgGovUpdateMinGasPrice request type. type MsgGovUpdateMinGasPrice struct { // authority must be the address of the governance account. Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` @@ -70,7 +70,7 @@ func (m *MsgGovUpdateMinGasPrice) XXX_DiscardUnknown() { var xxx_messageInfo_MsgGovUpdateMinGasPrice proto.InternalMessageInfo -// MsgGovUpdateMinGasPriceResponse is a response type for the Msg/GovUpdateMinGasPrice. +// MsgGovUpdateMinGasPriceResponse response type. type MsgGovUpdateMinGasPriceResponse struct { } @@ -107,15 +107,93 @@ func (m *MsgGovUpdateMinGasPriceResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgGovUpdateMinGasPriceResponse proto.InternalMessageInfo +// MsgGovSetEmergencyGroup request type. +type MsgGovSetEmergencyGroup struct { + // authority must be the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + EmergencyGroup string `protobuf:"bytes,2,opt,name=emergency_group,json=emergencyGroup,proto3" json:"emergency_group,omitempty"` +} + +func (m *MsgGovSetEmergencyGroup) Reset() { *m = MsgGovSetEmergencyGroup{} } +func (*MsgGovSetEmergencyGroup) ProtoMessage() {} +func (*MsgGovSetEmergencyGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_9ffc07de1c6ee91b, []int{2} +} +func (m *MsgGovSetEmergencyGroup) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgGovSetEmergencyGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgGovSetEmergencyGroup.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 *MsgGovSetEmergencyGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgGovSetEmergencyGroup.Merge(m, src) +} +func (m *MsgGovSetEmergencyGroup) XXX_Size() int { + return m.Size() +} +func (m *MsgGovSetEmergencyGroup) XXX_DiscardUnknown() { + xxx_messageInfo_MsgGovSetEmergencyGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgGovSetEmergencyGroup proto.InternalMessageInfo + +// MsgGovSetEmergencyGroupResponse response type. +type MsgGovSetEmergencyGroupResponse struct { +} + +func (m *MsgGovSetEmergencyGroupResponse) Reset() { *m = MsgGovSetEmergencyGroupResponse{} } +func (m *MsgGovSetEmergencyGroupResponse) String() string { return proto.CompactTextString(m) } +func (*MsgGovSetEmergencyGroupResponse) ProtoMessage() {} +func (*MsgGovSetEmergencyGroupResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9ffc07de1c6ee91b, []int{3} +} +func (m *MsgGovSetEmergencyGroupResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgGovSetEmergencyGroupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgGovSetEmergencyGroupResponse.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 *MsgGovSetEmergencyGroupResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgGovSetEmergencyGroupResponse.Merge(m, src) +} +func (m *MsgGovSetEmergencyGroupResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgGovSetEmergencyGroupResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgGovSetEmergencyGroupResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgGovSetEmergencyGroupResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgGovUpdateMinGasPrice)(nil), "umee.ugov.v1.MsgGovUpdateMinGasPrice") proto.RegisterType((*MsgGovUpdateMinGasPriceResponse)(nil), "umee.ugov.v1.MsgGovUpdateMinGasPriceResponse") + proto.RegisterType((*MsgGovSetEmergencyGroup)(nil), "umee.ugov.v1.MsgGovSetEmergencyGroup") + proto.RegisterType((*MsgGovSetEmergencyGroupResponse)(nil), "umee.ugov.v1.MsgGovSetEmergencyGroupResponse") } func init() { proto.RegisterFile("umee/ugov/v1/tx.proto", fileDescriptor_9ffc07de1c6ee91b) } var fileDescriptor_9ffc07de1c6ee91b = []byte{ - // 367 bytes of a gzipped FileDescriptorProto + // 432 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2d, 0xcd, 0x4d, 0x4d, 0xd5, 0x2f, 0x4d, 0xcf, 0x2f, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x09, 0xeb, 0x81, 0x84, 0xf5, 0xca, 0x0c, 0xa5, 0xe4, 0x92, 0xf3, 0x8b, @@ -131,14 +209,18 @@ var fileDescriptor_9ffc07de1c6ee91b = []byte{ 0x2a, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xa3, 0x07, 0xd5, 0x08, 0xf2, 0x95, 0x1e, 0xd4, 0x57, 0x7a, 0x2e, 0xa9, 0xc9, 0xce, 0xf9, 0x99, 0x79, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x71, 0xe7, 0x22, 0xec, 0xb7, 0x12, 0x9a, 0xb1, 0x40, 0x9e, 0xa1, 0xe9, 0xf9, 0x06, 0x2d, 0x84, - 0xd9, 0x4a, 0x8a, 0x5c, 0xf2, 0x38, 0x9c, 0x1b, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x6a, - 0x54, 0xcc, 0xc5, 0xec, 0x5b, 0x9c, 0x2e, 0x94, 0xc3, 0x25, 0x82, 0xd5, 0x57, 0xaa, 0x7a, 0xc8, - 0x41, 0xad, 0x87, 0xc3, 0x34, 0x29, 0x5d, 0xa2, 0x94, 0xc1, 0x2c, 0x75, 0x72, 0x39, 0xf1, 0x50, - 0x8e, 0xe1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, - 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xd4, 0xd2, 0x33, 0x4b, - 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0xc6, 0xea, 0xe6, 0xa5, 0x96, 0x94, 0xe7, - 0x17, 0x65, 0x83, 0x39, 0xfa, 0x65, 0xa6, 0xfa, 0x15, 0xe0, 0x14, 0x91, 0xc4, 0x06, 0x8e, 0x14, - 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x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, 0xb1, 0x81, + 0x53, 0xb4, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x88, 0x0b, 0x9c, 0x9f, 0x62, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -155,6 +237,8 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // GovUpdateMinGasPrice sets protocol controlled tx min fees. GovUpdateMinGasPrice(ctx context.Context, in *MsgGovUpdateMinGasPrice, opts ...grpc.CallOption) (*MsgGovUpdateMinGasPriceResponse, error) + // GovSetEmergencyGroup sets protocol controlled tx min fees. + GovSetEmergencyGroup(ctx context.Context, in *MsgGovSetEmergencyGroup, opts ...grpc.CallOption) (*MsgGovSetEmergencyGroupResponse, error) } type msgClient struct { @@ -174,10 +258,21 @@ func (c *msgClient) GovUpdateMinGasPrice(ctx context.Context, in *MsgGovUpdateMi return out, nil } +func (c *msgClient) GovSetEmergencyGroup(ctx context.Context, in *MsgGovSetEmergencyGroup, opts ...grpc.CallOption) (*MsgGovSetEmergencyGroupResponse, error) { + out := new(MsgGovSetEmergencyGroupResponse) + err := c.cc.Invoke(ctx, "/umee.ugov.v1.Msg/GovSetEmergencyGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // GovUpdateMinGasPrice sets protocol controlled tx min fees. GovUpdateMinGasPrice(context.Context, *MsgGovUpdateMinGasPrice) (*MsgGovUpdateMinGasPriceResponse, error) + // GovSetEmergencyGroup sets protocol controlled tx min fees. + GovSetEmergencyGroup(context.Context, *MsgGovSetEmergencyGroup) (*MsgGovSetEmergencyGroupResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -187,6 +282,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) GovUpdateMinGasPrice(ctx context.Context, req *MsgGovUpdateMinGasPrice) (*MsgGovUpdateMinGasPriceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GovUpdateMinGasPrice not implemented") } +func (*UnimplementedMsgServer) GovSetEmergencyGroup(ctx context.Context, req *MsgGovSetEmergencyGroup) (*MsgGovSetEmergencyGroupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GovSetEmergencyGroup not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -210,6 +308,24 @@ func _Msg_GovUpdateMinGasPrice_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Msg_GovSetEmergencyGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgGovSetEmergencyGroup) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).GovSetEmergencyGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/umee.ugov.v1.Msg/GovSetEmergencyGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).GovSetEmergencyGroup(ctx, req.(*MsgGovSetEmergencyGroup)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "umee.ugov.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -218,6 +334,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "GovUpdateMinGasPrice", Handler: _Msg_GovUpdateMinGasPrice_Handler, }, + { + MethodName: "GovSetEmergencyGroup", + Handler: _Msg_GovSetEmergencyGroup_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "umee/ugov/v1/tx.proto", @@ -286,6 +406,66 @@ func (m *MsgGovUpdateMinGasPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } +func (m *MsgGovSetEmergencyGroup) 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 *MsgGovSetEmergencyGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgGovSetEmergencyGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EmergencyGroup) > 0 { + i -= len(m.EmergencyGroup) + copy(dAtA[i:], m.EmergencyGroup) + i = encodeVarintTx(dAtA, i, uint64(len(m.EmergencyGroup))) + 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 *MsgGovSetEmergencyGroupResponse) 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 *MsgGovSetEmergencyGroupResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgGovSetEmergencyGroupResponse) 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 @@ -321,6 +501,32 @@ func (m *MsgGovUpdateMinGasPriceResponse) Size() (n int) { return n } +func (m *MsgGovSetEmergencyGroup) 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 = len(m.EmergencyGroup) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgGovSetEmergencyGroupResponse) 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 } @@ -492,6 +698,170 @@ func (m *MsgGovUpdateMinGasPriceResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgGovSetEmergencyGroup) 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: MsgGovSetEmergencyGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgGovSetEmergencyGroup: 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 EmergencyGroup", 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.EmergencyGroup = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgGovSetEmergencyGroupResponse) 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: MsgGovSetEmergencyGroupResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgGovSetEmergencyGroupResponse: 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 From abd1a3ed4221ae2586ea4c2f1b6719d4eeb06570 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 6 Jul 2023 23:26:14 +0200 Subject: [PATCH 2/9] proto: add stringer --- proto/umee/ugov/v1/tx.proto | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/proto/umee/ugov/v1/tx.proto b/proto/umee/ugov/v1/tx.proto index ec69902b76..665193a5d7 100644 --- a/proto/umee/ugov/v1/tx.proto +++ b/proto/umee/ugov/v1/tx.proto @@ -34,8 +34,7 @@ message MsgGovUpdateMinGasPriceResponse {}; // MsgGovSetEmergencyGroup request type. message MsgGovSetEmergencyGroup { - option (gogoproto.goproto_stringer) = false; - option (cosmos.msg.v1.signer) = "authority"; + option (cosmos.msg.v1.signer) = "authority"; // authority must be the address of the governance account. string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; From 09ba740b063ae0d74e4ad26e9b0a0bc9fd270d3b Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 6 Jul 2023 23:26:33 +0200 Subject: [PATCH 3/9] tests: add MkAccount helper method --- tests/accs/accounts.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/accs/accounts.go b/tests/accs/accounts.go index c73c4d7444..abf3229abc 100644 --- a/tests/accs/accounts.go +++ b/tests/accs/accounts.go @@ -4,6 +4,7 @@ package accs import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/tendermint/tendermint/crypto" ) // Test user accounts @@ -21,3 +22,8 @@ var ( var ( FooModule = authtypes.NewModuleAddress("foomodule") ) + +// MkAddress creats an address from the give seed string +func MkAddress(seed string) sdk.AccAddress { + return sdk.AccAddress(crypto.AddressHash([]byte(seed))) +} From e3c449f5ddba7bd7f1148ef8eab335156a821ef0 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 6 Jul 2023 23:38:51 +0200 Subject: [PATCH 4/9] implement Msg interface --- x/ugov/codec.go | 2 ++ x/ugov/msg.go | 40 ++++++++++++++++++++++++------ x/ugov/msg_test.go | 30 ++++++++++++++++++++++ x/ugov/tx.pb.go | 62 ++++++++++++++++++++++++---------------------- 4 files changed, 96 insertions(+), 38 deletions(-) diff --git a/x/ugov/codec.go b/x/ugov/codec.go index 2a093f6558..c578c4d2c5 100644 --- a/x/ugov/codec.go +++ b/x/ugov/codec.go @@ -30,12 +30,14 @@ func init() { // Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgGovUpdateMinGasPrice{}, proto.MessageName(&MsgGovUpdateMinGasPrice{}), nil) + cdc.RegisterConcrete(&MsgGovSetEmergencyGroup{}, "umee/ugov/MsgGovSetEmergencyGroup", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations( (*sdk.Msg)(nil), &MsgGovUpdateMinGasPrice{}, + &MsgGovSetEmergencyGroup{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/ugov/msg.go b/x/ugov/msg.go index da15a474e1..db0d53cf80 100644 --- a/x/ugov/msg.go +++ b/x/ugov/msg.go @@ -10,10 +10,12 @@ import ( ) var ( - _ sdk.Msg = &MsgGovUpdateMinGasPrice{} + _, _ sdk.Msg = &MsgGovUpdateMinGasPrice{}, + &MsgGovSetEmergencyGroup{} // amino - _ legacytx.LegacyMsg = &MsgGovUpdateMinGasPrice{} + _, _ legacytx.LegacyMsg = &MsgGovUpdateMinGasPrice{}, + &MsgGovSetEmergencyGroup{} ) // ValidateBasic implements Msg @@ -21,7 +23,6 @@ func (msg *MsgGovUpdateMinGasPrice) ValidateBasic() error { if err := checkers.IsGovAuthority(msg.Authority); err != nil { return err } - return msg.MinGasPrice.Validate() } @@ -35,13 +36,36 @@ func (msg *MsgGovUpdateMinGasPrice) String() string { return fmt.Sprintf("", msg.Authority, msg.MinGasPrice.String()) } -// Route implements LegacyMsg.Route -func (msg MsgGovUpdateMinGasPrice) Route() string { return "" } +// LegacyMsg.Type implementations -// GetSignBytes implements the LegacyMsg.GetSignBytes +func (msg MsgGovUpdateMinGasPrice) Route() string { return "" } func (msg MsgGovUpdateMinGasPrice) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) } - -// GetSignBytes implements the LegacyMsg.Type func (msg MsgGovUpdateMinGasPrice) Type() string { return sdk.MsgTypeURL(&msg) } + +// +// MsgGovSetEmergencyGroup +// + +// Msg interface implementation + +func (msg *MsgGovSetEmergencyGroup) ValidateBasic() error { + if err := checkers.IsGovAuthority(msg.Authority); err != nil { + return err + } + _, err := sdk.AccAddressFromBech32(msg.EmergencyGroup) + return err +} + +// GetSignBytes implements Msg +func (msg *MsgGovSetEmergencyGroup) GetSigners() []sdk.AccAddress { + return checkers.Signers(msg.Authority) +} + +// LegacyMsg.Type implementations +func (msg MsgGovSetEmergencyGroup) Route() string { return "" } +func (msg MsgGovSetEmergencyGroup) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} +func (msg MsgGovSetEmergencyGroup) Type() string { return sdk.MsgTypeURL(&msg) } diff --git a/x/ugov/msg_test.go b/x/ugov/msg_test.go index 0809aadb06..43144c8948 100644 --- a/x/ugov/msg_test.go +++ b/x/ugov/msg_test.go @@ -1,6 +1,7 @@ package ugov import ( + fmt "fmt" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -48,3 +49,32 @@ func TestMsgGovUpdateMinGasPrice(t *testing.T) { msg.Authority = accs.Alice.String() require.ErrorIs(msg.ValidateBasic(), govtypes.ErrInvalidSigner, "must fail on a non gov account") } + +func validMsgGovSetEmergencyGroup() MsgGovSetEmergencyGroup { + return MsgGovSetEmergencyGroup{ + Authority: authtypes.NewModuleAddress("gov").String(), + EmergencyGroup: accs.Alice.String(), + } +} + +func TestMsgGovSetEmergencyGroup(t *testing.T) { + t.Parallel() + require := require.New(t) + + msg := validMsgGovSetEmergencyGroup() + require.Equal(fmt.Sprintf("authority:%q emergency_group:%q ", msg.Authority, msg.EmergencyGroup), + msg.String()) + require.Contains("MsgGovSetEmergencyGroup", msg.Route()) + require.NoError(msg.ValidateBasic()) + + signers := msg.GetSigners() + require.Len(signers, 1) + require.Equal(msg.Authority, signers[0].String()) + + msg.Authority = accs.Bob.String() + require.ErrorIs(msg.ValidateBasic(), govtypes.ErrInvalidSigner, "must fail on a non gov account") + + msg = validMsgGovSetEmergencyGroup() + msg.EmergencyGroup = "umee1yesmdu06f7strl67kjvg2w7t5kacc" + require.ErrorContains(msg.ValidateBasic(), "bech32 failed", "must fail with bad emergency_group address") +} diff --git a/x/ugov/tx.pb.go b/x/ugov/tx.pb.go index f6e82d22e9..192e2b37cb 100644 --- a/x/ugov/tx.pb.go +++ b/x/ugov/tx.pb.go @@ -114,8 +114,9 @@ type MsgGovSetEmergencyGroup struct { EmergencyGroup string `protobuf:"bytes,2,opt,name=emergency_group,json=emergencyGroup,proto3" json:"emergency_group,omitempty"` } -func (m *MsgGovSetEmergencyGroup) Reset() { *m = MsgGovSetEmergencyGroup{} } -func (*MsgGovSetEmergencyGroup) ProtoMessage() {} +func (m *MsgGovSetEmergencyGroup) Reset() { *m = MsgGovSetEmergencyGroup{} } +func (m *MsgGovSetEmergencyGroup) String() string { return proto.CompactTextString(m) } +func (*MsgGovSetEmergencyGroup) ProtoMessage() {} func (*MsgGovSetEmergencyGroup) Descriptor() ([]byte, []int) { return fileDescriptor_9ffc07de1c6ee91b, []int{2} } @@ -193,34 +194,35 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/tx.proto", fileDescriptor_9ffc07de1c6ee91b) } var fileDescriptor_9ffc07de1c6ee91b = []byte{ - // 432 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2d, 0xcd, 0x4d, 0x4d, - 0xd5, 0x2f, 0x4d, 0xcf, 0x2f, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0xe2, 0x01, 0x09, 0xeb, 0x81, 0x84, 0xf5, 0xca, 0x0c, 0xa5, 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7e, 0x99, 0xa9, 0x7e, 0x05, 0x38, 0x3b, 0x25, 0xb1, 0x81, - 0x53, 0xb4, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x88, 0x0b, 0x9c, 0x9f, 0x62, 0x03, 0x00, 0x00, + // 434 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x4f, 0x8b, 0x13, 0x31, + 0x18, 0xc6, 0x27, 0x2a, 0xc2, 0x66, 0x75, 0x85, 0xa1, 0xb2, 0xb5, 0x48, 0xba, 0x16, 0x94, 0x45, + 0x68, 0x42, 0x57, 0xf4, 0xb0, 0xb7, 0xad, 0xab, 0x3d, 0x15, 0xa4, 0x8b, 0x17, 0x2f, 0x65, 0x66, + 0xfa, 0x92, 0x0d, 0x9a, 0x64, 0x48, 0x32, 0xe3, 0xee, 0xd5, 0x4f, 0xe0, 0xd1, 0xa3, 0x07, 0xaf, + 0x82, 0x07, 0x3f, 0x44, 0x8f, 0x8b, 0x27, 0x4f, 0x62, 0xdb, 0x83, 0x5f, 0x43, 0x32, 0x33, 0xb5, + 0x4a, 0x3b, 0x22, 0xde, 0xe6, 0xfd, 0x93, 0xe7, 0x79, 0x7f, 0x99, 0x37, 0xf8, 0x66, 0x26, 0x01, + 0x58, 0xc6, 0x75, 0xce, 0xf2, 0x1e, 0x73, 0x67, 0x34, 0x35, 0xda, 0xe9, 0xf0, 0x9a, 0x4f, 0x53, + 0x9f, 0xa6, 0x79, 0xaf, 0x45, 0x12, 0x6d, 0xa5, 0xb6, 0x2c, 0x8e, 0x2c, 0xb0, 0xbc, 0x17, 0x83, + 0x8b, 0x7a, 0x2c, 0xd1, 0x42, 0x95, 0xdd, 0xad, 0xdd, 0xaa, 0x2e, 0x2d, 0xf7, 0x2a, 0xd2, 0xf2, + 0xaa, 0x70, 0xab, 0x2c, 0x8c, 0x8b, 0x88, 0x95, 0x41, 0x55, 0x6a, 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x1b, + 0x1b, 0x7f, 0xd0, 0x5d, 0xfa, 0xfb, 0xd6, 0xd0, 0x9a, 0x8b, 0x69, 0x75, 0xff, 0xa9, 0x6d, 0xe9, + 0x5a, 0xb9, 0xad, 0xdf, 0xdd, 0x46, 0xb7, 0xb5, 0xb6, 0xcd, 0x6e, 0xb5, 0x8c, 0xfd, 0xe3, 0xe9, + 0x8c, 0x04, 0xd3, 0x39, 0x41, 0x17, 0x73, 0x82, 0xbe, 0xcf, 0x09, 0x7a, 0xbb, 0x20, 0xc1, 0xc5, + 0x82, 0x04, 0x5f, 0x17, 0x24, 0x78, 0x71, 0x8f, 0x0b, 0x77, 0x9a, 0xc5, 0x34, 0xd1, 0x92, 0x79, + 0xd9, 0xae, 0x02, 0xf7, 0x5a, 0x9b, 0x97, 0x45, 0xc0, 0xf2, 0x87, 0xec, 0xac, 0x78, 0x4a, 0xf1, + 0xd5, 0x62, 0x9b, 0x1f, 0xfc, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x5e, 0xa9, 0xbb, 0x4f, 0x5e, 0x03, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From 93cf12fdf1b7d4b2413b9a8dbd411391232e8dbb Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 6 Jul 2023 23:41:40 +0200 Subject: [PATCH 5/9] dummy rpc implementation --- x/ugov/keeper/msg_server.go | 5 +++++ x/ugov/keeper/query_server.go | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/x/ugov/keeper/msg_server.go b/x/ugov/keeper/msg_server.go index c83fb8ba7c..997d963642 100644 --- a/x/ugov/keeper/msg_server.go +++ b/x/ugov/keeper/msg_server.go @@ -35,3 +35,8 @@ func (m msgServer) GovUpdateMinGasPrice(ctx context.Context, msg *ugov.MsgGovUpd return &ugov.MsgGovUpdateMinGasPriceResponse{}, nil } + +func (m msgServer) GovSetEmergencyGroup(ctx context.Context, msg *ugov.MsgGovSetEmergencyGroup, +) (*ugov.MsgGovSetEmergencyGroupResponse, error) { + panic("not implemented") +} diff --git a/x/ugov/keeper/query_server.go b/x/ugov/keeper/query_server.go index 6a18bc7027..42f533ff96 100644 --- a/x/ugov/keeper/query_server.go +++ b/x/ugov/keeper/query_server.go @@ -24,3 +24,7 @@ func (q Querier) MinGasPrice(ctx context.Context, _ *ugov.QueryMinGasPrice) (*ug return &ugov.QueryMinGasPriceResponse{MinGasPrice: q.Keeper(&sdkCtx).MinGasPrice()}, nil } + +func (q Querier) EmergencyGroup(ctx context.Context, _ *ugov.QueryEmergencyGroup) (*ugov.QueryEmergencyGroupResponse, error) { + panic("not implemented") +} From 03fa400de6e436cbc59cda1f87430c4a9b5fea5c Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 6 Jul 2023 23:45:45 +0200 Subject: [PATCH 6/9] lint --- x/ugov/keeper/msg_server.go | 2 +- x/ugov/keeper/query_server.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x/ugov/keeper/msg_server.go b/x/ugov/keeper/msg_server.go index 997d963642..76d05b83b4 100644 --- a/x/ugov/keeper/msg_server.go +++ b/x/ugov/keeper/msg_server.go @@ -36,7 +36,7 @@ func (m msgServer) GovUpdateMinGasPrice(ctx context.Context, msg *ugov.MsgGovUpd return &ugov.MsgGovUpdateMinGasPriceResponse{}, nil } -func (m msgServer) GovSetEmergencyGroup(ctx context.Context, msg *ugov.MsgGovSetEmergencyGroup, +func (m msgServer) GovSetEmergencyGroup(_ context.Context, _ *ugov.MsgGovSetEmergencyGroup, ) (*ugov.MsgGovSetEmergencyGroupResponse, error) { panic("not implemented") } diff --git a/x/ugov/keeper/query_server.go b/x/ugov/keeper/query_server.go index 42f533ff96..1b5ac7f7c7 100644 --- a/x/ugov/keeper/query_server.go +++ b/x/ugov/keeper/query_server.go @@ -25,6 +25,6 @@ func (q Querier) MinGasPrice(ctx context.Context, _ *ugov.QueryMinGasPrice) (*ug nil } -func (q Querier) EmergencyGroup(ctx context.Context, _ *ugov.QueryEmergencyGroup) (*ugov.QueryEmergencyGroupResponse, error) { +func (q Querier) EmergencyGroup(_ context.Context, _ *ugov.QueryEmergencyGroup) (*ugov.QueryEmergencyGroupResponse, error) { panic("not implemented") } From 5f20905285f9216e7b9d21380915689f373aaf81 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 7 Jul 2023 00:24:10 +0200 Subject: [PATCH 7/9] lint --- x/ugov/keeper/query_server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/ugov/keeper/query_server.go b/x/ugov/keeper/query_server.go index 1b5ac7f7c7..6166203d3b 100644 --- a/x/ugov/keeper/query_server.go +++ b/x/ugov/keeper/query_server.go @@ -25,6 +25,7 @@ func (q Querier) MinGasPrice(ctx context.Context, _ *ugov.QueryMinGasPrice) (*ug nil } -func (q Querier) EmergencyGroup(_ context.Context, _ *ugov.QueryEmergencyGroup) (*ugov.QueryEmergencyGroupResponse, error) { +func (q Querier) EmergencyGroup(_ context.Context, _ *ugov.QueryEmergencyGroup, +) (*ugov.QueryEmergencyGroupResponse, error) { panic("not implemented") } From 76d1859f971add5cdf1b9e39a68127aa74593728 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Mon, 10 Jul 2023 11:40:30 +0200 Subject: [PATCH 8/9] Apply suggestions from code review Co-authored-by: Adam Moser <63419657+toteki@users.noreply.github.com> --- proto/umee/ugov/v1/tx.proto | 2 +- tests/accs/accounts.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/umee/ugov/v1/tx.proto b/proto/umee/ugov/v1/tx.proto index 665193a5d7..993f985522 100644 --- a/proto/umee/ugov/v1/tx.proto +++ b/proto/umee/ugov/v1/tx.proto @@ -15,7 +15,7 @@ service Msg { // GovUpdateMinGasPrice sets protocol controlled tx min fees. rpc GovUpdateMinGasPrice(MsgGovUpdateMinGasPrice) returns (MsgGovUpdateMinGasPriceResponse); - // GovSetEmergencyGroup sets protocol controlled tx min fees. + // GovSetEmergencyGroup sets emergency group address. rpc GovSetEmergencyGroup(MsgGovSetEmergencyGroup) returns (MsgGovSetEmergencyGroupResponse); } diff --git a/tests/accs/accounts.go b/tests/accs/accounts.go index abf3229abc..7fa0104f72 100644 --- a/tests/accs/accounts.go +++ b/tests/accs/accounts.go @@ -23,7 +23,7 @@ var ( FooModule = authtypes.NewModuleAddress("foomodule") ) -// MkAddress creats an address from the give seed string +// MkAddress creats an address from the given seed string func MkAddress(seed string) sdk.AccAddress { return sdk.AccAddress(crypto.AddressHash([]byte(seed))) } From 1f8c7e4f60005593ac883f00e83f686c8b5b04ec Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Mon, 10 Jul 2023 11:42:50 +0200 Subject: [PATCH 9/9] review --- tests/accs/accounts.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/accs/accounts.go b/tests/accs/accounts.go index 7fa0104f72..d662d7136c 100644 --- a/tests/accs/accounts.go +++ b/tests/accs/accounts.go @@ -23,7 +23,7 @@ var ( FooModule = authtypes.NewModuleAddress("foomodule") ) -// MkAddress creats an address from the given seed string -func MkAddress(seed string) sdk.AccAddress { +// GenerateAddr creates an address from the given name, without access to public / secret key. +func GenerateAddr(seed string) sdk.AccAddress { return sdk.AccAddress(crypto.AddressHash([]byte(seed))) }