Merge pull request #202 from skip-mev/blocksdkmodule
feat: finalize `x/blocksdk`
This commit is contained in:
commit
cb9b38a8d2
38
abci/abci.go
38
abci/abci.go
@ -20,11 +20,10 @@ type (
|
||||
// ProposalHandler is a wrapper around the ABCI++ PrepareProposal and ProcessProposal
|
||||
// handlers.
|
||||
ProposalHandler struct {
|
||||
logger log.Logger
|
||||
txDecoder sdk.TxDecoder
|
||||
txEncoder sdk.TxEncoder
|
||||
prepareLanesHandler block.PrepareLanesHandler
|
||||
mempool block.Mempool
|
||||
logger log.Logger
|
||||
txDecoder sdk.TxDecoder
|
||||
txEncoder sdk.TxEncoder
|
||||
mempool block.Mempool
|
||||
}
|
||||
)
|
||||
|
||||
@ -37,11 +36,10 @@ func NewProposalHandler(
|
||||
mempool block.Mempool,
|
||||
) *ProposalHandler {
|
||||
return &ProposalHandler{
|
||||
logger: logger,
|
||||
txDecoder: txDecoder,
|
||||
txEncoder: txEncoder,
|
||||
prepareLanesHandler: ChainPrepareLanes(mempool.Registry()),
|
||||
mempool: mempool,
|
||||
logger: logger,
|
||||
txDecoder: txDecoder,
|
||||
txEncoder: txEncoder,
|
||||
mempool: mempool,
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,8 +72,16 @@ func (h *ProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHandler {
|
||||
"height", req.Height,
|
||||
)
|
||||
|
||||
registry, err := h.mempool.Registry(ctx)
|
||||
if err != nil {
|
||||
h.logger.Error("failed to get lane registry", "err", err)
|
||||
return &abci.ResponsePrepareProposal{Txs: make([][]byte, 0)}, err
|
||||
}
|
||||
|
||||
prepareLanesHandler := ChainPrepareLanes(registry)
|
||||
|
||||
// Fill the proposal with transactions from each lane.
|
||||
finalProposal, err := h.prepareLanesHandler(ctx, proposals.NewProposalWithContext(h.logger, ctx, h.txEncoder))
|
||||
finalProposal, err := prepareLanesHandler(ctx, proposals.NewProposalWithContext(h.logger, ctx, h.txEncoder))
|
||||
if err != nil {
|
||||
h.logger.Error("failed to prepare proposal", "err", err)
|
||||
return &abci.ResponsePrepareProposal{Txs: make([][]byte, 0)}, err
|
||||
@ -133,14 +139,20 @@ func (h *ProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHandler {
|
||||
}()
|
||||
|
||||
// Extract all of the lanes and their corresponding transactions from the proposal.
|
||||
proposalInfo, partialProposals, err := h.ExtractLanes(req.Txs)
|
||||
proposalInfo, partialProposals, err := h.ExtractLanes(ctx, req.Txs)
|
||||
if err != nil {
|
||||
h.logger.Error("failed to validate proposal", "err", err)
|
||||
return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}, err
|
||||
}
|
||||
|
||||
// Build handler that will verify the partial proposals according to each lane's verification logic.
|
||||
processLanesHandler := ChainProcessLanes(partialProposals, h.mempool.Registry())
|
||||
registry, err := h.mempool.Registry(ctx)
|
||||
if err != nil {
|
||||
h.logger.Error("failed to get lane registry", "err", err)
|
||||
return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}, err
|
||||
}
|
||||
|
||||
processLanesHandler := ChainProcessLanes(partialProposals, registry)
|
||||
finalProposal, err := processLanesHandler(ctx, proposals.NewProposalWithContext(h.logger, ctx, h.txEncoder))
|
||||
if err != nil {
|
||||
h.logger.Error("failed to validate the proposal", "err", err)
|
||||
|
||||
@ -15,10 +15,40 @@ import (
|
||||
|
||||
"github.com/skip-mev/block-sdk/abci"
|
||||
"github.com/skip-mev/block-sdk/block"
|
||||
"github.com/skip-mev/block-sdk/block/mocks"
|
||||
"github.com/skip-mev/block-sdk/block/proposals"
|
||||
testutils "github.com/skip-mev/block-sdk/testutils"
|
||||
blocksdkmoduletypes "github.com/skip-mev/block-sdk/x/blocksdk/types"
|
||||
)
|
||||
|
||||
type MockLaneFetcher struct {
|
||||
getLaneHandler func() (blocksdkmoduletypes.Lane, error)
|
||||
getLanesHandler func() []blocksdkmoduletypes.Lane
|
||||
}
|
||||
|
||||
func NewMockLaneFetcher(getLane func() (blocksdkmoduletypes.Lane, error), getLanes func() []blocksdkmoduletypes.Lane) MockLaneFetcher {
|
||||
return MockLaneFetcher{
|
||||
getLaneHandler: getLane,
|
||||
getLanesHandler: getLanes,
|
||||
}
|
||||
}
|
||||
|
||||
func (m *MockLaneFetcher) SetGetLaneHandler(h func() (blocksdkmoduletypes.Lane, error)) {
|
||||
m.getLaneHandler = h
|
||||
}
|
||||
|
||||
func (m MockLaneFetcher) GetLane(_ sdk.Context, _ string) (blocksdkmoduletypes.Lane, error) {
|
||||
return m.getLaneHandler()
|
||||
}
|
||||
|
||||
func (m *MockLaneFetcher) SetGetLanesHandler(h func() []blocksdkmoduletypes.Lane) {
|
||||
m.getLanesHandler = h
|
||||
}
|
||||
|
||||
func (m MockLaneFetcher) GetLanes(_ sdk.Context) []blocksdkmoduletypes.Lane {
|
||||
return m.getLanesHandler()
|
||||
}
|
||||
|
||||
type ProposalsTestSuite struct {
|
||||
suite.Suite
|
||||
ctx sdk.Context
|
||||
@ -660,7 +690,34 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() {
|
||||
})
|
||||
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx))
|
||||
|
||||
mempool := block.NewLanedMempool(log.NewTestLogger(s.T()), false, panicLane, defaultLane)
|
||||
lanes := []block.Lane{
|
||||
panicLane,
|
||||
defaultLane,
|
||||
}
|
||||
|
||||
chainLanes := []blocksdkmoduletypes.Lane{
|
||||
{
|
||||
Id: panicLane.Name(),
|
||||
MaxBlockSpace: panicLane.GetMaxBlockSpace(),
|
||||
Order: 0,
|
||||
},
|
||||
{
|
||||
Id: defaultLane.Name(),
|
||||
MaxBlockSpace: defaultLane.GetMaxBlockSpace(),
|
||||
Order: 1,
|
||||
},
|
||||
}
|
||||
|
||||
mempool := block.NewLanedMempool(
|
||||
log.NewTestLogger(s.T()),
|
||||
false,
|
||||
mocks.NewMockLaneFetcher(func() (blocksdkmoduletypes.Lane, error) {
|
||||
return blocksdkmoduletypes.Lane{}, nil
|
||||
}, func() []blocksdkmoduletypes.Lane {
|
||||
return chainLanes
|
||||
}),
|
||||
lanes...,
|
||||
)
|
||||
|
||||
proposalHandler := abci.NewProposalHandler(
|
||||
log.NewTestLogger(s.T()),
|
||||
@ -709,7 +766,34 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() {
|
||||
})
|
||||
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx))
|
||||
|
||||
mempool := block.NewLanedMempool(log.NewTestLogger(s.T()), false, defaultLane, panicLane)
|
||||
lanes := []block.Lane{
|
||||
defaultLane,
|
||||
panicLane,
|
||||
}
|
||||
|
||||
chainLanes := []blocksdkmoduletypes.Lane{
|
||||
{
|
||||
Id: panicLane.Name(),
|
||||
MaxBlockSpace: panicLane.GetMaxBlockSpace(),
|
||||
Order: 1,
|
||||
},
|
||||
{
|
||||
Id: defaultLane.Name(),
|
||||
MaxBlockSpace: defaultLane.GetMaxBlockSpace(),
|
||||
Order: 0,
|
||||
},
|
||||
}
|
||||
|
||||
mempool := block.NewLanedMempool(
|
||||
log.NewTestLogger(s.T()),
|
||||
false,
|
||||
mocks.NewMockLaneFetcher(func() (blocksdkmoduletypes.Lane, error) {
|
||||
return blocksdkmoduletypes.Lane{}, nil
|
||||
}, func() []blocksdkmoduletypes.Lane {
|
||||
return chainLanes
|
||||
}),
|
||||
lanes...,
|
||||
)
|
||||
|
||||
proposalHandler := abci.NewProposalHandler(
|
||||
log.NewTestLogger(s.T()),
|
||||
@ -759,8 +843,40 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() {
|
||||
})
|
||||
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx))
|
||||
|
||||
mempool := block.NewLanedMempool(log.NewTestLogger(s.T()), false, panicLane, panicLane2, defaultLane)
|
||||
lanes := []block.Lane{
|
||||
panicLane,
|
||||
panicLane2,
|
||||
defaultLane,
|
||||
}
|
||||
|
||||
chainLanes := []blocksdkmoduletypes.Lane{
|
||||
{
|
||||
Id: panicLane.Name(),
|
||||
MaxBlockSpace: panicLane.GetMaxBlockSpace(),
|
||||
Order: 0,
|
||||
},
|
||||
{
|
||||
Id: panicLane2.Name(),
|
||||
MaxBlockSpace: panicLane2.GetMaxBlockSpace(),
|
||||
Order: 1,
|
||||
},
|
||||
{
|
||||
Id: defaultLane.Name(),
|
||||
MaxBlockSpace: defaultLane.GetMaxBlockSpace(),
|
||||
Order: 2,
|
||||
},
|
||||
}
|
||||
|
||||
mempool := block.NewLanedMempool(
|
||||
log.NewTestLogger(s.T()),
|
||||
false,
|
||||
mocks.NewMockLaneFetcher(func() (blocksdkmoduletypes.Lane, error) {
|
||||
return blocksdkmoduletypes.Lane{}, nil
|
||||
}, func() []blocksdkmoduletypes.Lane {
|
||||
return chainLanes
|
||||
}),
|
||||
lanes...,
|
||||
)
|
||||
proposalHandler := abci.NewProposalHandler(
|
||||
log.NewTestLogger(s.T()),
|
||||
s.encodingConfig.TxConfig.TxDecoder(),
|
||||
@ -809,7 +925,40 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() {
|
||||
})
|
||||
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx))
|
||||
|
||||
mempool := block.NewLanedMempool(log.NewTestLogger(s.T()), false, defaultLane, panicLane, panicLane2)
|
||||
lanes := []block.Lane{
|
||||
defaultLane,
|
||||
panicLane,
|
||||
panicLane2,
|
||||
}
|
||||
|
||||
chainLanes := []blocksdkmoduletypes.Lane{
|
||||
{
|
||||
Id: panicLane.Name(),
|
||||
MaxBlockSpace: panicLane.GetMaxBlockSpace(),
|
||||
Order: 1,
|
||||
},
|
||||
{
|
||||
Id: panicLane2.Name(),
|
||||
MaxBlockSpace: panicLane2.GetMaxBlockSpace(),
|
||||
Order: 2,
|
||||
},
|
||||
{
|
||||
Id: defaultLane.Name(),
|
||||
MaxBlockSpace: defaultLane.GetMaxBlockSpace(),
|
||||
Order: 0,
|
||||
},
|
||||
}
|
||||
|
||||
mempool := block.NewLanedMempool(
|
||||
log.NewTestLogger(s.T()),
|
||||
false,
|
||||
mocks.NewMockLaneFetcher(func() (blocksdkmoduletypes.Lane, error) {
|
||||
return blocksdkmoduletypes.Lane{}, nil
|
||||
}, func() []blocksdkmoduletypes.Lane {
|
||||
return chainLanes
|
||||
}),
|
||||
lanes...,
|
||||
)
|
||||
|
||||
proposalHandler := abci.NewProposalHandler(
|
||||
log.NewTestLogger(s.T()),
|
||||
@ -1454,7 +1603,7 @@ func (s *ProposalsTestSuite) TestIterateMempoolAndProcessProposalParity() {
|
||||
accounts := testutils.RandomAccounts(s.random, numAccounts)
|
||||
|
||||
// Create a bunch of transactions to insert into the default lane
|
||||
txsToInsert := []sdk.Tx{}
|
||||
var txsToInsert []sdk.Tx
|
||||
validationMap := make(map[sdk.Tx]bool)
|
||||
for _, account := range accounts {
|
||||
for nonce := uint64(0); nonce < numTxsPerAccount; nonce++ {
|
||||
@ -1511,14 +1660,14 @@ func (s *ProposalsTestSuite) TestIterateMempoolAndProcessProposalParity() {
|
||||
}
|
||||
|
||||
// Retrieve the transactions from the default lane in the same way the prepare function would.
|
||||
retrievedTxs := []sdk.Tx{}
|
||||
var retrievedTxs []sdk.Tx
|
||||
for iterator := defaultLane.Select(context.Background(), nil); iterator != nil; iterator = iterator.Next() {
|
||||
retrievedTxs = append(retrievedTxs, iterator.Tx())
|
||||
}
|
||||
s.Require().Equal(len(txsToInsert), len(retrievedTxs))
|
||||
|
||||
// Retrieve the transactions from the free lane in the same way the prepare function would.
|
||||
freeRetrievedTxs := []sdk.Tx{}
|
||||
var freeRetrievedTxs []sdk.Tx
|
||||
for iterator := freelane.Select(context.Background(), nil); iterator != nil; iterator = iterator.Next() {
|
||||
freeRetrievedTxs = append(freeRetrievedTxs, iterator.Tx())
|
||||
}
|
||||
@ -1557,7 +1706,7 @@ func (s *ProposalsTestSuite) TestValidateBasic() {
|
||||
info := s.createProposalInfoBytes(0, 0, 0, 0, nil)
|
||||
proposal := [][]byte{info}
|
||||
|
||||
_, partialProposals, err := proposalHandlers.ExtractLanes(proposal)
|
||||
_, partialProposals, err := proposalHandlers.ExtractLanes(s.ctx, proposal)
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal(3, len(partialProposals))
|
||||
|
||||
@ -1570,21 +1719,21 @@ func (s *ProposalsTestSuite) TestValidateBasic() {
|
||||
info := s.createProposalInfoBytes(0, 0, 0, 0, nil)
|
||||
proposal := [][]byte{info, {0x01, 0x02, 0x03}}
|
||||
|
||||
_, _, err := proposalHandlers.ExtractLanes(proposal)
|
||||
_, _, err := proposalHandlers.ExtractLanes(s.ctx, proposal)
|
||||
s.Require().Error(err)
|
||||
})
|
||||
|
||||
s.Run("should invalidate proposal without info", func() {
|
||||
proposal := [][]byte{{0x01, 0x02, 0x03}}
|
||||
|
||||
_, _, err := proposalHandlers.ExtractLanes(proposal)
|
||||
_, _, err := proposalHandlers.ExtractLanes(s.ctx, proposal)
|
||||
s.Require().Error(err)
|
||||
})
|
||||
|
||||
s.Run("should invalidate completely empty proposal", func() {
|
||||
proposal := [][]byte{}
|
||||
|
||||
_, _, err := proposalHandlers.ExtractLanes(proposal)
|
||||
_, _, err := proposalHandlers.ExtractLanes(s.ctx, proposal)
|
||||
s.Require().Error(err)
|
||||
})
|
||||
|
||||
@ -1592,7 +1741,7 @@ func (s *ProposalsTestSuite) TestValidateBasic() {
|
||||
info := s.createProposalInfoBytes(0, 0, 0, 0, nil)
|
||||
proposal := [][]byte{info, {0x01, 0x02, 0x03}, {0x01, 0x02, 0x03}}
|
||||
|
||||
_, _, err := proposalHandlers.ExtractLanes(proposal)
|
||||
_, _, err := proposalHandlers.ExtractLanes(s.ctx, proposal)
|
||||
s.Require().Error(err)
|
||||
})
|
||||
|
||||
@ -1622,7 +1771,7 @@ func (s *ProposalsTestSuite) TestValidateBasic() {
|
||||
|
||||
proposal = append([][]byte{info}, proposal...)
|
||||
|
||||
_, partialProposals, err := proposalHandlers.ExtractLanes(proposal)
|
||||
_, partialProposals, err := proposalHandlers.ExtractLanes(s.ctx, proposal)
|
||||
s.Require().NoError(err)
|
||||
|
||||
s.Require().Equal(3, len(partialProposals))
|
||||
@ -1669,7 +1818,7 @@ func (s *ProposalsTestSuite) TestValidateBasic() {
|
||||
|
||||
proposal = append([][]byte{info}, proposal...)
|
||||
|
||||
_, partialProposals, err := proposalHandlers.ExtractLanes(proposal)
|
||||
_, partialProposals, err := proposalHandlers.ExtractLanes(s.ctx, proposal)
|
||||
s.Require().NoError(err)
|
||||
|
||||
s.Require().Equal(3, len(partialProposals))
|
||||
@ -1730,7 +1879,7 @@ func (s *ProposalsTestSuite) TestValidateBasic() {
|
||||
|
||||
proposal = append([][]byte{info}, proposal...)
|
||||
|
||||
_, partialProposals, err := proposalHandlers.ExtractLanes(proposal)
|
||||
_, partialProposals, err := proposalHandlers.ExtractLanes(s.ctx, proposal)
|
||||
s.Require().NoError(err)
|
||||
|
||||
s.Require().Equal(3, len(partialProposals))
|
||||
|
||||
@ -15,7 +15,7 @@ import (
|
||||
// for the proposal to be valid. This includes:
|
||||
// 1. The proposal must contain the proposal information and must be valid.
|
||||
// 2. The proposal must contain the correct number of transactions for each lane.
|
||||
func (h *ProposalHandler) ExtractLanes(proposal [][]byte) (types.ProposalInfo, [][][]byte, error) {
|
||||
func (h *ProposalHandler) ExtractLanes(ctx sdk.Context, proposal [][]byte) (types.ProposalInfo, [][][]byte, error) {
|
||||
// If the proposal is empty, then the metadata was not included.
|
||||
if len(proposal) == 0 {
|
||||
return types.ProposalInfo{}, nil, fmt.Errorf("proposal does not contain proposal metadata")
|
||||
@ -29,7 +29,10 @@ func (h *ProposalHandler) ExtractLanes(proposal [][]byte) (types.ProposalInfo, [
|
||||
return types.ProposalInfo{}, nil, fmt.Errorf("failed to unmarshal proposal metadata: %w", err)
|
||||
}
|
||||
|
||||
lanes := h.mempool.Registry()
|
||||
lanes, err := h.mempool.Registry(ctx)
|
||||
if err != nil {
|
||||
return types.ProposalInfo{}, nil, fmt.Errorf("failed to get mempool registry: %w", err)
|
||||
}
|
||||
partialProposals := make([][][]byte, len(lanes))
|
||||
|
||||
if metaData.TxsByLane == nil {
|
||||
|
||||
@ -5,6 +5,8 @@ import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
|
||||
blocksdkmoduletypes "github.com/skip-mev/block-sdk/x/blocksdk/types"
|
||||
|
||||
"cosmossdk.io/log"
|
||||
"cosmossdk.io/math"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -63,6 +65,7 @@ func (s *ProposalsTestSuite) setUpStandardLane(maxBlockSpace math.LegacyDec, exp
|
||||
TxDecoder: s.encodingConfig.TxConfig.TxDecoder(),
|
||||
AnteHandler: s.setUpAnteHandler(expectedExecution),
|
||||
MaxBlockSpace: maxBlockSpace,
|
||||
IgnoreList: make([]block.Lane, 0),
|
||||
SignerExtractor: signeradaptors.NewDefaultAdapter(),
|
||||
}
|
||||
|
||||
@ -118,7 +121,29 @@ func (s *ProposalsTestSuite) setUpPanicLane(maxBlockSpace math.LegacyDec) *base.
|
||||
}
|
||||
|
||||
func (s *ProposalsTestSuite) setUpProposalHandlers(lanes []block.Lane) *abci.ProposalHandler {
|
||||
mempool := block.NewLanedMempool(log.NewTestLogger(s.T()), true, lanes...)
|
||||
blocksdkLanes := make([]blocksdkmoduletypes.Lane, len(lanes))
|
||||
for i, lane := range lanes {
|
||||
blocksdkLanes[i] = blocksdkmoduletypes.Lane{
|
||||
Id: lane.Name(),
|
||||
MaxBlockSpace: lane.GetMaxBlockSpace(),
|
||||
Order: uint64(i),
|
||||
}
|
||||
}
|
||||
|
||||
laneFetcher := NewMockLaneFetcher(
|
||||
func() (blocksdkmoduletypes.Lane, error) {
|
||||
return blocksdkmoduletypes.Lane{}, nil
|
||||
},
|
||||
func() []blocksdkmoduletypes.Lane {
|
||||
return blocksdkLanes
|
||||
})
|
||||
|
||||
mempool := block.NewLanedMempool(log.NewTestLogger(
|
||||
s.T()),
|
||||
false,
|
||||
laneFetcher,
|
||||
lanes...,
|
||||
)
|
||||
|
||||
return abci.NewProposalHandler(
|
||||
log.NewTestLogger(s.T()),
|
||||
|
||||
579
api/sdk/blocksdk/module/v1/module.pulsar.go
Normal file
579
api/sdk/blocksdk/module/v1/module.pulsar.go
Normal file
@ -0,0 +1,579 @@
|
||||
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
|
||||
package modulev1
|
||||
|
||||
import (
|
||||
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
|
||||
fmt "fmt"
|
||||
runtime "github.com/cosmos/cosmos-proto/runtime"
|
||||
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 (
|
||||
md_Module protoreflect.MessageDescriptor
|
||||
fd_Module_authority protoreflect.FieldDescriptor
|
||||
)
|
||||
|
||||
func init() {
|
||||
file_sdk_blocksdk_module_v1_module_proto_init()
|
||||
md_Module = File_sdk_blocksdk_module_v1_module_proto.Messages().ByName("Module")
|
||||
fd_Module_authority = md_Module.Fields().ByName("authority")
|
||||
}
|
||||
|
||||
var _ protoreflect.Message = (*fastReflection_Module)(nil)
|
||||
|
||||
type fastReflection_Module Module
|
||||
|
||||
func (x *Module) ProtoReflect() protoreflect.Message {
|
||||
return (*fastReflection_Module)(x)
|
||||
}
|
||||
|
||||
func (x *Module) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_sdk_blocksdk_module_v1_module_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_Module_messageType fastReflection_Module_messageType
|
||||
var _ protoreflect.MessageType = fastReflection_Module_messageType{}
|
||||
|
||||
type fastReflection_Module_messageType struct{}
|
||||
|
||||
func (x fastReflection_Module_messageType) Zero() protoreflect.Message {
|
||||
return (*fastReflection_Module)(nil)
|
||||
}
|
||||
func (x fastReflection_Module_messageType) New() protoreflect.Message {
|
||||
return new(fastReflection_Module)
|
||||
}
|
||||
func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_Module
|
||||
}
|
||||
|
||||
// Descriptor returns message descriptor, which contains only the protobuf
|
||||
// type information for the message.
|
||||
func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_Module
|
||||
}
|
||||
|
||||
// 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_Module) Type() protoreflect.MessageType {
|
||||
return _fastReflection_Module_messageType
|
||||
}
|
||||
|
||||
// New returns a newly allocated and mutable empty message.
|
||||
func (x *fastReflection_Module) New() protoreflect.Message {
|
||||
return new(fastReflection_Module)
|
||||
}
|
||||
|
||||
// Interface unwraps the message reflection interface and
|
||||
// returns the underlying ProtoMessage interface.
|
||||
func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
|
||||
return (*Module)(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_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if x.Authority != "" {
|
||||
value := protoreflect.ValueOfString(x.Authority)
|
||||
if !f(fd_Module_authority, 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_Module) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
case "sdk.blocksdk.module.v1.Module.authority":
|
||||
return x.Authority != ""
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.module.v1.Module"))
|
||||
}
|
||||
panic(fmt.Errorf("message sdk.blocksdk.module.v1.Module 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_Module) Clear(fd protoreflect.FieldDescriptor) {
|
||||
switch fd.FullName() {
|
||||
case "sdk.blocksdk.module.v1.Module.authority":
|
||||
x.Authority = ""
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.module.v1.Module"))
|
||||
}
|
||||
panic(fmt.Errorf("message sdk.blocksdk.module.v1.Module 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_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch descriptor.FullName() {
|
||||
case "sdk.blocksdk.module.v1.Module.authority":
|
||||
value := x.Authority
|
||||
return protoreflect.ValueOfString(value)
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.module.v1.Module"))
|
||||
}
|
||||
panic(fmt.Errorf("message sdk.blocksdk.module.v1.Module 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_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
case "sdk.blocksdk.module.v1.Module.authority":
|
||||
x.Authority = value.Interface().(string)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.module.v1.Module"))
|
||||
}
|
||||
panic(fmt.Errorf("message sdk.blocksdk.module.v1.Module 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_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "sdk.blocksdk.module.v1.Module.authority":
|
||||
panic(fmt.Errorf("field authority of message sdk.blocksdk.module.v1.Module is not mutable"))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.module.v1.Module"))
|
||||
}
|
||||
panic(fmt.Errorf("message sdk.blocksdk.module.v1.Module 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_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "sdk.blocksdk.module.v1.Module.authority":
|
||||
return protoreflect.ValueOfString("")
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.module.v1.Module"))
|
||||
}
|
||||
panic(fmt.Errorf("message sdk.blocksdk.module.v1.Module 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_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
switch d.FullName() {
|
||||
default:
|
||||
panic(fmt.Errorf("%s is not a oneof field in sdk.blocksdk.module.v1.Module", 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_Module) 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_Module) 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_Module) 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_Module) ProtoMethods() *protoiface.Methods {
|
||||
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
|
||||
x := input.Message.Interface().(*Module)
|
||||
if x == nil {
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: 0,
|
||||
}
|
||||
}
|
||||
options := runtime.SizeInputToOptions(input)
|
||||
_ = options
|
||||
var n int
|
||||
var l int
|
||||
_ = l
|
||||
l = len(x.Authority)
|
||||
if l > 0 {
|
||||
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().(*Module)
|
||||
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.Authority) > 0 {
|
||||
i -= len(x.Authority)
|
||||
copy(dAtA[i:], x.Authority)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority)))
|
||||
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().(*Module)
|
||||
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: Module: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: 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 Authority", wireType)
|
||||
}
|
||||
var stringLen 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++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
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.Authority = string(dAtA[iNdEx:postIndex])
|
||||
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/module/v1/module.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)
|
||||
)
|
||||
|
||||
// Module is the config object of the x/blocksdk module.
|
||||
type Module struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Authority defines the custom module authority. If not set, defaults to the
|
||||
// governance module.
|
||||
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Module) Reset() {
|
||||
*x = Module{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_sdk_blocksdk_module_v1_module_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Module) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Module) ProtoMessage() {}
|
||||
|
||||
// Deprecated: Use Module.ProtoReflect.Descriptor instead.
|
||||
func (*Module) Descriptor() ([]byte, []int) {
|
||||
return file_sdk_blocksdk_module_v1_module_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Module) GetAuthority() string {
|
||||
if x != nil {
|
||||
return x.Authority
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_sdk_blocksdk_module_v1_module_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_sdk_blocksdk_module_v1_module_proto_rawDesc = []byte{
|
||||
0x0a, 0x23, 0x73, 0x64, 0x6b, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x2f, 0x6d,
|
||||
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
|
||||
0x73, 0x64, 0x6b, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63,
|
||||
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68,
|
||||
0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||
0x58, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74,
|
||||
0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75,
|
||||
0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x30, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x2a, 0x0a,
|
||||
0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6b, 0x69, 0x70,
|
||||
0x2d, 0x6d, 0x65, 0x76, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78,
|
||||
0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x42, 0xd6, 0x01, 0x0a, 0x1a, 0x63, 0x6f,
|
||||
0x6d, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x2e, 0x6d,
|
||||
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
|
||||
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 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, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31,
|
||||
0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x42, 0x4d, 0xaa,
|
||||
0x02, 0x16, 0x53, 0x64, 0x6b, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x2e, 0x4d,
|
||||
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x16, 0x53, 0x64, 0x6b, 0x5c, 0x42,
|
||||
0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56,
|
||||
0x31, 0xe2, 0x02, 0x22, 0x53, 0x64, 0x6b, 0x5c, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b,
|
||||
0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65,
|
||||
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x53, 0x64, 0x6b, 0x3a, 0x3a, 0x42, 0x6c,
|
||||
0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a,
|
||||
0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_sdk_blocksdk_module_v1_module_proto_rawDescOnce sync.Once
|
||||
file_sdk_blocksdk_module_v1_module_proto_rawDescData = file_sdk_blocksdk_module_v1_module_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_sdk_blocksdk_module_v1_module_proto_rawDescGZIP() []byte {
|
||||
file_sdk_blocksdk_module_v1_module_proto_rawDescOnce.Do(func() {
|
||||
file_sdk_blocksdk_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_sdk_blocksdk_module_v1_module_proto_rawDescData)
|
||||
})
|
||||
return file_sdk_blocksdk_module_v1_module_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_sdk_blocksdk_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_sdk_blocksdk_module_v1_module_proto_goTypes = []interface{}{
|
||||
(*Module)(nil), // 0: sdk.blocksdk.module.v1.Module
|
||||
}
|
||||
var file_sdk_blocksdk_module_v1_module_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_sdk_blocksdk_module_v1_module_proto_init() }
|
||||
func file_sdk_blocksdk_module_v1_module_proto_init() {
|
||||
if File_sdk_blocksdk_module_v1_module_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_sdk_blocksdk_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Module); 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_module_v1_module_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_sdk_blocksdk_module_v1_module_proto_goTypes,
|
||||
DependencyIndexes: file_sdk_blocksdk_module_v1_module_proto_depIdxs,
|
||||
MessageInfos: file_sdk_blocksdk_module_v1_module_proto_msgTypes,
|
||||
}.Build()
|
||||
File_sdk_blocksdk_module_v1_module_proto = out.File
|
||||
file_sdk_blocksdk_module_v1_module_proto_rawDesc = nil
|
||||
file_sdk_blocksdk_module_v1_module_proto_goTypes = nil
|
||||
file_sdk_blocksdk_module_v1_module_proto_depIdxs = nil
|
||||
}
|
||||
724
api/sdk/blocksdk/v1/blocksdk.pulsar.go
Normal file
724
api/sdk/blocksdk/v1/blocksdk.pulsar.go
Normal file
@ -0,0 +1,724 @@
|
||||
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
|
||||
package blocksdkv1
|
||||
|
||||
import (
|
||||
_ "cosmossdk.io/api/amino"
|
||||
fmt "fmt"
|
||||
_ "github.com/cosmos/cosmos-proto"
|
||||
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 (
|
||||
md_Lane protoreflect.MessageDescriptor
|
||||
fd_Lane_id protoreflect.FieldDescriptor
|
||||
fd_Lane_max_block_space protoreflect.FieldDescriptor
|
||||
fd_Lane_order protoreflect.FieldDescriptor
|
||||
)
|
||||
|
||||
func init() {
|
||||
file_sdk_blocksdk_v1_blocksdk_proto_init()
|
||||
md_Lane = File_sdk_blocksdk_v1_blocksdk_proto.Messages().ByName("Lane")
|
||||
fd_Lane_id = md_Lane.Fields().ByName("id")
|
||||
fd_Lane_max_block_space = md_Lane.Fields().ByName("max_block_space")
|
||||
fd_Lane_order = md_Lane.Fields().ByName("order")
|
||||
}
|
||||
|
||||
var _ protoreflect.Message = (*fastReflection_Lane)(nil)
|
||||
|
||||
type fastReflection_Lane Lane
|
||||
|
||||
func (x *Lane) ProtoReflect() protoreflect.Message {
|
||||
return (*fastReflection_Lane)(x)
|
||||
}
|
||||
|
||||
func (x *Lane) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_sdk_blocksdk_v1_blocksdk_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_Lane_messageType fastReflection_Lane_messageType
|
||||
var _ protoreflect.MessageType = fastReflection_Lane_messageType{}
|
||||
|
||||
type fastReflection_Lane_messageType struct{}
|
||||
|
||||
func (x fastReflection_Lane_messageType) Zero() protoreflect.Message {
|
||||
return (*fastReflection_Lane)(nil)
|
||||
}
|
||||
func (x fastReflection_Lane_messageType) New() protoreflect.Message {
|
||||
return new(fastReflection_Lane)
|
||||
}
|
||||
func (x fastReflection_Lane_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_Lane
|
||||
}
|
||||
|
||||
// Descriptor returns message descriptor, which contains only the protobuf
|
||||
// type information for the message.
|
||||
func (x *fastReflection_Lane) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_Lane
|
||||
}
|
||||
|
||||
// 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_Lane) Type() protoreflect.MessageType {
|
||||
return _fastReflection_Lane_messageType
|
||||
}
|
||||
|
||||
// New returns a newly allocated and mutable empty message.
|
||||
func (x *fastReflection_Lane) New() protoreflect.Message {
|
||||
return new(fastReflection_Lane)
|
||||
}
|
||||
|
||||
// Interface unwraps the message reflection interface and
|
||||
// returns the underlying ProtoMessage interface.
|
||||
func (x *fastReflection_Lane) Interface() protoreflect.ProtoMessage {
|
||||
return (*Lane)(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_Lane) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if x.Id != "" {
|
||||
value := protoreflect.ValueOfString(x.Id)
|
||||
if !f(fd_Lane_id, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if x.MaxBlockSpace != "" {
|
||||
value := protoreflect.ValueOfString(x.MaxBlockSpace)
|
||||
if !f(fd_Lane_max_block_space, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if x.Order != uint64(0) {
|
||||
value := protoreflect.ValueOfUint64(x.Order)
|
||||
if !f(fd_Lane_order, 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_Lane) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
case "sdk.blocksdk.v1.Lane.id":
|
||||
return x.Id != ""
|
||||
case "sdk.blocksdk.v1.Lane.max_block_space":
|
||||
return x.MaxBlockSpace != ""
|
||||
case "sdk.blocksdk.v1.Lane.order":
|
||||
return x.Order != uint64(0)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.v1.Lane"))
|
||||
}
|
||||
panic(fmt.Errorf("message sdk.blocksdk.v1.Lane 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_Lane) Clear(fd protoreflect.FieldDescriptor) {
|
||||
switch fd.FullName() {
|
||||
case "sdk.blocksdk.v1.Lane.id":
|
||||
x.Id = ""
|
||||
case "sdk.blocksdk.v1.Lane.max_block_space":
|
||||
x.MaxBlockSpace = ""
|
||||
case "sdk.blocksdk.v1.Lane.order":
|
||||
x.Order = uint64(0)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.v1.Lane"))
|
||||
}
|
||||
panic(fmt.Errorf("message sdk.blocksdk.v1.Lane 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_Lane) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch descriptor.FullName() {
|
||||
case "sdk.blocksdk.v1.Lane.id":
|
||||
value := x.Id
|
||||
return protoreflect.ValueOfString(value)
|
||||
case "sdk.blocksdk.v1.Lane.max_block_space":
|
||||
value := x.MaxBlockSpace
|
||||
return protoreflect.ValueOfString(value)
|
||||
case "sdk.blocksdk.v1.Lane.order":
|
||||
value := x.Order
|
||||
return protoreflect.ValueOfUint64(value)
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.v1.Lane"))
|
||||
}
|
||||
panic(fmt.Errorf("message sdk.blocksdk.v1.Lane 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_Lane) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
case "sdk.blocksdk.v1.Lane.id":
|
||||
x.Id = value.Interface().(string)
|
||||
case "sdk.blocksdk.v1.Lane.max_block_space":
|
||||
x.MaxBlockSpace = value.Interface().(string)
|
||||
case "sdk.blocksdk.v1.Lane.order":
|
||||
x.Order = value.Uint()
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.v1.Lane"))
|
||||
}
|
||||
panic(fmt.Errorf("message sdk.blocksdk.v1.Lane 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_Lane) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "sdk.blocksdk.v1.Lane.id":
|
||||
panic(fmt.Errorf("field id of message sdk.blocksdk.v1.Lane is not mutable"))
|
||||
case "sdk.blocksdk.v1.Lane.max_block_space":
|
||||
panic(fmt.Errorf("field max_block_space of message sdk.blocksdk.v1.Lane is not mutable"))
|
||||
case "sdk.blocksdk.v1.Lane.order":
|
||||
panic(fmt.Errorf("field order of message sdk.blocksdk.v1.Lane is not mutable"))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.v1.Lane"))
|
||||
}
|
||||
panic(fmt.Errorf("message sdk.blocksdk.v1.Lane 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_Lane) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "sdk.blocksdk.v1.Lane.id":
|
||||
return protoreflect.ValueOfString("")
|
||||
case "sdk.blocksdk.v1.Lane.max_block_space":
|
||||
return protoreflect.ValueOfString("")
|
||||
case "sdk.blocksdk.v1.Lane.order":
|
||||
return protoreflect.ValueOfUint64(uint64(0))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: sdk.blocksdk.v1.Lane"))
|
||||
}
|
||||
panic(fmt.Errorf("message sdk.blocksdk.v1.Lane 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_Lane) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
switch d.FullName() {
|
||||
default:
|
||||
panic(fmt.Errorf("%s is not a oneof field in sdk.blocksdk.v1.Lane", 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_Lane) 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_Lane) 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_Lane) 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_Lane) ProtoMethods() *protoiface.Methods {
|
||||
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
|
||||
x := input.Message.Interface().(*Lane)
|
||||
if x == nil {
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: 0,
|
||||
}
|
||||
}
|
||||
options := runtime.SizeInputToOptions(input)
|
||||
_ = options
|
||||
var n int
|
||||
var l int
|
||||
_ = l
|
||||
l = len(x.Id)
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
l = len(x.MaxBlockSpace)
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.Order != 0 {
|
||||
n += 1 + runtime.Sov(uint64(x.Order))
|
||||
}
|
||||
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().(*Lane)
|
||||
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 x.Order != 0 {
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(x.Order))
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
if len(x.MaxBlockSpace) > 0 {
|
||||
i -= len(x.MaxBlockSpace)
|
||||
copy(dAtA[i:], x.MaxBlockSpace)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MaxBlockSpace)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(x.Id) > 0 {
|
||||
i -= len(x.Id)
|
||||
copy(dAtA[i:], x.Id)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id)))
|
||||
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().(*Lane)
|
||||
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: Lane: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Lane: 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 Id", wireType)
|
||||
}
|
||||
var stringLen 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++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
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.Id = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxBlockSpace", wireType)
|
||||
}
|
||||
var stringLen 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++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
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.MaxBlockSpace = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Order", wireType)
|
||||
}
|
||||
x.Order = 0
|
||||
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++
|
||||
x.Order |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
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/blocksdk.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)
|
||||
)
|
||||
|
||||
// Lane defines a block-sdk lane and its associated parameters. Only the
|
||||
// parameters that are critical to consensus are stored on-chain in this object.
|
||||
// The other associated configuration for a lane can be set and stored locally,
|
||||
// per-validator.
|
||||
type Lane struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// id is the unique identifier of a Lane. Maps to a block-sdk laneName.
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
// 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.
|
||||
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 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"`
|
||||
}
|
||||
|
||||
func (x *Lane) Reset() {
|
||||
*x = Lane{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_sdk_blocksdk_v1_blocksdk_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Lane) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Lane) ProtoMessage() {}
|
||||
|
||||
// Deprecated: Use Lane.ProtoReflect.Descriptor instead.
|
||||
func (*Lane) Descriptor() ([]byte, []int) {
|
||||
return file_sdk_blocksdk_v1_blocksdk_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Lane) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Lane) GetMaxBlockSpace() string {
|
||||
if x != nil {
|
||||
return x.MaxBlockSpace
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Lane) GetOrder() uint64 {
|
||||
if x != nil {
|
||||
return x.Order
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_sdk_blocksdk_v1_blocksdk_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_sdk_blocksdk_v1_blocksdk_proto_rawDesc = []byte{
|
||||
0x0a, 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,
|
||||
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, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61,
|
||||
0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8c, 0x01, 0x0a, 0x04, 0x4c, 0x61, 0x6e, 0x65, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x5e,
|
||||
0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x73, 0x70, 0x61, 0x63,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x36, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f,
|
||||
0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61,
|
||||
0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a,
|
||||
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52,
|
||||
0x0d, 0x6d, 0x61, 0x78, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x6f,
|
||||
0x72, 0x64, 0x65, 0x72, 0x42, 0xaf, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x64, 0x6b,
|
||||
0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 0x2e, 0x76, 0x31, 0x42, 0x0d, 0x42, 0x6c,
|
||||
0x6f, 0x63, 0x6b, 0x73, 0x64, 0x6b, 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_blocksdk_proto_rawDescOnce sync.Once
|
||||
file_sdk_blocksdk_v1_blocksdk_proto_rawDescData = file_sdk_blocksdk_v1_blocksdk_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_sdk_blocksdk_v1_blocksdk_proto_rawDescGZIP() []byte {
|
||||
file_sdk_blocksdk_v1_blocksdk_proto_rawDescOnce.Do(func() {
|
||||
file_sdk_blocksdk_v1_blocksdk_proto_rawDescData = protoimpl.X.CompressGZIP(file_sdk_blocksdk_v1_blocksdk_proto_rawDescData)
|
||||
})
|
||||
return file_sdk_blocksdk_v1_blocksdk_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_sdk_blocksdk_v1_blocksdk_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_sdk_blocksdk_v1_blocksdk_proto_goTypes = []interface{}{
|
||||
(*Lane)(nil), // 0: sdk.blocksdk.v1.Lane
|
||||
}
|
||||
var file_sdk_blocksdk_v1_blocksdk_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_sdk_blocksdk_v1_blocksdk_proto_init() }
|
||||
func file_sdk_blocksdk_v1_blocksdk_proto_init() {
|
||||
if File_sdk_blocksdk_v1_blocksdk_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_sdk_blocksdk_v1_blocksdk_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Lane); 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_blocksdk_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_sdk_blocksdk_v1_blocksdk_proto_goTypes,
|
||||
DependencyIndexes: file_sdk_blocksdk_v1_blocksdk_proto_depIdxs,
|
||||
MessageInfos: file_sdk_blocksdk_v1_blocksdk_proto_msgTypes,
|
||||
}.Build()
|
||||
File_sdk_blocksdk_v1_blocksdk_proto = out.File
|
||||
file_sdk_blocksdk_v1_blocksdk_proto_rawDesc = nil
|
||||
file_sdk_blocksdk_v1_blocksdk_proto_goTypes = nil
|
||||
file_sdk_blocksdk_v1_blocksdk_proto_depIdxs = nil
|
||||
}
|
||||
652
api/sdk/blocksdk/v1/genesis.pulsar.go
Normal file
652
api/sdk/blocksdk/v1/genesis.pulsar.go
Normal 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
|
||||
}
|
||||
2035
api/sdk/blocksdk/v1/query.pulsar.go
Normal file
2035
api/sdk/blocksdk/v1/query.pulsar.go
Normal file
File diff suppressed because it is too large
Load Diff
150
api/sdk/blocksdk/v1/query_grpc.pb.go
Normal file
150
api/sdk/blocksdk/v1/query_grpc.pb.go
Normal 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",
|
||||
}
|
||||
1090
api/sdk/blocksdk/v1/tx.pulsar.go
Normal file
1090
api/sdk/blocksdk/v1/tx.pulsar.go
Normal file
File diff suppressed because it is too large
Load Diff
111
api/sdk/blocksdk/v1/tx_grpc.pb.go
Normal file
111
api/sdk/blocksdk/v1/tx_grpc.pb.go
Normal 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",
|
||||
}
|
||||
@ -173,3 +173,9 @@ func (l *BaseLane) TxEncoder() sdk.TxEncoder {
|
||||
func (l *BaseLane) GetMaxBlockSpace() math.LegacyDec {
|
||||
return l.cfg.MaxBlockSpace
|
||||
}
|
||||
|
||||
// SetMaxBlockSpace sets the maximum amount of block space that the lane is
|
||||
// allowed to consume as a percentage of the total block space.
|
||||
func (l *BaseLane) SetMaxBlockSpace(maxBlockSpace math.LegacyDec) {
|
||||
l.cfg.MaxBlockSpace = maxBlockSpace
|
||||
}
|
||||
|
||||
@ -57,6 +57,9 @@ type Lane interface {
|
||||
// GetMaxBlockSpace returns the max block space for the lane as a relative percentage.
|
||||
GetMaxBlockSpace() math.LegacyDec
|
||||
|
||||
// SetMaxBlockSpace sets the max block space for the lane as a relative percentage.
|
||||
SetMaxBlockSpace(math.LegacyDec)
|
||||
|
||||
// Name returns the name of the lane.
|
||||
Name() string
|
||||
|
||||
@ -69,3 +72,15 @@ type Lane interface {
|
||||
// Match determines if a transaction belongs to this lane.
|
||||
Match(ctx sdk.Context, tx sdk.Tx) bool
|
||||
}
|
||||
|
||||
// FindLane finds a Lanes from in an array of Lanes and returns it and its index if found.
|
||||
// Returns nil, 0 and false if not found.
|
||||
func FindLane(lanes []Lane, name string) (lane Lane, index int, found bool) {
|
||||
for i, lane := range lanes {
|
||||
if lane.Name() == name {
|
||||
return lanes[i], i, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, 0, false
|
||||
}
|
||||
|
||||
78
block/lane_test.go
Normal file
78
block/lane_test.go
Normal file
@ -0,0 +1,78 @@
|
||||
package block_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/skip-mev/block-sdk/block"
|
||||
"github.com/skip-mev/block-sdk/block/mocks"
|
||||
)
|
||||
|
||||
func (suite *BlockBusterTestSuite) TestFindLane() {
|
||||
lanes := make([]block.Lane, 30)
|
||||
cleanup := func() {
|
||||
for i := range lanes {
|
||||
_ = lanes[i].Name()
|
||||
}
|
||||
}
|
||||
defer cleanup()
|
||||
|
||||
for i := range lanes {
|
||||
laneMock := mocks.NewLane(suite.T())
|
||||
laneMock.On("Name").Return(fmt.Sprintf("lane%d", i))
|
||||
lanes[i] = laneMock
|
||||
}
|
||||
|
||||
type args struct {
|
||||
lanes []block.Lane
|
||||
name string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
wantLane block.Lane
|
||||
wantIndex int
|
||||
wantFound bool
|
||||
}{
|
||||
{
|
||||
name: "invalid lane not found",
|
||||
args: args{
|
||||
lanes: lanes,
|
||||
name: "invalid",
|
||||
},
|
||||
wantFound: false,
|
||||
},
|
||||
{
|
||||
name: "valid lane1",
|
||||
args: args{
|
||||
lanes: lanes,
|
||||
name: "lane1",
|
||||
},
|
||||
wantLane: lanes[1],
|
||||
wantIndex: 1,
|
||||
wantFound: true,
|
||||
},
|
||||
{
|
||||
name: "valid lane15",
|
||||
args: args{
|
||||
lanes: lanes,
|
||||
name: "lane15",
|
||||
},
|
||||
wantLane: lanes[15],
|
||||
wantIndex: 15,
|
||||
wantFound: true,
|
||||
},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
suite.Run(tc.name, func() {
|
||||
gotLane, gotIndex, gotFound := block.FindLane(tc.args.lanes, tc.args.name)
|
||||
if tc.wantFound {
|
||||
suite.Require().True(gotFound)
|
||||
suite.Require().Equal(tc.wantLane, gotLane)
|
||||
suite.Require().Equal(tc.wantIndex, gotIndex)
|
||||
return
|
||||
}
|
||||
|
||||
suite.Require().False(gotFound)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -9,19 +9,27 @@ import (
|
||||
"cosmossdk.io/math"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkmempool "github.com/cosmos/cosmos-sdk/types/mempool"
|
||||
|
||||
blocksdkmoduletypes "github.com/skip-mev/block-sdk/x/blocksdk/types"
|
||||
)
|
||||
|
||||
var _ Mempool = (*LanedMempool)(nil)
|
||||
|
||||
// LaneFetcher defines the interface to get a lane stored in the x/blocksdk module.
|
||||
type LaneFetcher interface {
|
||||
GetLane(ctx sdk.Context, id string) (lane blocksdkmoduletypes.Lane, err error)
|
||||
GetLanes(ctx sdk.Context) []blocksdkmoduletypes.Lane
|
||||
}
|
||||
|
||||
type (
|
||||
// Mempool defines the Block SDK mempool interface.
|
||||
Mempool interface {
|
||||
sdkmempool.Mempool
|
||||
|
||||
// Registry returns the mempool's lane registry.
|
||||
Registry() []Lane
|
||||
Registry(ctx sdk.Context) ([]Lane, error)
|
||||
|
||||
// Contains returns the any of the lanes currently contain the transaction.
|
||||
// Contains returns true if any of the lanes currently contain the transaction.
|
||||
Contains(tx sdk.Tx) bool
|
||||
|
||||
// GetTxDistribution returns the number of transactions in each lane.
|
||||
@ -37,11 +45,17 @@ type (
|
||||
// according to their priority. The first lane in the registry has the
|
||||
// highest priority and the last lane has the lowest priority.
|
||||
registry []Lane
|
||||
|
||||
// moduleLaneFetcher is the mempool's interface to read on-chain lane
|
||||
// information in the x/blocksdk module.
|
||||
moduleLaneFetcher LaneFetcher
|
||||
}
|
||||
)
|
||||
|
||||
// NewLanedMempool returns a new Block SDK LanedMempool. The laned mempool is
|
||||
// comprised of a registry of lanes. Each lane is responsible for selecting
|
||||
// NewLanedMempool returns a new Block SDK LanedMempool. The laned mempool comprises
|
||||
//
|
||||
// a registry of lanes. Each lane is responsible for selecting
|
||||
//
|
||||
// transactions according to its own selection logic. The lanes are ordered
|
||||
// according to their priority. The first lane in the registry has the highest
|
||||
// priority. Proposals are verified according to the order of the lanes in the
|
||||
@ -51,10 +65,11 @@ type (
|
||||
// attempt to insert, remove transactions from all lanes it belongs to. It is recommended,
|
||||
// that mutex is set to true when creating the mempool. This will ensure that each
|
||||
// transaction cannot be inserted into the lanes before it.
|
||||
func NewLanedMempool(logger log.Logger, mutex bool, lanes ...Lane) Mempool {
|
||||
func NewLanedMempool(logger log.Logger, mutex bool, laneFetcher LaneFetcher, lanes ...Lane) Mempool {
|
||||
mempool := &LanedMempool{
|
||||
logger: logger,
|
||||
registry: lanes,
|
||||
logger: logger,
|
||||
registry: lanes,
|
||||
moduleLaneFetcher: laneFetcher,
|
||||
}
|
||||
|
||||
if err := mempool.ValidateBasic(); err != nil {
|
||||
@ -63,8 +78,10 @@ func NewLanedMempool(logger log.Logger, mutex bool, lanes ...Lane) Mempool {
|
||||
|
||||
// Set the ignore list for each lane
|
||||
if mutex {
|
||||
registry := mempool.registry
|
||||
for index, lane := range mempool.registry {
|
||||
// perform full copy to prevent GC
|
||||
registry := make([]Lane, len(mempool.registry))
|
||||
copy(registry, mempool.registry)
|
||||
for index, lane := range registry {
|
||||
if index > 0 {
|
||||
lane.SetIgnoreList(registry[:index])
|
||||
}
|
||||
@ -193,11 +210,6 @@ func (m *LanedMempool) Contains(tx sdk.Tx) (contains bool) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Registry returns the mempool's lane registry.
|
||||
func (m *LanedMempool) Registry() []Lane {
|
||||
return m.registry
|
||||
}
|
||||
|
||||
// ValidateBasic validates the mempools configuration. ValidateBasic ensures
|
||||
// the following:
|
||||
// - The sum of the lane max block space percentages is less than or equal to 1.
|
||||
@ -225,5 +237,50 @@ func (m *LanedMempool) ValidateBasic() error {
|
||||
return fmt.Errorf("sum of total block space percentages will be less than 1")
|
||||
}
|
||||
|
||||
if m.moduleLaneFetcher == nil {
|
||||
return fmt.Errorf("moduleLaneFetcher muset be set on mempool")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Registry returns the mempool's lane registry.
|
||||
func (m *LanedMempool) Registry(ctx sdk.Context) (newRegistry []Lane, err error) {
|
||||
if m.moduleLaneFetcher == nil {
|
||||
return m.registry, fmt.Errorf("module lane fetcher not set")
|
||||
}
|
||||
|
||||
// TODO add a last block updated check ?
|
||||
// potential future optimization
|
||||
chainLanes := m.moduleLaneFetcher.GetLanes(ctx)
|
||||
|
||||
// order lanes and populate the necessary fields (maxBlockSize, etc)
|
||||
m.registry, err = m.OrderLanes(chainLanes)
|
||||
return m.registry, err
|
||||
}
|
||||
|
||||
func (m *LanedMempool) OrderLanes(chainLanes []blocksdkmoduletypes.Lane) (orderedLanes []Lane, err error) {
|
||||
orderedLanes = make([]Lane, len(chainLanes))
|
||||
for _, chainLane := range chainLanes {
|
||||
// panic protect
|
||||
if chainLane.GetOrder() >= uint64(len(orderedLanes)) {
|
||||
return orderedLanes, fmt.Errorf("lane order %d out of bounds, invalid configuration", chainLane.GetOrder())
|
||||
}
|
||||
|
||||
_, index, found := FindLane(m.registry, chainLane.Id)
|
||||
if !found {
|
||||
return orderedLanes, fmt.Errorf("lane %s not found in registry, invalid configuration", chainLane.Id)
|
||||
}
|
||||
|
||||
lane := m.registry[index]
|
||||
lane.SetMaxBlockSpace(chainLane.MaxBlockSpace)
|
||||
orderedLanes[chainLane.GetOrder()] = lane
|
||||
|
||||
// remove found lane from registry lanes for quicker find()
|
||||
m.registry[index] = m.registry[len(m.registry)-1] // Copy last element to index i.
|
||||
m.registry[len(m.registry)-1] = nil // Erase last element (write zero value).
|
||||
m.registry = m.registry[:len(m.registry)-1] // Truncate slice.
|
||||
}
|
||||
|
||||
return orderedLanes, nil
|
||||
}
|
||||
|
||||
@ -5,6 +5,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
blocksdkmoduletypes "github.com/skip-mev/block-sdk/x/blocksdk/types"
|
||||
|
||||
"github.com/skip-mev/block-sdk/block/mocks"
|
||||
|
||||
"cosmossdk.io/log"
|
||||
"cosmossdk.io/math"
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
@ -35,8 +39,14 @@ type BlockBusterTestSuite struct {
|
||||
freeLane *free.FreeLane
|
||||
gasTokenDenom string
|
||||
|
||||
lanes []block.Lane
|
||||
mempool block.Mempool
|
||||
// sdk module lanes
|
||||
mevSDKLane blocksdkmoduletypes.Lane
|
||||
baseSDKLane blocksdkmoduletypes.Lane
|
||||
freeSDKLane blocksdkmoduletypes.Lane
|
||||
|
||||
chainLanes []blocksdkmoduletypes.Lane
|
||||
lanes []block.Lane
|
||||
mempool block.Mempool
|
||||
|
||||
// account set up
|
||||
accounts []testutils.Account
|
||||
@ -73,6 +83,12 @@ func (suite *BlockBusterTestSuite) SetupTest() {
|
||||
mev.NewDefaultAuctionFactory(suite.encodingConfig.TxConfig.TxDecoder(), signer_extraction.NewDefaultAdapter()),
|
||||
)
|
||||
|
||||
suite.mevSDKLane = blocksdkmoduletypes.Lane{
|
||||
Id: suite.mevLane.Name(),
|
||||
MaxBlockSpace: suite.mevLane.GetMaxBlockSpace(),
|
||||
Order: 0,
|
||||
}
|
||||
|
||||
// Free lane set up
|
||||
freeConfig := base.LaneConfig{
|
||||
Logger: log.NewNopLogger(),
|
||||
@ -88,6 +104,12 @@ func (suite *BlockBusterTestSuite) SetupTest() {
|
||||
free.DefaultMatchHandler(),
|
||||
)
|
||||
|
||||
suite.freeSDKLane = blocksdkmoduletypes.Lane{
|
||||
Id: suite.freeLane.Name(),
|
||||
MaxBlockSpace: suite.freeLane.GetMaxBlockSpace(),
|
||||
Order: 1,
|
||||
}
|
||||
|
||||
// Base lane set up
|
||||
baseConfig := base.LaneConfig{
|
||||
Logger: log.NewNopLogger(),
|
||||
@ -101,9 +123,25 @@ func (suite *BlockBusterTestSuite) SetupTest() {
|
||||
baseConfig,
|
||||
)
|
||||
|
||||
suite.baseSDKLane = blocksdkmoduletypes.Lane{
|
||||
Id: suite.baseLane.Name(),
|
||||
MaxBlockSpace: suite.baseLane.GetMaxBlockSpace(),
|
||||
Order: 2,
|
||||
}
|
||||
|
||||
// Mempool set up
|
||||
suite.lanes = []block.Lane{suite.mevLane, suite.freeLane, suite.baseLane}
|
||||
suite.mempool = block.NewLanedMempool(log.NewTestLogger(suite.T()), true, suite.lanes...)
|
||||
suite.chainLanes = []blocksdkmoduletypes.Lane{suite.mevSDKLane, suite.freeSDKLane, suite.baseSDKLane}
|
||||
suite.mempool = block.NewLanedMempool(
|
||||
log.NewTestLogger(suite.T()),
|
||||
true,
|
||||
mocks.NewMockLaneFetcher(func() (blocksdkmoduletypes.Lane, error) {
|
||||
return suite.baseSDKLane, nil
|
||||
}, func() []blocksdkmoduletypes.Lane {
|
||||
return suite.chainLanes
|
||||
}),
|
||||
suite.lanes...,
|
||||
)
|
||||
|
||||
// Accounts set up
|
||||
suite.accounts = testutils.RandomAccounts(suite.random, 10)
|
||||
@ -376,3 +414,260 @@ func (suite *BlockBusterTestSuite) fillFreeLane(numTxs int) {
|
||||
suite.Require().NoError(suite.mempool.Insert(suite.ctx, tx))
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *BlockBusterTestSuite) TestLanedMempool_Registry() {
|
||||
tests := []struct {
|
||||
name string
|
||||
chainLanes []blocksdkmoduletypes.Lane
|
||||
registryLanes []block.Lane
|
||||
expectedNewRegistry []block.Lane
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "invalid lanes in chain",
|
||||
chainLanes: []blocksdkmoduletypes.Lane{
|
||||
suite.mevSDKLane, // order = 0
|
||||
suite.baseSDKLane, // order = 2
|
||||
},
|
||||
registryLanes: []block.Lane{
|
||||
suite.freeLane,
|
||||
suite.mevLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid duplicate lanes in chain",
|
||||
chainLanes: []blocksdkmoduletypes.Lane{
|
||||
suite.mevSDKLane, // order = 0
|
||||
suite.baseSDKLane, // order = 2
|
||||
suite.baseSDKLane, // order = 2
|
||||
},
|
||||
registryLanes: []block.Lane{
|
||||
suite.freeLane,
|
||||
suite.mevLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid lanes in registry",
|
||||
chainLanes: []blocksdkmoduletypes.Lane{
|
||||
suite.mevSDKLane, // order = 0
|
||||
suite.freeSDKLane, // order = 1
|
||||
suite.baseSDKLane, // order = 2
|
||||
},
|
||||
registryLanes: []block.Lane{
|
||||
suite.freeLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid duplicate lanes in registry",
|
||||
chainLanes: []blocksdkmoduletypes.Lane{
|
||||
suite.mevSDKLane, // order = 0
|
||||
suite.freeSDKLane, // order = 1
|
||||
suite.baseSDKLane, // order = 2
|
||||
},
|
||||
registryLanes: []block.Lane{
|
||||
suite.freeLane,
|
||||
suite.baseLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "valid reorder",
|
||||
chainLanes: []blocksdkmoduletypes.Lane{
|
||||
suite.mevSDKLane, // order = 0
|
||||
suite.freeSDKLane, // order = 1
|
||||
suite.baseSDKLane, // order = 2
|
||||
},
|
||||
registryLanes: []block.Lane{
|
||||
suite.freeLane,
|
||||
suite.mevLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
expectedNewRegistry: []block.Lane{
|
||||
suite.mevLane,
|
||||
suite.freeLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "valid no reorder",
|
||||
chainLanes: []blocksdkmoduletypes.Lane{
|
||||
suite.mevSDKLane, // order = 0
|
||||
suite.freeSDKLane, // order = 1
|
||||
suite.baseSDKLane, // order = 2
|
||||
},
|
||||
registryLanes: []block.Lane{
|
||||
suite.mevLane,
|
||||
suite.freeLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
expectedNewRegistry: []block.Lane{
|
||||
suite.mevLane,
|
||||
suite.freeLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
suite.Run(tc.name, func() {
|
||||
// setup mock mempool
|
||||
mempool := block.NewLanedMempool(
|
||||
log.NewTestLogger(suite.T()),
|
||||
true,
|
||||
mocks.NewMockLaneFetcher(func() (blocksdkmoduletypes.Lane, error) {
|
||||
return blocksdkmoduletypes.Lane{}, nil
|
||||
}, func() []blocksdkmoduletypes.Lane {
|
||||
return tc.chainLanes
|
||||
}),
|
||||
tc.registryLanes...,
|
||||
)
|
||||
|
||||
gotOrderedLanes, err := mempool.Registry(suite.ctx)
|
||||
if tc.wantErr {
|
||||
suite.Require().Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().Equal(tc.expectedNewRegistry, gotOrderedLanes)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *BlockBusterTestSuite) TestLanedMempool_OrderLanes() {
|
||||
tests := []struct {
|
||||
name string
|
||||
chainLanes []blocksdkmoduletypes.Lane
|
||||
registryLanes []block.Lane
|
||||
expectedOrderedLane []block.Lane
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "invalid lanes in chain",
|
||||
chainLanes: []blocksdkmoduletypes.Lane{
|
||||
suite.mevSDKLane, // order = 0
|
||||
suite.baseSDKLane, // order = 2
|
||||
},
|
||||
registryLanes: []block.Lane{
|
||||
suite.freeLane,
|
||||
suite.mevLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid duplicate lanes in chain",
|
||||
chainLanes: []blocksdkmoduletypes.Lane{
|
||||
suite.mevSDKLane, // order = 0
|
||||
suite.baseSDKLane, // order = 2
|
||||
suite.baseSDKLane, // order = 2
|
||||
},
|
||||
registryLanes: []block.Lane{
|
||||
suite.freeLane,
|
||||
suite.mevLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid lanes in registry",
|
||||
chainLanes: []blocksdkmoduletypes.Lane{
|
||||
suite.mevSDKLane, // order = 0
|
||||
suite.freeSDKLane, // order = 1
|
||||
suite.baseSDKLane, // order = 2
|
||||
},
|
||||
registryLanes: []block.Lane{
|
||||
suite.freeLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid duplicate lanes in registry",
|
||||
chainLanes: []blocksdkmoduletypes.Lane{
|
||||
suite.mevSDKLane, // order = 0
|
||||
suite.freeSDKLane, // order = 1
|
||||
suite.baseSDKLane, // order = 2
|
||||
},
|
||||
registryLanes: []block.Lane{
|
||||
suite.freeLane,
|
||||
suite.baseLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "valid reorder",
|
||||
chainLanes: []blocksdkmoduletypes.Lane{
|
||||
suite.mevSDKLane, // order = 0
|
||||
suite.freeSDKLane, // order = 1
|
||||
suite.baseSDKLane, // order = 2
|
||||
},
|
||||
registryLanes: []block.Lane{
|
||||
suite.freeLane,
|
||||
suite.mevLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
expectedOrderedLane: []block.Lane{
|
||||
suite.mevLane,
|
||||
suite.freeLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "valid no reorder",
|
||||
chainLanes: []blocksdkmoduletypes.Lane{
|
||||
suite.mevSDKLane, // order = 0
|
||||
suite.freeSDKLane, // order = 1
|
||||
suite.baseSDKLane, // order = 2
|
||||
},
|
||||
registryLanes: []block.Lane{
|
||||
suite.mevLane,
|
||||
suite.freeLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
expectedOrderedLane: []block.Lane{
|
||||
suite.mevLane,
|
||||
suite.freeLane,
|
||||
suite.baseLane,
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
suite.Run(tc.name, func() {
|
||||
// setup mock mempool
|
||||
mempool := block.NewLanedMempool(
|
||||
log.NewTestLogger(suite.T()),
|
||||
true,
|
||||
mocks.NewMockLaneFetcher(func() (blocksdkmoduletypes.Lane, error) {
|
||||
return blocksdkmoduletypes.Lane{}, nil
|
||||
}, func() []blocksdkmoduletypes.Lane {
|
||||
return []blocksdkmoduletypes.Lane{}
|
||||
}),
|
||||
tc.registryLanes...,
|
||||
)
|
||||
|
||||
lanedMempool, ok := mempool.(*block.LanedMempool)
|
||||
suite.Require().True(ok)
|
||||
|
||||
gotOrderedLanes, err := lanedMempool.OrderLanes(tc.chainLanes)
|
||||
if tc.wantErr {
|
||||
suite.Require().Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().Equal(tc.expectedOrderedLane, gotOrderedLanes)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Code generated by mockery v2.30.1. DO NOT EDIT.
|
||||
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
@ -24,17 +24,27 @@ type Lane struct {
|
||||
}
|
||||
|
||||
// Compare provides a mock function with given fields: ctx, this, other
|
||||
func (_m *Lane) Compare(ctx types.Context, this types.Tx, other types.Tx) int {
|
||||
func (_m *Lane) Compare(ctx types.Context, this types.Tx, other types.Tx) (int, error) {
|
||||
ret := _m.Called(ctx, this, other)
|
||||
|
||||
var r0 int
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(types.Context, types.Tx, types.Tx) (int, error)); ok {
|
||||
return rf(ctx, this, other)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(types.Context, types.Tx, types.Tx) int); ok {
|
||||
r0 = rf(ctx, this, other)
|
||||
} else {
|
||||
r0 = ret.Get(0).(int)
|
||||
}
|
||||
|
||||
return r0
|
||||
if rf, ok := ret.Get(1).(func(types.Context, types.Tx, types.Tx) error); ok {
|
||||
r1 = rf(ctx, this, other)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Contains provides a mock function with given fields: tx
|
||||
@ -209,6 +219,11 @@ func (_m *Lane) SetIgnoreList(ignoreList []block.Lane) {
|
||||
_m.Called(ignoreList)
|
||||
}
|
||||
|
||||
// SetMaxBlockSpace provides a mock function with given fields: _a0
|
||||
func (_m *Lane) SetMaxBlockSpace(_a0 math.LegacyDec) {
|
||||
_m.Called(_a0)
|
||||
}
|
||||
|
||||
// NewLane creates a new instance of Lane. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewLane(t interface {
|
||||
|
||||
35
block/mocks/lane_fetcher.go
Normal file
35
block/mocks/lane_fetcher.go
Normal file
@ -0,0 +1,35 @@
|
||||
package mocks
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
blocksdkmoduletypes "github.com/skip-mev/block-sdk/x/blocksdk/types"
|
||||
)
|
||||
|
||||
type MockLaneFetcher struct {
|
||||
getLaneHandler func() (blocksdkmoduletypes.Lane, error)
|
||||
getLanesHandler func() []blocksdkmoduletypes.Lane
|
||||
}
|
||||
|
||||
func NewMockLaneFetcher(getLane func() (blocksdkmoduletypes.Lane, error), getLanes func() []blocksdkmoduletypes.Lane) MockLaneFetcher {
|
||||
return MockLaneFetcher{
|
||||
getLaneHandler: getLane,
|
||||
getLanesHandler: getLanes,
|
||||
}
|
||||
}
|
||||
|
||||
func (m *MockLaneFetcher) SetGetLaneHandler(h func() (blocksdkmoduletypes.Lane, error)) {
|
||||
m.getLaneHandler = h
|
||||
}
|
||||
|
||||
func (m MockLaneFetcher) GetLane(_ sdk.Context, _ string) (blocksdkmoduletypes.Lane, error) {
|
||||
return m.getLaneHandler()
|
||||
}
|
||||
|
||||
func (m *MockLaneFetcher) SetGetLanesHandler(h func() []blocksdkmoduletypes.Lane) {
|
||||
m.getLanesHandler = h
|
||||
}
|
||||
|
||||
func (m MockLaneFetcher) GetLanes(_ sdk.Context) []blocksdkmoduletypes.Lane {
|
||||
return m.getLanesHandler()
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
// Code generated by mockery v2.30.1. DO NOT EDIT.
|
||||
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
@ -17,17 +17,27 @@ type LaneMempool struct {
|
||||
}
|
||||
|
||||
// Compare provides a mock function with given fields: ctx, this, other
|
||||
func (_m *LaneMempool) Compare(ctx types.Context, this types.Tx, other types.Tx) int {
|
||||
func (_m *LaneMempool) Compare(ctx types.Context, this types.Tx, other types.Tx) (int, error) {
|
||||
ret := _m.Called(ctx, this, other)
|
||||
|
||||
var r0 int
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(types.Context, types.Tx, types.Tx) (int, error)); ok {
|
||||
return rf(ctx, this, other)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(types.Context, types.Tx, types.Tx) int); ok {
|
||||
r0 = rf(ctx, this, other)
|
||||
} else {
|
||||
r0 = ret.Get(0).(int)
|
||||
}
|
||||
|
||||
return r0
|
||||
if rf, ok := ret.Get(1).(func(types.Context, types.Tx, types.Tx) error); ok {
|
||||
r1 = rf(ctx, this, other)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Contains provides a mock function with given fields: tx
|
||||
|
||||
@ -55,6 +55,9 @@ func (t Terminator) GetMaxBlockSpace() math.LegacyDec {
|
||||
return math.LegacyZeroDec()
|
||||
}
|
||||
|
||||
// SetMaxBlockSpace is a no-op
|
||||
func (t Terminator) SetMaxBlockSpace(_ math.LegacyDec) {}
|
||||
|
||||
// Logger is a no-op
|
||||
func (t Terminator) Logger() log.Logger {
|
||||
return log.NewNopLogger()
|
||||
|
||||
16
proto/sdk/blocksdk/module/v1/module.proto
Normal file
16
proto/sdk/blocksdk/module/v1/module.proto
Normal file
@ -0,0 +1,16 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sdk.blocksdk.module.v1;
|
||||
|
||||
import "cosmos/app/v1alpha1/module.proto";
|
||||
|
||||
// Module is the config object of the x/blocksdk module.
|
||||
message Module {
|
||||
option (cosmos.app.v1alpha1.module) = {
|
||||
go_import : "github.com/skip-mev/block-sdk/x/blocksdk"
|
||||
};
|
||||
|
||||
// Authority defines the custom module authority. If not set, defaults to the
|
||||
// governance module.
|
||||
string authority = 1;
|
||||
}
|
||||
37
proto/sdk/blocksdk/v1/blocksdk.proto
Normal file
37
proto/sdk/blocksdk/v1/blocksdk.proto
Normal file
@ -0,0 +1,37 @@
|
||||
syntax = "proto3";
|
||||
package sdk.blocksdk.v1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "amino/amino.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
|
||||
option go_package = "github.com/skip-mev/block-sdk/x/blocksdk/types";
|
||||
|
||||
// Lane defines a block-sdk lane and its associated parameters. Only the
|
||||
// parameters that are critical to consensus are stored on-chain in this object.
|
||||
// The other associated configuration for a lane can be set and stored locally,
|
||||
// per-validator.
|
||||
message Lane {
|
||||
// id is the unique identifier of a Lane. Maps to a block-sdk laneName.
|
||||
string id = 1;
|
||||
|
||||
// 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.
|
||||
string max_block_space = 2 [
|
||||
(cosmos_proto.scalar) = "cosmos.Dec",
|
||||
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
|
||||
(amino.dont_omitempty) = true,
|
||||
(gogoproto.nullable) = false
|
||||
];
|
||||
|
||||
// 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.
|
||||
uint64 order = 3;
|
||||
}
|
||||
13
proto/sdk/blocksdk/v1/genesis.proto
Normal file
13
proto/sdk/blocksdk/v1/genesis.proto
Normal file
@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
package sdk.blocksdk.v1;
|
||||
|
||||
option go_package = "github.com/skip-mev/block-sdk/x/blocksdk/types";
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "sdk/blocksdk/v1/blocksdk.proto";
|
||||
|
||||
// GenesisState defines the genesis state of the x/blocksdk module.
|
||||
message GenesisState {
|
||||
// lanes is the list of all configured lanes at genesis time.
|
||||
repeated Lane lanes = 1 [ (gogoproto.nullable) = false ];
|
||||
}
|
||||
38
proto/sdk/blocksdk/v1/query.proto
Normal file
38
proto/sdk/blocksdk/v1/query.proto
Normal 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 ];
|
||||
}
|
||||
33
proto/sdk/blocksdk/v1/tx.proto
Normal file
33
proto/sdk/blocksdk/v1/tx.proto
Normal 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 {}
|
||||
@ -12,11 +12,9 @@ import (
|
||||
"cosmossdk.io/depinject"
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
circuitkeeper "cosmossdk.io/x/circuit/keeper"
|
||||
"cosmossdk.io/x/upgrade"
|
||||
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
|
||||
|
||||
feegrantkeeper "cosmossdk.io/x/feegrant/keeper"
|
||||
feegrantmodule "cosmossdk.io/x/feegrant/module"
|
||||
cometabci "github.com/cometbft/cometbft/abci/types"
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
@ -29,36 +27,19 @@ import (
|
||||
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/ante"
|
||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
|
||||
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
|
||||
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/consensus"
|
||||
consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/crisis"
|
||||
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
|
||||
distr "github.com/cosmos/cosmos-sdk/x/distribution"
|
||||
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil"
|
||||
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/gov"
|
||||
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
|
||||
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
|
||||
groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper"
|
||||
groupmodule "github.com/cosmos/cosmos-sdk/x/group/module"
|
||||
"github.com/cosmos/cosmos-sdk/x/mint"
|
||||
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/params"
|
||||
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
|
||||
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
|
||||
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/slashing"
|
||||
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/staking"
|
||||
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
||||
|
||||
"github.com/skip-mev/block-sdk/abci"
|
||||
@ -68,8 +49,8 @@ import (
|
||||
defaultlane "github.com/skip-mev/block-sdk/lanes/base"
|
||||
"github.com/skip-mev/block-sdk/lanes/free"
|
||||
"github.com/skip-mev/block-sdk/lanes/mev"
|
||||
auctionmodule "github.com/skip-mev/block-sdk/x/auction"
|
||||
auctionkeeper "github.com/skip-mev/block-sdk/x/auction/keeper"
|
||||
blocksdkkeeper "github.com/skip-mev/block-sdk/x/blocksdk/keeper"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -81,33 +62,6 @@ var (
|
||||
|
||||
// DefaultNodeHome default home directories for the application daemon
|
||||
DefaultNodeHome string
|
||||
|
||||
// ModuleBasics defines the module BasicManager is in charge of setting up basic,
|
||||
// non-dependant module elements, such as codec registration
|
||||
// and genesis verification.
|
||||
ModuleBasics = module.NewBasicManager(
|
||||
auth.AppModuleBasic{},
|
||||
genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
|
||||
bank.AppModuleBasic{},
|
||||
staking.AppModuleBasic{},
|
||||
mint.AppModuleBasic{},
|
||||
distr.AppModuleBasic{},
|
||||
gov.NewAppModuleBasic(
|
||||
[]govclient.ProposalHandler{
|
||||
paramsclient.ProposalHandler,
|
||||
},
|
||||
),
|
||||
params.AppModuleBasic{},
|
||||
crisis.AppModuleBasic{},
|
||||
slashing.AppModuleBasic{},
|
||||
upgrade.AppModuleBasic{},
|
||||
authzmodule.AppModuleBasic{},
|
||||
groupmodule.AppModuleBasic{},
|
||||
vesting.AppModuleBasic{},
|
||||
consensus.AppModuleBasic{},
|
||||
auctionmodule.AppModuleBasic{},
|
||||
feegrantmodule.AppModuleBasic{},
|
||||
)
|
||||
)
|
||||
|
||||
var (
|
||||
@ -138,6 +92,7 @@ type TestApp struct {
|
||||
ConsensusParamsKeeper consensuskeeper.Keeper
|
||||
CircuitBreakerKeeper circuitkeeper.Keeper
|
||||
auctionkeeper auctionkeeper.Keeper
|
||||
blocksdkKeeper blocksdkkeeper.Keeper
|
||||
FeeGrantKeeper feegrantkeeper.Keeper
|
||||
|
||||
// custom checkTx handler
|
||||
@ -219,6 +174,7 @@ func New(
|
||||
&app.AuthzKeeper,
|
||||
&app.GroupKeeper,
|
||||
&app.auctionkeeper,
|
||||
&app.blocksdkKeeper,
|
||||
&app.ConsensusParamsKeeper,
|
||||
&app.FeeGrantKeeper,
|
||||
&app.CircuitBreakerKeeper,
|
||||
@ -309,7 +265,12 @@ func New(
|
||||
freeLane,
|
||||
defaultLane,
|
||||
}
|
||||
mempool := block.NewLanedMempool(app.Logger(), true, lanes...)
|
||||
mempool := block.NewLanedMempool(
|
||||
app.Logger(),
|
||||
true,
|
||||
&app.blocksdkKeeper,
|
||||
lanes...,
|
||||
)
|
||||
app.App.SetMempool(mempool)
|
||||
|
||||
// Create a global ante handler that will be called on each transaction when
|
||||
|
||||
@ -49,6 +49,7 @@ import (
|
||||
"google.golang.org/protobuf/types/known/durationpb"
|
||||
|
||||
_ "cosmossdk.io/x/circuit" // import for side-effects
|
||||
_ "cosmossdk.io/x/feegrant/module" // import for side-effects
|
||||
_ "cosmossdk.io/x/upgrade" // import for side-effects
|
||||
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects
|
||||
_ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects
|
||||
@ -66,8 +67,11 @@ import (
|
||||
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
|
||||
|
||||
auctionmodulev1 "github.com/skip-mev/block-sdk/api/sdk/auction/module/v1"
|
||||
blocksdkmodulev1 "github.com/skip-mev/block-sdk/api/sdk/blocksdk/module/v1"
|
||||
_ "github.com/skip-mev/block-sdk/x/auction" // import for side-effects
|
||||
auctiontypes "github.com/skip-mev/block-sdk/x/auction/types"
|
||||
_ "github.com/skip-mev/block-sdk/x/blocksdk" // import for side-effects
|
||||
blocksdktypes "github.com/skip-mev/block-sdk/x/blocksdk/types"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -151,6 +155,7 @@ var (
|
||||
consensustypes.ModuleName,
|
||||
circuittypes.ModuleName,
|
||||
auctiontypes.ModuleName,
|
||||
blocksdktypes.ModuleName,
|
||||
feegrant.ModuleName,
|
||||
},
|
||||
// When ExportGenesis is not specified, the export genesis module order
|
||||
@ -247,6 +252,10 @@ var (
|
||||
Name: auctiontypes.ModuleName,
|
||||
Config: appconfig.WrapAny(&auctionmodulev1.Module{}),
|
||||
},
|
||||
{
|
||||
Name: blocksdktypes.ModuleName,
|
||||
Config: appconfig.WrapAny(&blocksdkmodulev1.Module{}),
|
||||
},
|
||||
},
|
||||
}),
|
||||
depinject.Supply(
|
||||
|
||||
@ -4,15 +4,21 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
|
||||
testutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
"github.com/strangelove-ventures/interchaintest/v7"
|
||||
interchaintest "github.com/strangelove-ventures/interchaintest/v7"
|
||||
"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
|
||||
"github.com/strangelove-ventures/interchaintest/v7/ibc"
|
||||
ictestutil "github.com/strangelove-ventures/interchaintest/v7/testutil"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/skip-mev/block-sdk/lanes/base"
|
||||
"github.com/skip-mev/block-sdk/lanes/free"
|
||||
"github.com/skip-mev/block-sdk/lanes/mev"
|
||||
"github.com/skip-mev/block-sdk/tests/integration"
|
||||
auctiontypes "github.com/skip-mev/block-sdk/x/auction/types"
|
||||
blocksdkmoduletypes "github.com/skip-mev/block-sdk/x/blocksdk/types"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -28,13 +34,33 @@ var (
|
||||
}
|
||||
encodingConfig = MakeEncodingConfig()
|
||||
noHostMount = false
|
||||
gasAdjustment = float64(2.0)
|
||||
gasAdjustment = 2.0
|
||||
|
||||
genesisKV = []cosmos.GenesisKV{
|
||||
{
|
||||
Key: "app_state.auction.params.max_bundle_size",
|
||||
Value: 3,
|
||||
},
|
||||
{
|
||||
Key: "app_state.blocksdk.lanes",
|
||||
Value: []blocksdkmoduletypes.Lane{
|
||||
{
|
||||
Id: mev.LaneName,
|
||||
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.2"),
|
||||
Order: 0,
|
||||
},
|
||||
{
|
||||
Id: free.LaneName,
|
||||
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.2"),
|
||||
Order: 1,
|
||||
},
|
||||
{
|
||||
Id: base.LaneName,
|
||||
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.6"),
|
||||
Order: 2,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
consensusParams = ictestutil.Toml{
|
||||
@ -78,6 +104,7 @@ func MakeEncodingConfig() *testutil.TestEncodingConfig {
|
||||
|
||||
// register auction types
|
||||
auctiontypes.RegisterInterfaces(cfg.InterfaceRegistry)
|
||||
blocksdkmoduletypes.RegisterInterfaces(cfg.InterfaceRegistry)
|
||||
|
||||
return &cfg
|
||||
}
|
||||
|
||||
88
x/blocksdk/client/cli/query.go
Normal file
88
x/blocksdk/client/cli/query.go
Normal 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
|
||||
}
|
||||
24
x/blocksdk/client/cli/tx.go
Normal file
24
x/blocksdk/client/cli/tx.go
Normal 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
|
||||
}
|
||||
21
x/blocksdk/keeper/genesis.go
Normal file
21
x/blocksdk/keeper/genesis.go
Normal file
@ -0,0 +1,21 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/skip-mev/block-sdk/x/blocksdk/types"
|
||||
)
|
||||
|
||||
// InitGenesis initializes the blocksdk module's state from a given genesis state.
|
||||
func (k *Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState) {
|
||||
for _, lane := range gs.Lanes {
|
||||
k.setLane(ctx, lane)
|
||||
}
|
||||
}
|
||||
|
||||
// ExportGenesis returns a GenesisState for a given context.
|
||||
func (k *Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
|
||||
lanes := k.GetLanes(ctx)
|
||||
|
||||
return &types.GenesisState{Lanes: lanes}
|
||||
}
|
||||
42
x/blocksdk/keeper/grpc_query.go
Normal file
42
x/blocksdk/keeper/grpc_query.go
Normal 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
|
||||
}
|
||||
104
x/blocksdk/keeper/grpc_query_test.go
Normal file
104
x/blocksdk/keeper/grpc_query_test.go
Normal 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())
|
||||
})
|
||||
}
|
||||
}
|
||||
104
x/blocksdk/keeper/keeper.go
Normal file
104
x/blocksdk/keeper/keeper.go
Normal file
@ -0,0 +1,104 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"cosmossdk.io/log"
|
||||
"cosmossdk.io/store/prefix"
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/skip-mev/block-sdk/x/blocksdk/types"
|
||||
)
|
||||
|
||||
type Keeper struct {
|
||||
cdc codec.BinaryCodec
|
||||
storeKey storetypes.StoreKey
|
||||
|
||||
// The address that is capable of executing a message.
|
||||
// Typically, this will be the governance module's address.
|
||||
authority string
|
||||
}
|
||||
|
||||
// NewKeeper creates a new x/blocksdk keeper.
|
||||
func NewKeeper(
|
||||
cdc codec.BinaryCodec,
|
||||
storeKey storetypes.StoreKey,
|
||||
|
||||
authority string,
|
||||
) Keeper {
|
||||
return Keeper{
|
||||
cdc: cdc,
|
||||
storeKey: storeKey,
|
||||
|
||||
authority: authority,
|
||||
}
|
||||
}
|
||||
|
||||
// Logger returns a blocksdk module-specific logger.
|
||||
func (k *Keeper) Logger(ctx sdk.Context) log.Logger {
|
||||
return ctx.Logger().With("module", "x/"+types.ModuleName)
|
||||
}
|
||||
|
||||
// GetAuthority returns the address that is capable of executing a MsgUpdateParams message.
|
||||
func (k *Keeper) GetAuthority() string {
|
||||
return k.authority
|
||||
}
|
||||
|
||||
// AddLane calls SetLane and provides additional stateful checks that the new
|
||||
// set of lanes will be valid.
|
||||
func (k *Keeper) AddLane(ctx sdk.Context, lane types.Lane) error {
|
||||
currentLanes := k.GetLanes(ctx)
|
||||
currentLanes = append(currentLanes, lane)
|
||||
|
||||
// validate new set of lanes
|
||||
if err := types.Lanes(currentLanes).ValidateBasic(); err != nil {
|
||||
return fmt.Errorf("new lane creates invalid lane configuration: %w", err)
|
||||
}
|
||||
|
||||
k.setLane(ctx, lane)
|
||||
return nil
|
||||
}
|
||||
|
||||
// setLane sets a lane in the store.
|
||||
func (k *Keeper) setLane(ctx sdk.Context, lane types.Lane) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyLanes)
|
||||
b := k.cdc.MustMarshal(&lane)
|
||||
store.Set([]byte(lane.Id), b)
|
||||
}
|
||||
|
||||
// GetLane returns a lane by its id.
|
||||
func (k *Keeper) GetLane(ctx sdk.Context, id string) (lane types.Lane, err error) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyLanes)
|
||||
b := store.Get([]byte(id))
|
||||
if b == nil {
|
||||
return lane, fmt.Errorf("lane not found for ID %s", id)
|
||||
}
|
||||
k.cdc.MustUnmarshal(b, &lane)
|
||||
return lane, nil
|
||||
}
|
||||
|
||||
// GetLanes returns all lanes.
|
||||
func (k *Keeper) GetLanes(ctx sdk.Context) (lanes []types.Lane) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyLanes)
|
||||
iterator := storetypes.KVStorePrefixIterator(store, []byte{})
|
||||
|
||||
defer iterator.Close()
|
||||
|
||||
for ; iterator.Valid(); iterator.Next() {
|
||||
var lane types.Lane
|
||||
k.cdc.MustUnmarshal(iterator.Value(), &lane)
|
||||
lanes = append(lanes, lane)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeleteLane deletes an Lane.
|
||||
func (k *Keeper) DeleteLane(ctx sdk.Context, id string) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyLanes)
|
||||
// Delete the Lane
|
||||
store.Delete([]byte(id))
|
||||
}
|
||||
131
x/blocksdk/keeper/keeper_test.go
Normal file
131
x/blocksdk/keeper/keeper_test.go
Normal file
@ -0,0 +1,131 @@
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
testutils "github.com/skip-mev/block-sdk/testutils"
|
||||
"github.com/skip-mev/block-sdk/x/blocksdk/keeper"
|
||||
"github.com/skip-mev/block-sdk/x/blocksdk/types"
|
||||
)
|
||||
|
||||
type KeeperTestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
blocksdKeeper keeper.Keeper
|
||||
encCfg testutils.EncodingConfig
|
||||
ctx sdk.Context
|
||||
queryServer types.QueryServer
|
||||
msgServer types.MsgServer
|
||||
key *storetypes.KVStoreKey
|
||||
authorityAccount sdk.AccAddress
|
||||
}
|
||||
|
||||
func TestKeeperTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(KeeperTestSuite))
|
||||
}
|
||||
|
||||
func (s *KeeperTestSuite) SetupTest() {
|
||||
s.encCfg = testutils.CreateTestEncodingConfig()
|
||||
s.key = storetypes.NewKVStoreKey(types.StoreKey)
|
||||
testCtx := testutil.DefaultContextWithDB(s.T(), s.key, storetypes.NewTransientStoreKey("transient_test"))
|
||||
s.ctx = testCtx.Ctx
|
||||
s.authorityAccount = []byte("authority")
|
||||
s.blocksdKeeper = keeper.NewKeeper(
|
||||
s.encCfg.Codec,
|
||||
s.key,
|
||||
s.authorityAccount.String(),
|
||||
)
|
||||
|
||||
s.msgServer = keeper.NewMsgServerImpl(s.blocksdKeeper)
|
||||
s.queryServer = keeper.NewQueryServer(s.blocksdKeeper)
|
||||
}
|
||||
|
||||
func (s *KeeperTestSuite) TestLane() {
|
||||
const (
|
||||
validLaneID1 = "test1"
|
||||
validLaneID2 = "test2"
|
||||
validLaneID3 = "test3"
|
||||
invalidLaneID = "invalid"
|
||||
)
|
||||
|
||||
lanes := []types.Lane{
|
||||
{
|
||||
Id: validLaneID1,
|
||||
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.10"),
|
||||
Order: 0,
|
||||
},
|
||||
{
|
||||
Id: validLaneID2,
|
||||
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.10"),
|
||||
Order: 1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, lane := range lanes {
|
||||
err := s.blocksdKeeper.AddLane(s.ctx, lane)
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
s.Run("get lane valid", func() {
|
||||
gotLane, err := s.blocksdKeeper.GetLane(s.ctx, validLaneID1)
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal(lanes[0], gotLane)
|
||||
})
|
||||
|
||||
s.Run("get lane invalid", func() {
|
||||
_, err := s.blocksdKeeper.GetLane(s.ctx, invalidLaneID)
|
||||
s.Require().Error(err)
|
||||
})
|
||||
|
||||
s.Run("get lanes", func() {
|
||||
gotLanes := s.blocksdKeeper.GetLanes(s.ctx)
|
||||
s.Require().Equal(lanes, gotLanes)
|
||||
})
|
||||
|
||||
s.Run("add invalid duplicate lane order", func() {
|
||||
invalidLane := types.Lane{
|
||||
Id: validLaneID3,
|
||||
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.10"),
|
||||
Order: 0,
|
||||
}
|
||||
|
||||
err := s.blocksdKeeper.AddLane(s.ctx, invalidLane)
|
||||
s.Require().Error(err)
|
||||
})
|
||||
|
||||
s.Run("add invalid duplicate lane ID", func() {
|
||||
invalidLane := types.Lane{
|
||||
Id: validLaneID1,
|
||||
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.10"),
|
||||
Order: 2,
|
||||
}
|
||||
|
||||
err := s.blocksdKeeper.AddLane(s.ctx, invalidLane)
|
||||
s.Require().Error(err)
|
||||
})
|
||||
|
||||
s.Run("add invalid non-monotonic order", func() {
|
||||
invalidLane := types.Lane{
|
||||
Id: validLaneID3,
|
||||
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.10"),
|
||||
Order: 3,
|
||||
}
|
||||
|
||||
err := s.blocksdKeeper.AddLane(s.ctx, invalidLane)
|
||||
s.Require().Error(err)
|
||||
})
|
||||
|
||||
s.Run("delete valid", func() {
|
||||
s.blocksdKeeper.DeleteLane(s.ctx, validLaneID1)
|
||||
_, err := s.blocksdKeeper.GetLane(s.ctx, validLaneID1)
|
||||
s.Require().Error(err)
|
||||
})
|
||||
}
|
||||
47
x/blocksdk/keeper/msg_server.go
Normal file
47
x/blocksdk/keeper/msg_server.go
Normal 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
|
||||
}
|
||||
144
x/blocksdk/keeper/msg_server_test.go
Normal file
144
x/blocksdk/keeper/msg_server_test.go
Normal 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
186
x/blocksdk/module.go
Normal 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}
|
||||
}
|
||||
424
x/blocksdk/types/blocksdk.pb.go
Normal file
424
x/blocksdk/types/blocksdk.pb.go
Normal file
@ -0,0 +1,424 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: sdk/blocksdk/v1/blocksdk.proto
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
cosmossdk_io_math "cosmossdk.io/math"
|
||||
fmt "fmt"
|
||||
_ "github.com/cosmos/cosmos-proto"
|
||||
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// Lane defines a block-sdk lane and its associated parameters. Only the
|
||||
// parameters that are critical to consensus are stored on-chain in this object.
|
||||
// The other associated configuration for a lane can be set and stored locally,
|
||||
// per-validator.
|
||||
type Lane struct {
|
||||
// id is the unique identifier of a Lane. Maps to a block-sdk laneName.
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
// 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.
|
||||
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 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"`
|
||||
}
|
||||
|
||||
func (m *Lane) Reset() { *m = Lane{} }
|
||||
func (m *Lane) String() string { return proto.CompactTextString(m) }
|
||||
func (*Lane) ProtoMessage() {}
|
||||
func (*Lane) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f70e4127b99be786, []int{0}
|
||||
}
|
||||
func (m *Lane) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *Lane) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_Lane.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 *Lane) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Lane.Merge(m, src)
|
||||
}
|
||||
func (m *Lane) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *Lane) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Lane.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Lane proto.InternalMessageInfo
|
||||
|
||||
func (m *Lane) GetId() string {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Lane) GetOrder() uint64 {
|
||||
if m != nil {
|
||||
return m.Order
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Lane)(nil), "sdk.blocksdk.v1.Lane")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("sdk/blocksdk/v1/blocksdk.proto", fileDescriptor_f70e4127b99be786) }
|
||||
|
||||
var fileDescriptor_f70e4127b99be786 = []byte{
|
||||
// 280 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x4e, 0xc9, 0xd6,
|
||||
0x4f, 0xca, 0xc9, 0x4f, 0xce, 0x06, 0x31, 0xca, 0x0c, 0xe1, 0x6c, 0xbd, 0x82, 0xa2, 0xfc, 0x92,
|
||||
0x7c, 0x21, 0x7e, 0x10, 0x13, 0x2e, 0x56, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x96,
|
||||
0xd3, 0x07, 0xb1, 0x20, 0xca, 0xa4, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x54,
|
||||
0x48, 0x32, 0x39, 0xbf, 0x38, 0x37, 0xbf, 0x38, 0x1e, 0xa2, 0x16, 0xc2, 0x81, 0x48, 0x29, 0xf5,
|
||||
0x30, 0x72, 0xb1, 0xf8, 0x24, 0xe6, 0xa5, 0x0a, 0xf1, 0x71, 0x31, 0x65, 0xa6, 0x48, 0x30, 0x2a,
|
||||
0x30, 0x6a, 0x70, 0x06, 0x31, 0x65, 0xa6, 0x08, 0xc5, 0x71, 0xf1, 0xe7, 0x26, 0x56, 0xc4, 0x83,
|
||||
0xed, 0x8b, 0x2f, 0x2e, 0x48, 0x4c, 0x4e, 0x95, 0x60, 0x02, 0x49, 0x3a, 0x99, 0x9d, 0xb8, 0x27,
|
||||
0xcf, 0x70, 0xeb, 0x9e, 0xbc, 0x34, 0xc4, 0x1c, 0x90, 0x5b, 0x32, 0xf3, 0xf5, 0x73, 0x13, 0x4b,
|
||||
0x32, 0xf4, 0x7c, 0x52, 0xd3, 0x13, 0x93, 0x2b, 0x5d, 0x52, 0x93, 0x2f, 0x6d, 0xd1, 0xe5, 0x82,
|
||||
0x5a, 0xe3, 0x92, 0x9a, 0xbc, 0xe2, 0xf9, 0x06, 0x2d, 0xc6, 0x20, 0xde, 0xdc, 0xc4, 0x0a, 0x27,
|
||||
0x90, 0x69, 0xc1, 0x20, 0xc3, 0x84, 0x44, 0xb8, 0x58, 0xf3, 0x8b, 0x52, 0x52, 0x8b, 0x24, 0x98,
|
||||
0x15, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x27, 0x8f, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92,
|
||||
0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c,
|
||||
0x96, 0x63, 0x88, 0xd2, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x2f,
|
||||
0xce, 0xce, 0x2c, 0xd0, 0xcd, 0x4d, 0x2d, 0x83, 0x84, 0x90, 0x2e, 0x28, 0xb8, 0x2a, 0x10, 0x21,
|
||||
0x57, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0x9f, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff,
|
||||
0xba, 0xb0, 0x4c, 0x7e, 0x56, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *Lane) 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 *Lane) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Lane) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Order != 0 {
|
||||
i = encodeVarintBlocksdk(dAtA, i, uint64(m.Order))
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
{
|
||||
size := m.MaxBlockSpace.Size()
|
||||
i -= size
|
||||
if _, err := m.MaxBlockSpace.MarshalTo(dAtA[i:]); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i = encodeVarintBlocksdk(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
if len(m.Id) > 0 {
|
||||
i -= len(m.Id)
|
||||
copy(dAtA[i:], m.Id)
|
||||
i = encodeVarintBlocksdk(dAtA, i, uint64(len(m.Id)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintBlocksdk(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovBlocksdk(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *Lane) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Id)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovBlocksdk(uint64(l))
|
||||
}
|
||||
l = m.MaxBlockSpace.Size()
|
||||
n += 1 + l + sovBlocksdk(uint64(l))
|
||||
if m.Order != 0 {
|
||||
n += 1 + sovBlocksdk(uint64(m.Order))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovBlocksdk(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozBlocksdk(x uint64) (n int) {
|
||||
return sovBlocksdk(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *Lane) 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 ErrIntOverflowBlocksdk
|
||||
}
|
||||
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: Lane: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Lane: 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 ErrIntOverflowBlocksdk
|
||||
}
|
||||
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 ErrInvalidLengthBlocksdk
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthBlocksdk
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Id = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field MaxBlockSpace", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowBlocksdk
|
||||
}
|
||||
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 ErrInvalidLengthBlocksdk
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthBlocksdk
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := m.MaxBlockSpace.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Order", wireType)
|
||||
}
|
||||
m.Order = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowBlocksdk
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Order |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipBlocksdk(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthBlocksdk
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipBlocksdk(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, ErrIntOverflowBlocksdk
|
||||
}
|
||||
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, ErrIntOverflowBlocksdk
|
||||
}
|
||||
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, ErrIntOverflowBlocksdk
|
||||
}
|
||||
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, ErrInvalidLengthBlocksdk
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupBlocksdk
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthBlocksdk
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthBlocksdk = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowBlocksdk = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupBlocksdk = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
39
x/blocksdk/types/codec.go
Normal file
39
x/blocksdk/types/codec.go
Normal 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)
|
||||
}
|
||||
34
x/blocksdk/types/genesis.go
Normal file
34
x/blocksdk/types/genesis.go
Normal file
@ -0,0 +1,34 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
// NewGenesisState creates a new GenesisState instance.
|
||||
func NewGenesisState() *GenesisState {
|
||||
return &GenesisState{}
|
||||
}
|
||||
|
||||
// DefaultGenesisState returns the default GenesisState instance.
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{}
|
||||
}
|
||||
|
||||
// Validate performs basic validation of the blocksdk module genesis state.
|
||||
func (gs GenesisState) Validate() error {
|
||||
return Lanes(gs.Lanes).ValidateBasic()
|
||||
}
|
||||
|
||||
// GetGenesisStateFromAppState returns x/blocksdk GenesisState given raw application
|
||||
// genesis state.
|
||||
func GetGenesisStateFromAppState(cdc codec.Codec, appState map[string]json.RawMessage) GenesisState {
|
||||
var genesisState GenesisState
|
||||
|
||||
if appState[ModuleName] != nil {
|
||||
cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState)
|
||||
}
|
||||
|
||||
return genesisState
|
||||
}
|
||||
331
x/blocksdk/types/genesis.pb.go
Normal file
331
x/blocksdk/types/genesis.pb.go
Normal file
@ -0,0 +1,331 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: sdk/blocksdk/v1/genesis.proto
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// GenesisState defines the genesis state of the x/blocksdk module.
|
||||
type GenesisState struct {
|
||||
// lanes is the list of all configured lanes at genesis time.
|
||||
Lanes []Lane `protobuf:"bytes,1,rep,name=lanes,proto3" json:"lanes"`
|
||||
}
|
||||
|
||||
func (m *GenesisState) Reset() { *m = GenesisState{} }
|
||||
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
|
||||
func (*GenesisState) ProtoMessage() {}
|
||||
func (*GenesisState) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_b356885c34672c5f, []int{0}
|
||||
}
|
||||
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GenesisState.Merge(m, src)
|
||||
}
|
||||
func (m *GenesisState) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *GenesisState) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GenesisState.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
|
||||
|
||||
func (m *GenesisState) GetLanes() []Lane {
|
||||
if m != nil {
|
||||
return m.Lanes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*GenesisState)(nil), "sdk.blocksdk.v1.GenesisState")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("sdk/blocksdk/v1/genesis.proto", fileDescriptor_b356885c34672c5f) }
|
||||
|
||||
var fileDescriptor_b356885c34672c5f = []byte{
|
||||
// 199 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0x4e, 0xc9, 0xd6,
|
||||
0x4f, 0xca, 0xc9, 0x4f, 0xce, 0x06, 0x31, 0xca, 0x0c, 0xf5, 0xd3, 0x53, 0xf3, 0x52, 0x8b, 0x33,
|
||||
0x8b, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xf8, 0x8b, 0x53, 0xb2, 0xf5, 0x60, 0xd2, 0x7a,
|
||||
0x65, 0x86, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x39, 0x7d, 0x10, 0x0b, 0xa2, 0x4c, 0x4a,
|
||||
0x0e, 0xdd, 0x14, 0xb8, 0x16, 0xb0, 0xbc, 0x92, 0x23, 0x17, 0x8f, 0x3b, 0xc4, 0xdc, 0xe0, 0x92,
|
||||
0xc4, 0x92, 0x54, 0x21, 0x43, 0x2e, 0xd6, 0x9c, 0xc4, 0xbc, 0xd4, 0x62, 0x09, 0x46, 0x05, 0x66,
|
||||
0x0d, 0x6e, 0x23, 0x51, 0x3d, 0x34, 0x6b, 0xf4, 0x7c, 0x12, 0xf3, 0x52, 0x9d, 0x58, 0x4e, 0xdc,
|
||||
0x93, 0x67, 0x08, 0x82, 0xa8, 0x74, 0xf2, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6,
|
||||
0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39,
|
||||
0x86, 0x28, 0xbd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xe2, 0xec,
|
||||
0xcc, 0x02, 0xdd, 0xdc, 0xd4, 0x32, 0x88, 0x03, 0x74, 0x41, 0xae, 0xa9, 0x40, 0x38, 0xac, 0xa4,
|
||||
0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x26, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x68,
|
||||
0xfa, 0x64, 0x9d, 0xfb, 0x00, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *GenesisState) 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 = encodeVarintGenesis(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovGenesis(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *GenesisState) 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 + sovGenesis(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovGenesis(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozGenesis(x uint64) (n int) {
|
||||
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *GenesisState) 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 ErrIntOverflowGenesis
|
||||
}
|
||||
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: GenesisState: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Lanes", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
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 := skipGenesis(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipGenesis(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, ErrIntOverflowGenesis
|
||||
}
|
||||
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, ErrIntOverflowGenesis
|
||||
}
|
||||
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, ErrIntOverflowGenesis
|
||||
}
|
||||
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, ErrInvalidLengthGenesis
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupGenesis
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthGenesis
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
4
x/blocksdk/types/genesis_test.go
Normal file
4
x/blocksdk/types/genesis_test.go
Normal file
@ -0,0 +1,4 @@
|
||||
package types_test
|
||||
|
||||
// TODO add tests if genesis expands.
|
||||
// Currently is fully covered by TestLanes_ValidateBasic
|
||||
22
x/blocksdk/types/keys.go
Normal file
22
x/blocksdk/types/keys.go
Normal file
@ -0,0 +1,22 @@
|
||||
package types
|
||||
|
||||
const (
|
||||
// ModuleName is the name of the blocksdk module
|
||||
ModuleName = "blocksdk"
|
||||
|
||||
// StoreKey is the default store key for the blocksdk module
|
||||
StoreKey = ModuleName
|
||||
|
||||
// RouterKey is the message route for the blocksdk module
|
||||
RouterKey = ModuleName
|
||||
|
||||
// QuerierRoute is the querier route for the blocksdk module
|
||||
QuerierRoute = ModuleName
|
||||
)
|
||||
|
||||
const (
|
||||
prefixLanes = iota
|
||||
)
|
||||
|
||||
// KeyLanes is the store key for the lanes.
|
||||
var KeyLanes = []byte{prefixLanes}
|
||||
66
x/blocksdk/types/lane.go
Normal file
66
x/blocksdk/types/lane.go
Normal file
@ -0,0 +1,66 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
)
|
||||
|
||||
// Lanes is a type alias for a slice of Lane objects.
|
||||
type Lanes []Lane
|
||||
|
||||
// ValidateBasic performs stateless validation of a Lane.
|
||||
func (l *Lane) ValidateBasic() error {
|
||||
if l.Id == "" {
|
||||
return fmt.Errorf("lane must have an id specified")
|
||||
}
|
||||
|
||||
if l.MaxBlockSpace.IsNil() || l.MaxBlockSpace.IsNegative() || l.MaxBlockSpace.GT(math.LegacyOneDec()) {
|
||||
return fmt.Errorf("max block space must be set to a value between 0 and 1")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ValidateBasic performs stateless validation all Lanes. Performs lane.ValidateBasic()
|
||||
// for each lane, verifies that order is monotonically increasing for all lanes, and
|
||||
// checks that IDs are unique.
|
||||
func (ls Lanes) ValidateBasic() error {
|
||||
encounteredIDs := make(map[string]struct{})
|
||||
encounteredOrders := make(map[uint64]struct{})
|
||||
|
||||
// validate each lane and check that ID and order fields are unique
|
||||
for _, l := range ls {
|
||||
if err := l.ValidateBasic(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, found := encounteredIDs[l.Id]
|
||||
if found {
|
||||
return fmt.Errorf("duplicate lane ID found: %s", l.Id)
|
||||
}
|
||||
|
||||
encounteredIDs[l.Id] = struct{}{}
|
||||
|
||||
_, found = encounteredOrders[l.Order]
|
||||
if found {
|
||||
return fmt.Errorf("duplicate lane order found: %d", l.Order)
|
||||
}
|
||||
|
||||
encounteredOrders[l.Order] = struct{}{}
|
||||
}
|
||||
|
||||
// check if an order value is outside the expected range
|
||||
// since all order values are already unique, if a value
|
||||
// is greater than the total number of lanes it must break
|
||||
// the rule of monotonicity
|
||||
numLanes := uint64(len(ls))
|
||||
for order := range encounteredOrders {
|
||||
// subtract 1 since orders starts at 0
|
||||
if order > numLanes-1 {
|
||||
return fmt.Errorf("orders are not set in a monotonically increasing order: order value: %d", order)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
187
x/blocksdk/types/lane_test.go
Normal file
187
x/blocksdk/types/lane_test.go
Normal file
@ -0,0 +1,187 @@
|
||||
package types_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
|
||||
"github.com/skip-mev/block-sdk/x/blocksdk/types"
|
||||
)
|
||||
|
||||
func TestLane_ValidateBasic(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
lane types.Lane
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "invalid no id",
|
||||
lane: types.Lane{
|
||||
Id: "",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 0,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid maxblockspace nil",
|
||||
lane: types.Lane{
|
||||
Id: "free",
|
||||
Order: 0,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid maxblockspace negative",
|
||||
lane: types.Lane{
|
||||
Id: "free",
|
||||
MaxBlockSpace: math.LegacyMustNewDecFromStr("-1.0"),
|
||||
Order: 0,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid maxblockspace greater than 1",
|
||||
lane: types.Lane{
|
||||
Id: "free",
|
||||
MaxBlockSpace: math.LegacyMustNewDecFromStr("1.1"),
|
||||
Order: 0,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "valid",
|
||||
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.lane.ValidateBasic(); (err != nil) != tc.wantErr {
|
||||
t.Errorf("ValidateBasic() error = %v, wantErr %v", err, tc.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestLanes_ValidateBasic(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
lanes types.Lanes
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "invalid validate basic (no id)",
|
||||
lanes: types.Lanes{
|
||||
types.Lane{
|
||||
Id: "",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 0,
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid duplicate IDs",
|
||||
lanes: types.Lanes{
|
||||
types.Lane{
|
||||
Id: "free",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 0,
|
||||
},
|
||||
types.Lane{
|
||||
Id: "free",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 1,
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid duplicate orders",
|
||||
lanes: types.Lanes{
|
||||
types.Lane{
|
||||
Id: "free",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 0,
|
||||
},
|
||||
types.Lane{
|
||||
Id: "mev",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 0,
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid duplicate orders",
|
||||
lanes: types.Lanes{
|
||||
types.Lane{
|
||||
Id: "free",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 0,
|
||||
},
|
||||
types.Lane{
|
||||
Id: "mev",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 0,
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "invalid orders non-monotonic",
|
||||
lanes: types.Lanes{
|
||||
types.Lane{
|
||||
Id: "free",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 0,
|
||||
},
|
||||
types.Lane{
|
||||
Id: "mev",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 2,
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "valid single",
|
||||
lanes: types.Lanes{
|
||||
types.Lane{
|
||||
Id: "free",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 0,
|
||||
},
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "valid multiple",
|
||||
lanes: types.Lanes{
|
||||
types.Lane{
|
||||
Id: "free",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 0,
|
||||
},
|
||||
types.Lane{
|
||||
Id: "mev",
|
||||
MaxBlockSpace: math.LegacyOneDec(),
|
||||
Order: 1,
|
||||
},
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if err := tc.lanes.ValidateBasic(); (err != nil) != tc.wantErr {
|
||||
t.Errorf("ValidateBasic() error = %v, wantErr %v", err, tc.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
28
x/blocksdk/types/msgs.go
Normal file
28
x/blocksdk/types/msgs.go
Normal 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()
|
||||
}
|
||||
79
x/blocksdk/types/msgs_test.go
Normal file
79
x/blocksdk/types/msgs_test.go
Normal 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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
932
x/blocksdk/types/query.pb.go
Normal file
932
x/blocksdk/types/query.pb.go
Normal 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")
|
||||
)
|
||||
254
x/blocksdk/types/query.pb.gw.go
Normal file
254
x/blocksdk/types/query.pb.gw.go
Normal 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
592
x/blocksdk/types/tx.pb.go
Normal 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")
|
||||
)
|
||||
171
x/blocksdk/types/tx.pb.gw.go
Normal file
171
x/blocksdk/types/tx.pb.gw.go
Normal 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
|
||||
)
|
||||
Loading…
Reference in New Issue
Block a user