feat: x/blocksdk full module (#192)

* module proto

* lane proto

* proto-gen

* proto-format

* regenerate

* genesis

* stub

* test

* comment

* new keeper functions

* finalize

* lint fix

* proto format

* encounteredLanes

* make protos

* generate

* generate

* msgs

* msgs test

* msg service

* grpc query

* add module

* add module assertions

* add client

* fix proto

* typo
This commit is contained in:
Alex Johnson 2023-11-06 07:49:52 -05:00 committed by GitHub
parent ef654f5cbf
commit 79b9434615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 6860 additions and 15 deletions

View File

@ -574,12 +574,15 @@ type Lane struct {
// max_block_space defines the relative percentage of block space that can be
// used by this lane. NOTE: If this is set to zero, then there is no limit
// on the number of transactions that can be included in the block for this
// lane (up to maxTxBytes as provided by the request). This is useful for the default lane.
// lane (up to maxTxBytes as provided by the request). This is useful for the
// default lane.
MaxBlockSpace string `protobuf:"bytes,2,opt,name=max_block_space,json=maxBlockSpace,proto3" json:"max_block_space,omitempty"`
// order is the priority ordering of the Lane. Lane orders should be set in order of priority
// starting from 0, monotonically increasing and non-overlapping. A lane with a lower order value
// will have a higher priority over a lane with a higher order value. For example, if LaneA has
// priority of 0 and LaneB has a priority of 1, LaneA has priority over LaneB.
// order is the priority ordering of the Lane when processed in
// PrepareProposal and ProcessProposal. Lane orders should be set in order of
// priority starting from 0, monotonically increasing and non-overlapping. A
// lane with a lower order value will have a higher priority over a lane with
// a higher order value. For example, if LaneA has priority of 0 and LaneB
// has a priority of 1, LaneA has priority over LaneB.
Order uint64 `protobuf:"varint,3,opt,name=order,proto3" json:"order,omitempty"`
}

View File

@ -0,0 +1,652 @@
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
package blocksdkv1
import (
fmt "fmt"
runtime "github.com/cosmos/cosmos-proto/runtime"
_ "github.com/cosmos/gogoproto/gogoproto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
io "io"
reflect "reflect"
sync "sync"
)
var _ protoreflect.List = (*_GenesisState_1_list)(nil)
type _GenesisState_1_list struct {
list *[]*Lane
}
func (x *_GenesisState_1_list) Len() int {
if x.list == nil {
return 0
}
return len(*x.list)
}
func (x *_GenesisState_1_list) Get(i int) protoreflect.Value {
return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect())
}
func (x *_GenesisState_1_list) Set(i int, value protoreflect.Value) {
valueUnwrapped := value.Message()
concreteValue := valueUnwrapped.Interface().(*Lane)
(*x.list)[i] = concreteValue
}
func (x *_GenesisState_1_list) Append(value protoreflect.Value) {
valueUnwrapped := value.Message()
concreteValue := valueUnwrapped.Interface().(*Lane)
*x.list = append(*x.list, concreteValue)
}
func (x *_GenesisState_1_list) AppendMutable() protoreflect.Value {
v := new(Lane)
*x.list = append(*x.list, v)
return protoreflect.ValueOfMessage(v.ProtoReflect())
}
func (x *_GenesisState_1_list) Truncate(n int) {
for i := n; i < len(*x.list); i++ {
(*x.list)[i] = nil
}
*x.list = (*x.list)[:n]
}
func (x *_GenesisState_1_list) NewElement() protoreflect.Value {
v := new(Lane)
return protoreflect.ValueOfMessage(v.ProtoReflect())
}
func (x *_GenesisState_1_list) IsValid() bool {
return x.list != nil
}
var (
md_GenesisState protoreflect.MessageDescriptor
fd_GenesisState_lanes protoreflect.FieldDescriptor
)
func init() {
file_sdk_blocksdk_v1_genesis_proto_init()
md_GenesisState = File_sdk_blocksdk_v1_genesis_proto.Messages().ByName("GenesisState")
fd_GenesisState_lanes = md_GenesisState.Fields().ByName("lanes")
}
var _ protoreflect.Message = (*fastReflection_GenesisState)(nil)
type fastReflection_GenesisState GenesisState
func (x *GenesisState) ProtoReflect() protoreflect.Message {
return (*fastReflection_GenesisState)(x)
}
func (x *GenesisState) slowProtoReflect() protoreflect.Message {
mi := &file_sdk_blocksdk_v1_genesis_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType
var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{}
type fastReflection_GenesisState_messageType struct{}
func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message {
return (*fastReflection_GenesisState)(nil)
}
func (x fastReflection_GenesisState_messageType) New() protoreflect.Message {
return new(fastReflection_GenesisState)
}
func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_GenesisState
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor {
return md_GenesisState
}
// Type returns the message type, which encapsulates both Go and protobuf
// type information. If the Go type information is not needed,
// it is recommended that the message descriptor be used instead.
func (x *fastReflection_GenesisState) Type() protoreflect.MessageType {
return _fastReflection_GenesisState_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_GenesisState) New() protoreflect.Message {
return new(fastReflection_GenesisState)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage {
return (*GenesisState)(x)
}
// Range iterates over every populated field in an undefined order,
// calling f for each field descriptor and value encountered.
// Range returns immediately if f returns false.
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if len(x.Lanes) != 0 {
value := protoreflect.ValueOfList(&_GenesisState_1_list{list: &x.Lanes})
if !f(fd_GenesisState_lanes, value) {
return
}
}
}
// Has reports whether a field is populated.
//
// Some fields have the property of nullability where it is possible to
// distinguish between the default value of a field and whether the field
// was explicitly populated with the default value. Singular message fields,
// member fields of a oneof, and proto2 scalar fields are nullable. Such
// fields are populated only if explicitly set.
//
// In other cases (aside from the nullable cases above),
// a proto3 scalar field is populated if it contains a non-zero value, and
// a repeated field is populated if it is non-empty.
func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "sdk.blocksdk.v1.GenesisState.lanes":
return len(x.Lanes) != 0
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.v1.GenesisState"))
}
panic(fmt.Errorf("message sdk.blocksdk.v1.GenesisState does not contain field %s", fd.FullName()))
}
}
// Clear clears the field such that a subsequent Has call reports false.
//
// Clearing an extension field clears both the extension type and value
// associated with the given field number.
//
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "sdk.blocksdk.v1.GenesisState.lanes":
x.Lanes = nil
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.v1.GenesisState"))
}
panic(fmt.Errorf("message sdk.blocksdk.v1.GenesisState does not contain field %s", fd.FullName()))
}
}
// Get retrieves the value for a field.
//
// For unpopulated scalars, it returns the default value, where
// the default value of a bytes scalar is guaranteed to be a copy.
// For unpopulated composite types, it returns an empty, read-only view
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "sdk.blocksdk.v1.GenesisState.lanes":
if len(x.Lanes) == 0 {
return protoreflect.ValueOfList(&_GenesisState_1_list{})
}
listValue := &_GenesisState_1_list{list: &x.Lanes}
return protoreflect.ValueOfList(listValue)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.v1.GenesisState"))
}
panic(fmt.Errorf("message sdk.blocksdk.v1.GenesisState does not contain field %s", descriptor.FullName()))
}
}
// Set stores the value for a field.
//
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType.
// When setting a composite type, it is unspecified whether the stored value
// aliases the source's memory in any way. If the composite value is an
// empty, read-only value, then it panics.
//
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "sdk.blocksdk.v1.GenesisState.lanes":
lv := value.List()
clv := lv.(*_GenesisState_1_list)
x.Lanes = *clv.list
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.v1.GenesisState"))
}
panic(fmt.Errorf("message sdk.blocksdk.v1.GenesisState does not contain field %s", fd.FullName()))
}
}
// Mutable returns a mutable reference to a composite type.
//
// If the field is unpopulated, it may allocate a composite value.
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType
// if not already stored.
// It panics if the field does not contain a composite type.
//
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "sdk.blocksdk.v1.GenesisState.lanes":
if x.Lanes == nil {
x.Lanes = []*Lane{}
}
value := &_GenesisState_1_list{list: &x.Lanes}
return protoreflect.ValueOfList(value)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.v1.GenesisState"))
}
panic(fmt.Errorf("message sdk.blocksdk.v1.GenesisState does not contain field %s", fd.FullName()))
}
}
// NewField returns a new value that is assignable to the field
// for the given descriptor. For scalars, this returns the default value.
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "sdk.blocksdk.v1.GenesisState.lanes":
list := []*Lane{}
return protoreflect.ValueOfList(&_GenesisState_1_list{list: &list})
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.v1.GenesisState"))
}
panic(fmt.Errorf("message sdk.blocksdk.v1.GenesisState does not contain field %s", fd.FullName()))
}
}
// WhichOneof reports which field within the oneof is populated,
// returning nil if none are populated.
// It panics if the oneof descriptor does not belong to this message.
func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in sdk.blocksdk.v1.GenesisState", d.FullName()))
}
panic("unreachable")
}
// GetUnknown retrieves the entire list of unknown fields.
// The caller may only mutate the contents of the RawFields
// if the mutated bytes are stored back into the message with SetUnknown.
func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields {
return x.unknownFields
}
// SetUnknown stores an entire list of unknown fields.
// The raw fields must be syntactically valid according to the wire format.
// An implementation may panic if this is not the case.
// Once stored, the caller must not mutate the content of the RawFields.
// An empty RawFields may be passed to clear the fields.
//
// SetUnknown is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) {
x.unknownFields = fields
}
// IsValid reports whether the message is valid.
//
// An invalid message is an empty, read-only value.
//
// An invalid message often corresponds to a nil pointer of the concrete
// message type, but the details are implementation dependent.
// Validity is not part of the protobuf data model, and may not
// be preserved in marshaling or other operations.
func (x *fastReflection_GenesisState) IsValid() bool {
return x != nil
}
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
// This method may return nil.
//
// The returned methods type is identical to
// "google.golang.org/protobuf/runtime/protoiface".Methods.
// Consult the protoiface package documentation for details.
func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*GenesisState)
if x == nil {
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: 0,
}
}
options := runtime.SizeInputToOptions(input)
_ = options
var n int
var l int
_ = l
if len(x.Lanes) > 0 {
for _, e := range x.Lanes {
l = options.Size(e)
n += 1 + l + runtime.Sov(uint64(l))
}
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: n,
}
}
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
x := input.Message.Interface().(*GenesisState)
if x == nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
options := runtime.MarshalInputToOptions(input)
_ = options
size := options.Size(x)
dAtA := make([]byte, size)
i := len(dAtA)
_ = i
var l int
_ = l
if x.unknownFields != nil {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Lanes) > 0 {
for iNdEx := len(x.Lanes) - 1; iNdEx >= 0; iNdEx-- {
encoded, err := options.Marshal(x.Lanes[iNdEx])
if err != nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, err
}
i -= len(encoded)
copy(dAtA[i:], encoded)
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
i--
dAtA[i] = 0xa
}
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
input.Buf = dAtA
}
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
x := input.Message.Interface().(*GenesisState)
if x == nil {
return protoiface.UnmarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Flags: input.Flags,
}, nil
}
options := runtime.UnmarshalInputToOptions(input)
_ = options
dAtA := input.Buf
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Lanes", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Lanes = append(x.Lanes, &Lane{})
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Lanes[len(x.Lanes)-1]); err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
if err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if !options.DiscardUnknown {
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
}
iNdEx += skippy
}
}
if iNdEx > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
}
return &protoiface.Methods{
NoUnkeyedLiterals: struct{}{},
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
Size: size,
Marshal: marshal,
Unmarshal: unmarshal,
Merge: nil,
CheckInitialized: nil,
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.0
// protoc (unknown)
// source: sdk/blocksdk/v1/genesis.proto
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// GenesisState defines the genesis state of the x/blocksdk module.
type GenesisState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// lanes is the list of all configured lanes at genesis time.
Lanes []*Lane `protobuf:"bytes,1,rep,name=lanes,proto3" json:"lanes,omitempty"`
}
func (x *GenesisState) Reset() {
*x = GenesisState{}
if protoimpl.UnsafeEnabled {
mi := &file_sdk_blocksdk_v1_genesis_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GenesisState) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GenesisState) ProtoMessage() {}
// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead.
func (*GenesisState) Descriptor() ([]byte, []int) {
return file_sdk_blocksdk_v1_genesis_proto_rawDescGZIP(), []int{0}
}
func (x *GenesisState) GetLanes() []*Lane {
if x != nil {
return x.Lanes
}
return nil
}
var File_sdk_blocksdk_v1_genesis_proto protoreflect.FileDescriptor
var file_sdk_blocksdk_v1_genesis_proto_rawDesc = []byte{
0x0a, 0x1d, 0x73, 0x64, 0x6b, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x2f, 0x76,
0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x0f, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x2e, 0x76, 0x31,
0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x73, 0x64, 0x6b, 0x2f, 0x62, 0x6c, 0x6f, 0x63,
0x6b, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x41, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69,
0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x6c, 0x61, 0x6e, 0x65, 0x73, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x6c, 0x6f, 0x63,
0x6b, 0x73, 0x64, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x61, 0x6e, 0x65, 0x42, 0x04, 0xc8, 0xde,
0x1f, 0x00, 0x52, 0x05, 0x6c, 0x61, 0x6e, 0x65, 0x73, 0x42, 0xae, 0x01, 0x0a, 0x13, 0x63, 0x6f,
0x6d, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x2e, 0x76,
0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,
0x01, 0x5a, 0x2b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b,
0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x76, 0x31, 0xa2, 0x02,
0x03, 0x53, 0x42, 0x58, 0xaa, 0x02, 0x0f, 0x53, 0x64, 0x6b, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b,
0x73, 0x64, 0x6b, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0f, 0x53, 0x64, 0x6b, 0x5c, 0x42, 0x6c, 0x6f,
0x63, 0x6b, 0x73, 0x64, 0x6b, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1b, 0x53, 0x64, 0x6b, 0x5c, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x53, 0x64, 0x6b, 0x3a, 0x3a, 0x42, 0x6c,
0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
}
var (
file_sdk_blocksdk_v1_genesis_proto_rawDescOnce sync.Once
file_sdk_blocksdk_v1_genesis_proto_rawDescData = file_sdk_blocksdk_v1_genesis_proto_rawDesc
)
func file_sdk_blocksdk_v1_genesis_proto_rawDescGZIP() []byte {
file_sdk_blocksdk_v1_genesis_proto_rawDescOnce.Do(func() {
file_sdk_blocksdk_v1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_sdk_blocksdk_v1_genesis_proto_rawDescData)
})
return file_sdk_blocksdk_v1_genesis_proto_rawDescData
}
var file_sdk_blocksdk_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_sdk_blocksdk_v1_genesis_proto_goTypes = []interface{}{
(*GenesisState)(nil), // 0: sdk.blocksdk.v1.GenesisState
(*Lane)(nil), // 1: sdk.blocksdk.v1.Lane
}
var file_sdk_blocksdk_v1_genesis_proto_depIdxs = []int32{
1, // 0: sdk.blocksdk.v1.GenesisState.lanes:type_name -> sdk.blocksdk.v1.Lane
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_sdk_blocksdk_v1_genesis_proto_init() }
func file_sdk_blocksdk_v1_genesis_proto_init() {
if File_sdk_blocksdk_v1_genesis_proto != nil {
return
}
file_sdk_blocksdk_v1_blocksdk_proto_init()
if !protoimpl.UnsafeEnabled {
file_sdk_blocksdk_v1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GenesisState); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_sdk_blocksdk_v1_genesis_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_sdk_blocksdk_v1_genesis_proto_goTypes,
DependencyIndexes: file_sdk_blocksdk_v1_genesis_proto_depIdxs,
MessageInfos: file_sdk_blocksdk_v1_genesis_proto_msgTypes,
}.Build()
File_sdk_blocksdk_v1_genesis_proto = out.File
file_sdk_blocksdk_v1_genesis_proto_rawDesc = nil
file_sdk_blocksdk_v1_genesis_proto_goTypes = nil
file_sdk_blocksdk_v1_genesis_proto_depIdxs = nil
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,150 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: sdk/blocksdk/v1/query.proto
package blocksdkv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Query_Lane_FullMethodName = "/sdk.blocksdk.v1.Query/Lane"
Query_Lanes_FullMethodName = "/sdk.blocksdk.v1.Query/Lanes"
)
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type QueryClient interface {
// Lane queries the a lane by its id.
Lane(ctx context.Context, in *QueryLaneRequest, opts ...grpc.CallOption) (*QueryLaneResponse, error)
// Lane queries all lanes in the x/blocksdk module
Lanes(ctx context.Context, in *QueryLanesRequest, opts ...grpc.CallOption) (*QueryLanesResponse, error)
}
type queryClient struct {
cc grpc.ClientConnInterface
}
func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Lane(ctx context.Context, in *QueryLaneRequest, opts ...grpc.CallOption) (*QueryLaneResponse, error) {
out := new(QueryLaneResponse)
err := c.cc.Invoke(ctx, Query_Lane_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Lanes(ctx context.Context, in *QueryLanesRequest, opts ...grpc.CallOption) (*QueryLanesResponse, error) {
out := new(QueryLanesResponse)
err := c.cc.Invoke(ctx, Query_Lanes_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
type QueryServer interface {
// Lane queries the a lane by its id.
Lane(context.Context, *QueryLaneRequest) (*QueryLaneResponse, error)
// Lane queries all lanes in the x/blocksdk module
Lanes(context.Context, *QueryLanesRequest) (*QueryLanesResponse, error)
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (UnimplementedQueryServer) Lane(context.Context, *QueryLaneRequest) (*QueryLaneResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Lane not implemented")
}
func (UnimplementedQueryServer) Lanes(context.Context, *QueryLanesRequest) (*QueryLanesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Lanes not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
// result in compilation errors.
type UnsafeQueryServer interface {
mustEmbedUnimplementedQueryServer()
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
s.RegisterService(&Query_ServiceDesc, srv)
}
func _Query_Lane_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryLaneRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Lane(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Lane_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Lane(ctx, req.(*QueryLaneRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Lanes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryLanesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Lanes(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Lanes_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Lanes(ctx, req.(*QueryLanesRequest))
}
return interceptor(ctx, in, info, handler)
}
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Query_ServiceDesc = grpc.ServiceDesc{
ServiceName: "sdk.blocksdk.v1.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Lane",
Handler: _Query_Lane_Handler,
},
{
MethodName: "Lanes",
Handler: _Query_Lanes_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "sdk/blocksdk/v1/query.proto",
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,111 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: sdk/blocksdk/v1/tx.proto
package blocksdkv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Msg_UpdateLane_FullMethodName = "/sdk.blocksdk.v1.Msg/UpdateLane"
)
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type MsgClient interface {
// UpdateLane defines a method to update an existing lane in the store.
UpdateLane(ctx context.Context, in *MsgUpdateLane, opts ...grpc.CallOption) (*MsgUpdateLaneResponse, error)
}
type msgClient struct {
cc grpc.ClientConnInterface
}
func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) UpdateLane(ctx context.Context, in *MsgUpdateLane, opts ...grpc.CallOption) (*MsgUpdateLaneResponse, error) {
out := new(MsgUpdateLaneResponse)
err := c.cc.Invoke(ctx, Msg_UpdateLane_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
type MsgServer interface {
// UpdateLane defines a method to update an existing lane in the store.
UpdateLane(context.Context, *MsgUpdateLane) (*MsgUpdateLaneResponse, error)
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (UnimplementedMsgServer) UpdateLane(context.Context, *MsgUpdateLane) (*MsgUpdateLaneResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateLane not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
// result in compilation errors.
type UnsafeMsgServer interface {
mustEmbedUnimplementedMsgServer()
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
s.RegisterService(&Msg_ServiceDesc, srv)
}
func _Msg_UpdateLane_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateLane)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateLane(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateLane_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateLane(ctx, req.(*MsgUpdateLane))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Msg_ServiceDesc = grpc.ServiceDesc{
ServiceName: "sdk.blocksdk.v1.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "UpdateLane",
Handler: _Msg_UpdateLane_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "sdk/blocksdk/v1/tx.proto",
}

View File

@ -0,0 +1,38 @@
syntax = "proto3";
package sdk.blocksdk.v1;
option go_package = "github.com/skip-mev/block-sdk/x/blocksdk/types";
import "google/api/annotations.proto";
import "gogoproto/gogo.proto";
import "cosmos/query/v1/query.proto";
import "sdk/blocksdk/v1/blocksdk.proto";
// Query defines the x/blocksdk querier service.
service Query {
// Lane queries the a lane by its id.
rpc Lane(QueryLaneRequest) returns (QueryLaneResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/block-sdk/blocksdk/v1/lane/{id}";
}
// Lane queries all lanes in the x/blocksdk module
rpc Lanes(QueryLanesRequest) returns (QueryLanesResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/block-sdk/blocksdk/v1/lanes";
}
}
// QueryLaneRequest is the request type for the Query/Lane RPC method.
message QueryLaneRequest { string id = 1; }
// QueryLaneResponse is the response type for the Query/Lane RPC method.
message QueryLaneResponse { Lane lane = 1 [ (gogoproto.nullable) = false ]; }
// QueryLaneRequest is the request type for the Query/Lanes RPC method.
message QueryLanesRequest {}
// QueryLaneResponse is the response type for the Query/Lanes RPC method.
message QueryLanesResponse {
repeated Lane lanes = 1 [ (gogoproto.nullable) = false ];
}

View File

@ -0,0 +1,33 @@
syntax = "proto3";
package sdk.blocksdk.v1;
option go_package = "github.com/skip-mev/block-sdk/x/blocksdk/types";
import "gogoproto/gogo.proto";
import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "amino/amino.proto";
import "sdk/blocksdk/v1/blocksdk.proto";
// Msg defines the x/blocksdk Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;
// UpdateLane defines a method to update an existing lane in the store.
rpc UpdateLane(MsgUpdateLane) returns (MsgUpdateLaneResponse);
}
// MsgUpdateLane defines a request to update an existing lane in the store.
message MsgUpdateLane {
option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "block-sdk/x/blocksdk/MsgUpdateLane";
option (gogoproto.equal) = false;
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
Lane lane = 2 [ (gogoproto.nullable) = false ];
}
// MsgUpdateLaneResponse defines a response to update an existing lane in the
// store.
message MsgUpdateLaneResponse {}

View File

@ -0,0 +1,88 @@
package cli
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"
"github.com/skip-mev/block-sdk/x/blocksdk/types"
)
// GetQueryCmd returns the cli query commands for the blocksdk module.
func GetQueryCmd() *cobra.Command {
cmd := &cobra.Command{
Use: types.ModuleName,
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName),
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(
CmdQueryLane(),
CmdQueryLanes(),
)
return cmd
}
// CmdQueryLane implements a command that will return a lane by its ID.
func CmdQueryLane() *cobra.Command {
cmd := &cobra.Command{
Use: "lane",
Short: "Query the a lane by its ID",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
request := &types.QueryLaneRequest{}
response, err := queryClient.Lane(clientCtx.CmdContext, request)
if err != nil {
return err
}
return clientCtx.PrintProto(&response.Lane)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// CmdQueryLanes implements a command that will return all lanes.
func CmdQueryLanes() *cobra.Command {
cmd := &cobra.Command{
Use: "lanes",
Short: "Query the all lanes",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
request := &types.QueryLanesRequest{}
response, err := queryClient.Lanes(clientCtx.CmdContext, request)
if err != nil {
return err
}
return clientCtx.PrintProto(response)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}

View File

@ -0,0 +1,24 @@
package cli
import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"
"github.com/skip-mev/block-sdk/x/blocksdk/types"
)
// NewTxCmd returns a root CLI command handler for all x/blocksdk transaction
// commands.
func NewTxCmd() *cobra.Command {
txCmd := &cobra.Command{
Use: types.ModuleName,
Short: "blocksdk transaction subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
txCmd.AddCommand()
return txCmd
}

View File

@ -0,0 +1,42 @@
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/block-sdk/x/blocksdk/types"
)
var _ types.QueryServer = QueryServer{}
// QueryServer defines the blocksdk module's gRPC querier service.
type QueryServer struct {
keeper Keeper
}
// NewQueryServer creates a new gRPC query server for the blocksdk module.
func NewQueryServer(keeper Keeper) *QueryServer {
return &QueryServer{keeper: keeper}
}
// Lane implements the service to query a Lane by its ID.
func (q QueryServer) Lane(goCtx context.Context, query *types.QueryLaneRequest) (*types.QueryLaneResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
lane, err := q.keeper.GetLane(ctx, query.Id)
if err != nil {
return nil, err
}
return &types.QueryLaneResponse{Lane: lane}, nil
}
// Lanes implements the service to query all Lanes in the stores.
func (q QueryServer) Lanes(goCtx context.Context, _ *types.QueryLanesRequest) (*types.QueryLanesResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
lanes := q.keeper.GetLanes(ctx)
return &types.QueryLanesResponse{Lanes: lanes}, nil
}

View File

@ -0,0 +1,104 @@
package keeper_test
import (
"cosmossdk.io/math"
"github.com/skip-mev/block-sdk/x/blocksdk/types"
)
func (s *KeeperTestSuite) TestQueryLane() {
// pre-register a lane
registeredLanes := types.Lanes{
types.Lane{
Id: "registered1",
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.1"),
Order: 0,
},
types.Lane{
Id: "registered2",
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.1"),
Order: 1,
},
}
for _, lane := range registeredLanes {
s.Require().NoError(s.blocksdKeeper.AddLane(s.ctx, lane))
}
testCases := []struct {
name string
query *types.QueryLaneRequest
expected types.Lane
wantErr bool
}{
{
name: "invalid lane does not exist",
query: &types.QueryLaneRequest{Id: "invalid"},
expected: types.Lane{},
wantErr: true,
},
{
name: "valid query 1",
query: &types.QueryLaneRequest{Id: registeredLanes[0].Id},
expected: registeredLanes[0],
wantErr: false,
},
{
name: "valid query 2",
query: &types.QueryLaneRequest{Id: registeredLanes[1].Id},
expected: registeredLanes[1],
wantErr: false,
},
}
for _, tc := range testCases {
s.Run(tc.name, func() {
resp, err := s.queryServer.Lane(s.ctx, tc.query)
if tc.wantErr {
s.Require().Error(err)
return
}
s.Require().NoError(err)
s.Require().Equal(tc.expected, resp.GetLane())
})
}
}
func (s *KeeperTestSuite) TestQueryLanes() {
// pre-register a lane
registeredLanes := types.Lanes{
types.Lane{
Id: "registered1",
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.1"),
Order: 0,
},
types.Lane{
Id: "registered2",
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.1"),
Order: 1,
},
}
for _, lane := range registeredLanes {
s.Require().NoError(s.blocksdKeeper.AddLane(s.ctx, lane))
}
testCases := []struct {
name string
query *types.QueryLanesRequest
expected []types.Lane
}{
{
name: "valid",
query: &types.QueryLanesRequest{},
expected: registeredLanes,
},
}
for _, tc := range testCases {
s.Run(tc.name, func() {
resp, err := s.queryServer.Lanes(s.ctx, tc.query)
s.Require().NoError(err)
s.Require().Equal(tc.expected, resp.GetLanes())
})
}
}

View File

@ -19,10 +19,11 @@ import (
type KeeperTestSuite struct {
suite.Suite
blocksdKeeper keeper.Keeper
encCfg testutils.EncodingConfig
ctx sdk.Context
// msgServer types.MsgServer
blocksdKeeper keeper.Keeper
encCfg testutils.EncodingConfig
ctx sdk.Context
queryServer types.QueryServer
msgServer types.MsgServer
key *storetypes.KVStoreKey
authorityAccount sdk.AccAddress
}
@ -43,7 +44,8 @@ func (s *KeeperTestSuite) SetupTest() {
s.authorityAccount.String(),
)
// s.msgServer = keeper.NewMsgServerImpl(s.blocksdKeeper)
s.msgServer = keeper.NewMsgServerImpl(s.blocksdKeeper)
s.queryServer = keeper.NewQueryServer(s.blocksdKeeper)
}
func (s *KeeperTestSuite) TestLane() {

View File

@ -0,0 +1,47 @@
package keeper
import (
"context"
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/block-sdk/x/blocksdk/types"
)
var _ types.MsgServer = MsgServer{}
// MsgServer is the wrapper for the x/blocksdk module's msg service.
type MsgServer struct {
Keeper
}
// NewMsgServerImpl returns an implementation of the x/blocksdk MsgServer interface.
func NewMsgServerImpl(keeper Keeper) *MsgServer {
return &MsgServer{Keeper: keeper}
}
// UpdateLane implements the message service for updating a lane that exists in the store.
func (m MsgServer) UpdateLane(goCtx context.Context, msg *types.MsgUpdateLane) (*types.MsgUpdateLaneResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
// ensure that the message signer is the authority
if msg.Authority != m.Keeper.GetAuthority() {
return nil, fmt.Errorf("this message can only be executed by the authority; expected %s, got %s", m.Keeper.GetAuthority(), msg.Authority)
}
oldLane, err := m.GetLane(ctx, msg.Lane.Id)
if err != nil {
return nil, fmt.Errorf("lane with ID %s not found", msg.Lane.Id)
}
if oldLane.Order != msg.Lane.Order {
return nil, fmt.Errorf("unable to change lane order using UpdateLane method")
}
m.setLane(ctx, msg.Lane)
// TODO emit event
return nil, nil
}

View File

@ -0,0 +1,144 @@
package keeper_test
import (
"math/rand"
"time"
"cosmossdk.io/math"
testutils "github.com/skip-mev/block-sdk/testutils"
"github.com/skip-mev/block-sdk/x/blocksdk/types"
)
func (s *KeeperTestSuite) TestMsgUpdateLane() {
rng := rand.New(rand.NewSource(time.Now().Unix()))
account := testutils.RandomAccounts(rng, 1)[0]
// pre-register a lane
registeredLane := types.Lane{
Id: "registered",
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.1"),
Order: 0,
}
s.Require().NoError(s.blocksdKeeper.AddLane(s.ctx, registeredLane))
testCases := []struct {
name string
msg *types.MsgUpdateLane
pass bool
passBasic bool
}{
{
name: "invalid authority",
msg: &types.MsgUpdateLane{
Authority: "invalid",
Lane: types.Lane{
Id: "test",
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.1"),
Order: 0,
},
},
passBasic: false,
pass: false,
},
{
name: "invalid unauthorized authority",
msg: &types.MsgUpdateLane{
Authority: account.Address.String(),
Lane: types.Lane{
Id: "test",
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.1"),
Order: 0,
},
},
passBasic: true,
pass: false,
},
{
name: "invalid lane ID",
msg: &types.MsgUpdateLane{
Authority: s.authorityAccount.String(),
Lane: types.Lane{
Id: "",
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.1"),
Order: 0,
},
},
passBasic: false,
pass: false,
},
{
name: "invalid MaxBlockSpace",
msg: &types.MsgUpdateLane{
Authority: s.authorityAccount.String(),
Lane: types.Lane{
Id: "",
MaxBlockSpace: math.LegacyMustNewDecFromStr("1.1"),
Order: 0,
},
},
passBasic: false,
pass: false,
},
{
name: "invalid lane does not exist",
msg: &types.MsgUpdateLane{
Authority: s.authorityAccount.String(),
Lane: types.Lane{
Id: "invalid",
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.1"),
Order: 0,
},
},
passBasic: true,
pass: false,
},
{
name: "invalid order modification",
msg: &types.MsgUpdateLane{
Authority: s.authorityAccount.String(),
Lane: types.Lane{
Id: "registered",
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.2"),
Order: 1,
},
},
passBasic: true,
pass: false,
},
{
name: "valid",
msg: &types.MsgUpdateLane{
Authority: s.authorityAccount.String(),
Lane: types.Lane{
Id: "registered",
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.2"),
Order: 0,
},
},
passBasic: true,
pass: true,
},
}
for _, tc := range testCases {
s.Run(tc.name, func() {
if !tc.passBasic {
s.Require().Error(tc.msg.ValidateBasic())
return
}
_, err := s.msgServer.UpdateLane(s.ctx, tc.msg)
if tc.pass {
s.Require().NoError(err)
lane, err := s.blocksdKeeper.GetLane(s.ctx, tc.msg.Lane.Id)
s.Require().NoError(err)
s.Require().Equal(tc.msg.Lane, lane)
} else {
s.Require().Error(err)
}
})
}
}

186
x/blocksdk/module.go Normal file
View File

@ -0,0 +1,186 @@
package blocksdk
import (
"context"
"encoding/json"
"fmt"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/depinject"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
modulev1 "github.com/skip-mev/block-sdk/api/sdk/blocksdk/module/v1"
"github.com/skip-mev/block-sdk/x/blocksdk/client/cli"
"github.com/skip-mev/block-sdk/x/blocksdk/keeper"
"github.com/skip-mev/block-sdk/x/blocksdk/types"
)
var (
_ module.AppModuleBasic = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasInvariants = AppModule{}
_ appmodule.AppModule = AppModule{}
)
// ConsensusVersion defines the current x/blocksdk module consensus version.
const ConsensusVersion = 1
// AppModuleBasic defines the basic application module used by the blocksdk module.
type AppModuleBasic struct {
cdc codec.Codec
}
// Name returns the blocksdk module's name.
func (AppModuleBasic) Name() string {
return types.ModuleName
}
// RegisterLegacyAminoCodec registers the blocksdk module's types on the given LegacyAmino codec.
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterLegacyAminoCodec(cdc)
}
// RegisterInterfaces registers the blocksdk module's interface types.
func (AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
types.RegisterInterfaces(registry)
}
// DefaultGenesis returns default genesis state as raw bytes for the blocksdk module.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(types.DefaultGenesisState())
}
// ValidateGenesis performs genesis state validation for the blocksdk module.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var genState types.GenesisState
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
}
return genState.Validate()
}
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the blocksdk module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}
// GetTxCmd returns the root tx command for the blocksdk module.
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.NewTxCmd()
}
// GetQueryCmd returns the root query command for the blocksdk module.
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}
type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
}
var _ appmodule.AppModule = AppModule{}
// NewAppModule creates a new AppModule object.
func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{cdc: cdc},
keeper: keeper,
}
}
// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
// ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
// RegisterServices registers the gRPC Query and Msg services for the x/blocksdk
// module.
func (am AppModule) RegisterServices(cfc module.Configurator) {
types.RegisterMsgServer(cfc.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
types.RegisterQueryServer(cfc.QueryServer(), keeper.NewQueryServer(am.keeper))
}
func (a AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {}
// RegisterInvariants registers the invariants of the module. If an invariant
// deviates from its predicted value, the InvariantRegistry triggers appropriate
// logic (most often the chain will be halted).
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
// InitGenesis performs the module's genesis initialization for the blocksdk
// module. It returns no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) {
var genState types.GenesisState
cdc.MustUnmarshalJSON(gs, &genState)
am.keeper.InitGenesis(ctx, genState)
}
// ExportGenesis returns the blocksdk module's exported genesis state as raw
// JSON bytes.
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
genState := am.keeper.ExportGenesis(ctx)
return cdc.MustMarshalJSON(genState)
}
func init() {
appmodule.Register(
&modulev1.Module{},
appmodule.Provide(ProvideModule),
)
}
type Inputs struct {
depinject.In
Config *modulev1.Module
Cdc codec.Codec
Key *storetypes.KVStoreKey
}
type Outputs struct {
depinject.Out
BlockSDKkeeper keeper.Keeper
Module appmodule.AppModule
}
func ProvideModule(in Inputs) Outputs {
// default to governance authority if not provided
authority := authtypes.NewModuleAddress(govtypes.ModuleName)
if in.Config.Authority != "" {
authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority)
}
blocksdkKeeper := keeper.NewKeeper(
in.Cdc,
in.Key,
authority.String(),
)
m := NewAppModule(in.Cdc, blocksdkKeeper)
return Outputs{BlockSDKkeeper: blocksdkKeeper, Module: m}
}

View File

@ -39,11 +39,12 @@ type Lane struct {
// lane (up to maxTxBytes as provided by the request). This is useful for the
// default lane.
MaxBlockSpace cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=max_block_space,json=maxBlockSpace,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"max_block_space"`
// order is the priority ordering of the Lane. Lane orders should be set in
// order of priority starting from 0, monotonically increasing and
// non-overlapping. A lane with a lower order value will have a higher
// priority over a lane with a higher order value. For example, if LaneA has
// priority of 0 and LaneB has a priority of 1, LaneA has priority over LaneB.
// order is the priority ordering of the Lane when processed in
// PrepareProposal and ProcessProposal. Lane orders should be set in order of
// priority starting from 0, monotonically increasing and non-overlapping. A
// lane with a lower order value will have a higher priority over a lane with
// a higher order value. For example, if LaneA has priority of 0 and LaneB
// has a priority of 1, LaneA has priority over LaneB.
Order uint64 `protobuf:"varint,3,opt,name=order,proto3" json:"order,omitempty"`
}

39
x/blocksdk/types/codec.go Normal file
View File

@ -0,0 +1,39 @@
package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)
var (
amino = codec.NewLegacyAmino()
ModuleCdc = codec.NewLegacyAmino()
)
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)
sdk.RegisterLegacyAminoCodec(amino)
}
// RegisterLegacyAminoCodec registers the necessary x/blocksdk interfaces and
// concrete types on the provided LegacyAmino codec. These types are used for
// Amino JSON serialization.
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
legacy.RegisterAminoMsg(cdc, &MsgUpdateLane{}, "block-sdk/x/blocksdk/MsgUpdateLane")
}
// RegisterInterfaces registers the x/blocksdk interfaces types with the
// interface registry.
func RegisterInterfaces(registry types.InterfaceRegistry) {
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgUpdateLane{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

28
x/blocksdk/types/msgs.go Normal file
View File

@ -0,0 +1,28 @@
package types
import (
"cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
)
var _ sdk.Msg = &MsgUpdateLane{}
// GetSignBytes implements the LegacyMsg interface.
func (m *MsgUpdateLane) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}
// GetSigners returns the expected signers for a MsgUpdateLane message.
func (m *MsgUpdateLane) GetSigners() []sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(m.Authority)
return []sdk.AccAddress{addr}
}
// ValidateBasic does a sanity check on the provided data.
func (m *MsgUpdateLane) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil {
return errors.Wrap(err, "invalid authority address")
}
return m.Lane.ValidateBasic()
}

View File

@ -0,0 +1,79 @@
package types_test
import (
"math/rand"
"testing"
"time"
"cosmossdk.io/math"
"github.com/skip-mev/block-sdk/testutils"
"github.com/skip-mev/block-sdk/x/blocksdk/types"
)
func TestMsgUpdateLane_ValidateBasic(t *testing.T) {
testAcc := testutils.RandomAccounts(rand.New(rand.NewSource(time.Now().Unix())), 1)[0]
tests := []struct {
name string
msg types.MsgUpdateLane
wantErr bool
}{
{
name: "invalid empty authority",
msg: types.MsgUpdateLane{
Authority: "",
Lane: types.Lane{
Id: "free",
MaxBlockSpace: math.LegacyOneDec(),
Order: 0,
},
},
wantErr: true,
},
{
name: "invalid authority",
msg: types.MsgUpdateLane{
Authority: "invalid",
Lane: types.Lane{
Id: "free",
MaxBlockSpace: math.LegacyOneDec(),
Order: 0,
},
},
wantErr: true,
},
{
name: "invalid lane",
msg: types.MsgUpdateLane{
Authority: testAcc.Address.String(),
Lane: types.Lane{
Id: "",
MaxBlockSpace: math.LegacyOneDec(),
Order: 0,
},
},
wantErr: true,
},
{
name: "valid",
msg: types.MsgUpdateLane{
Authority: testAcc.Address.String(),
Lane: types.Lane{
Id: "free",
MaxBlockSpace: math.LegacyOneDec(),
Order: 0,
},
},
wantErr: false,
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
if err := tc.msg.ValidateBasic(); (err != nil) != tc.wantErr {
t.Errorf("ValidateBasic() error = %v, wantErr %v", err, tc.wantErr)
}
})
}
}

View File

@ -0,0 +1,932 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: sdk/blocksdk/v1/query.proto
package types
import (
context "context"
fmt "fmt"
_ "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/cosmos/gogoproto/grpc"
proto "github.com/cosmos/gogoproto/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.
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
// QueryLaneRequest is the request type for the Query/Lane RPC method.
type QueryLaneRequest struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (m *QueryLaneRequest) Reset() { *m = QueryLaneRequest{} }
func (m *QueryLaneRequest) String() string { return proto.CompactTextString(m) }
func (*QueryLaneRequest) ProtoMessage() {}
func (*QueryLaneRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_0c631e2e97c81d34, []int{0}
}
func (m *QueryLaneRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryLaneRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryLaneRequest.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 *QueryLaneRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryLaneRequest.Merge(m, src)
}
func (m *QueryLaneRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryLaneRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryLaneRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryLaneRequest proto.InternalMessageInfo
func (m *QueryLaneRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
// QueryLaneResponse is the response type for the Query/Lane RPC method.
type QueryLaneResponse struct {
Lane Lane `protobuf:"bytes,1,opt,name=lane,proto3" json:"lane"`
}
func (m *QueryLaneResponse) Reset() { *m = QueryLaneResponse{} }
func (m *QueryLaneResponse) String() string { return proto.CompactTextString(m) }
func (*QueryLaneResponse) ProtoMessage() {}
func (*QueryLaneResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_0c631e2e97c81d34, []int{1}
}
func (m *QueryLaneResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryLaneResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryLaneResponse.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 *QueryLaneResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryLaneResponse.Merge(m, src)
}
func (m *QueryLaneResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryLaneResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryLaneResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryLaneResponse proto.InternalMessageInfo
func (m *QueryLaneResponse) GetLane() Lane {
if m != nil {
return m.Lane
}
return Lane{}
}
// QueryLaneRequest is the request type for the Query/Lanes RPC method.
type QueryLanesRequest struct {
}
func (m *QueryLanesRequest) Reset() { *m = QueryLanesRequest{} }
func (m *QueryLanesRequest) String() string { return proto.CompactTextString(m) }
func (*QueryLanesRequest) ProtoMessage() {}
func (*QueryLanesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_0c631e2e97c81d34, []int{2}
}
func (m *QueryLanesRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryLanesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryLanesRequest.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 *QueryLanesRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryLanesRequest.Merge(m, src)
}
func (m *QueryLanesRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryLanesRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryLanesRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryLanesRequest proto.InternalMessageInfo
// QueryLaneResponse is the response type for the Query/Lanes RPC method.
type QueryLanesResponse struct {
Lanes []Lane `protobuf:"bytes,1,rep,name=lanes,proto3" json:"lanes"`
}
func (m *QueryLanesResponse) Reset() { *m = QueryLanesResponse{} }
func (m *QueryLanesResponse) String() string { return proto.CompactTextString(m) }
func (*QueryLanesResponse) ProtoMessage() {}
func (*QueryLanesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_0c631e2e97c81d34, []int{3}
}
func (m *QueryLanesResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryLanesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryLanesResponse.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 *QueryLanesResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryLanesResponse.Merge(m, src)
}
func (m *QueryLanesResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryLanesResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryLanesResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryLanesResponse proto.InternalMessageInfo
func (m *QueryLanesResponse) GetLanes() []Lane {
if m != nil {
return m.Lanes
}
return nil
}
func init() {
proto.RegisterType((*QueryLaneRequest)(nil), "sdk.blocksdk.v1.QueryLaneRequest")
proto.RegisterType((*QueryLaneResponse)(nil), "sdk.blocksdk.v1.QueryLaneResponse")
proto.RegisterType((*QueryLanesRequest)(nil), "sdk.blocksdk.v1.QueryLanesRequest")
proto.RegisterType((*QueryLanesResponse)(nil), "sdk.blocksdk.v1.QueryLanesResponse")
}
func init() { proto.RegisterFile("sdk/blocksdk/v1/query.proto", fileDescriptor_0c631e2e97c81d34) }
var fileDescriptor_0c631e2e97c81d34 = []byte{
// 371 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcf, 0x4a, 0xeb, 0x40,
0x14, 0x87, 0x93, 0xdc, 0xf6, 0xc2, 0x9d, 0x0b, 0xfe, 0x19, 0x15, 0x4a, 0x5a, 0xc6, 0x3a, 0x6e,
0x54, 0xe8, 0x0c, 0xad, 0x6f, 0x50, 0x04, 0x5d, 0xb8, 0xb1, 0x4b, 0x77, 0x69, 0x33, 0xc4, 0x21,
0x6d, 0x26, 0xed, 0xa4, 0xc5, 0x52, 0xdd, 0x74, 0xe5, 0x52, 0xf0, 0x45, 0x7c, 0x8c, 0x2e, 0x0b,
0x6e, 0x5c, 0x89, 0xb4, 0x82, 0xaf, 0x21, 0x33, 0x49, 0x6d, 0x88, 0x10, 0x77, 0x87, 0x39, 0xdf,
0x7c, 0xe7, 0x77, 0x86, 0x01, 0x65, 0xe9, 0xfa, 0xb4, 0xdd, 0x15, 0x1d, 0x5f, 0x15, 0xa3, 0x3a,
0xed, 0x0f, 0xd9, 0x60, 0x4c, 0xc2, 0x81, 0x88, 0x04, 0xdc, 0x94, 0xae, 0x4f, 0x56, 0x4d, 0x32,
0xaa, 0xdb, 0x15, 0x4f, 0x08, 0xaf, 0xcb, 0xa8, 0x13, 0x72, 0xea, 0x04, 0x81, 0x88, 0x9c, 0x88,
0x8b, 0x40, 0xc6, 0xb8, 0xbd, 0xeb, 0x09, 0x4f, 0xe8, 0x92, 0xaa, 0x2a, 0x39, 0x2d, 0x77, 0x84,
0xec, 0x09, 0x19, 0x8b, 0x33, 0x13, 0x6c, 0x94, 0x1d, 0xff, 0x3d, 0x4d, 0xf7, 0x31, 0x06, 0x5b,
0x57, 0x0a, 0xbf, 0x74, 0x02, 0xd6, 0x62, 0xfd, 0x21, 0x93, 0x11, 0xdc, 0x00, 0x16, 0x77, 0x4b,
0x66, 0xd5, 0x3c, 0xfa, 0xd7, 0xb2, 0xb8, 0x8b, 0xcf, 0xc0, 0x76, 0x8a, 0x91, 0xa1, 0x08, 0x24,
0x83, 0x14, 0x14, 0xba, 0x4e, 0xc0, 0x34, 0xf6, 0xbf, 0xb1, 0x47, 0x32, 0x9b, 0x10, 0x05, 0x37,
0x0b, 0xb3, 0xb7, 0x7d, 0xa3, 0xa5, 0x41, 0xbc, 0x93, 0xb2, 0xc8, 0x64, 0x14, 0x3e, 0x07, 0x30,
0x7d, 0x98, 0xb8, 0xeb, 0xa0, 0xa8, 0xae, 0xc8, 0x92, 0x59, 0xfd, 0xf3, 0x9b, 0x3c, 0x26, 0x1b,
0x53, 0x0b, 0x14, 0xb5, 0x09, 0xde, 0x81, 0x82, 0x6a, 0xc3, 0x83, 0x1f, 0xb7, 0xb2, 0x8b, 0xda,
0x38, 0x0f, 0x89, 0xb3, 0xe0, 0xda, 0xc3, 0xe7, 0xf3, 0x89, 0x39, 0x7d, 0xf9, 0x78, 0xb2, 0x30,
0xac, 0xc6, 0xcf, 0x57, 0xcb, 0x3e, 0xaa, 0xca, 0x40, 0x27, 0xdc, 0xbd, 0x87, 0x13, 0x50, 0xd4,
0xbb, 0xc0, 0x1c, 0xf7, 0x6a, 0x7b, 0xfb, 0x30, 0x97, 0x49, 0x02, 0x1c, 0xaf, 0x03, 0x20, 0x58,
0xc9, 0x09, 0x20, 0x9b, 0x17, 0xb3, 0x05, 0x32, 0xe7, 0x0b, 0x64, 0xbe, 0x2f, 0x90, 0xf9, 0xb8,
0x44, 0xc6, 0x7c, 0x89, 0x8c, 0xd7, 0x25, 0x32, 0xae, 0x89, 0xc7, 0xa3, 0x9b, 0x61, 0x9b, 0x74,
0x44, 0x8f, 0x4a, 0x9f, 0x87, 0xb5, 0x1e, 0x1b, 0xa5, 0x54, 0xb7, 0x6b, 0x59, 0x34, 0x0e, 0x99,
0x6c, 0xff, 0xd5, 0xbf, 0xe3, 0xf4, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x49, 0x58, 0x65, 0x30, 0xbe,
0x02, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// QueryClient is the client API for Query service.
//
// 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 {
// Lane queries the a lane by its id.
Lane(ctx context.Context, in *QueryLaneRequest, opts ...grpc.CallOption) (*QueryLaneResponse, error)
// Lane queries all lanes in the x/blocksdk module
Lanes(ctx context.Context, in *QueryLanesRequest, opts ...grpc.CallOption) (*QueryLanesResponse, error)
}
type queryClient struct {
cc grpc1.ClientConn
}
func NewQueryClient(cc grpc1.ClientConn) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Lane(ctx context.Context, in *QueryLaneRequest, opts ...grpc.CallOption) (*QueryLaneResponse, error) {
out := new(QueryLaneResponse)
err := c.cc.Invoke(ctx, "/sdk.blocksdk.v1.Query/Lane", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Lanes(ctx context.Context, in *QueryLanesRequest, opts ...grpc.CallOption) (*QueryLanesResponse, error) {
out := new(QueryLanesResponse)
err := c.cc.Invoke(ctx, "/sdk.blocksdk.v1.Query/Lanes", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
type QueryServer interface {
// Lane queries the a lane by its id.
Lane(context.Context, *QueryLaneRequest) (*QueryLaneResponse, error)
// Lane queries all lanes in the x/blocksdk module
Lanes(context.Context, *QueryLanesRequest) (*QueryLanesResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (*UnimplementedQueryServer) Lane(ctx context.Context, req *QueryLaneRequest) (*QueryLaneResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Lane not implemented")
}
func (*UnimplementedQueryServer) Lanes(ctx context.Context, req *QueryLanesRequest) (*QueryLanesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Lanes not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
}
func _Query_Lane_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryLaneRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Lane(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/sdk.blocksdk.v1.Query/Lane",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Lane(ctx, req.(*QueryLaneRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Lanes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryLanesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Lanes(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/sdk.blocksdk.v1.Query/Lanes",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Lanes(ctx, req.(*QueryLanesRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "sdk.blocksdk.v1.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Lane",
Handler: _Query_Lane_Handler,
},
{
MethodName: "Lanes",
Handler: _Query_Lanes_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "sdk/blocksdk/v1/query.proto",
}
func (m *QueryLaneRequest) 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 *QueryLaneRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryLaneRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Id) > 0 {
i -= len(m.Id)
copy(dAtA[i:], m.Id)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Id)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryLaneResponse) 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 *QueryLaneResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryLaneResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Lane.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 (m *QueryLanesRequest) 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 *QueryLanesRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryLanesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryLanesResponse) 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 *QueryLanesResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryLanesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Lanes) > 0 {
for iNdEx := len(m.Lanes) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Lanes[iNdEx].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 *QueryLaneRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Id)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryLaneResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Lane.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryLanesRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryLanesResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Lanes) > 0 {
for _, e := range m.Lanes {
l = e.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 *QueryLaneRequest) 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: QueryLaneRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryLaneRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Id = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryLaneResponse) 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: QueryLaneResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryLaneResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Lane", 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.Lane.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 (m *QueryLanesRequest) 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: QueryLanesRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryLanesRequest: 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 *QueryLanesResponse) 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: QueryLanesResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryLanesResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Lanes", 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
}
m.Lanes = append(m.Lanes, Lane{})
if err := m.Lanes[len(m.Lanes)-1].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")
)

View File

@ -0,0 +1,254 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: sdk/blocksdk/v1/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_Lane_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryLaneRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := client.Lane(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Lane_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryLaneRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := server.Lane(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_Lanes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryLanesRequest
var metadata runtime.ServerMetadata
msg, err := client.Lanes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Lanes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryLanesRequest
var metadata runtime.ServerMetadata
msg, err := server.Lanes(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_Lane_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_Lane_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_Lane_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_Lanes_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_Lanes_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_Lanes_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_Lane_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_Lane_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_Lane_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_Lanes_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_Lanes_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_Lanes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Query_Lane_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"block-sdk", "blocksdk", "v1", "lane", "id"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Lanes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"block-sdk", "blocksdk", "v1", "lanes"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Query_Lane_0 = runtime.ForwardResponseMessage
forward_Query_Lanes_0 = runtime.ForwardResponseMessage
)

592
x/blocksdk/types/tx.pb.go Normal file
View File

@ -0,0 +1,592 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: sdk/blocksdk/v1/tx.proto
package types
import (
context "context"
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/cosmos/gogoproto/grpc"
proto "github.com/cosmos/gogoproto/proto"
grpc "google.golang.org/grpc"
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.
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
// MsgUpdateLane defines a request to update an existing lane in the store.
type MsgUpdateLane struct {
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
Lane Lane `protobuf:"bytes,2,opt,name=lane,proto3" json:"lane"`
}
func (m *MsgUpdateLane) Reset() { *m = MsgUpdateLane{} }
func (m *MsgUpdateLane) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateLane) ProtoMessage() {}
func (*MsgUpdateLane) Descriptor() ([]byte, []int) {
return fileDescriptor_fc6ccd9f56097321, []int{0}
}
func (m *MsgUpdateLane) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateLane) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateLane.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 *MsgUpdateLane) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateLane.Merge(m, src)
}
func (m *MsgUpdateLane) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateLane) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateLane.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateLane proto.InternalMessageInfo
func (m *MsgUpdateLane) GetAuthority() string {
if m != nil {
return m.Authority
}
return ""
}
func (m *MsgUpdateLane) GetLane() Lane {
if m != nil {
return m.Lane
}
return Lane{}
}
// MsgUpdateLaneResponse defines a response to update an existing lane in the
// store.
type MsgUpdateLaneResponse struct {
}
func (m *MsgUpdateLaneResponse) Reset() { *m = MsgUpdateLaneResponse{} }
func (m *MsgUpdateLaneResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateLaneResponse) ProtoMessage() {}
func (*MsgUpdateLaneResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_fc6ccd9f56097321, []int{1}
}
func (m *MsgUpdateLaneResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateLaneResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateLaneResponse.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 *MsgUpdateLaneResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateLaneResponse.Merge(m, src)
}
func (m *MsgUpdateLaneResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateLaneResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateLaneResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateLaneResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgUpdateLane)(nil), "sdk.blocksdk.v1.MsgUpdateLane")
proto.RegisterType((*MsgUpdateLaneResponse)(nil), "sdk.blocksdk.v1.MsgUpdateLaneResponse")
}
func init() { proto.RegisterFile("sdk/blocksdk/v1/tx.proto", fileDescriptor_fc6ccd9f56097321) }
var fileDescriptor_fc6ccd9f56097321 = []byte{
// 348 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x4e, 0xc9, 0xd6,
0x4f, 0xca, 0xc9, 0x4f, 0xce, 0x06, 0x31, 0xca, 0x0c, 0xf5, 0x4b, 0x2a, 0xf4, 0x0a, 0x8a, 0xf2,
0x4b, 0xf2, 0x85, 0xf8, 0x8b, 0x53, 0xb2, 0xf5, 0x60, 0x32, 0x7a, 0x65, 0x86, 0x52, 0x22, 0xe9,
0xf9, 0xe9, 0xf9, 0x60, 0x39, 0x7d, 0x10, 0x0b, 0xa2, 0x4c, 0x4a, 0x3c, 0x39, 0xbf, 0x38, 0x37,
0xbf, 0x58, 0x3f, 0xb7, 0x38, 0x1d, 0xa4, 0x3d, 0xb7, 0x38, 0x1d, 0x2a, 0x21, 0x09, 0x91, 0x88,
0x87, 0xe8, 0x80, 0x70, 0xa0, 0x52, 0x82, 0x89, 0xb9, 0x99, 0x79, 0xf9, 0xfa, 0x60, 0x12, 0x2a,
0x24, 0x87, 0xee, 0x0e, 0xb8, 0xcd, 0x60, 0x79, 0xa5, 0xcd, 0x8c, 0x5c, 0xbc, 0xbe, 0xc5, 0xe9,
0xa1, 0x05, 0x29, 0x89, 0x25, 0xa9, 0x3e, 0x89, 0x79, 0xa9, 0x42, 0x66, 0x5c, 0x9c, 0x89, 0xa5,
0x25, 0x19, 0xf9, 0x45, 0x99, 0x25, 0x95, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, 0x12, 0x97,
0xb6, 0xe8, 0x8a, 0x40, 0x6d, 0x72, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x0e, 0x2e, 0x29, 0xca,
0xcc, 0x4b, 0x0f, 0x42, 0x28, 0x15, 0xd2, 0xe7, 0x62, 0xc9, 0x49, 0xcc, 0x4b, 0x95, 0x60, 0x52,
0x60, 0xd4, 0xe0, 0x36, 0x12, 0xd5, 0x43, 0xf3, 0xa6, 0x1e, 0xc8, 0x70, 0x27, 0x96, 0x13, 0xf7,
0xe4, 0x19, 0x82, 0xc0, 0x0a, 0xad, 0x2c, 0x5f, 0x2c, 0x90, 0x67, 0x68, 0x7a, 0xbe, 0x41, 0x0b,
0x61, 0x48, 0xd7, 0xf3, 0x0d, 0x5a, 0x4a, 0x60, 0x4d, 0xba, 0x20, 0xe7, 0x56, 0x20, 0x5c, 0x8e,
0xe2, 0x46, 0x25, 0x71, 0x2e, 0x51, 0x14, 0x81, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54,
0xa3, 0x24, 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0xa1, 0x10, 0x2e, 0x2e, 0x24, 0x1f, 0xc9, 0x61, 0xb8,
0x05, 0x45, 0xb3, 0x94, 0x1a, 0x7e, 0x79, 0x98, 0xe1, 0x52, 0xac, 0x0d, 0xcf, 0x37, 0x68, 0x31,
0x3a, 0x79, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13,
0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x5e, 0x7a, 0x66,
0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x71, 0x76, 0x66, 0x81, 0x6e, 0x6e, 0x6a,
0x99, 0x3e, 0x56, 0xef, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xe3, 0xc0, 0x18, 0x10,
0x00, 0x00, 0xff, 0xff, 0x9b, 0x33, 0x0c, 0xc1, 0x2d, 0x02, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type MsgClient interface {
// UpdateLane defines a method to update an existing lane in the store.
UpdateLane(ctx context.Context, in *MsgUpdateLane, opts ...grpc.CallOption) (*MsgUpdateLaneResponse, error)
}
type msgClient struct {
cc grpc1.ClientConn
}
func NewMsgClient(cc grpc1.ClientConn) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) UpdateLane(ctx context.Context, in *MsgUpdateLane, opts ...grpc.CallOption) (*MsgUpdateLaneResponse, error) {
out := new(MsgUpdateLaneResponse)
err := c.cc.Invoke(ctx, "/sdk.blocksdk.v1.Msg/UpdateLane", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
// UpdateLane defines a method to update an existing lane in the store.
UpdateLane(context.Context, *MsgUpdateLane) (*MsgUpdateLaneResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (*UnimplementedMsgServer) UpdateLane(ctx context.Context, req *MsgUpdateLane) (*MsgUpdateLaneResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateLane not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
}
func _Msg_UpdateLane_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateLane)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateLane(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/sdk.blocksdk.v1.Msg/UpdateLane",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateLane(ctx, req.(*MsgUpdateLane))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "sdk.blocksdk.v1.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "UpdateLane",
Handler: _Msg_UpdateLane_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "sdk/blocksdk/v1/tx.proto",
}
func (m *MsgUpdateLane) 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 *MsgUpdateLane) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateLane) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Lane.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
if len(m.Authority) > 0 {
i -= len(m.Authority)
copy(dAtA[i:], m.Authority)
i = encodeVarintTx(dAtA, i, uint64(len(m.Authority)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateLaneResponse) 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 *MsgUpdateLaneResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateLaneResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *MsgUpdateLane) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Authority)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = m.Lane.Size()
n += 1 + l + sovTx(uint64(l))
return n
}
func (m *MsgUpdateLaneResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTx(x uint64) (n int) {
return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *MsgUpdateLane) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateLane: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateLane: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Lane", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Lane.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateLaneResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateLaneResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateLaneResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
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, ErrIntOverflowTx
}
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, ErrIntOverflowTx
}
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, ErrInvalidLengthTx
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTx
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTx
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTx = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)

View File

@ -0,0 +1,171 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: sdk/blocksdk/v1/tx.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
var (
filter_Msg_UpdateLane_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Msg_UpdateLane_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq MsgUpdateLane
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_UpdateLane_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.UpdateLane(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Msg_UpdateLane_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq MsgUpdateLane
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_UpdateLane_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.UpdateLane(ctx, &protoReq)
return msg, metadata, err
}
// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux".
// UnaryRPC :call MsgServer 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 RegisterMsgHandlerFromEndpoint instead.
func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error {
mux.Handle("POST", pattern_Msg_UpdateLane_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_Msg_UpdateLane_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_Msg_UpdateLane_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterMsgHandlerFromEndpoint is same as RegisterMsgHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterMsgHandlerFromEndpoint(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 RegisterMsgHandler(ctx, mux, conn)
}
// RegisterMsgHandler registers the http handlers for service Msg to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterMsgHandlerClient(ctx, mux, NewMsgClient(conn))
}
// RegisterMsgHandlerClient registers the http handlers for service Msg
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MsgClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MsgClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "MsgClient" to call the correct interceptors.
func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error {
mux.Handle("POST", pattern_Msg_UpdateLane_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_Msg_UpdateLane_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Msg_UpdateLane_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Msg_UpdateLane_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"block-sdk", "blocksdk", "v1", "update_lane"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Msg_UpdateLane_0 = runtime.ForwardResponseMessage
)