From 9b70f9ab5c7f7333c16a3ab30ebd49bbcc98945b Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 20 Oct 2022 23:32:40 +1100 Subject: [PATCH 01/46] feat: define protobuf file for params --- proto/payment/params.proto | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 proto/payment/params.proto diff --git a/proto/payment/params.proto b/proto/payment/params.proto new file mode 100644 index 0000000000..faad8f870b --- /dev/null +++ b/proto/payment/params.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package payment; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/celestiaorg/celestia-app/x/payment/types"; + +// Params defines the parameters for the module. +message Params { + option (gogoproto.goproto_stringer) = false; + + int32 minSquareSize = 1 [(gogoproto.moretags) = "yaml:\"min_square_size\""]; + int32 maxSqaureSize = 2 [(gogoproto.moretags) = "yaml:\"max_sqaure_size\""]; +} \ No newline at end of file From 89afc7a54dd09b2b024cde92d049d267bd1914eb Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 20 Oct 2022 23:33:05 +1100 Subject: [PATCH 02/46] feat: define protobuf file for querying params --- proto/payment/query.proto | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/proto/payment/query.proto b/proto/payment/query.proto index ebdae3cc26..643fd050a4 100644 --- a/proto/payment/query.proto +++ b/proto/payment/query.proto @@ -1,12 +1,24 @@ syntax = "proto3"; package payment; +import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "payment/params.proto"; option go_package = "github.com/celestiaorg/celestia-app/x/payment/types"; // Query defines the gRPC querier service. service Query { + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/payment/params"; + } } +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} From fe4d7b0f23c8bf696fa06e57123fb051d29f77a2 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 20 Oct 2022 23:33:35 +1100 Subject: [PATCH 03/46] feat: define protobuf file for genesis value for params --- proto/payment/genesis.proto | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/proto/payment/genesis.proto b/proto/payment/genesis.proto index 76c8bab730..aa0f34d34f 100644 --- a/proto/payment/genesis.proto +++ b/proto/payment/genesis.proto @@ -1,7 +1,12 @@ syntax = "proto3"; package payment; +import "gogoproto/gogo.proto"; +import "payment/params.proto"; + option go_package = "github.com/celestiaorg/celestia-app/x/payment/types"; // GenesisState defines the capability module's genesis state. -message GenesisState {} +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; +} From 82edaade184bf0a44348468ca24941132a20c955 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 20 Oct 2022 23:43:07 +1100 Subject: [PATCH 04/46] feat: type defs for params and relevant protobuf generated files --- x/payment/types/genesis.pb.go | 73 ++++- x/payment/types/params.go | 99 +++++++ x/payment/types/params.pb.go | 339 +++++++++++++++++++++++ x/payment/types/query.pb.go | 480 +++++++++++++++++++++++++++++++-- x/payment/types/query.pb.gw.go | 153 +++++++++++ 5 files changed, 1120 insertions(+), 24 deletions(-) create mode 100644 x/payment/types/params.go create mode 100644 x/payment/types/params.pb.go create mode 100644 x/payment/types/query.pb.gw.go diff --git a/x/payment/types/genesis.pb.go b/x/payment/types/genesis.pb.go index 3b25078113..a9ca50153d 100644 --- a/x/payment/types/genesis.pb.go +++ b/x/payment/types/genesis.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -24,6 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the capability module's genesis state. type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -59,6 +61,13 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + func init() { proto.RegisterType((*GenesisState)(nil), "payment.GenesisState") } @@ -66,16 +75,19 @@ func init() { func init() { proto.RegisterFile("payment/genesis.proto", fileDescriptor_ded92bd505296f58) } var fileDescriptor_ded92bd505296f58 = []byte{ - // 135 bytes of a gzipped FileDescriptorProto + // 189 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2d, 0x48, 0xac, 0xcc, 0x4d, 0xcd, 0x2b, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0x62, 0x87, 0x0a, 0x2b, 0xf1, 0x71, 0xf1, 0xb8, 0x43, 0x64, 0x82, 0x4b, 0x12, 0x4b, - 0x52, 0x9d, 0x7c, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, - 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x38, 0x3d, - 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0x39, 0x35, 0x27, 0xb5, 0xb8, 0x24, - 0x33, 0x31, 0xbf, 0x28, 0x1d, 0xce, 0xd6, 0x4d, 0x2c, 0x28, 0xd0, 0xaf, 0xd0, 0x87, 0xd9, 0x57, - 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xb6, 0xce, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x12, - 0x51, 0x3e, 0xf3, 0x87, 0x00, 0x00, 0x00, + 0xc9, 0x17, 0x62, 0x87, 0x0a, 0x4b, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xc5, 0xf4, 0x41, 0x2c, + 0x88, 0xb4, 0x94, 0x08, 0x4c, 0x57, 0x41, 0x62, 0x51, 0x62, 0x2e, 0x54, 0x93, 0x92, 0x2d, 0x17, + 0x8f, 0x3b, 0xc4, 0x94, 0xe0, 0x92, 0xc4, 0x92, 0x54, 0x21, 0x5d, 0x2e, 0x36, 0x88, 0xbc, 0x04, + 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x11, 0xbf, 0x1e, 0x54, 0x9b, 0x5e, 0x00, 0x58, 0xd8, 0x89, 0xe5, + 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xa8, 0x22, 0x27, 0xdf, 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, 0x32, 0x4e, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, + 0x4e, 0xcd, 0x49, 0x2d, 0x2e, 0xc9, 0x4c, 0xcc, 0x2f, 0x4a, 0x87, 0xb3, 0x75, 0x13, 0x0b, 0x0a, + 0xf4, 0x2b, 0xf4, 0x61, 0x8e, 0x2a, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x3b, 0xca, 0x18, + 0x10, 0x00, 0x00, 0xff, 0xff, 0x68, 0xc3, 0x75, 0x3c, 0xe2, 0x00, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -98,6 +110,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -118,6 +140,8 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -156,6 +180,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + 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 ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + 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 := skipGenesis(dAtA[iNdEx:]) diff --git a/x/payment/types/params.go b/x/payment/types/params.go new file mode 100644 index 0000000000..960ef1efee --- /dev/null +++ b/x/payment/types/params.go @@ -0,0 +1,99 @@ +package types + +import ( + "fmt" + + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "gopkg.in/yaml.v2" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +var ( + KeyMinSquareSize = []byte("MinSquareSize") + // TODO: Determine the default value + DefaultMinSquareSize int32 = 0 +) + +var ( + KeyMaxSqaureSize = []byte("MaxSqaureSize") + // TODO: Determine the default value + DefaultMaxSqaureSize int32 = 0 +) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams( + minSquareSize int32, + maxSqaureSize int32, +) Params { + return Params{ + MinSquareSize: minSquareSize, + MaxSqaureSize: maxSqaureSize, + } +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams( + DefaultMinSquareSize, + DefaultMaxSqaureSize, + ) +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyMinSquareSize, &p.MinSquareSize, validateMinSquareSize), + paramtypes.NewParamSetPair(KeyMaxSqaureSize, &p.MaxSqaureSize, validateMaxSqaureSize), + } +} + +// Validate validates the set of params +func (p Params) Validate() error { + if err := validateMinSquareSize(p.MinSquareSize); err != nil { + return err + } + + if err := validateMaxSqaureSize(p.MaxSqaureSize); err != nil { + return err + } + + return nil +} + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} + +// validateMinSquareSize validates the MinSquareSize param +func validateMinSquareSize(v interface{}) error { + minSquareSize, ok := v.(int32) + if !ok { + return fmt.Errorf("invalid parameter type: %T", v) + } + + // TODO implement validation + _ = minSquareSize + + return nil +} + +// validateMaxSqaureSize validates the MaxSqaureSize param +func validateMaxSqaureSize(v interface{}) error { + maxSqaureSize, ok := v.(int32) + if !ok { + return fmt.Errorf("invalid parameter type: %T", v) + } + + // TODO implement validation + _ = maxSqaureSize + + return nil +} diff --git a/x/payment/types/params.pb.go b/x/payment/types/params.pb.go new file mode 100644 index 0000000000..e7a42bf2b7 --- /dev/null +++ b/x/payment/types/params.pb.go @@ -0,0 +1,339 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: payment/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the module. +type Params struct { + MinSquareSize int32 `protobuf:"varint,1,opt,name=minSquareSize,proto3" json:"minSquareSize,omitempty" yaml:"min_square_size"` + MaxSqaureSize int32 `protobuf:"varint,2,opt,name=maxSqaureSize,proto3" json:"maxSqaureSize,omitempty" yaml:"max_sqaure_size"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_12d54b052075926a, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetMinSquareSize() int32 { + if m != nil { + return m.MinSquareSize + } + return 0 +} + +func (m *Params) GetMaxSqaureSize() int32 { + if m != nil { + return m.MaxSqaureSize + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "payment.Params") +} + +func init() { proto.RegisterFile("payment/params.proto", fileDescriptor_12d54b052075926a) } + +var fileDescriptor_12d54b052075926a = []byte{ + // 225 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x48, 0xac, 0xcc, + 0x4d, 0xcd, 0x2b, 0xd1, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0x62, 0x87, 0x8a, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xc5, 0xf4, 0x41, 0x2c, 0x88, + 0xb4, 0xd2, 0x24, 0x46, 0x2e, 0xb6, 0x00, 0xb0, 0x7a, 0x21, 0x07, 0x2e, 0xde, 0xdc, 0xcc, 0xbc, + 0xe0, 0xc2, 0xd2, 0xc4, 0xa2, 0xd4, 0xe0, 0xcc, 0xaa, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x56, + 0x27, 0xa9, 0x4f, 0xf7, 0xe4, 0xc5, 0x2a, 0x13, 0x73, 0x73, 0xac, 0x94, 0x72, 0x33, 0xf3, 0xe2, + 0x8b, 0xc1, 0xf2, 0xf1, 0xc5, 0x99, 0x55, 0xa9, 0x4a, 0x41, 0xa8, 0x1a, 0xc0, 0x26, 0x24, 0x56, + 0x04, 0x17, 0x26, 0x96, 0x42, 0x4d, 0x60, 0xc2, 0x30, 0x21, 0xb1, 0x22, 0xbe, 0x18, 0x2c, 0x0f, + 0x37, 0x01, 0x59, 0x83, 0x15, 0xcb, 0x8c, 0x05, 0xf2, 0x0c, 0x4e, 0xbe, 0x27, 0x1e, 0xc9, 0x31, + 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, + 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x9c, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, + 0x9f, 0xab, 0x9f, 0x9c, 0x9a, 0x93, 0x5a, 0x5c, 0x92, 0x99, 0x98, 0x5f, 0x94, 0x0e, 0x67, 0xeb, + 0x26, 0x16, 0x14, 0xe8, 0x57, 0xe8, 0xc3, 0x42, 0xa2, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, + 0xec, 0x55, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x4e, 0x10, 0x17, 0x21, 0x01, 0x00, + 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MaxSqaureSize != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxSqaureSize)) + i-- + dAtA[i] = 0x10 + } + if m.MinSquareSize != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinSquareSize)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MinSquareSize != 0 { + n += 1 + sovParams(uint64(m.MinSquareSize)) + } + if m.MaxSqaureSize != 0 { + n += 1 + sovParams(uint64(m.MaxSqaureSize)) + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSquareSize", wireType) + } + m.MinSquareSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinSquareSize |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSqaureSize", wireType) + } + m.MaxSqaureSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSqaureSize |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/payment/types/query.pb.go b/x/payment/types/query.pb.go index 04022eb22e..d4e3531f2a 100644 --- a/x/payment/types/query.pb.go +++ b/x/payment/types/query.pb.go @@ -7,11 +7,16 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -25,22 +30,116 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0d907c42280cbd58, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0d907c42280cbd58, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "payment.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "payment.QueryParamsResponse") +} + func init() { proto.RegisterFile("payment/query.proto", fileDescriptor_0d907c42280cbd58) } var fileDescriptor_0d907c42280cbd58 = []byte{ - // 187 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0xce, 0xb1, 0x8e, 0x82, 0x40, - 0x10, 0x06, 0x60, 0x28, 0xee, 0x48, 0x28, 0xef, 0x3a, 0x72, 0xd9, 0x07, 0xb8, 0x44, 0x26, 0xc8, - 0x1b, 0xd8, 0x5b, 0xd8, 0xda, 0xcd, 0x92, 0xc9, 0xba, 0x09, 0xec, 0xac, 0xec, 0x60, 0xe4, 0x2d, - 0x7c, 0x2c, 0x4b, 0x4a, 0x4b, 0x03, 0x2f, 0x62, 0x04, 0xb5, 0x9b, 0x4c, 0xbe, 0xff, 0xcf, 0x9f, - 0xfe, 0x7a, 0xec, 0x1b, 0x72, 0x02, 0xc7, 0x8e, 0xda, 0x3e, 0xf7, 0x2d, 0x0b, 0xff, 0x24, 0xaf, - 0x67, 0xf6, 0x67, 0x98, 0x4d, 0x4d, 0x80, 0xde, 0x02, 0x3a, 0xc7, 0x82, 0x62, 0xd9, 0x85, 0x85, - 0x65, 0xff, 0x15, 0x87, 0x86, 0x03, 0x68, 0x0c, 0xb4, 0xe4, 0xe1, 0x54, 0x68, 0x12, 0x2c, 0xc0, - 0xa3, 0xb1, 0x6e, 0xc6, 0x8b, 0x5d, 0x27, 0xe9, 0xd7, 0xee, 0x29, 0x36, 0xdb, 0xeb, 0xa8, 0xe2, - 0x61, 0x54, 0xf1, 0x7d, 0x54, 0xf1, 0x65, 0x52, 0xd1, 0x30, 0xa9, 0xe8, 0x36, 0xa9, 0x68, 0x5f, - 0x1a, 0x2b, 0x87, 0x4e, 0xe7, 0x15, 0x37, 0x50, 0x51, 0x4d, 0x41, 0x2c, 0x72, 0x6b, 0x3e, 0xf7, - 0x0a, 0xbd, 0x87, 0x33, 0xbc, 0x07, 0x4b, 0xef, 0x29, 0xe8, 0xef, 0xb9, 0xbe, 0x7c, 0x04, 0x00, - 0x00, 0xff, 0xff, 0x99, 0xff, 0xee, 0xed, 0xc8, 0x00, 0x00, 0x00, + // 291 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x4f, 0x4b, 0xc3, 0x30, + 0x18, 0xc6, 0x5b, 0xd1, 0x09, 0xf1, 0x30, 0xcc, 0x06, 0xca, 0x1c, 0x51, 0x76, 0x12, 0x61, 0x0d, + 0xdb, 0xbe, 0xc1, 0xf0, 0x2a, 0xe8, 0x8e, 0xe2, 0x25, 0x2d, 0x2f, 0xb1, 0xb0, 0xe6, 0xcd, 0x9a, + 0x54, 0xec, 0xd5, 0x4f, 0x20, 0xf8, 0xa5, 0x76, 0x1c, 0x78, 0xf1, 0x24, 0xd2, 0xfa, 0x41, 0x64, + 0x4d, 0x2c, 0x0c, 0xbd, 0xbd, 0x3c, 0x7f, 0x7e, 0x0f, 0x09, 0xe9, 0x69, 0x51, 0x66, 0xa0, 0x2c, + 0x5f, 0x15, 0x90, 0x97, 0x91, 0xce, 0xd1, 0x22, 0x3d, 0xf4, 0xe2, 0xa0, 0x2f, 0x51, 0x62, 0xa3, + 0xf1, 0xed, 0xe5, 0xec, 0xc1, 0x50, 0x22, 0xca, 0x25, 0x70, 0xa1, 0x53, 0x2e, 0x94, 0x42, 0x2b, + 0x6c, 0x8a, 0xca, 0x78, 0xf7, 0x2a, 0x41, 0x93, 0xa1, 0xe1, 0xb1, 0x30, 0xe0, 0xa8, 0xfc, 0x69, + 0x12, 0x83, 0x15, 0x13, 0xae, 0x85, 0x4c, 0x55, 0x13, 0xf6, 0xd9, 0xfe, 0xef, 0xba, 0x16, 0xb9, + 0xc8, 0x3c, 0x61, 0xd4, 0x27, 0xf4, 0x6e, 0xdb, 0xbb, 0x6d, 0xc4, 0x05, 0xac, 0x0a, 0x30, 0x76, + 0x74, 0x4d, 0x7a, 0x3b, 0xaa, 0xd1, 0xa8, 0x0c, 0xd0, 0x31, 0xe9, 0xb8, 0xf2, 0x69, 0x78, 0x11, + 0x5e, 0x1e, 0x4d, 0xbb, 0x91, 0x67, 0x46, 0x2e, 0x38, 0xdf, 0x5f, 0x7f, 0x9e, 0x07, 0x0b, 0x1f, + 0x9a, 0x02, 0x39, 0x68, 0x28, 0xf4, 0x81, 0x74, 0x5c, 0x80, 0x9e, 0xb5, 0x8d, 0xbf, 0xab, 0x83, + 0xe1, 0xff, 0xa6, 0x1b, 0x1f, 0x9d, 0xbc, 0xbc, 0x7f, 0xbf, 0xed, 0x1d, 0xd3, 0x2e, 0xdf, 0x7d, + 0xc8, 0xfc, 0x66, 0x5d, 0xb1, 0x70, 0x53, 0xb1, 0xf0, 0xab, 0x62, 0xe1, 0x6b, 0xcd, 0x82, 0x4d, + 0xcd, 0x82, 0x8f, 0x9a, 0x05, 0xf7, 0x33, 0x99, 0xda, 0xc7, 0x22, 0x8e, 0x12, 0xcc, 0x78, 0x02, + 0x4b, 0x30, 0x36, 0x15, 0x98, 0xcb, 0xf6, 0x1e, 0x0b, 0xad, 0xf9, 0x73, 0xcb, 0xb3, 0xa5, 0x06, + 0x13, 0x77, 0x9a, 0x8f, 0x99, 0xfd, 0x04, 0x00, 0x00, 0xff, 0xff, 0x13, 0xfe, 0x9d, 0xcc, 0xae, + 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -55,6 +154,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) } type queryClient struct { @@ -65,22 +165,370 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/payment.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/payment.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "payment.Query", HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "payment/query.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "payment/query.proto", +} + +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) 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 = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *QueryParamsRequest) 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: 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 *QueryParamsResponse) 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + 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 := 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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/payment/types/query.pb.gw.go b/x/payment/types/query.pb.gw.go new file mode 100644 index 0000000000..c8bf5a63fb --- /dev/null +++ b/x/payment/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: payment/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(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. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_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_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_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_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"payment", "params"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) From 6858ad206d79b6992878c99f71935918aa8b774b Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 20 Oct 2022 23:44:55 +1100 Subject: [PATCH 05/46] feat: add cli command to query params --- x/payment/client/cli/query.go | 2 ++ x/payment/client/cli/query_params.go | 34 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 x/payment/client/cli/query_params.go diff --git a/x/payment/client/cli/query.go b/x/payment/client/cli/query.go index 93113b2d6e..81f036a105 100644 --- a/x/payment/client/cli/query.go +++ b/x/payment/client/cli/query.go @@ -19,5 +19,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command { RunE: client.ValidateCmd, } + cmd.AddCommand(CmdQueryParams()) + return cmd } diff --git a/x/payment/client/cli/query_params.go b/x/payment/client/cli/query_params.go new file mode 100644 index 0000000000..b6aeabfa11 --- /dev/null +++ b/x/payment/client/cli/query_params.go @@ -0,0 +1,34 @@ +package cli + +import ( + "context" + + "github.com/celestiaorg/celestia-app/x/payment/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} From 34eba8ca62a4f3924643f580aef59b401c3aa59a Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 20 Oct 2022 23:45:50 +1100 Subject: [PATCH 06/46] feat: getter and setter methods to get/set params from keeper --- x/payment/keeper/params.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 x/payment/keeper/params.go diff --git a/x/payment/keeper/params.go b/x/payment/keeper/params.go new file mode 100644 index 0000000000..5b5dac7260 --- /dev/null +++ b/x/payment/keeper/params.go @@ -0,0 +1,31 @@ +package keeper + +import ( + "github.com/celestiaorg/celestia-app/x/payment/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + return types.NewParams( + k.MinSquareSize(ctx), + k.MaxSqaureSize(ctx), + ) +} + +// SetParams set the params +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramstore.SetParamSet(ctx, ¶ms) +} + +// MinSquareSize returns the MinSquareSize param +func (k Keeper) MinSquareSize(ctx sdk.Context) (res int32) { + k.paramstore.Get(ctx, types.KeyMinSquareSize, &res) + return +} + +// MaxSqaureSize returns the MaxSqaureSize param +func (k Keeper) MaxSqaureSize(ctx sdk.Context) (res int32) { + k.paramstore.Get(ctx, types.KeyMaxSqaureSize, &res) + return +} From 2a2b7028f0a027254bd9b300c06e29023f5e8219 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 20 Oct 2022 23:52:27 +1100 Subject: [PATCH 07/46] feat: define param stores in keeper --- x/payment/keeper/keeper.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/x/payment/keeper/keeper.go b/x/payment/keeper/keeper.go index 4967f59d9c..9c89620582 100644 --- a/x/payment/keeper/keeper.go +++ b/x/payment/keeper/keeper.go @@ -8,19 +8,31 @@ import ( "github.com/celestiaorg/celestia-app/x/payment/types" "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) const payForDataGasDescriptor = "pay for data" // Keeper handles all the state changes for the payment module. type Keeper struct { - cdc codec.BinaryCodec + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + paramstore paramtypes.Subspace } -func NewKeeper(cdc codec.BinaryCodec) *Keeper { +func NewKeeper( + cdc codec.BinaryCodec, + storeKey, + memKey storetypes.StoreKey, + ps paramtypes.Subspace, + +) *Keeper { return &Keeper{ - cdc: cdc, + cdc: cdc, + paramstore: ps, } } From 47d6859155c9560444aad2b7b7c1099e87791f4e Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 20 Oct 2022 23:53:00 +1100 Subject: [PATCH 08/46] chore: pass releavnt stores when initializing payment keeper --- app/app.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/app.go b/app/app.go index b1ea0e8e0f..5bea30e7f4 100644 --- a/app/app.go +++ b/app/app.go @@ -367,6 +367,9 @@ func New( app.PaymentKeeper = *paymentmodulekeeper.NewKeeper( appCodec, + keys[paymentmoduletypes.StoreKey], + keys[paymentmoduletypes.MemStoreKey], + app.GetSubspace(paymentmoduletypes.ModuleName), ) paymentmod := paymentmodule.NewAppModule(appCodec, app.PaymentKeeper) From 32bc44cc540361f65c52fae5e9546c7d5df12b7d Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 00:20:26 +1100 Subject: [PATCH 09/46] feat: implement callback to query params --- x/payment/keeper/grpc_query_params.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 x/payment/keeper/grpc_query_params.go diff --git a/x/payment/keeper/grpc_query_params.go b/x/payment/keeper/grpc_query_params.go new file mode 100644 index 0000000000..51930666a8 --- /dev/null +++ b/x/payment/keeper/grpc_query_params.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + "github.com/celestiaorg/celestia-app/x/payment/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} From 9dda2eacae6ec4795763ffcf2f934a7439e0c14b Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 00:46:37 +1100 Subject: [PATCH 10/46] chore: typo --- proto/payment/params.proto | 2 +- x/payment/keeper/params.go | 8 ++++---- x/payment/types/params.go | 22 +++++++++++----------- x/payment/types/params.pb.go | 20 ++++++++++---------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/proto/payment/params.proto b/proto/payment/params.proto index faad8f870b..51ffe2db11 100644 --- a/proto/payment/params.proto +++ b/proto/payment/params.proto @@ -10,5 +10,5 @@ message Params { option (gogoproto.goproto_stringer) = false; int32 minSquareSize = 1 [(gogoproto.moretags) = "yaml:\"min_square_size\""]; - int32 maxSqaureSize = 2 [(gogoproto.moretags) = "yaml:\"max_sqaure_size\""]; + int32 maxSquareSize = 2 [(gogoproto.moretags) = "yaml:\"max_square_size\""]; } \ No newline at end of file diff --git a/x/payment/keeper/params.go b/x/payment/keeper/params.go index 5b5dac7260..579a7fe6f8 100644 --- a/x/payment/keeper/params.go +++ b/x/payment/keeper/params.go @@ -9,7 +9,7 @@ import ( func (k Keeper) GetParams(ctx sdk.Context) types.Params { return types.NewParams( k.MinSquareSize(ctx), - k.MaxSqaureSize(ctx), + k.MaxSquareSize(ctx), ) } @@ -24,8 +24,8 @@ func (k Keeper) MinSquareSize(ctx sdk.Context) (res int32) { return } -// MaxSqaureSize returns the MaxSqaureSize param -func (k Keeper) MaxSqaureSize(ctx sdk.Context) (res int32) { - k.paramstore.Get(ctx, types.KeyMaxSqaureSize, &res) +// MaxSquareSize returns the MaxSquareSize param +func (k Keeper) MaxSquareSize(ctx sdk.Context) (res int32) { + k.paramstore.Get(ctx, types.KeyMaxSquareSize, &res) return } diff --git a/x/payment/types/params.go b/x/payment/types/params.go index 960ef1efee..ba8256dcd3 100644 --- a/x/payment/types/params.go +++ b/x/payment/types/params.go @@ -16,9 +16,9 @@ var ( ) var ( - KeyMaxSqaureSize = []byte("MaxSqaureSize") + KeyMaxSquareSize = []byte("MaxSquareSize") // TODO: Determine the default value - DefaultMaxSqaureSize int32 = 0 + DefaultMaxSquareSize int32 = 0 ) // ParamKeyTable the param key table for launch module @@ -29,11 +29,11 @@ func ParamKeyTable() paramtypes.KeyTable { // NewParams creates a new Params instance func NewParams( minSquareSize int32, - maxSqaureSize int32, + maxSquareSize int32, ) Params { return Params{ MinSquareSize: minSquareSize, - MaxSqaureSize: maxSqaureSize, + MaxSquareSize: maxSquareSize, } } @@ -41,7 +41,7 @@ func NewParams( func DefaultParams() Params { return NewParams( DefaultMinSquareSize, - DefaultMaxSqaureSize, + DefaultMaxSquareSize, ) } @@ -49,7 +49,7 @@ func DefaultParams() Params { func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(KeyMinSquareSize, &p.MinSquareSize, validateMinSquareSize), - paramtypes.NewParamSetPair(KeyMaxSqaureSize, &p.MaxSqaureSize, validateMaxSqaureSize), + paramtypes.NewParamSetPair(KeyMaxSquareSize, &p.MaxSquareSize, validateMaxSquareSize), } } @@ -59,7 +59,7 @@ func (p Params) Validate() error { return err } - if err := validateMaxSqaureSize(p.MaxSqaureSize); err != nil { + if err := validateMaxSquareSize(p.MaxSquareSize); err != nil { return err } @@ -85,15 +85,15 @@ func validateMinSquareSize(v interface{}) error { return nil } -// validateMaxSqaureSize validates the MaxSqaureSize param -func validateMaxSqaureSize(v interface{}) error { - maxSqaureSize, ok := v.(int32) +// validateMaxSquareSize validates the MaxSquareSize param +func validateMaxSquareSize(v interface{}) error { + maxSquareSize, ok := v.(int32) if !ok { return fmt.Errorf("invalid parameter type: %T", v) } // TODO implement validation - _ = maxSqaureSize + _ = maxSquareSize return nil } diff --git a/x/payment/types/params.pb.go b/x/payment/types/params.pb.go index e7a42bf2b7..1ee5abae68 100644 --- a/x/payment/types/params.pb.go +++ b/x/payment/types/params.pb.go @@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { MinSquareSize int32 `protobuf:"varint,1,opt,name=minSquareSize,proto3" json:"minSquareSize,omitempty" yaml:"min_square_size"` - MaxSqaureSize int32 `protobuf:"varint,2,opt,name=maxSqaureSize,proto3" json:"maxSqaureSize,omitempty" yaml:"max_sqaure_size"` + MaxSquareSize int32 `protobuf:"varint,2,opt,name=maxSquareSize,proto3" json:"maxSquareSize,omitempty" yaml:"max_square_size"` } func (m *Params) Reset() { *m = Params{} } @@ -68,9 +68,9 @@ func (m *Params) GetMinSquareSize() int32 { return 0 } -func (m *Params) GetMaxSqaureSize() int32 { +func (m *Params) GetMaxSquareSize() int32 { if m != nil { - return m.MaxSqaureSize + return m.MaxSquareSize } return 0 } @@ -120,8 +120,8 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.MaxSqaureSize != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.MaxSqaureSize)) + if m.MaxSquareSize != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxSquareSize)) i-- dAtA[i] = 0x10 } @@ -153,8 +153,8 @@ func (m *Params) Size() (n int) { if m.MinSquareSize != 0 { n += 1 + sovParams(uint64(m.MinSquareSize)) } - if m.MaxSqaureSize != 0 { - n += 1 + sovParams(uint64(m.MaxSqaureSize)) + if m.MaxSquareSize != 0 { + n += 1 + sovParams(uint64(m.MaxSquareSize)) } return n } @@ -215,9 +215,9 @@ func (m *Params) Unmarshal(dAtA []byte) error { } case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxSqaureSize", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MaxSquareSize", wireType) } - m.MaxSqaureSize = 0 + m.MaxSquareSize = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -227,7 +227,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxSqaureSize |= int32(b&0x7F) << shift + m.MaxSquareSize |= int32(b&0x7F) << shift if b < 0x80 { break } From aa34b4dec1153cb6ec809a3f4a94d52a52457415 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 00:48:38 +1100 Subject: [PATCH 11/46] chore: grammar --- proto/payment/query.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/payment/query.proto b/proto/payment/query.proto index 643fd050a4..283385d5f2 100644 --- a/proto/payment/query.proto +++ b/proto/payment/query.proto @@ -15,10 +15,10 @@ service Query { } } -// QueryParamsRequest is request type for the Query/Params RPC method. +// QueryParamsRequest is the request type for the Query/Params RPC method. message QueryParamsRequest {} -// QueryParamsResponse is response type for the Query/Params RPC method. +// QueryParamsResponse is the response type for the Query/Params RPC method. message QueryParamsResponse { Params params = 1 [(gogoproto.nullable) = false]; } From 55b890836dc1121a323f9137ca9b7a095bdb35f0 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 00:49:31 +1100 Subject: [PATCH 12/46] chore: line ending --- proto/payment/params.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/payment/params.proto b/proto/payment/params.proto index 51ffe2db11..b29e1a3411 100644 --- a/proto/payment/params.proto +++ b/proto/payment/params.proto @@ -11,4 +11,4 @@ message Params { int32 minSquareSize = 1 [(gogoproto.moretags) = "yaml:\"min_square_size\""]; int32 maxSquareSize = 2 [(gogoproto.moretags) = "yaml:\"max_square_size\""]; -} \ No newline at end of file +} From b65e1f3f2f495a6906025dc97b75bbe262f46379 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 00:55:22 +1100 Subject: [PATCH 13/46] fix: assign storeKey and memKey --- x/payment/keeper/keeper.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/payment/keeper/keeper.go b/x/payment/keeper/keeper.go index 9c89620582..b9c85ac244 100644 --- a/x/payment/keeper/keeper.go +++ b/x/payment/keeper/keeper.go @@ -32,6 +32,8 @@ func NewKeeper( ) *Keeper { return &Keeper{ cdc: cdc, + storeKey: storeKey, + memKey: memKey, paramstore: ps, } } From bfda77eff987c3d5bad9b75f7c67471a2e6815db Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 00:58:18 +1100 Subject: [PATCH 14/46] fix: follow standard while naming proto var --- proto/payment/params.proto | 4 ++-- x/payment/types/params.pb.go | 29 ++++++++++++++--------------- x/payment/types/query.pb.go | 4 ++-- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/proto/payment/params.proto b/proto/payment/params.proto index b29e1a3411..4e8bcebd9c 100644 --- a/proto/payment/params.proto +++ b/proto/payment/params.proto @@ -9,6 +9,6 @@ option go_package = "github.com/celestiaorg/celestia-app/x/payment/types"; message Params { option (gogoproto.goproto_stringer) = false; - int32 minSquareSize = 1 [(gogoproto.moretags) = "yaml:\"min_square_size\""]; - int32 maxSquareSize = 2 [(gogoproto.moretags) = "yaml:\"max_square_size\""]; + int32 min_square_size = 1 [(gogoproto.moretags) = "yaml:\"min_square_size\""]; + int32 max_square_size = 2 [(gogoproto.moretags) = "yaml:\"max_square_size\""]; } diff --git a/x/payment/types/params.pb.go b/x/payment/types/params.pb.go index 1ee5abae68..1f0bb389f3 100644 --- a/x/payment/types/params.pb.go +++ b/x/payment/types/params.pb.go @@ -25,8 +25,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - MinSquareSize int32 `protobuf:"varint,1,opt,name=minSquareSize,proto3" json:"minSquareSize,omitempty" yaml:"min_square_size"` - MaxSquareSize int32 `protobuf:"varint,2,opt,name=maxSquareSize,proto3" json:"maxSquareSize,omitempty" yaml:"max_square_size"` + MinSquareSize int32 `protobuf:"varint,1,opt,name=min_square_size,json=minSquareSize,proto3" json:"min_square_size,omitempty" yaml:"min_square_size"` + MaxSquareSize int32 `protobuf:"varint,2,opt,name=max_square_size,json=maxSquareSize,proto3" json:"max_square_size,omitempty" yaml:"max_square_size"` } func (m *Params) Reset() { *m = Params{} } @@ -82,22 +82,21 @@ func init() { func init() { proto.RegisterFile("payment/params.proto", fileDescriptor_12d54b052075926a) } var fileDescriptor_12d54b052075926a = []byte{ - // 225 bytes of a gzipped FileDescriptorProto + // 220 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x48, 0xac, 0xcc, 0x4d, 0xcd, 0x2b, 0xd1, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x8a, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xc5, 0xf4, 0x41, 0x2c, 0x88, - 0xb4, 0xd2, 0x24, 0x46, 0x2e, 0xb6, 0x00, 0xb0, 0x7a, 0x21, 0x07, 0x2e, 0xde, 0xdc, 0xcc, 0xbc, - 0xe0, 0xc2, 0xd2, 0xc4, 0xa2, 0xd4, 0xe0, 0xcc, 0xaa, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x56, - 0x27, 0xa9, 0x4f, 0xf7, 0xe4, 0xc5, 0x2a, 0x13, 0x73, 0x73, 0xac, 0x94, 0x72, 0x33, 0xf3, 0xe2, - 0x8b, 0xc1, 0xf2, 0xf1, 0xc5, 0x99, 0x55, 0xa9, 0x4a, 0x41, 0xa8, 0x1a, 0xc0, 0x26, 0x24, 0x56, - 0x04, 0x17, 0x26, 0x96, 0x42, 0x4d, 0x60, 0xc2, 0x30, 0x21, 0xb1, 0x22, 0xbe, 0x18, 0x2c, 0x0f, - 0x37, 0x01, 0x59, 0x83, 0x15, 0xcb, 0x8c, 0x05, 0xf2, 0x0c, 0x4e, 0xbe, 0x27, 0x1e, 0xc9, 0x31, - 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, - 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x9c, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, - 0x9f, 0xab, 0x9f, 0x9c, 0x9a, 0x93, 0x5a, 0x5c, 0x92, 0x99, 0x98, 0x5f, 0x94, 0x0e, 0x67, 0xeb, - 0x26, 0x16, 0x14, 0xe8, 0x57, 0xe8, 0xc3, 0x42, 0xa2, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, - 0xec, 0x55, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x4e, 0x10, 0x17, 0x21, 0x01, 0x00, - 0x00, + 0xb4, 0xd2, 0x34, 0x46, 0x2e, 0xb6, 0x00, 0xb0, 0x7a, 0x21, 0x27, 0x2e, 0xfe, 0xdc, 0xcc, 0xbc, + 0xf8, 0xe2, 0xc2, 0xd2, 0xc4, 0xa2, 0xd4, 0xf8, 0xe2, 0xcc, 0xaa, 0x54, 0x09, 0x46, 0x05, 0x46, + 0x0d, 0x56, 0x27, 0xa9, 0x4f, 0xf7, 0xe4, 0xc5, 0x2a, 0x13, 0x73, 0x73, 0xac, 0x94, 0xd0, 0x14, + 0x28, 0x05, 0xf1, 0xe6, 0x66, 0xe6, 0x05, 0x83, 0x05, 0x82, 0x33, 0xab, 0x52, 0xc1, 0x66, 0x24, + 0x56, 0xa0, 0x98, 0xc1, 0x84, 0x61, 0x06, 0xaa, 0x02, 0x90, 0x19, 0x89, 0x15, 0x08, 0x33, 0xac, + 0x58, 0x66, 0x2c, 0x90, 0x67, 0x70, 0xf2, 0x3d, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, + 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, + 0x86, 0x28, 0xe3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xe4, 0xd4, + 0x9c, 0xd4, 0xe2, 0x92, 0xcc, 0xc4, 0xfc, 0xa2, 0x74, 0x38, 0x5b, 0x37, 0xb1, 0xa0, 0x40, 0xbf, + 0x42, 0x1f, 0x16, 0x1a, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xef, 0x1a, 0x03, 0x02, + 0x00, 0x00, 0xff, 0xff, 0x1c, 0x79, 0x91, 0x12, 0x25, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/payment/types/query.pb.go b/x/payment/types/query.pb.go index d4e3531f2a..06cec8fd4b 100644 --- a/x/payment/types/query.pb.go +++ b/x/payment/types/query.pb.go @@ -30,7 +30,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryParamsRequest is request type for the Query/Params RPC method. +// QueryParamsRequest is the request type for the Query/Params RPC method. type QueryParamsRequest struct { } @@ -67,7 +67,7 @@ func (m *QueryParamsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo -// QueryParamsResponse is response type for the Query/Params RPC method. +// QueryParamsResponse is the response type for the Query/Params RPC method. type QueryParamsResponse struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } From 1e4175b08f1db1e9f95a33a3240c329731a7d15e Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 00:59:40 +1100 Subject: [PATCH 15/46] chore: documentation comment --- proto/payment/query.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/payment/query.proto b/proto/payment/query.proto index 283385d5f2..3c6c76d8a0 100644 --- a/proto/payment/query.proto +++ b/proto/payment/query.proto @@ -10,6 +10,7 @@ option go_package = "github.com/celestiaorg/celestia-app/x/payment/types"; // Query defines the gRPC querier service. service Query { + // Params queries the parameters of the module. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/payment/params"; } From a5e258e32966833f3d34e732c63fab3ed10c7d89 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 02:47:24 +1100 Subject: [PATCH 16/46] chore: run gofumpt --- x/payment/keeper/keeper.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/payment/keeper/keeper.go b/x/payment/keeper/keeper.go index b9c85ac244..90924e3454 100644 --- a/x/payment/keeper/keeper.go +++ b/x/payment/keeper/keeper.go @@ -28,7 +28,6 @@ func NewKeeper( storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, - ) *Keeper { return &Keeper{ cdc: cdc, From f2500eaafc8bd73bf104e1de6c85b4f80e87db5e Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 02:59:48 +1100 Subject: [PATCH 17/46] fix: generate pb files using correct version --- x/payment/types/query.pb.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/payment/types/query.pb.go b/x/payment/types/query.pb.go index 06cec8fd4b..9f454c3ebf 100644 --- a/x/payment/types/query.pb.go +++ b/x/payment/types/query.pb.go @@ -154,6 +154,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + // Params queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) } @@ -176,6 +177,7 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . // QueryServer is the server API for Query service. type QueryServer interface { + // Params queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) } From 243f1f48cb6ed98809625d05ed0c88a7fa66479f Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 04:14:05 +1100 Subject: [PATCH 18/46] chore: make params uint32 instead of int32 and set default values --- proto/payment/params.proto | 4 ++-- x/payment/keeper/params.go | 4 ++-- x/payment/types/params.go | 14 ++++++-------- x/payment/types/params.pb.go | 16 ++++++++-------- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/proto/payment/params.proto b/proto/payment/params.proto index 4e8bcebd9c..8e0cf13159 100644 --- a/proto/payment/params.proto +++ b/proto/payment/params.proto @@ -9,6 +9,6 @@ option go_package = "github.com/celestiaorg/celestia-app/x/payment/types"; message Params { option (gogoproto.goproto_stringer) = false; - int32 min_square_size = 1 [(gogoproto.moretags) = "yaml:\"min_square_size\""]; - int32 max_square_size = 2 [(gogoproto.moretags) = "yaml:\"max_square_size\""]; + uint32 min_square_size = 1 [(gogoproto.moretags) = "yaml:\"min_square_size\""]; + uint32 max_square_size = 2 [(gogoproto.moretags) = "yaml:\"max_square_size\""]; } diff --git a/x/payment/keeper/params.go b/x/payment/keeper/params.go index 579a7fe6f8..6d2d6739ba 100644 --- a/x/payment/keeper/params.go +++ b/x/payment/keeper/params.go @@ -19,13 +19,13 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { } // MinSquareSize returns the MinSquareSize param -func (k Keeper) MinSquareSize(ctx sdk.Context) (res int32) { +func (k Keeper) MinSquareSize(ctx sdk.Context) (res uint32) { k.paramstore.Get(ctx, types.KeyMinSquareSize, &res) return } // MaxSquareSize returns the MaxSquareSize param -func (k Keeper) MaxSquareSize(ctx sdk.Context) (res int32) { +func (k Keeper) MaxSquareSize(ctx sdk.Context) (res uint32) { k.paramstore.Get(ctx, types.KeyMaxSquareSize, &res) return } diff --git a/x/payment/types/params.go b/x/payment/types/params.go index ba8256dcd3..d7d457a555 100644 --- a/x/payment/types/params.go +++ b/x/payment/types/params.go @@ -10,15 +10,13 @@ import ( var _ paramtypes.ParamSet = (*Params)(nil) var ( - KeyMinSquareSize = []byte("MinSquareSize") - // TODO: Determine the default value - DefaultMinSquareSize int32 = 0 + KeyMinSquareSize = []byte("MinSquareSize") + DefaultMinSquareSize uint32 = 1 ) var ( - KeyMaxSquareSize = []byte("MaxSquareSize") - // TODO: Determine the default value - DefaultMaxSquareSize int32 = 0 + KeyMaxSquareSize = []byte("MaxSquareSize") + DefaultMaxSquareSize uint32 = 128 ) // ParamKeyTable the param key table for launch module @@ -28,8 +26,8 @@ func ParamKeyTable() paramtypes.KeyTable { // NewParams creates a new Params instance func NewParams( - minSquareSize int32, - maxSquareSize int32, + minSquareSize uint32, + maxSquareSize uint32, ) Params { return Params{ MinSquareSize: minSquareSize, diff --git a/x/payment/types/params.pb.go b/x/payment/types/params.pb.go index 1f0bb389f3..6b9de7bb7a 100644 --- a/x/payment/types/params.pb.go +++ b/x/payment/types/params.pb.go @@ -25,8 +25,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - MinSquareSize int32 `protobuf:"varint,1,opt,name=min_square_size,json=minSquareSize,proto3" json:"min_square_size,omitempty" yaml:"min_square_size"` - MaxSquareSize int32 `protobuf:"varint,2,opt,name=max_square_size,json=maxSquareSize,proto3" json:"max_square_size,omitempty" yaml:"max_square_size"` + MinSquareSize uint32 `protobuf:"varint,1,opt,name=min_square_size,json=minSquareSize,proto3" json:"min_square_size,omitempty" yaml:"min_square_size"` + MaxSquareSize uint32 `protobuf:"varint,2,opt,name=max_square_size,json=maxSquareSize,proto3" json:"max_square_size,omitempty" yaml:"max_square_size"` } func (m *Params) Reset() { *m = Params{} } @@ -61,14 +61,14 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetMinSquareSize() int32 { +func (m *Params) GetMinSquareSize() uint32 { if m != nil { return m.MinSquareSize } return 0 } -func (m *Params) GetMaxSquareSize() int32 { +func (m *Params) GetMaxSquareSize() uint32 { if m != nil { return m.MaxSquareSize } @@ -88,7 +88,7 @@ var fileDescriptor_12d54b052075926a = []byte{ 0x17, 0x62, 0x87, 0x8a, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xc5, 0xf4, 0x41, 0x2c, 0x88, 0xb4, 0xd2, 0x34, 0x46, 0x2e, 0xb6, 0x00, 0xb0, 0x7a, 0x21, 0x27, 0x2e, 0xfe, 0xdc, 0xcc, 0xbc, 0xf8, 0xe2, 0xc2, 0xd2, 0xc4, 0xa2, 0xd4, 0xf8, 0xe2, 0xcc, 0xaa, 0x54, 0x09, 0x46, 0x05, 0x46, - 0x0d, 0x56, 0x27, 0xa9, 0x4f, 0xf7, 0xe4, 0xc5, 0x2a, 0x13, 0x73, 0x73, 0xac, 0x94, 0xd0, 0x14, + 0x0d, 0x5e, 0x27, 0xa9, 0x4f, 0xf7, 0xe4, 0xc5, 0x2a, 0x13, 0x73, 0x73, 0xac, 0x94, 0xd0, 0x14, 0x28, 0x05, 0xf1, 0xe6, 0x66, 0xe6, 0x05, 0x83, 0x05, 0x82, 0x33, 0xab, 0x52, 0xc1, 0x66, 0x24, 0x56, 0xa0, 0x98, 0xc1, 0x84, 0x61, 0x06, 0xaa, 0x02, 0x90, 0x19, 0x89, 0x15, 0x08, 0x33, 0xac, 0x58, 0x66, 0x2c, 0x90, 0x67, 0x70, 0xf2, 0x3d, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, @@ -96,7 +96,7 @@ var fileDescriptor_12d54b052075926a = []byte{ 0x86, 0x28, 0xe3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xe4, 0xd4, 0x9c, 0xd4, 0xe2, 0x92, 0xcc, 0xc4, 0xfc, 0xa2, 0x74, 0x38, 0x5b, 0x37, 0xb1, 0xa0, 0x40, 0xbf, 0x42, 0x1f, 0x16, 0x1a, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xef, 0x1a, 0x03, 0x02, - 0x00, 0x00, 0xff, 0xff, 0x1c, 0x79, 0x91, 0x12, 0x25, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x05, 0x68, 0x47, 0xac, 0x25, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -207,7 +207,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MinSquareSize |= int32(b&0x7F) << shift + m.MinSquareSize |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -226,7 +226,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxSquareSize |= int32(b&0x7F) << shift + m.MaxSquareSize |= uint32(b&0x7F) << shift if b < 0x80 { break } From 986848cb60d44d632e53ce6a210f332371b4739e Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 04:14:57 +1100 Subject: [PATCH 19/46] chore: typo --- x/payment/types/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/payment/types/params.go b/x/payment/types/params.go index d7d457a555..ba953f358f 100644 --- a/x/payment/types/params.go +++ b/x/payment/types/params.go @@ -19,7 +19,7 @@ var ( DefaultMaxSquareSize uint32 = 128 ) -// ParamKeyTable the param key table for launch module +// ParamKeyTable the param key table for the payment module func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } From 6fa6d8775557bb27809b4783f1d88d342fa7472d Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 04:16:16 +1100 Subject: [PATCH 20/46] chore: better comment --- x/payment/types/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/payment/types/params.go b/x/payment/types/params.go index ba953f358f..27569cdf78 100644 --- a/x/payment/types/params.go +++ b/x/payment/types/params.go @@ -43,7 +43,7 @@ func DefaultParams() Params { ) } -// ParamSetPairs get the params.ParamSet +// ParamSetPairs gets the list of param key-pair values func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(KeyMinSquareSize, &p.MinSquareSize, validateMinSquareSize), From feac96348ff53b278a00663fda464f3dc214a0ca Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 04:18:14 +1100 Subject: [PATCH 21/46] fix: min/max square size validation --- x/payment/types/params.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/x/payment/types/params.go b/x/payment/types/params.go index 27569cdf78..7bf806f524 100644 --- a/x/payment/types/params.go +++ b/x/payment/types/params.go @@ -72,26 +72,20 @@ func (p Params) String() string { // validateMinSquareSize validates the MinSquareSize param func validateMinSquareSize(v interface{}) error { - minSquareSize, ok := v.(int32) + _, ok := v.(uint32) if !ok { return fmt.Errorf("invalid parameter type: %T", v) } - // TODO implement validation - _ = minSquareSize - return nil } // validateMaxSquareSize validates the MaxSquareSize param func validateMaxSquareSize(v interface{}) error { - maxSquareSize, ok := v.(int32) + _, ok := v.(uint32) if !ok { return fmt.Errorf("invalid parameter type: %T", v) } - // TODO implement validation - _ = maxSquareSize - return nil } From 726d58c74c1c5cbb0ab98614e74126d387467233 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 05:03:33 +1100 Subject: [PATCH 22/46] chore: define genesis state params --- x/payment/genesis.go | 2 ++ x/payment/types/genesis.go | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/x/payment/genesis.go b/x/payment/genesis.go index df9fdab9d0..5ddfdf7fe3 100644 --- a/x/payment/genesis.go +++ b/x/payment/genesis.go @@ -9,11 +9,13 @@ import ( // InitGenesis initializes the capability module's state from a provided genesis // state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + k.SetParams(ctx, genState.Params) } // ExportGenesis returns the capability module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) return genesis } diff --git a/x/payment/types/genesis.go b/x/payment/types/genesis.go index 094d1119cc..0785224ae9 100644 --- a/x/payment/types/genesis.go +++ b/x/payment/types/genesis.go @@ -5,11 +5,13 @@ const DefaultIndex uint64 = 1 // DefaultGenesis returns the default Capability genesis state func DefaultGenesis() *GenesisState { - return &GenesisState{} + return &GenesisState{ + Params: DefaultParams(), + } } // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - return nil + return gs.Params.Validate() } From 3aef9c7456a3a62becdc5c01aaa3f608645da860 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Fri, 21 Oct 2022 05:32:30 +1100 Subject: [PATCH 23/46] chore: set key table for subspace if not already set --- x/payment/genesis.go | 1 - x/payment/keeper/grpc_query.go | 7 +++++++ x/payment/keeper/keeper.go | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 x/payment/keeper/grpc_query.go diff --git a/x/payment/genesis.go b/x/payment/genesis.go index 5ddfdf7fe3..e496c6e908 100644 --- a/x/payment/genesis.go +++ b/x/payment/genesis.go @@ -16,6 +16,5 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) - return genesis } diff --git a/x/payment/keeper/grpc_query.go b/x/payment/keeper/grpc_query.go new file mode 100644 index 0000000000..f5e93a4906 --- /dev/null +++ b/x/payment/keeper/grpc_query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/celestiaorg/celestia-app/x/payment/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/payment/keeper/keeper.go b/x/payment/keeper/keeper.go index 90924e3454..06cd9b5dd9 100644 --- a/x/payment/keeper/keeper.go +++ b/x/payment/keeper/keeper.go @@ -29,6 +29,10 @@ func NewKeeper( memKey storetypes.StoreKey, ps paramtypes.Subspace, ) *Keeper { + if !ps.HasKeyTable() { + ps = ps.WithKeyTable(types.ParamKeyTable()) + } + return &Keeper{ cdc: cdc, storeKey: storeKey, From 31af6a58bf13656f5974abb2c97941cbb9caf746 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Tue, 25 Oct 2022 11:02:48 +0530 Subject: [PATCH 24/46] test: define dummy payment keeper for testing --- testutil/keeper/payment.go | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 testutil/keeper/payment.go diff --git a/testutil/keeper/payment.go b/testutil/keeper/payment.go new file mode 100644 index 0000000000..1b0aba0571 --- /dev/null +++ b/testutil/keeper/payment.go @@ -0,0 +1,53 @@ +package keeper + +import ( + "testing" + + "github.com/celestiaorg/celestia-app/testutil" + "github.com/celestiaorg/celestia-app/x/payment/keeper" + "github.com/celestiaorg/celestia-app/x/payment/types" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + typesparams "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmdb "github.com/tendermint/tm-db" +) + +func PaymentKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { + storeKey := sdk.NewKVStoreKey(types.StoreKey) + memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + + db := tmdb.NewMemDB() + stateStore := store.NewCommitMultiStore(db) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + + paramsSubspace := typesparams.NewSubspace(cdc, + testutil.MakeTestCodec(), + storeKey, + memStoreKey, + "Payment", + ) + k := keeper.NewKeeper( + cdc, + storeKey, + memStoreKey, + paramsSubspace, + ) + + ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + return k, ctx +} From b61e873ff64826edd8b35249519db39d9fecc88c Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Tue, 25 Oct 2022 11:03:12 +0530 Subject: [PATCH 25/46] test: define nullify module to set data to nil --- testutil/nullify/nullify.go | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 testutil/nullify/nullify.go diff --git a/testutil/nullify/nullify.go b/testutil/nullify/nullify.go new file mode 100644 index 0000000000..3b968c09c1 --- /dev/null +++ b/testutil/nullify/nullify.go @@ -0,0 +1,57 @@ +// Package nullify provides methods to init nil values structs for test assertion. +package nullify + +import ( + "reflect" + "unsafe" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var ( + coinType = reflect.TypeOf(sdk.Coin{}) + coinsType = reflect.TypeOf(sdk.Coins{}) +) + +// Fill analyze all struct fields and slices with +// reflection and initialize the nil and empty slices, +// structs, and pointers. +func Fill(x interface{}) interface{} { + v := reflect.Indirect(reflect.ValueOf(x)) + switch v.Kind() { + case reflect.Slice: + for i := 0; i < v.Len(); i++ { + obj := v.Index(i) + objPt := reflect.NewAt(obj.Type(), unsafe.Pointer(obj.UnsafeAddr())).Interface() + objPt = Fill(objPt) + obj.Set(reflect.ValueOf(objPt)) + } + case reflect.Struct: + for i := 0; i < v.NumField(); i++ { + f := reflect.Indirect(v.Field(i)) + if !f.CanSet() { + continue + } + switch f.Kind() { + case reflect.Slice: + f.Set(reflect.MakeSlice(f.Type(), 0, 0)) + case reflect.Struct: + switch f.Type() { + case coinType: + coin := reflect.New(coinType).Interface() + s := reflect.ValueOf(coin).Elem() + f.Set(s) + case coinsType: + coins := reflect.New(coinsType).Interface() + s := reflect.ValueOf(coins).Elem() + f.Set(s) + default: + objPt := reflect.NewAt(f.Type(), unsafe.Pointer(f.UnsafeAddr())).Interface() + s := Fill(objPt) + f.Set(reflect.ValueOf(s)) + } + } + } + } + return reflect.Indirect(v).Interface() +} From 7e670ab439c73a3aeb1093e896c8f17feeac9002 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Tue, 25 Oct 2022 11:03:28 +0530 Subject: [PATCH 26/46] test: params query test --- x/payment/keeper/grpc_query_params_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 x/payment/keeper/grpc_query_params_test.go diff --git a/x/payment/keeper/grpc_query_params_test.go b/x/payment/keeper/grpc_query_params_test.go new file mode 100644 index 0000000000..950adc390f --- /dev/null +++ b/x/payment/keeper/grpc_query_params_test.go @@ -0,0 +1,21 @@ +package keeper_test + +import ( + "testing" + + testkeeper "github.com/celestiaorg/celestia-app/testutil/keeper" + "github.com/celestiaorg/celestia-app/x/payment/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := testkeeper.PaymentKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + params := types.DefaultParams() + keeper.SetParams(ctx, params) + + response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} From 0cf6e098e2241cedb9ea87d668f0e698378051bd Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Tue, 25 Oct 2022 11:03:37 +0530 Subject: [PATCH 27/46] test: genesis test --- x/payment/genesis_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 x/payment/genesis_test.go diff --git a/x/payment/genesis_test.go b/x/payment/genesis_test.go new file mode 100644 index 0000000000..5e90a38c61 --- /dev/null +++ b/x/payment/genesis_test.go @@ -0,0 +1,25 @@ +package payment_test + +import ( + "testing" + + keepertest "github.com/celestiaorg/celestia-app/testutil/keeper" + "github.com/celestiaorg/celestia-app/testutil/nullify" + "github.com/celestiaorg/celestia-app/x/payment" + "github.com/celestiaorg/celestia-app/x/payment/types" + "github.com/stretchr/testify/require" +) + +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + } + + k, ctx := keepertest.PaymentKeeper(t) + payment.InitGenesis(ctx, *k, genesisState) + got := payment.ExportGenesis(ctx, *k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) +} From 129d26f10f5c5803056a1aefe1d6fa231c5a5f46 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Tue, 25 Oct 2022 13:05:50 +0530 Subject: [PATCH 28/46] test: add params keeper test --- x/payment/keeper/params_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 x/payment/keeper/params_test.go diff --git a/x/payment/keeper/params_test.go b/x/payment/keeper/params_test.go new file mode 100644 index 0000000000..eb5c44a75b --- /dev/null +++ b/x/payment/keeper/params_test.go @@ -0,0 +1,20 @@ +package keeper_test + +import ( + "testing" + + testkeeper "github.com/celestiaorg/celestia-app/testutil/keeper" + "github.com/celestiaorg/celestia-app/x/payment/types" + "github.com/stretchr/testify/require" +) + +func TestGetParams(t *testing.T) { + k, ctx := testkeeper.PaymentKeeper(t) + params := types.DefaultParams() + + k.SetParams(ctx, params) + + require.EqualValues(t, params, k.GetParams(ctx)) + require.EqualValues(t, params.MinSquareSize, k.MinSquareSize(ctx)) + require.EqualValues(t, params.MaxSquareSize, k.MaxSquareSize(ctx)) +} From 79a1a72654f846bf0b02ec12be8ee93ef3181d08 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Mon, 31 Oct 2022 21:00:57 +0530 Subject: [PATCH 29/46] chore: cleanup --- testutil/nullify/nullify.go | 6 +++--- x/payment/keeper/keeper.go | 4 ++-- x/payment/keeper/params.go | 8 ++++---- x/payment/types/params.go | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/testutil/nullify/nullify.go b/testutil/nullify/nullify.go index 3b968c09c1..e646027769 100644 --- a/testutil/nullify/nullify.go +++ b/testutil/nullify/nullify.go @@ -1,4 +1,4 @@ -// Package nullify provides methods to init nil values structs for test assertion. +// Package nullify provides methods to init nil value structs for test assertion. package nullify import ( @@ -13,8 +13,8 @@ var ( coinsType = reflect.TypeOf(sdk.Coins{}) ) -// Fill analyze all struct fields and slices with -// reflection and initialize the nil and empty slices, +// Fill analyzes all struct fields and slices with +// reflection and initializes the nil and empty slices, // structs, and pointers. func Fill(x interface{}) interface{} { v := reflect.Indirect(reflect.ValueOf(x)) diff --git a/x/payment/keeper/keeper.go b/x/payment/keeper/keeper.go index 06cd9b5dd9..60aa1e7625 100644 --- a/x/payment/keeper/keeper.go +++ b/x/payment/keeper/keeper.go @@ -20,7 +20,7 @@ type Keeper struct { cdc codec.BinaryCodec storeKey storetypes.StoreKey memKey storetypes.StoreKey - paramstore paramtypes.Subspace + paramStore paramtypes.Subspace } func NewKeeper( @@ -37,7 +37,7 @@ func NewKeeper( cdc: cdc, storeKey: storeKey, memKey: memKey, - paramstore: ps, + paramStore: ps, } } diff --git a/x/payment/keeper/params.go b/x/payment/keeper/params.go index 6d2d6739ba..3607bbf413 100644 --- a/x/payment/keeper/params.go +++ b/x/payment/keeper/params.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// GetParams get all parameters as types.Params +// GetParams gets all parameters as types.Params func (k Keeper) GetParams(ctx sdk.Context) types.Params { return types.NewParams( k.MinSquareSize(ctx), @@ -15,17 +15,17 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { // SetParams set the params func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) + k.paramStore.SetParamSet(ctx, ¶ms) } // MinSquareSize returns the MinSquareSize param func (k Keeper) MinSquareSize(ctx sdk.Context) (res uint32) { - k.paramstore.Get(ctx, types.KeyMinSquareSize, &res) + k.paramStore.Get(ctx, types.KeyMinSquareSize, &res) return } // MaxSquareSize returns the MaxSquareSize param func (k Keeper) MaxSquareSize(ctx sdk.Context) (res uint32) { - k.paramstore.Get(ctx, types.KeyMaxSquareSize, &res) + k.paramStore.Get(ctx, types.KeyMaxSquareSize, &res) return } diff --git a/x/payment/types/params.go b/x/payment/types/params.go index 7bf806f524..42f0860f78 100644 --- a/x/payment/types/params.go +++ b/x/payment/types/params.go @@ -19,7 +19,7 @@ var ( DefaultMaxSquareSize uint32 = 128 ) -// ParamKeyTable the param key table for the payment module +// ParamKeyTable returns the param key table for the payment module func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } @@ -43,7 +43,7 @@ func DefaultParams() Params { ) } -// ParamSetPairs gets the list of param key-pair values +// ParamSetPairs gets the list of param key-value pairs func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(KeyMinSquareSize, &p.MinSquareSize, validateMinSquareSize), From b769d07708e77fa40d58ae92b0518abee826d361 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 3 Nov 2022 13:55:48 +0530 Subject: [PATCH 30/46] test: removing fill assertions and unsafe code --- testutil/nullify/nullify.go | 57 ------------------------------------- x/payment/genesis_test.go | 4 --- 2 files changed, 61 deletions(-) delete mode 100644 testutil/nullify/nullify.go diff --git a/testutil/nullify/nullify.go b/testutil/nullify/nullify.go deleted file mode 100644 index e646027769..0000000000 --- a/testutil/nullify/nullify.go +++ /dev/null @@ -1,57 +0,0 @@ -// Package nullify provides methods to init nil value structs for test assertion. -package nullify - -import ( - "reflect" - "unsafe" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - coinType = reflect.TypeOf(sdk.Coin{}) - coinsType = reflect.TypeOf(sdk.Coins{}) -) - -// Fill analyzes all struct fields and slices with -// reflection and initializes the nil and empty slices, -// structs, and pointers. -func Fill(x interface{}) interface{} { - v := reflect.Indirect(reflect.ValueOf(x)) - switch v.Kind() { - case reflect.Slice: - for i := 0; i < v.Len(); i++ { - obj := v.Index(i) - objPt := reflect.NewAt(obj.Type(), unsafe.Pointer(obj.UnsafeAddr())).Interface() - objPt = Fill(objPt) - obj.Set(reflect.ValueOf(objPt)) - } - case reflect.Struct: - for i := 0; i < v.NumField(); i++ { - f := reflect.Indirect(v.Field(i)) - if !f.CanSet() { - continue - } - switch f.Kind() { - case reflect.Slice: - f.Set(reflect.MakeSlice(f.Type(), 0, 0)) - case reflect.Struct: - switch f.Type() { - case coinType: - coin := reflect.New(coinType).Interface() - s := reflect.ValueOf(coin).Elem() - f.Set(s) - case coinsType: - coins := reflect.New(coinsType).Interface() - s := reflect.ValueOf(coins).Elem() - f.Set(s) - default: - objPt := reflect.NewAt(f.Type(), unsafe.Pointer(f.UnsafeAddr())).Interface() - s := Fill(objPt) - f.Set(reflect.ValueOf(s)) - } - } - } - } - return reflect.Indirect(v).Interface() -} diff --git a/x/payment/genesis_test.go b/x/payment/genesis_test.go index 5e90a38c61..e494439ff9 100644 --- a/x/payment/genesis_test.go +++ b/x/payment/genesis_test.go @@ -4,7 +4,6 @@ import ( "testing" keepertest "github.com/celestiaorg/celestia-app/testutil/keeper" - "github.com/celestiaorg/celestia-app/testutil/nullify" "github.com/celestiaorg/celestia-app/x/payment" "github.com/celestiaorg/celestia-app/x/payment/types" "github.com/stretchr/testify/require" @@ -19,7 +18,4 @@ func TestGenesis(t *testing.T) { payment.InitGenesis(ctx, *k, genesisState) got := payment.ExportGenesis(ctx, *k) require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) } From 7d38d90e2ac0888d748e16484defb93d27364dd3 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 3 Nov 2022 14:00:15 +0530 Subject: [PATCH 31/46] chore: assert that min/max sqaure size is not 0 --- x/payment/types/params.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/x/payment/types/params.go b/x/payment/types/params.go index 42f0860f78..ec82857ed4 100644 --- a/x/payment/types/params.go +++ b/x/payment/types/params.go @@ -72,20 +72,28 @@ func (p Params) String() string { // validateMinSquareSize validates the MinSquareSize param func validateMinSquareSize(v interface{}) error { - _, ok := v.(uint32) + minSquareSize, ok := v.(uint32) if !ok { return fmt.Errorf("invalid parameter type: %T", v) } + if minSquareSize == 0 { + return fmt.Errorf("min square size cannot be 0") + } + return nil } // validateMaxSquareSize validates the MaxSquareSize param func validateMaxSquareSize(v interface{}) error { - _, ok := v.(uint32) + maxSquareSize, ok := v.(uint32) if !ok { return fmt.Errorf("invalid parameter type: %T", v) } + if maxSquareSize == 0 { + return fmt.Errorf("max square size cannot be 0") + } + return nil } From 0cb7a09aa22f8de706b0d76597b014184847d2f5 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 3 Nov 2022 14:35:39 +0530 Subject: [PATCH 32/46] test: add equality check for genesis params --- x/payment/genesis_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/payment/genesis_test.go b/x/payment/genesis_test.go index e494439ff9..c5e5d8433c 100644 --- a/x/payment/genesis_test.go +++ b/x/payment/genesis_test.go @@ -18,4 +18,5 @@ func TestGenesis(t *testing.T) { payment.InitGenesis(ctx, *k, genesisState) got := payment.ExportGenesis(ctx, *k) require.NotNil(t, got) + require.Equal(t, types.DefaultParams(), got.Params) } From 885bc1e7680e9fc873983f2d4fd75b232d9030c3 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 3 Nov 2022 15:03:54 +0530 Subject: [PATCH 33/46] chore update dependency --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 67ddd7a09d..ee1834a89b 100644 --- a/go.mod +++ b/go.mod @@ -32,6 +32,7 @@ require ( github.com/regen-network/cosmos-proto v0.3.1 github.com/tendermint/tendermint v0.34.20 golang.org/x/exp v0.0.0-20221012211006-4de253d81b95 + gopkg.in/yaml.v2 v2.4.0 ) require ( @@ -173,7 +174,6 @@ require ( google.golang.org/protobuf v1.28.1 // indirect gopkg.in/ini.v1 v1.66.6 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect sigs.k8s.io/yaml v1.3.0 // indirect From 5a43a68986a3d7be6658355ff4becb1e3137942a Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 3 Nov 2022 15:04:14 +0530 Subject: [PATCH 34/46] test: fix test by defining min/max square size --- x/payment/types/genesis_test.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/x/payment/types/genesis_test.go b/x/payment/types/genesis_test.go index 56a870f7ff..4e7ad402d2 100644 --- a/x/payment/types/genesis_test.go +++ b/x/payment/types/genesis_test.go @@ -19,9 +19,14 @@ func TestGenesisState_Validate(t *testing.T) { valid: true, }, { - desc: "valid genesis state", - genState: &types.GenesisState{}, - valid: true, + desc: "valid genesis state", + genState: &types.GenesisState{ + Params: types.Params{ + MinSquareSize: 512, + MaxSquareSize: 1024, + }, + }, + valid: true, }, } { t.Run(tc.desc, func(t *testing.T) { From ea2a421201e9c0017db8a4b894b268d8881e9115 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 10 Nov 2022 12:09:10 +0530 Subject: [PATCH 35/46] fix: proto file package --- proto/blob/params.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/blob/params.proto b/proto/blob/params.proto index 8e0cf13159..360c18a015 100644 --- a/proto/blob/params.proto +++ b/proto/blob/params.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package payment; +package blob; import "gogoproto/gogo.proto"; From f8787a411895dc06f351a1afe78503a2ed349e9d Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 10 Nov 2022 12:10:08 +0530 Subject: [PATCH 36/46] fix: proto file go_package --- proto/blob/params.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/blob/params.proto b/proto/blob/params.proto index 360c18a015..64ce258108 100644 --- a/proto/blob/params.proto +++ b/proto/blob/params.proto @@ -3,7 +3,7 @@ package blob; import "gogoproto/gogo.proto"; -option go_package = "github.com/celestiaorg/celestia-app/x/payment/types"; +option go_package = "github.com/celestiaorg/celestia-app/x/blob/types"; // Params defines the parameters for the module. message Params { From 1fb9d96b41b61627716a7f2f28140a491854bdf3 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 10 Nov 2022 12:10:57 +0530 Subject: [PATCH 37/46] chore: generate files fromn protobuf --- x/blob/types/genesis.pb.go | 36 ++++++++++---------- x/blob/types/params.pb.go | 40 +++++++++++----------- x/blob/types/query.pb.go | 68 ++++++++++++++++++------------------- x/blob/types/query.pb.gw.go | 2 +- 4 files changed, 73 insertions(+), 73 deletions(-) diff --git a/x/blob/types/genesis.pb.go b/x/blob/types/genesis.pb.go index a9ca50153d..b196814bba 100644 --- a/x/blob/types/genesis.pb.go +++ b/x/blob/types/genesis.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: payment/genesis.proto +// source: blob/genesis.proto package types @@ -32,7 +32,7 @@ func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_ded92bd505296f58, []int{0} + return fileDescriptor_a5280efddde57f21, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -69,25 +69,25 @@ func (m *GenesisState) GetParams() Params { } func init() { - proto.RegisterType((*GenesisState)(nil), "payment.GenesisState") + proto.RegisterType((*GenesisState)(nil), "blob.GenesisState") } -func init() { proto.RegisterFile("payment/genesis.proto", fileDescriptor_ded92bd505296f58) } +func init() { proto.RegisterFile("blob/genesis.proto", fileDescriptor_a5280efddde57f21) } -var fileDescriptor_ded92bd505296f58 = []byte{ - // 189 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2d, 0x48, 0xac, 0xcc, - 0x4d, 0xcd, 0x2b, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0x62, 0x87, 0x0a, 0x4b, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xc5, 0xf4, 0x41, 0x2c, - 0x88, 0xb4, 0x94, 0x08, 0x4c, 0x57, 0x41, 0x62, 0x51, 0x62, 0x2e, 0x54, 0x93, 0x92, 0x2d, 0x17, - 0x8f, 0x3b, 0xc4, 0x94, 0xe0, 0x92, 0xc4, 0x92, 0x54, 0x21, 0x5d, 0x2e, 0x36, 0x88, 0xbc, 0x04, - 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x11, 0xbf, 0x1e, 0x54, 0x9b, 0x5e, 0x00, 0x58, 0xd8, 0x89, 0xe5, - 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xa8, 0x22, 0x27, 0xdf, 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, 0x32, 0x4e, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, - 0x4e, 0xcd, 0x49, 0x2d, 0x2e, 0xc9, 0x4c, 0xcc, 0x2f, 0x4a, 0x87, 0xb3, 0x75, 0x13, 0x0b, 0x0a, - 0xf4, 0x2b, 0xf4, 0x61, 0x8e, 0x2a, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x3b, 0xca, 0x18, - 0x10, 0x00, 0x00, 0xff, 0xff, 0x68, 0xc3, 0x75, 0x3c, 0xe2, 0x00, 0x00, 0x00, +var fileDescriptor_a5280efddde57f21 = []byte{ + // 186 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4a, 0xca, 0xc9, 0x4f, + 0xd2, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, + 0x01, 0x89, 0x49, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x05, 0xf4, 0x41, 0x2c, 0x88, 0x9c, 0x94, + 0x20, 0x58, 0x7d, 0x41, 0x62, 0x51, 0x62, 0x2e, 0x54, 0xb9, 0x92, 0x15, 0x17, 0x8f, 0x3b, 0x44, + 0x7f, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x16, 0x17, 0x1b, 0x44, 0x5e, 0x82, 0x51, 0x81, 0x51, + 0x83, 0xdb, 0x88, 0x47, 0x0f, 0xa4, 0x47, 0x2f, 0x00, 0x2c, 0xe6, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, + 0x43, 0x10, 0x54, 0x85, 0x93, 0xd7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, + 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, + 0x19, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x27, 0xa7, 0xe6, 0xa4, + 0x16, 0x97, 0x64, 0x26, 0xe6, 0x17, 0xa5, 0xc3, 0xd9, 0xba, 0x89, 0x05, 0x05, 0xfa, 0x15, 0xfa, + 0x60, 0xe7, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x9d, 0x63, 0x0c, 0x08, 0x00, 0x00, + 0xff, 0xff, 0x04, 0xd4, 0x5d, 0x2f, 0xd3, 0x00, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/blob/types/params.pb.go b/x/blob/types/params.pb.go index 6b9de7bb7a..3cb9954c93 100644 --- a/x/blob/types/params.pb.go +++ b/x/blob/types/params.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: payment/params.proto +// source: blob/params.proto package types @@ -32,7 +32,7 @@ type Params struct { func (m *Params) Reset() { *m = Params{} } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_12d54b052075926a, []int{0} + return fileDescriptor_6eb7255e25c6327c, []int{0} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -76,27 +76,27 @@ func (m *Params) GetMaxSquareSize() uint32 { } func init() { - proto.RegisterType((*Params)(nil), "payment.Params") + proto.RegisterType((*Params)(nil), "blob.Params") } -func init() { proto.RegisterFile("payment/params.proto", fileDescriptor_12d54b052075926a) } +func init() { proto.RegisterFile("blob/params.proto", fileDescriptor_6eb7255e25c6327c) } -var fileDescriptor_12d54b052075926a = []byte{ - // 220 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x48, 0xac, 0xcc, - 0x4d, 0xcd, 0x2b, 0xd1, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, - 0x17, 0x62, 0x87, 0x8a, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xc5, 0xf4, 0x41, 0x2c, 0x88, - 0xb4, 0xd2, 0x34, 0x46, 0x2e, 0xb6, 0x00, 0xb0, 0x7a, 0x21, 0x27, 0x2e, 0xfe, 0xdc, 0xcc, 0xbc, - 0xf8, 0xe2, 0xc2, 0xd2, 0xc4, 0xa2, 0xd4, 0xf8, 0xe2, 0xcc, 0xaa, 0x54, 0x09, 0x46, 0x05, 0x46, - 0x0d, 0x5e, 0x27, 0xa9, 0x4f, 0xf7, 0xe4, 0xc5, 0x2a, 0x13, 0x73, 0x73, 0xac, 0x94, 0xd0, 0x14, - 0x28, 0x05, 0xf1, 0xe6, 0x66, 0xe6, 0x05, 0x83, 0x05, 0x82, 0x33, 0xab, 0x52, 0xc1, 0x66, 0x24, - 0x56, 0xa0, 0x98, 0xc1, 0x84, 0x61, 0x06, 0xaa, 0x02, 0x90, 0x19, 0x89, 0x15, 0x08, 0x33, 0xac, - 0x58, 0x66, 0x2c, 0x90, 0x67, 0x70, 0xf2, 0x3d, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, - 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, - 0x86, 0x28, 0xe3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xe4, 0xd4, - 0x9c, 0xd4, 0xe2, 0x92, 0xcc, 0xc4, 0xfc, 0xa2, 0x74, 0x38, 0x5b, 0x37, 0xb1, 0xa0, 0x40, 0xbf, - 0x42, 0x1f, 0x16, 0x1a, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xef, 0x1a, 0x03, 0x02, - 0x00, 0x00, 0xff, 0xff, 0x05, 0x68, 0x47, 0xac, 0x25, 0x01, 0x00, 0x00, +var fileDescriptor_6eb7255e25c6327c = []byte{ + // 217 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4c, 0xca, 0xc9, 0x4f, + 0xd2, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, + 0x09, 0x49, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x05, 0xf4, 0x41, 0x2c, 0x88, 0x9c, 0xd2, 0x34, + 0x46, 0x2e, 0xb6, 0x00, 0xb0, 0x62, 0x21, 0x27, 0x2e, 0xfe, 0xdc, 0xcc, 0xbc, 0xf8, 0xe2, 0xc2, + 0xd2, 0xc4, 0xa2, 0xd4, 0xf8, 0xe2, 0xcc, 0xaa, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x5e, 0x27, + 0xa9, 0x4f, 0xf7, 0xe4, 0xc5, 0x2a, 0x13, 0x73, 0x73, 0xac, 0x94, 0xd0, 0x14, 0x28, 0x05, 0xf1, + 0xe6, 0x66, 0xe6, 0x05, 0x83, 0x05, 0x82, 0x33, 0xab, 0x52, 0xc1, 0x66, 0x24, 0x56, 0xa0, 0x98, + 0xc1, 0x84, 0x61, 0x06, 0xaa, 0x02, 0x90, 0x19, 0x89, 0x15, 0x08, 0x33, 0xac, 0x58, 0x66, 0x2c, + 0x90, 0x67, 0x70, 0xf2, 0x3a, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, + 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x83, + 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xe4, 0xd4, 0x9c, 0xd4, 0xe2, + 0x92, 0xcc, 0xc4, 0xfc, 0xa2, 0x74, 0x38, 0x5b, 0x37, 0xb1, 0xa0, 0x40, 0xbf, 0x42, 0x1f, 0x1c, + 0x0e, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xbf, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x5c, 0x4f, 0x18, 0x6e, 0x1c, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/blob/types/query.pb.go b/x/blob/types/query.pb.go index 9f454c3ebf..edeb73a2c1 100644 --- a/x/blob/types/query.pb.go +++ b/x/blob/types/query.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: payment/query.proto +// source: blob/query.proto package types @@ -38,7 +38,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_0d907c42280cbd58, []int{0} + return fileDescriptor_a07e481b352b93f9, []int{0} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -76,7 +76,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0d907c42280cbd58, []int{1} + return fileDescriptor_a07e481b352b93f9, []int{1} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -113,33 +113,33 @@ func (m *QueryParamsResponse) GetParams() Params { } func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "payment.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "payment.QueryParamsResponse") -} - -func init() { proto.RegisterFile("payment/query.proto", fileDescriptor_0d907c42280cbd58) } - -var fileDescriptor_0d907c42280cbd58 = []byte{ - // 291 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x4f, 0x4b, 0xc3, 0x30, - 0x18, 0xc6, 0x5b, 0xd1, 0x09, 0xf1, 0x30, 0xcc, 0x06, 0xca, 0x1c, 0x51, 0x76, 0x12, 0x61, 0x0d, - 0xdb, 0xbe, 0xc1, 0xf0, 0x2a, 0xe8, 0x8e, 0xe2, 0x25, 0x2d, 0x2f, 0xb1, 0xb0, 0xe6, 0xcd, 0x9a, - 0x54, 0xec, 0xd5, 0x4f, 0x20, 0xf8, 0xa5, 0x76, 0x1c, 0x78, 0xf1, 0x24, 0xd2, 0xfa, 0x41, 0x64, - 0x4d, 0x2c, 0x0c, 0xbd, 0xbd, 0x3c, 0x7f, 0x7e, 0x0f, 0x09, 0xe9, 0x69, 0x51, 0x66, 0xa0, 0x2c, - 0x5f, 0x15, 0x90, 0x97, 0x91, 0xce, 0xd1, 0x22, 0x3d, 0xf4, 0xe2, 0xa0, 0x2f, 0x51, 0x62, 0xa3, - 0xf1, 0xed, 0xe5, 0xec, 0xc1, 0x50, 0x22, 0xca, 0x25, 0x70, 0xa1, 0x53, 0x2e, 0x94, 0x42, 0x2b, - 0x6c, 0x8a, 0xca, 0x78, 0xf7, 0x2a, 0x41, 0x93, 0xa1, 0xe1, 0xb1, 0x30, 0xe0, 0xa8, 0xfc, 0x69, - 0x12, 0x83, 0x15, 0x13, 0xae, 0x85, 0x4c, 0x55, 0x13, 0xf6, 0xd9, 0xfe, 0xef, 0xba, 0x16, 0xb9, - 0xc8, 0x3c, 0x61, 0xd4, 0x27, 0xf4, 0x6e, 0xdb, 0xbb, 0x6d, 0xc4, 0x05, 0xac, 0x0a, 0x30, 0x76, - 0x74, 0x4d, 0x7a, 0x3b, 0xaa, 0xd1, 0xa8, 0x0c, 0xd0, 0x31, 0xe9, 0xb8, 0xf2, 0x69, 0x78, 0x11, - 0x5e, 0x1e, 0x4d, 0xbb, 0x91, 0x67, 0x46, 0x2e, 0x38, 0xdf, 0x5f, 0x7f, 0x9e, 0x07, 0x0b, 0x1f, - 0x9a, 0x02, 0x39, 0x68, 0x28, 0xf4, 0x81, 0x74, 0x5c, 0x80, 0x9e, 0xb5, 0x8d, 0xbf, 0xab, 0x83, - 0xe1, 0xff, 0xa6, 0x1b, 0x1f, 0x9d, 0xbc, 0xbc, 0x7f, 0xbf, 0xed, 0x1d, 0xd3, 0x2e, 0xdf, 0x7d, - 0xc8, 0xfc, 0x66, 0x5d, 0xb1, 0x70, 0x53, 0xb1, 0xf0, 0xab, 0x62, 0xe1, 0x6b, 0xcd, 0x82, 0x4d, - 0xcd, 0x82, 0x8f, 0x9a, 0x05, 0xf7, 0x33, 0x99, 0xda, 0xc7, 0x22, 0x8e, 0x12, 0xcc, 0x78, 0x02, - 0x4b, 0x30, 0x36, 0x15, 0x98, 0xcb, 0xf6, 0x1e, 0x0b, 0xad, 0xf9, 0x73, 0xcb, 0xb3, 0xa5, 0x06, - 0x13, 0x77, 0x9a, 0x8f, 0x99, 0xfd, 0x04, 0x00, 0x00, 0xff, 0xff, 0x13, 0xfe, 0x9d, 0xcc, 0xae, - 0x01, 0x00, 0x00, + proto.RegisterType((*QueryParamsRequest)(nil), "blob.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "blob.QueryParamsResponse") +} + +func init() { proto.RegisterFile("blob/query.proto", fileDescriptor_a07e481b352b93f9) } + +var fileDescriptor_a07e481b352b93f9 = []byte{ + // 298 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4a, 0xf4, 0x30, + 0x1c, 0xc4, 0xdb, 0x8f, 0xfd, 0xf6, 0x10, 0x05, 0xdd, 0xb8, 0xe0, 0x5a, 0x24, 0x4a, 0x4f, 0xb2, + 0x60, 0xe3, 0xae, 0x4f, 0xe0, 0x1e, 0x3d, 0xe9, 0x1e, 0x3c, 0x78, 0x91, 0xa4, 0x84, 0x58, 0x68, + 0xf3, 0xcf, 0x36, 0xa9, 0xd8, 0xab, 0x4f, 0x20, 0xf8, 0x52, 0x7b, 0x5c, 0xf0, 0xe2, 0x49, 0xa4, + 0xf5, 0x41, 0xa4, 0x49, 0x11, 0x44, 0x6f, 0x61, 0xe6, 0x37, 0x33, 0xe1, 0x8f, 0x76, 0x79, 0x0e, + 0x9c, 0xae, 0x2a, 0x51, 0xd6, 0x89, 0x2e, 0xc1, 0x02, 0x1e, 0x74, 0x4a, 0x34, 0x96, 0x20, 0xc1, + 0x09, 0xb4, 0x7b, 0x79, 0x2f, 0x3a, 0x94, 0x00, 0x32, 0x17, 0x94, 0xe9, 0x8c, 0x32, 0xa5, 0xc0, + 0x32, 0x9b, 0x81, 0x32, 0xbd, 0x3b, 0x4d, 0xc1, 0x14, 0x60, 0x28, 0x67, 0x46, 0xf8, 0x4a, 0xfa, + 0x30, 0xe3, 0xc2, 0xb2, 0x19, 0xd5, 0x4c, 0x66, 0xca, 0xc1, 0x3d, 0x3b, 0x72, 0xbb, 0x9a, 0x95, + 0xac, 0xe8, 0xe3, 0xf1, 0x18, 0xe1, 0xeb, 0x2e, 0x74, 0xe5, 0xc4, 0xa5, 0x58, 0x55, 0xc2, 0xd8, + 0xf8, 0x02, 0xed, 0xfd, 0x50, 0x8d, 0x06, 0x65, 0x04, 0x9e, 0xa2, 0xa1, 0x0f, 0x4f, 0xc2, 0xe3, + 0xf0, 0x64, 0x6b, 0xbe, 0x9d, 0x74, 0x85, 0x89, 0xa7, 0x16, 0x83, 0xf5, 0xfb, 0x51, 0xb0, 0xec, + 0x89, 0xf9, 0x1d, 0xfa, 0xef, 0x2a, 0xf0, 0x0d, 0x1a, 0x7a, 0x00, 0x4f, 0x3c, 0xfe, 0x7b, 0x2f, + 0x3a, 0xf8, 0xc3, 0xf1, 0x9b, 0xf1, 0xfe, 0xd3, 0xeb, 0xe7, 0xcb, 0xbf, 0x11, 0xde, 0xa1, 0x9a, + 0xd5, 0x85, 0x50, 0xb6, 0xff, 0xff, 0xe2, 0x72, 0xdd, 0x90, 0x70, 0xd3, 0x90, 0xf0, 0xa3, 0x21, + 0xe1, 0x73, 0x4b, 0x82, 0x4d, 0x4b, 0x82, 0xb7, 0x96, 0x04, 0xb7, 0x67, 0x32, 0xb3, 0xf7, 0x15, + 0x4f, 0x52, 0x28, 0x68, 0x2a, 0x72, 0x61, 0x6c, 0xc6, 0xa0, 0x94, 0xdf, 0xef, 0x53, 0xa6, 0x35, + 0x7d, 0xa4, 0xee, 0x18, 0xb6, 0xd6, 0xc2, 0xf0, 0xa1, 0x3b, 0xc6, 0xf9, 0x57, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x2d, 0x89, 0x2a, 0xca, 0x99, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -168,7 +168,7 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/payment.Query/Params", in, out, opts...) + err := c.cc.Invoke(ctx, "/blob.Query/Params", in, out, opts...) if err != nil { return nil, err } @@ -203,7 +203,7 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/payment.Query/Params", + FullMethod: "/blob.Query/Params", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) @@ -212,7 +212,7 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf } var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "payment.Query", + ServiceName: "blob.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { @@ -221,7 +221,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "payment/query.proto", + Metadata: "blob/query.proto", } func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { diff --git a/x/blob/types/query.pb.gw.go b/x/blob/types/query.pb.gw.go index c8bf5a63fb..f7366e51a4 100644 --- a/x/blob/types/query.pb.gw.go +++ b/x/blob/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: payment/query.proto +// source: blob/query.proto /* Package types is a reverse proxy. From 743d6103bc824ceaccf6a273ebd430544aa0fb03 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 10 Nov 2022 12:11:56 +0530 Subject: [PATCH 38/46] fix: query params url --- proto/blob/query.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/blob/query.proto b/proto/blob/query.proto index c3fa8efd28..6ee2914230 100644 --- a/proto/blob/query.proto +++ b/proto/blob/query.proto @@ -12,7 +12,7 @@ option go_package = "github.com/celestiaorg/celestia-app/x/blob/types"; service Query { // Params queries the parameters of the module. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/payment/params"; + option (google.api.http).get = "/blob/params"; } } From 713ca6272ba1e1547d8f690b966972e4f15108b1 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 10 Nov 2022 12:12:15 +0530 Subject: [PATCH 39/46] chore: generate files fromn protobuf --- x/blob/types/query.pb.go | 40 ++++++++++++++++++------------------- x/blob/types/query.pb.gw.go | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/x/blob/types/query.pb.go b/x/blob/types/query.pb.go index edeb73a2c1..1b57155ef6 100644 --- a/x/blob/types/query.pb.go +++ b/x/blob/types/query.pb.go @@ -120,26 +120,26 @@ func init() { func init() { proto.RegisterFile("blob/query.proto", fileDescriptor_a07e481b352b93f9) } var fileDescriptor_a07e481b352b93f9 = []byte{ - // 298 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4a, 0xf4, 0x30, - 0x1c, 0xc4, 0xdb, 0x8f, 0xfd, 0xf6, 0x10, 0x05, 0xdd, 0xb8, 0xe0, 0x5a, 0x24, 0x4a, 0x4f, 0xb2, - 0x60, 0xe3, 0xae, 0x4f, 0xe0, 0x1e, 0x3d, 0xe9, 0x1e, 0x3c, 0x78, 0x91, 0xa4, 0x84, 0x58, 0x68, - 0xf3, 0xcf, 0x36, 0xa9, 0xd8, 0xab, 0x4f, 0x20, 0xf8, 0x52, 0x7b, 0x5c, 0xf0, 0xe2, 0x49, 0xa4, - 0xf5, 0x41, 0xa4, 0x49, 0x11, 0x44, 0x6f, 0x61, 0xe6, 0x37, 0x33, 0xe1, 0x8f, 0x76, 0x79, 0x0e, - 0x9c, 0xae, 0x2a, 0x51, 0xd6, 0x89, 0x2e, 0xc1, 0x02, 0x1e, 0x74, 0x4a, 0x34, 0x96, 0x20, 0xc1, - 0x09, 0xb4, 0x7b, 0x79, 0x2f, 0x3a, 0x94, 0x00, 0x32, 0x17, 0x94, 0xe9, 0x8c, 0x32, 0xa5, 0xc0, - 0x32, 0x9b, 0x81, 0x32, 0xbd, 0x3b, 0x4d, 0xc1, 0x14, 0x60, 0x28, 0x67, 0x46, 0xf8, 0x4a, 0xfa, - 0x30, 0xe3, 0xc2, 0xb2, 0x19, 0xd5, 0x4c, 0x66, 0xca, 0xc1, 0x3d, 0x3b, 0x72, 0xbb, 0x9a, 0x95, - 0xac, 0xe8, 0xe3, 0xf1, 0x18, 0xe1, 0xeb, 0x2e, 0x74, 0xe5, 0xc4, 0xa5, 0x58, 0x55, 0xc2, 0xd8, - 0xf8, 0x02, 0xed, 0xfd, 0x50, 0x8d, 0x06, 0x65, 0x04, 0x9e, 0xa2, 0xa1, 0x0f, 0x4f, 0xc2, 0xe3, - 0xf0, 0x64, 0x6b, 0xbe, 0x9d, 0x74, 0x85, 0x89, 0xa7, 0x16, 0x83, 0xf5, 0xfb, 0x51, 0xb0, 0xec, - 0x89, 0xf9, 0x1d, 0xfa, 0xef, 0x2a, 0xf0, 0x0d, 0x1a, 0x7a, 0x00, 0x4f, 0x3c, 0xfe, 0x7b, 0x2f, - 0x3a, 0xf8, 0xc3, 0xf1, 0x9b, 0xf1, 0xfe, 0xd3, 0xeb, 0xe7, 0xcb, 0xbf, 0x11, 0xde, 0xa1, 0x9a, - 0xd5, 0x85, 0x50, 0xb6, 0xff, 0xff, 0xe2, 0x72, 0xdd, 0x90, 0x70, 0xd3, 0x90, 0xf0, 0xa3, 0x21, - 0xe1, 0x73, 0x4b, 0x82, 0x4d, 0x4b, 0x82, 0xb7, 0x96, 0x04, 0xb7, 0x67, 0x32, 0xb3, 0xf7, 0x15, - 0x4f, 0x52, 0x28, 0x68, 0x2a, 0x72, 0x61, 0x6c, 0xc6, 0xa0, 0x94, 0xdf, 0xef, 0x53, 0xa6, 0x35, - 0x7d, 0xa4, 0xee, 0x18, 0xb6, 0xd6, 0xc2, 0xf0, 0xa1, 0x3b, 0xc6, 0xf9, 0x57, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x2d, 0x89, 0x2a, 0xca, 0x99, 0x01, 0x00, 0x00, + // 290 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x41, 0x4b, 0xc3, 0x30, + 0x1c, 0xc5, 0x5b, 0x99, 0x3d, 0xc4, 0x21, 0x1a, 0x7b, 0x98, 0x45, 0xa2, 0xf4, 0x24, 0x03, 0x1b, + 0x37, 0x3f, 0x81, 0x3b, 0x7a, 0xd2, 0x79, 0x13, 0x2f, 0x49, 0x09, 0xb1, 0xd0, 0xf6, 0x9f, 0x35, + 0xa9, 0xb8, 0xab, 0x9f, 0x40, 0xf0, 0x4b, 0xed, 0x38, 0xf0, 0xe2, 0x49, 0xa4, 0xf5, 0x83, 0x48, + 0x93, 0x22, 0x8a, 0xbb, 0xfd, 0x79, 0xef, 0xf7, 0xde, 0x0b, 0x41, 0x7b, 0x3c, 0x07, 0x4e, 0x17, + 0xb5, 0xa8, 0x96, 0x89, 0xaa, 0xc0, 0x00, 0x1e, 0x74, 0x4a, 0x14, 0x4a, 0x90, 0x60, 0x05, 0xda, + 0x5d, 0xce, 0x8b, 0x8e, 0x24, 0x80, 0xcc, 0x05, 0x65, 0x2a, 0xa3, 0xac, 0x2c, 0xc1, 0x30, 0x93, + 0x41, 0xa9, 0x7b, 0x77, 0x9c, 0x82, 0x2e, 0x40, 0x53, 0xce, 0xb4, 0x70, 0x95, 0xf4, 0x71, 0xc2, + 0x85, 0x61, 0x13, 0xaa, 0x98, 0xcc, 0x4a, 0x0b, 0xf7, 0xec, 0xbe, 0xdd, 0x55, 0xac, 0x62, 0x45, + 0x1f, 0x8f, 0x43, 0x84, 0x6f, 0xba, 0xd0, 0xb5, 0x15, 0xe7, 0x62, 0x51, 0x0b, 0x6d, 0xe2, 0x4b, + 0x74, 0xf0, 0x47, 0xd5, 0x0a, 0x4a, 0x2d, 0xf0, 0x18, 0x05, 0x2e, 0x3c, 0xf2, 0x4f, 0xfc, 0xd3, + 0x9d, 0xe9, 0x30, 0xe9, 0x0a, 0x13, 0x47, 0xcd, 0x06, 0xab, 0x8f, 0x63, 0x6f, 0xde, 0x13, 0xd3, + 0x7b, 0xb4, 0x6d, 0x2b, 0xf0, 0x2d, 0x0a, 0x1c, 0x80, 0x47, 0x0e, 0xff, 0xbf, 0x17, 0x1d, 0x6e, + 0x70, 0xdc, 0x66, 0x1c, 0x3e, 0xbf, 0x7d, 0xbd, 0x6e, 0xed, 0xe2, 0x21, 0xfd, 0xf5, 0xf8, 0xd9, + 0xd5, 0xaa, 0x21, 0xfe, 0xba, 0x21, 0xfe, 0x67, 0x43, 0xfc, 0x97, 0x96, 0x78, 0xeb, 0x96, 0x78, + 0xef, 0x2d, 0xf1, 0xee, 0xce, 0x65, 0x66, 0x1e, 0x6a, 0x9e, 0xa4, 0x50, 0xd0, 0x54, 0xe4, 0x42, + 0x9b, 0x8c, 0x41, 0x25, 0x7f, 0xee, 0x33, 0xa6, 0x14, 0x7d, 0x72, 0x65, 0x66, 0xa9, 0x84, 0xe6, + 0x81, 0xfd, 0x89, 0x8b, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc5, 0xce, 0x07, 0x7d, 0x96, 0x01, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/blob/types/query.pb.gw.go b/x/blob/types/query.pb.gw.go index f7366e51a4..38d4c09ad4 100644 --- a/x/blob/types/query.pb.gw.go +++ b/x/blob/types/query.pb.gw.go @@ -145,7 +145,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"payment", "params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"blob", "params"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( From 807bc7ddff9d962922b5f58efa96e9ec27f11d0b Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 10 Nov 2022 12:13:48 +0530 Subject: [PATCH 40/46] chore: grammar --- proto/blob/query.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/blob/query.proto b/proto/blob/query.proto index 6ee2914230..0210bbbc4e 100644 --- a/proto/blob/query.proto +++ b/proto/blob/query.proto @@ -8,7 +8,7 @@ import "blob/params.proto"; option go_package = "github.com/celestiaorg/celestia-app/x/blob/types"; -// Query defines the gRPC querier service. +// Query defines the gRPC query service. service Query { // Params queries the parameters of the module. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { From 1bb4b1efe8d27e77aed67b5a8d57f22102e9549b Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 10 Nov 2022 12:14:24 +0530 Subject: [PATCH 41/46] chore: grammar --- x/blob/keeper/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/blob/keeper/params.go b/x/blob/keeper/params.go index 3607bbf413..0cacb422b1 100644 --- a/x/blob/keeper/params.go +++ b/x/blob/keeper/params.go @@ -13,7 +13,7 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { ) } -// SetParams set the params +// SetParams sets the params func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { k.paramStore.SetParamSet(ctx, ¶ms) } From cab417299758c9d50e222f6edd35e4104460cb8b Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 10 Nov 2022 12:17:53 +0530 Subject: [PATCH 42/46] chore: rename payment to blob --- app/app.go | 6 +++--- testutil/keeper/payment.go | 8 ++++---- x/blob/client/cli/query_params.go | 2 +- x/blob/genesis_test.go | 12 ++++++------ x/blob/keeper/grpc_query.go | 2 +- x/blob/keeper/grpc_query_params.go | 2 +- x/blob/keeper/grpc_query_params_test.go | 4 ++-- x/blob/keeper/params.go | 2 +- x/blob/keeper/params_test.go | 4 ++-- x/blob/types/params.go | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/app.go b/app/app.go index 17f774625e..8a7d36e4ca 100644 --- a/app/app.go +++ b/app/app.go @@ -367,9 +367,9 @@ func New( app.BlobKeeper = *blobmodulekeeper.NewKeeper( appCodec, - keys[paymentmoduletypes.StoreKey], - keys[paymentmoduletypes.MemStoreKey], - app.GetSubspace(paymentmoduletypes.ModuleName), + keys[blobmoduletypes.StoreKey], + keys[blobmoduletypes.MemStoreKey], + app.GetSubspace(blobmoduletypes.ModuleName), ) blobmod := blobmodule.NewAppModule(appCodec, app.BlobKeeper) diff --git a/testutil/keeper/payment.go b/testutil/keeper/payment.go index 1b0aba0571..e0dfb2f258 100644 --- a/testutil/keeper/payment.go +++ b/testutil/keeper/payment.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/celestiaorg/celestia-app/testutil" - "github.com/celestiaorg/celestia-app/x/payment/keeper" - "github.com/celestiaorg/celestia-app/x/payment/types" + "github.com/celestiaorg/celestia-app/x/blob/keeper" + "github.com/celestiaorg/celestia-app/x/blob/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store" @@ -18,7 +18,7 @@ import ( tmdb "github.com/tendermint/tm-db" ) -func PaymentKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { +func BlobKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) @@ -35,7 +35,7 @@ func PaymentKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { testutil.MakeTestCodec(), storeKey, memStoreKey, - "Payment", + "Blob", ) k := keeper.NewKeeper( cdc, diff --git a/x/blob/client/cli/query_params.go b/x/blob/client/cli/query_params.go index b6aeabfa11..7c59e94e8c 100644 --- a/x/blob/client/cli/query_params.go +++ b/x/blob/client/cli/query_params.go @@ -3,7 +3,7 @@ package cli import ( "context" - "github.com/celestiaorg/celestia-app/x/payment/types" + "github.com/celestiaorg/celestia-app/x/blob/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" diff --git a/x/blob/genesis_test.go b/x/blob/genesis_test.go index c5e5d8433c..bb37aec832 100644 --- a/x/blob/genesis_test.go +++ b/x/blob/genesis_test.go @@ -1,11 +1,11 @@ -package payment_test +package blob_test import ( "testing" keepertest "github.com/celestiaorg/celestia-app/testutil/keeper" - "github.com/celestiaorg/celestia-app/x/payment" - "github.com/celestiaorg/celestia-app/x/payment/types" + "github.com/celestiaorg/celestia-app/x/blob" + "github.com/celestiaorg/celestia-app/x/blob/types" "github.com/stretchr/testify/require" ) @@ -14,9 +14,9 @@ func TestGenesis(t *testing.T) { Params: types.DefaultParams(), } - k, ctx := keepertest.PaymentKeeper(t) - payment.InitGenesis(ctx, *k, genesisState) - got := payment.ExportGenesis(ctx, *k) + k, ctx := keepertest.BlobKeeper(t) + blob.InitGenesis(ctx, *k, genesisState) + got := blob.ExportGenesis(ctx, *k) require.NotNil(t, got) require.Equal(t, types.DefaultParams(), got.Params) } diff --git a/x/blob/keeper/grpc_query.go b/x/blob/keeper/grpc_query.go index f5e93a4906..a81d6f19f3 100644 --- a/x/blob/keeper/grpc_query.go +++ b/x/blob/keeper/grpc_query.go @@ -1,7 +1,7 @@ package keeper import ( - "github.com/celestiaorg/celestia-app/x/payment/types" + "github.com/celestiaorg/celestia-app/x/blob/types" ) var _ types.QueryServer = Keeper{} diff --git a/x/blob/keeper/grpc_query_params.go b/x/blob/keeper/grpc_query_params.go index 51930666a8..492c428c26 100644 --- a/x/blob/keeper/grpc_query_params.go +++ b/x/blob/keeper/grpc_query_params.go @@ -3,7 +3,7 @@ package keeper import ( "context" - "github.com/celestiaorg/celestia-app/x/payment/types" + "github.com/celestiaorg/celestia-app/x/blob/types" sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/x/blob/keeper/grpc_query_params_test.go b/x/blob/keeper/grpc_query_params_test.go index 950adc390f..52075f435b 100644 --- a/x/blob/keeper/grpc_query_params_test.go +++ b/x/blob/keeper/grpc_query_params_test.go @@ -4,13 +4,13 @@ import ( "testing" testkeeper "github.com/celestiaorg/celestia-app/testutil/keeper" - "github.com/celestiaorg/celestia-app/x/payment/types" + "github.com/celestiaorg/celestia-app/x/blob/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" ) func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.PaymentKeeper(t) + keeper, ctx := testkeeper.BlobKeeper(t) wctx := sdk.WrapSDKContext(ctx) params := types.DefaultParams() keeper.SetParams(ctx, params) diff --git a/x/blob/keeper/params.go b/x/blob/keeper/params.go index 0cacb422b1..2fa1c3e065 100644 --- a/x/blob/keeper/params.go +++ b/x/blob/keeper/params.go @@ -1,7 +1,7 @@ package keeper import ( - "github.com/celestiaorg/celestia-app/x/payment/types" + "github.com/celestiaorg/celestia-app/x/blob/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/blob/keeper/params_test.go b/x/blob/keeper/params_test.go index eb5c44a75b..e8d29f4857 100644 --- a/x/blob/keeper/params_test.go +++ b/x/blob/keeper/params_test.go @@ -4,12 +4,12 @@ import ( "testing" testkeeper "github.com/celestiaorg/celestia-app/testutil/keeper" - "github.com/celestiaorg/celestia-app/x/payment/types" + "github.com/celestiaorg/celestia-app/x/blob/types" "github.com/stretchr/testify/require" ) func TestGetParams(t *testing.T) { - k, ctx := testkeeper.PaymentKeeper(t) + k, ctx := testkeeper.BlobKeeper(t) params := types.DefaultParams() k.SetParams(ctx, params) diff --git a/x/blob/types/params.go b/x/blob/types/params.go index ec82857ed4..c94c37843d 100644 --- a/x/blob/types/params.go +++ b/x/blob/types/params.go @@ -19,7 +19,7 @@ var ( DefaultMaxSquareSize uint32 = 128 ) -// ParamKeyTable returns the param key table for the payment module +// ParamKeyTable returns the param key table for the blob module func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } From d8617cd435f71cedb3d4d6b590331f83feadf90f Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 10 Nov 2022 15:52:42 +0530 Subject: [PATCH 43/46] chore: rename payment to blob --- testutil/keeper/{payment.go => blob.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename testutil/keeper/{payment.go => blob.go} (100%) diff --git a/testutil/keeper/payment.go b/testutil/keeper/blob.go similarity index 100% rename from testutil/keeper/payment.go rename to testutil/keeper/blob.go From 7b93b936215b10aece8c180de10f6d29c669fdcf Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 10 Nov 2022 15:53:00 +0530 Subject: [PATCH 44/46] chore: add order validation for min/max square size --- x/blob/types/params.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/x/blob/types/params.go b/x/blob/types/params.go index c94c37843d..5f7246e2c5 100644 --- a/x/blob/types/params.go +++ b/x/blob/types/params.go @@ -61,6 +61,10 @@ func (p Params) Validate() error { return err } + if err := validateMinMaxSquareSizeOrder(p.MinSquareSize, p.MaxSquareSize); err != nil { + return err + } + return nil } @@ -97,3 +101,10 @@ func validateMaxSquareSize(v interface{}) error { return nil } + +func validateMinMaxSquareSizeOrder(minSquareSize, maxSquareSize uint32) error { + if minSquareSize >= maxSquareSize { + return fmt.Errorf("min square size cannot be less than max square size") + } + return nil +} From 837bdaaadac13034a071d58db53ae76bbce1ba32 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 10 Nov 2022 15:53:58 +0530 Subject: [PATCH 45/46] chore: min and max square size can be same --- x/blob/types/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/blob/types/params.go b/x/blob/types/params.go index 5f7246e2c5..f3e88ff3b1 100644 --- a/x/blob/types/params.go +++ b/x/blob/types/params.go @@ -103,7 +103,7 @@ func validateMaxSquareSize(v interface{}) error { } func validateMinMaxSquareSizeOrder(minSquareSize, maxSquareSize uint32) error { - if minSquareSize >= maxSquareSize { + if minSquareSize > maxSquareSize { return fmt.Errorf("min square size cannot be less than max square size") } return nil From 17669da1be253978728256eda4a8ed4619ea5121 Mon Sep 17 00:00:00 2001 From: Rahul Ghangas Date: Thu, 10 Nov 2022 19:23:48 +0530 Subject: [PATCH 46/46] fix: typo --- x/blob/types/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/blob/types/params.go b/x/blob/types/params.go index f3e88ff3b1..600f33c859 100644 --- a/x/blob/types/params.go +++ b/x/blob/types/params.go @@ -104,7 +104,7 @@ func validateMaxSquareSize(v interface{}) error { func validateMinMaxSquareSizeOrder(minSquareSize, maxSquareSize uint32) error { if minSquareSize > maxSquareSize { - return fmt.Errorf("min square size cannot be less than max square size") + return fmt.Errorf("max square size cannot be less than min square size") } return nil }