diff --git a/proto/exocore/oracle/tx.proto b/proto/exocore/oracle/tx.proto index 555fc41f2..4e828ba1d 100644 --- a/proto/exocore/oracle/tx.proto +++ b/proto/exocore/oracle/tx.proto @@ -3,14 +3,19 @@ syntax = "proto3"; package exocore.oracle; import "exocore/oracle/price.proto"; +import "exocore/oracle/params.proto"; +import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; - +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/oracle/types"; // Msg defines the Msg service. service Msg { //create price for a new oracle round rpc CreatePrice (MsgCreatePrice) returns (MsgCreatePriceResponse); + + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } message MsgCreatePrice { string creator = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; @@ -23,3 +28,17 @@ message MsgCreatePrice { } message MsgCreatePriceResponse {} + +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/x/oracle/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // params defines the x/staking parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +}; + +message MsgUpdateParamsResponse {}; diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 1c4148f81..f367e14de 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -19,6 +19,7 @@ type ( storeKey storetypes.StoreKey memKey storetypes.StoreKey paramstore paramtypes.Subspace + authority string common.KeeperStaking } ) diff --git a/x/oracle/keeper/msg_server_update_params.go b/x/oracle/keeper/msg_server_update_params.go new file mode 100644 index 000000000..b3aff3a37 --- /dev/null +++ b/x/oracle/keeper/msg_server_update_params.go @@ -0,0 +1,24 @@ +package keeper + +import ( + "context" + + "github.com/ExocoreNetwork/exocore/x/oracle/types" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +func (ms msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if ms.authority != msg.Authority { + return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", ms.authority, msg.Authority) + } + + // store params + if err := ms.SetParams(ctx, msg.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/oracle/types/message_create_price.go b/x/oracle/types/message_create_price.go index ffbc60992..268091f6b 100644 --- a/x/oracle/types/message_create_price.go +++ b/x/oracle/types/message_create_price.go @@ -9,9 +9,13 @@ const TypeMsgCreatePrice = "create_price" var _ sdk.Msg = &MsgCreatePrice{} -func NewMsgCreatePrice(creator string) *MsgCreatePrice { +func NewMsgCreatePrice(creator string, feederID int32, prices []*PriceWithSource, basedBlock uint64, nonce int32) *MsgCreatePrice { return &MsgCreatePrice{ - Creator: creator, + Creator: creator, + FeederId: feederID, + Prices: prices, + BasedBlock: basedBlock, + Nonce: nonce, } } diff --git a/x/oracle/types/message_update_params.go b/x/oracle/types/message_update_params.go new file mode 100644 index 000000000..9a0388b28 --- /dev/null +++ b/x/oracle/types/message_update_params.go @@ -0,0 +1,39 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgUpdateParams = "update_params" + +var _ sdk.Msg = &MsgUpdateParams{} + +func (msg *MsgUpdateParams) Route() string { + return RouterKey +} + +func (msg *MsgUpdateParams) Type() string { + return TypeMsgUpdateParams +} + +// GetSignBytes returns the raw bytes for a MsgUpdateParams message that +// the expected signer needs to sign. +func (msg *MsgUpdateParams) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic executes sanity validation on the provided data +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + return msg.Params.Validate() +} + +// GetSigners returns the expected signers for a MsgUpdateParams message +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index ffb03fcd3..ee56ac28a 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -7,6 +7,9 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -142,37 +145,142 @@ func (m *MsgCreatePriceResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreatePriceResponse proto.InternalMessageInfo +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/staking 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_02cf64aff79d2288, []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_02cf64aff79d2288, []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((*MsgCreatePrice)(nil), "exocore.oracle.MsgCreatePrice") proto.RegisterType((*MsgCreatePriceResponse)(nil), "exocore.oracle.MsgCreatePriceResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "exocore.oracle.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "exocore.oracle.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("exocore/oracle/tx.proto", fileDescriptor_02cf64aff79d2288) } var fileDescriptor_02cf64aff79d2288 = []byte{ - // 350 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x51, 0xcd, 0x4a, 0xeb, 0x40, - 0x18, 0xed, 0xdc, 0xfe, 0xdc, 0xdb, 0x29, 0x74, 0x11, 0x2e, 0x1a, 0x23, 0xa6, 0xb1, 0x0b, 0xc9, - 0xc6, 0x44, 0xea, 0xc2, 0x85, 0x2b, 0x2b, 0x2e, 0x14, 0x2a, 0x92, 0xa2, 0x82, 0x08, 0x25, 0x99, - 0x7c, 0xa6, 0xa1, 0x6d, 0xbe, 0x30, 0x33, 0xc5, 0xfa, 0x16, 0x3e, 0x8c, 0x0f, 0xe1, 0xb2, 0xb8, - 0x12, 0x57, 0xd2, 0xbe, 0x88, 0x24, 0xd3, 0x8a, 0xed, 0xc2, 0xe5, 0xf9, 0xce, 0x39, 0x33, 0xe7, - 0x70, 0xe8, 0x26, 0x4c, 0x90, 0x21, 0x07, 0x17, 0xb9, 0xcf, 0x86, 0xe0, 0xca, 0x89, 0x93, 0x72, - 0x94, 0xa8, 0xd5, 0x17, 0x84, 0xa3, 0x08, 0xc3, 0x58, 0x13, 0xa6, 0x3c, 0x66, 0xa0, 0xb4, 0xc6, - 0x16, 0x43, 0x31, 0x42, 0xd1, 0xcb, 0x91, 0xab, 0x80, 0xa2, 0x9a, 0x1f, 0x84, 0xd6, 0x3b, 0x22, - 0x3a, 0xe5, 0xe0, 0x4b, 0xb8, 0xca, 0x3c, 0xda, 0x31, 0xfd, 0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xf2, 0x81, 0xbb, 0xdc, 0x6f, 0xf2, 0x3d, 0xf5, 0x53, 0x0a, 0x22, 0xa8, 0xe4, 0x3b, 0x1d, - 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x4e, 0x5f, 0x3a, 0xf5, 0x09, 0x02, 0x00, 0x00, + // 515 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x4f, 0x8f, 0xd2, 0x40, + 0x1c, 0x65, 0x64, 0x41, 0x19, 0xcc, 0x1a, 0x27, 0x64, 0xe9, 0x76, 0x63, 0x41, 0x4c, 0x94, 0x90, + 0xd0, 0x2a, 0x26, 0x6b, 0xd4, 0x93, 0x18, 0x0f, 0x9a, 0x60, 0x4c, 0x37, 0xab, 0xc6, 0x0b, 0x29, + 0xed, 0x58, 0x1a, 0x68, 0xa7, 0x99, 0x19, 0x94, 0xbd, 0x7a, 0xf4, 0xe4, 0xc7, 0xf0, 0xc8, 0x61, + 0xe3, 0xc9, 0x0f, 0xb0, 0xc7, 0xcd, 0x9e, 0x8c, 0x07, 0x63, 0xe0, 0xc0, 0xd7, 0x30, 0x9d, 0x99, + 0xba, 0xb4, 0x1a, 0xbd, 0xc0, 0xfc, 0xde, 0x7b, 0xbf, 0x3f, 0xef, 0x37, 0x53, 0x58, 0xc7, 0x73, + 0xe2, 0x12, 0x8a, 0x2d, 0x42, 0x1d, 0x77, 0x8a, 0x2d, 0x3e, 0x37, 0x63, 0x4a, 0x38, 0x41, 0xdb, + 0x8a, 0x30, 0x25, 0xa1, 0xeb, 0x39, 0x61, 0x4c, 0x03, 0x17, 0x4b, 0xad, 0xbe, 0x97, 0xe7, 0x1c, + 0xea, 0x84, 0x4c, 0x91, 0x35, 0x9f, 0xf8, 0x44, 0x1c, 0xad, 0xe4, 0xa4, 0xd0, 0x5d, 0x97, 0xb0, + 0x90, 0xb0, 0xa1, 0x24, 0x64, 0xa0, 0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reference imports to suppress errors if they are not otherwise used. @@ -189,6 +297,7 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // create price for a new oracle round CreatePrice(ctx context.Context, in *MsgCreatePrice, opts ...grpc.CallOption) (*MsgCreatePriceResponse, error) + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -208,10 +317,20 @@ func (c *msgClient) CreatePrice(ctx context.Context, in *MsgCreatePrice, opts .. 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, "/exocore.oracle.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 { // create price for a new oracle round CreatePrice(context.Context, *MsgCreatePrice) (*MsgCreatePriceResponse, error) + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -221,6 +340,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) CreatePrice(ctx context.Context, req *MsgCreatePrice) (*MsgCreatePriceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreatePrice 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) @@ -244,6 +366,24 @@ func _Msg_CreatePrice_Handler(srv interface{}, ctx context.Context, dec func(int 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: "/exocore.oracle.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: "exocore.oracle.Msg", HandlerType: (*MsgServer)(nil), @@ -252,6 +392,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "CreatePrice", Handler: _Msg_CreatePrice_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "exocore/oracle/tx.proto", @@ -339,6 +483,69 @@ func (m *MsgCreatePriceResponse) 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 @@ -387,6 +594,30 @@ func (m *MsgCreatePriceResponse) 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 } @@ -616,6 +847,171 @@ func (m *MsgCreatePriceResponse) 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