From 5b58293f7308c57f367be025ea99a76171ac3456 Mon Sep 17 00:00:00 2001 From: tnv1 Date: Sun, 7 Apr 2024 16:05:12 +0700 Subject: [PATCH 01/12] Add initial implementation of rollup module --- go.mod | 8 +- proto/buf.gen.gogo.yml | 8 + proto/buf.lock | 28 + proto/buf.yaml | 23 + proto/nucleic/rollup/block.proto | 22 + proto/nucleic/rollup/genesis.proto | 12 + proto/nucleic/rollup/params.proto | 7 + proto/nucleic/rollup/query.proto | 42 ++ proto/nucleic/rollup/state.proto | 52 ++ proto/nucleic/rollup/tx.proto | 29 + scripts/protocgen.sh | 20 + x/rollup/keeper/keeper.go | 4 + x/rollup/types/block.pb.go | 599 +++++++++++++++ x/rollup/types/genesis.pb.go | 321 +++++++++ x/rollup/types/params.pb.go | 263 +++++++ x/rollup/types/query.pb.go | 1079 ++++++++++++++++++++++++++++ x/rollup/types/query.pb.gw.go | 319 ++++++++ x/rollup/types/state.pb.go | 920 ++++++++++++++++++++++++ x/rollup/types/tx.pb.go | 851 ++++++++++++++++++++++ 19 files changed, 4603 insertions(+), 4 deletions(-) create mode 100644 proto/buf.gen.gogo.yml create mode 100644 proto/buf.lock create mode 100644 proto/buf.yaml create mode 100644 proto/nucleic/rollup/block.proto create mode 100644 proto/nucleic/rollup/genesis.proto create mode 100644 proto/nucleic/rollup/params.proto create mode 100644 proto/nucleic/rollup/query.proto create mode 100644 proto/nucleic/rollup/state.proto create mode 100644 proto/nucleic/rollup/tx.proto create mode 100644 scripts/protocgen.sh create mode 100644 x/rollup/keeper/keeper.go create mode 100644 x/rollup/types/block.pb.go create mode 100644 x/rollup/types/genesis.pb.go create mode 100644 x/rollup/types/params.pb.go create mode 100644 x/rollup/types/query.pb.go create mode 100644 x/rollup/types/query.pb.gw.go create mode 100644 x/rollup/types/state.pb.go create mode 100644 x/rollup/types/tx.pb.go diff --git a/go.mod b/go.mod index 552aa65a..37868b7f 100644 --- a/go.mod +++ b/go.mod @@ -12,10 +12,10 @@ require ( github.com/cosmos/iavl v1.0.1 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect - github.com/golang/protobuf v1.5.4 // indirect + github.com/golang/protobuf v1.5.4 github.com/google/gofuzz v1.2.0 // indirect github.com/gorilla/mux v1.8.1 // indirect - github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.18.0 github.com/spf13/cast v1.6.0 @@ -24,7 +24,7 @@ require ( github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect - google.golang.org/grpc v1.62.1 // indirect + google.golang.org/grpc v1.62.1 gopkg.in/yaml.v2 v2.4.0 // indirect ) @@ -51,6 +51,7 @@ require ( github.com/osmosis-labs/tokenfactory v0.0.0-20240310155926-981fbeb0fe42 github.com/spf13/viper v1.18.2 github.com/terra-money/alliance v0.4.3 + google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 ) require ( @@ -203,7 +204,6 @@ require ( golang.org/x/time v0.5.0 // indirect google.golang.org/api v0.162.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/proto/buf.gen.gogo.yml b/proto/buf.gen.gogo.yml new file mode 100644 index 00000000..855ea251 --- /dev/null +++ b/proto/buf.gen.gogo.yml @@ -0,0 +1,8 @@ +version: v1 +plugins: + - name: gocosmos + out: .. + opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types + - name: grpc-gateway + out: .. + opt: logtostderr=true,allow_colon_final_segments=true \ No newline at end of file diff --git a/proto/buf.lock b/proto/buf.lock new file mode 100644 index 00000000..a4e9f3a6 --- /dev/null +++ b/proto/buf.lock @@ -0,0 +1,28 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: cosmos + repository: cosmos-proto + commit: 1935555c206d4afb9e94615dfd0fad31 + digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 + - remote: buf.build + owner: cosmos + repository: cosmos-sdk + commit: 5a6ab7bc14314acaa912d5e53aef1c2f + digest: shake256:02c00c73493720055f9b57553a35b5550023a3c1914123b247956288a78fb913aff70e66552777ae14d759467e119079d484af081264a5dd607a94d9fbc8116b + - remote: buf.build + owner: cosmos + repository: gogo-proto + commit: 34d970b699f84aa382f3c29773a60836 + digest: shake256:3d3bee5229ba579e7d19ffe6e140986a228b48a8c7fe74348f308537ab95e9135210e81812489d42cd8941d33ff71f11583174ccc5972e86e6112924b6ce9f04 + - remote: buf.build + owner: cosmos + repository: ics23 + commit: 55085f7c710a45f58fa09947208eb70b + digest: shake256:9bf0bc495b5a11c88d163d39ef521bc4b00bc1374a05758c91d82821bdc61f09e8c2c51dda8452529bf80137f34d852561eacbe9550a59015d51cecb0dacb628 + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 8d7204855ec14631a499bd7393ce1970 + digest: shake256:40bf4112960cad01281930beed85829910768e32e80e986791596853eccd42c0cbd9d96690b918f658020d2d427e16f8b6514e2ac7f4a10306fd32e77be44329 diff --git a/proto/buf.yaml b/proto/buf.yaml new file mode 100644 index 00000000..69de69e3 --- /dev/null +++ b/proto/buf.yaml @@ -0,0 +1,23 @@ +version: v1 +name: buf.build/nucleic-network/nucleic +deps: + - buf.build/cosmos/cosmos-sdk:v0.50.0 + - buf.build/cosmos/cosmos-proto:1935555c206d4afb9e94615dfd0fad31 + - buf.build/cosmos/gogo-proto:a14993478f40695898ed8a86931094b6656e8a5d + - buf.build/googleapis/googleapis:8d7204855ec14631a499bd7393ce1970 + - buf.build/cosmos/ics23:b1abd8678aab07165efd453c96796a179eb3131f +breaking: + use: + - FILE +lint: + use: + - DEFAULT + - COMMENTS + - FILE_LOWER_SNAKE_CASE + except: + - UNARY_RPC + - COMMENT_FIELD + - SERVICE_SUFFIX + - PACKAGE_VERSION_SUFFIX + - RPC_REQUEST_STANDARD_NAME + - PACKAGE_DIRECTORY_MATCH \ No newline at end of file diff --git a/proto/nucleic/rollup/block.proto b/proto/nucleic/rollup/block.proto new file mode 100644 index 00000000..ed0bdda9 --- /dev/null +++ b/proto/nucleic/rollup/block.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package nucleic.rollup; + +option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; + +import "gogoproto/gogo.proto"; + +// BlockDescriptor defines a single rollup chain block description. +message BlockDescriptor { + // height is the height of the block + uint64 height = 1; + // stateRoot is a 32 byte array of the hash of the block (state root of the block) + bytes stateRoot = 2; + // intermediateStatesRoot is a 32 byte array representing + // the root of a Merkle tree built from the ISRs of the block (Intermediate State Roots) + bytes intermediateStatesRoot = 3; + } + + // BlockDescriptors defines list of BlockDescriptor. + message BlockDescriptors { + repeated BlockDescriptor BD = 1 [(gogoproto.nullable) = false]; + } \ No newline at end of file diff --git a/proto/nucleic/rollup/genesis.proto b/proto/nucleic/rollup/genesis.proto new file mode 100644 index 00000000..1184e938 --- /dev/null +++ b/proto/nucleic/rollup/genesis.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package nucleic.rollup; + +option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; + +import "gogoproto/gogo.proto"; +import "nucleic/rollup/params.proto"; + +// GenesisState defines the rollup module's genesis state. +message GenesisState { + Params params = 1 [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/proto/nucleic/rollup/params.proto b/proto/nucleic/rollup/params.proto new file mode 100644 index 00000000..a3169295 --- /dev/null +++ b/proto/nucleic/rollup/params.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; +package nucleic.rollup; + +option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; + +// Params defines the parameters for the module. +message Params {} \ No newline at end of file diff --git a/proto/nucleic/rollup/query.proto b/proto/nucleic/rollup/query.proto new file mode 100644 index 00000000..dde2cb2c --- /dev/null +++ b/proto/nucleic/rollup/query.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; +package nucleic.rollup; + +option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; + +import "google/api/annotations.proto"; + +service Query { + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/nucleicnetwork/nucleic/rollup/params"; + } + rpc Rollup(QueryRollupRequest) returns (QueryRollupResponse) { + option (google.api.http).get = "/nucleicnetwork/nucleic/rollup/{rollup_id}"; + } + rpc AllRollup(QueryAllRollupRequest) returns (QueryAllRollupResponse) { + option (google.api.http).get = "/nucleicnetwork/nucleic/rollup"; + } +} + +message QueryParamsRequest { + +} + +message QueryParamsResponse { + +} + +message QueryRollupRequest { + string rollup_id = 1; +} + +message QueryRollupResponse { + +} + +message QueryAllRollupRequest { + +} + +message QueryAllRollupResponse { + +} \ No newline at end of file diff --git a/proto/nucleic/rollup/state.proto b/proto/nucleic/rollup/state.proto new file mode 100644 index 00000000..5682e82e --- /dev/null +++ b/proto/nucleic/rollup/state.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; +package nucleic.rollup; + +option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; + +import "gogoproto/gogo.proto"; +import "nucleic/rollup/block.proto"; + +// StateInfoIndex is the data used for indexing and retrieving a StateInfo +// it updated and saved with every UpdateState in StateInfo. +// We use the this structure also for: +// 1. LatestStateInfoIndex which defines the rollups' current (latest) index of the last UpdateState +// 2. LatestFinalizedStateIndex which defines the rollups' current (latest) index of the latest StateInfo that was finalized +message StateInfoIndex { + // rollupId is the rollup that the sequencer belongs to and asking to update + // it used to identify the what rollup a StateInfo belongs + // The rollupId follows the same standard as cosmos chain_id + string rollupId = 1; + // index is a sequential increasing number, updating on each + // state update used for indexing to a specific state info, the first index is 1 + uint64 index = 2; +} + +enum StateStatus { + PENDING = 0; + FINALIZED = 1; + REVERTED = 3; +} + +// StateInfo defines a state of the rollup. +message StateInfo { + // stateInfoIndex defines what rollup the state belongs to + // and in which index it can be referenced + StateInfoIndex stateInfoIndex = 1 [(gogoproto.nullable) = false]; + // sequencer is the bech32-encoded address of the sequencer sent the update + string sequencer = 2; + // startHeight is the block height of the first block in the batch + uint64 startHeight = 3; + // numBlocks is the number of blocks included in this batch update + uint64 numBlocks = 4; + // DAPath is the description of the location on the DA layer + string DAPath = 5; + // version is the version of the rollup + uint64 version = 6; + // creationHeight is the height at which the UpdateState took place + uint64 creationHeight = 7; + // status is the status of the state update + StateStatus status = 8; + // BDs is a list of block description objects (one per block) + // the list must be ordered by height, starting from startHeight to startHeight+numBlocks-1 + BlockDescriptors BDs = 9 [(gogoproto.nullable) = false]; +} diff --git a/proto/nucleic/rollup/tx.proto b/proto/nucleic/rollup/tx.proto new file mode 100644 index 00000000..9f4b3566 --- /dev/null +++ b/proto/nucleic/rollup/tx.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package nucleic.rollup; + +option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; + + +// Msg defines the Msg service +service Msg { + rpc CreateRollup(MsgCreateRollup) returns (MsgCreateRollupResponse); + rpc UpdateState(MsgUpdateState) returns (MsgUpdateStateResponse); +} + +// MsgCreateRollup creates a rollup app on the share sequencer chain +message MsgCreateRollup { + string creator = 1; + string rollup_id = 2; + +} +message MsgCreateRollupResponse { + +} + +message MsgUpdateState { + +} + +message MsgUpdateStateResponse { + +} \ No newline at end of file diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh new file mode 100644 index 00000000..6d3b2551 --- /dev/null +++ b/scripts/protocgen.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -eo pipefail + +echo "Generating gogo proto code" +cd proto +proto_dirs=$(find ./nucleic -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) +for dir in $proto_dirs; do + for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do + if grep "option go_package" $file &>/dev/null; then + buf generate --template buf.gen.gogo.yml $file + fi + done +done + +cd .. + +# move proto files to the right places +cp -r github.com/nucleic-network/nucleic/* ./ +rm -rf github.com diff --git a/x/rollup/keeper/keeper.go b/x/rollup/keeper/keeper.go new file mode 100644 index 00000000..a4cc4f6a --- /dev/null +++ b/x/rollup/keeper/keeper.go @@ -0,0 +1,4 @@ +package keeper + +type Keeper struct { +} diff --git a/x/rollup/types/block.pb.go b/x/rollup/types/block.pb.go new file mode 100644 index 00000000..95dc3a16 --- /dev/null +++ b/x/rollup/types/block.pb.go @@ -0,0 +1,599 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollup/block.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 + +// BlockDescriptor defines a single rollup chain block description. +type BlockDescriptor struct { + // height is the height of the block + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + // stateRoot is a 32 byte array of the hash of the block (state root of the block) + StateRoot []byte `protobuf:"bytes,2,opt,name=stateRoot,proto3" json:"stateRoot,omitempty"` + // intermediateStatesRoot is a 32 byte array representing + // the root of a Merkle tree built from the ISRs of the block (Intermediate State Roots) + IntermediateStatesRoot []byte `protobuf:"bytes,3,opt,name=intermediateStatesRoot,proto3" json:"intermediateStatesRoot,omitempty"` +} + +func (m *BlockDescriptor) Reset() { *m = BlockDescriptor{} } +func (m *BlockDescriptor) String() string { return proto.CompactTextString(m) } +func (*BlockDescriptor) ProtoMessage() {} +func (*BlockDescriptor) Descriptor() ([]byte, []int) { + return fileDescriptor_fafc17eae1e5eff4, []int{0} +} +func (m *BlockDescriptor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockDescriptor.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 *BlockDescriptor) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockDescriptor.Merge(m, src) +} +func (m *BlockDescriptor) XXX_Size() int { + return m.Size() +} +func (m *BlockDescriptor) XXX_DiscardUnknown() { + xxx_messageInfo_BlockDescriptor.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockDescriptor proto.InternalMessageInfo + +func (m *BlockDescriptor) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *BlockDescriptor) GetStateRoot() []byte { + if m != nil { + return m.StateRoot + } + return nil +} + +func (m *BlockDescriptor) GetIntermediateStatesRoot() []byte { + if m != nil { + return m.IntermediateStatesRoot + } + return nil +} + +// BlockDescriptors defines list of BlockDescriptor. +type BlockDescriptors struct { + BD []BlockDescriptor `protobuf:"bytes,1,rep,name=BD,proto3" json:"BD"` +} + +func (m *BlockDescriptors) Reset() { *m = BlockDescriptors{} } +func (m *BlockDescriptors) String() string { return proto.CompactTextString(m) } +func (*BlockDescriptors) ProtoMessage() {} +func (*BlockDescriptors) Descriptor() ([]byte, []int) { + return fileDescriptor_fafc17eae1e5eff4, []int{1} +} +func (m *BlockDescriptors) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockDescriptors) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockDescriptors.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 *BlockDescriptors) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockDescriptors.Merge(m, src) +} +func (m *BlockDescriptors) XXX_Size() int { + return m.Size() +} +func (m *BlockDescriptors) XXX_DiscardUnknown() { + xxx_messageInfo_BlockDescriptors.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockDescriptors proto.InternalMessageInfo + +func (m *BlockDescriptors) GetBD() []BlockDescriptor { + if m != nil { + return m.BD + } + return nil +} + +func init() { + proto.RegisterType((*BlockDescriptor)(nil), "nucleic.rollup.BlockDescriptor") + proto.RegisterType((*BlockDescriptors)(nil), "nucleic.rollup.BlockDescriptors") +} + +func init() { proto.RegisterFile("nucleic/rollup/block.proto", fileDescriptor_fafc17eae1e5eff4) } + +var fileDescriptor_fafc17eae1e5eff4 = []byte{ + // 261 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xca, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x29, 0x2d, 0xd0, 0x4f, 0xca, 0xc9, 0x4f, 0xce, + 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0xe9, 0x41, 0xe4, 0xa4, 0x44, 0xd2, + 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x52, 0x3d, 0x17, 0xbf, 0x13, 0x48, + 0x93, 0x4b, 0x6a, 0x71, 0x72, 0x51, 0x66, 0x41, 0x49, 0x7e, 0x91, 0x90, 0x18, 0x17, 0x5b, 0x46, + 0x6a, 0x66, 0x7a, 0x46, 0x89, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x4b, 0x10, 0x94, 0x27, 0x24, 0xc3, + 0xc5, 0x59, 0x5c, 0x92, 0x58, 0x92, 0x1a, 0x94, 0x9f, 0x5f, 0x22, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, + 0x13, 0x84, 0x10, 0x10, 0x32, 0xe3, 0x12, 0xcb, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4d, 0x4d, 0xc9, + 0x4c, 0x2c, 0x49, 0x0d, 0x06, 0x49, 0x14, 0x83, 0x95, 0x32, 0x83, 0x95, 0xe2, 0x90, 0x55, 0xf2, + 0xe4, 0x12, 0x40, 0x73, 0x40, 0xb1, 0x90, 0x29, 0x17, 0x93, 0x93, 0x8b, 0x04, 0xa3, 0x02, 0xb3, + 0x06, 0xb7, 0x91, 0xbc, 0x1e, 0xaa, 0x3f, 0xf4, 0xd0, 0x54, 0x3b, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, + 0x10, 0xc4, 0xe4, 0xe4, 0xe2, 0xe4, 0x7d, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, + 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, + 0x51, 0x86, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, 0xe3, 0x74, + 0xf3, 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0x61, 0x7c, 0xfd, 0x0a, 0x58, 0x20, 0x96, 0x54, 0x16, + 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xc3, 0xc7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xd5, 0xae, 0x65, + 0x87, 0x63, 0x01, 0x00, 0x00, +} + +func (m *BlockDescriptor) 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 *BlockDescriptor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockDescriptor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.IntermediateStatesRoot) > 0 { + i -= len(m.IntermediateStatesRoot) + copy(dAtA[i:], m.IntermediateStatesRoot) + i = encodeVarintBlock(dAtA, i, uint64(len(m.IntermediateStatesRoot))) + i-- + dAtA[i] = 0x1a + } + if len(m.StateRoot) > 0 { + i -= len(m.StateRoot) + copy(dAtA[i:], m.StateRoot) + i = encodeVarintBlock(dAtA, i, uint64(len(m.StateRoot))) + i-- + dAtA[i] = 0x12 + } + if m.Height != 0 { + i = encodeVarintBlock(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *BlockDescriptors) 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 *BlockDescriptors) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockDescriptors) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BD) > 0 { + for iNdEx := len(m.BD) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BD[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBlock(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintBlock(dAtA []byte, offset int, v uint64) int { + offset -= sovBlock(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BlockDescriptor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovBlock(uint64(m.Height)) + } + l = len(m.StateRoot) + if l > 0 { + n += 1 + l + sovBlock(uint64(l)) + } + l = len(m.IntermediateStatesRoot) + if l > 0 { + n += 1 + l + sovBlock(uint64(l)) + } + return n +} + +func (m *BlockDescriptors) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BD) > 0 { + for _, e := range m.BD { + l = e.Size() + n += 1 + l + sovBlock(uint64(l)) + } + } + return n +} + +func sovBlock(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozBlock(x uint64) (n int) { + return sovBlock(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *BlockDescriptor) 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 ErrIntOverflowBlock + } + 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: BlockDescriptor: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockDescriptor: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlock + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateRoot", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlock + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBlock + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBlock + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StateRoot = append(m.StateRoot[:0], dAtA[iNdEx:postIndex]...) + if m.StateRoot == nil { + m.StateRoot = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IntermediateStatesRoot", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlock + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBlock + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBlock + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IntermediateStatesRoot = append(m.IntermediateStatesRoot[:0], dAtA[iNdEx:postIndex]...) + if m.IntermediateStatesRoot == nil { + m.IntermediateStatesRoot = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBlock(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBlock + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlockDescriptors) 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 ErrIntOverflowBlock + } + 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: BlockDescriptors: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockDescriptors: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BD", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlock + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBlock + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBlock + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BD = append(m.BD, BlockDescriptor{}) + if err := m.BD[len(m.BD)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBlock(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBlock + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipBlock(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, ErrIntOverflowBlock + } + 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, ErrIntOverflowBlock + } + 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, ErrIntOverflowBlock + } + 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, ErrInvalidLengthBlock + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupBlock + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthBlock + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthBlock = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBlock = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBlock = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollup/types/genesis.pb.go b/x/rollup/types/genesis.pb.go new file mode 100644 index 00000000..efb4fb44 --- /dev/null +++ b/x/rollup/types/genesis.pb.go @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollup/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 rollup module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +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_093adc730a34492c, []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) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "nucleic.rollup.GenesisState") +} + +func init() { proto.RegisterFile("nucleic/rollup/genesis.proto", fileDescriptor_093adc730a34492c) } + +var fileDescriptor_093adc730a34492c = []byte{ + // 194 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc9, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x29, 0x2d, 0xd0, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, + 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0xea, 0x41, 0x64, 0xa5, + 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x94, 0x34, 0x9a, 0x19, + 0x05, 0x89, 0x45, 0x89, 0xb9, 0x50, 0x23, 0x94, 0x5c, 0xb8, 0x78, 0xdc, 0x21, 0x66, 0x06, 0x97, + 0x24, 0x96, 0xa4, 0x0a, 0x99, 0x70, 0xb1, 0x41, 0xe4, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, + 0xc4, 0xf4, 0x50, 0xed, 0xd0, 0x0b, 0x00, 0xcb, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, + 0x55, 0xeb, 0xe4, 0x7d, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, + 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x86, 0xe9, + 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, 0x93, 0x74, 0xf3, 0x52, 0x4b, + 0xca, 0xf3, 0x8b, 0xb2, 0x61, 0x7c, 0xfd, 0x0a, 0x98, 0xcb, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, + 0xd8, 0xc0, 0x2e, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x0b, 0xbd, 0xe6, 0x9d, 0xfc, 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 + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +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 + l = m.Params.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 Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + 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") +) diff --git a/x/rollup/types/params.pb.go b/x/rollup/types/params.pb.go new file mode 100644 index 00000000..f22c6056 --- /dev/null +++ b/x/rollup/types/params.pb.go @@ -0,0 +1,263 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollup/params.proto + +package types + +import ( + fmt "fmt" + 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 + +// Params defines the parameters for the module. +type Params struct { +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_e4f8f0f26e946001, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "nucleic.rollup.Params") +} + +func init() { proto.RegisterFile("nucleic/rollup/params.proto", fileDescriptor_e4f8f0f26e946001) } + +var fileDescriptor_e4f8f0f26e946001 = []byte{ + // 133 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xce, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x29, 0x2d, 0xd0, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, + 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xea, 0x41, 0x24, 0x95, 0x38, + 0xb8, 0xd8, 0x02, 0xc0, 0xf2, 0x4e, 0xde, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, + 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, + 0x10, 0x65, 0x98, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xd5, 0xae, + 0x9b, 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0x0d, 0xe3, 0xeb, 0x57, 0xc0, 0x6c, 0x2b, 0xa9, 0x2c, + 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xdb, 0x66, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x03, 0x57, 0x09, + 0x11, 0x8c, 0x00, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollup/types/query.pb.go b/x/rollup/types/query.pb.go new file mode 100644 index 00000000..0ac3ee89 --- /dev/null +++ b/x/rollup/types/query.pb.go @@ -0,0 +1,1079 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollup/query.proto + +package types + +import ( + context "context" + fmt "fmt" + 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 + +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4ffe00ca994f2cf8, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +type QueryParamsResponse struct { +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4ffe00ca994f2cf8, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +type QueryRollupRequest struct { + RollupId string `protobuf:"bytes,1,opt,name=rollup_id,json=rollupId,proto3" json:"rollup_id,omitempty"` +} + +func (m *QueryRollupRequest) Reset() { *m = QueryRollupRequest{} } +func (m *QueryRollupRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRollupRequest) ProtoMessage() {} +func (*QueryRollupRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4ffe00ca994f2cf8, []int{2} +} +func (m *QueryRollupRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRollupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRollupRequest.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 *QueryRollupRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRollupRequest.Merge(m, src) +} +func (m *QueryRollupRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRollupRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRollupRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRollupRequest proto.InternalMessageInfo + +func (m *QueryRollupRequest) GetRollupId() string { + if m != nil { + return m.RollupId + } + return "" +} + +type QueryRollupResponse struct { +} + +func (m *QueryRollupResponse) Reset() { *m = QueryRollupResponse{} } +func (m *QueryRollupResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRollupResponse) ProtoMessage() {} +func (*QueryRollupResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4ffe00ca994f2cf8, []int{3} +} +func (m *QueryRollupResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRollupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRollupResponse.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 *QueryRollupResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRollupResponse.Merge(m, src) +} +func (m *QueryRollupResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRollupResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRollupResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRollupResponse proto.InternalMessageInfo + +type QueryAllRollupRequest struct { +} + +func (m *QueryAllRollupRequest) Reset() { *m = QueryAllRollupRequest{} } +func (m *QueryAllRollupRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllRollupRequest) ProtoMessage() {} +func (*QueryAllRollupRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4ffe00ca994f2cf8, []int{4} +} +func (m *QueryAllRollupRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRollupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllRollupRequest.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 *QueryAllRollupRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRollupRequest.Merge(m, src) +} +func (m *QueryAllRollupRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRollupRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRollupRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRollupRequest proto.InternalMessageInfo + +type QueryAllRollupResponse struct { +} + +func (m *QueryAllRollupResponse) Reset() { *m = QueryAllRollupResponse{} } +func (m *QueryAllRollupResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllRollupResponse) ProtoMessage() {} +func (*QueryAllRollupResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4ffe00ca994f2cf8, []int{5} +} +func (m *QueryAllRollupResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRollupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllRollupResponse.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 *QueryAllRollupResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRollupResponse.Merge(m, src) +} +func (m *QueryAllRollupResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRollupResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRollupResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRollupResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "nucleic.rollup.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "nucleic.rollup.QueryParamsResponse") + proto.RegisterType((*QueryRollupRequest)(nil), "nucleic.rollup.QueryRollupRequest") + proto.RegisterType((*QueryRollupResponse)(nil), "nucleic.rollup.QueryRollupResponse") + proto.RegisterType((*QueryAllRollupRequest)(nil), "nucleic.rollup.QueryAllRollupRequest") + proto.RegisterType((*QueryAllRollupResponse)(nil), "nucleic.rollup.QueryAllRollupResponse") +} + +func init() { proto.RegisterFile("nucleic/rollup/query.proto", fileDescriptor_4ffe00ca994f2cf8) } + +var fileDescriptor_4ffe00ca994f2cf8 = []byte{ + // 344 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xca, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x29, 0x2d, 0xd0, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, + 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0xe9, 0x41, 0xe4, 0xa4, 0x64, 0xd2, + 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, + 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xaa, 0x95, 0x44, 0xb8, 0x84, 0x02, 0x41, 0x9a, 0x03, 0x12, + 0x8b, 0x12, 0x73, 0x8b, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x94, 0x44, 0xb9, 0x84, 0x51, + 0x44, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x95, 0x0c, 0xa1, 0x8a, 0x83, 0xc0, 0x26, 0x43, 0x15, + 0x0b, 0x49, 0x73, 0x71, 0x42, 0xac, 0x8a, 0xcf, 0x4c, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, + 0xe2, 0x80, 0x08, 0x78, 0xa6, 0xc0, 0x4d, 0x82, 0x69, 0x81, 0x9a, 0x24, 0xce, 0x25, 0x0a, 0x16, + 0x76, 0xcc, 0xc9, 0x41, 0x31, 0x4c, 0x49, 0x82, 0x4b, 0x0c, 0x5d, 0x02, 0xa2, 0xc5, 0x68, 0x3a, + 0x33, 0x17, 0x2b, 0x58, 0x4a, 0xa8, 0x81, 0x91, 0x8b, 0x0d, 0xe2, 0x32, 0x21, 0x25, 0x3d, 0x54, + 0xdf, 0xea, 0x61, 0x7a, 0x46, 0x4a, 0x19, 0xaf, 0x1a, 0xa8, 0x83, 0x74, 0x9b, 0x2e, 0x3f, 0x99, + 0xcc, 0xa4, 0x2e, 0xa4, 0xaa, 0x0f, 0x55, 0x9c, 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0xad, 0x8f, + 0x16, 0xd2, 0x05, 0x10, 0x7b, 0x5b, 0x19, 0xb9, 0xd8, 0x20, 0xee, 0xc3, 0xe1, 0x04, 0x14, 0x5f, + 0xe1, 0x70, 0x02, 0x5a, 0x98, 0x18, 0x81, 0x9d, 0xa0, 0x23, 0xa4, 0x45, 0xc0, 0x09, 0xd5, 0xf0, + 0xd0, 0xae, 0x15, 0x6a, 0x62, 0xe4, 0xe2, 0x84, 0x07, 0x95, 0x90, 0x2a, 0x56, 0x6b, 0xd0, 0xc3, + 0x58, 0x4a, 0x8d, 0x90, 0x32, 0xa8, 0x83, 0xd4, 0xc0, 0x0e, 0x52, 0x10, 0x92, 0xc3, 0xef, 0x20, + 0x27, 0xef, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, + 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4c, 0xcf, 0x2c, + 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0x85, 0x69, 0xd2, 0x45, 0x37, 0xa4, 0x02, 0xe6, 0xaf, + 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0xba, 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, + 0xc4, 0x42, 0x53, 0xc0, 0xe3, 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 { + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + Rollup(ctx context.Context, in *QueryRollupRequest, opts ...grpc.CallOption) (*QueryRollupResponse, error) + AllRollup(ctx context.Context, in *QueryAllRollupRequest, opts ...grpc.CallOption) (*QueryAllRollupResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollup.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Rollup(ctx context.Context, in *QueryRollupRequest, opts ...grpc.CallOption) (*QueryRollupResponse, error) { + out := new(QueryRollupResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollup.Query/Rollup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AllRollup(ctx context.Context, in *QueryAllRollupRequest, opts ...grpc.CallOption) (*QueryAllRollupResponse, error) { + out := new(QueryAllRollupResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollup.Query/AllRollup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + Rollup(context.Context, *QueryRollupRequest) (*QueryRollupResponse, error) + AllRollup(context.Context, *QueryAllRollupRequest) (*QueryAllRollupResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Rollup(ctx context.Context, req *QueryRollupRequest) (*QueryRollupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Rollup not implemented") +} +func (*UnimplementedQueryServer) AllRollup(ctx context.Context, req *QueryAllRollupRequest) (*QueryAllRollupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllRollup not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollup.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Rollup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRollupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Rollup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollup.Query/Rollup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Rollup(ctx, req.(*QueryRollupRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AllRollup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllRollupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllRollup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollup.Query/AllRollup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllRollup(ctx, req.(*QueryAllRollupRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "nucleic.rollup.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Rollup", + Handler: _Query_Rollup_Handler, + }, + { + MethodName: "AllRollup", + Handler: _Query_AllRollup_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "nucleic/rollup/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryRollupRequest) 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 *QueryRollupRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRollupRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RollupId) > 0 { + i -= len(m.RollupId) + copy(dAtA[i:], m.RollupId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollupId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRollupResponse) 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 *QueryRollupResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRollupResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAllRollupRequest) 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 *QueryAllRollupRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRollupRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAllRollupResponse) 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 *QueryAllRollupResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRollupResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryRollupRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollupId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRollupResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllRollupRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllRollupResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *QueryRollupRequest) 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: QueryRollupRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRollupRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollupId", 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.RollupId = 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 *QueryRollupResponse) 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: QueryRollupResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRollupResponse: 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 *QueryAllRollupRequest) 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: QueryAllRollupRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllRollupRequest: 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 *QueryAllRollupResponse) 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: QueryAllRollupResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllRollupResponse: 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 skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollup/types/query.pb.gw.go b/x/rollup/types/query.pb.gw.go new file mode 100644 index 00000000..f678a2cc --- /dev/null +++ b/x/rollup/types/query.pb.gw.go @@ -0,0 +1,319 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: nucleic/rollup/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Rollup_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRollupRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollup_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollup_id") + } + + protoReq.RollupId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollup_id", err) + } + + msg, err := client.Rollup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Rollup_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRollupRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollup_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollup_id") + } + + protoReq.RollupId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollup_id", err) + } + + msg, err := server.Rollup(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_AllRollup_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRollupRequest + var metadata runtime.ServerMetadata + + msg, err := client.AllRollup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllRollup_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRollupRequest + var metadata runtime.ServerMetadata + + msg, err := server.AllRollup(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Rollup_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_Rollup_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_Rollup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllRollup_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_AllRollup_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_AllRollup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Rollup_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_Rollup_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_Rollup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllRollup_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_AllRollup_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_AllRollup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"nucleicnetwork", "nucleic", "rollup", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Rollup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"nucleicnetwork", "nucleic", "rollup", "rollup_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AllRollup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nucleicnetwork", "nucleic", "rollup"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Rollup_0 = runtime.ForwardResponseMessage + + forward_Query_AllRollup_0 = runtime.ForwardResponseMessage +) diff --git a/x/rollup/types/state.pb.go b/x/rollup/types/state.pb.go new file mode 100644 index 00000000..e0233739 --- /dev/null +++ b/x/rollup/types/state.pb.go @@ -0,0 +1,920 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollup/state.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 + +type StateStatus int32 + +const ( + StateStatus_PENDING StateStatus = 0 + StateStatus_FINALIZED StateStatus = 1 + StateStatus_REVERTED StateStatus = 3 +) + +var StateStatus_name = map[int32]string{ + 0: "PENDING", + 1: "FINALIZED", + 3: "REVERTED", +} + +var StateStatus_value = map[string]int32{ + "PENDING": 0, + "FINALIZED": 1, + "REVERTED": 3, +} + +func (x StateStatus) String() string { + return proto.EnumName(StateStatus_name, int32(x)) +} + +func (StateStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_486e5873fc407807, []int{0} +} + +// StateInfoIndex is the data used for indexing and retrieving a StateInfo +// it updated and saved with every UpdateState in StateInfo. +// We use the this structure also for: +// 1. LatestStateInfoIndex which defines the rollups' current (latest) index of the last UpdateState +// 2. LatestFinalizedStateIndex which defines the rollups' current (latest) index of the latest StateInfo that was finalized +type StateInfoIndex struct { + // rollupId is the rollup that the sequencer belongs to and asking to update + // it used to identify the what rollup a StateInfo belongs + // The rollupId follows the same standard as cosmos chain_id + RollupId string `protobuf:"bytes,1,opt,name=rollupId,proto3" json:"rollupId,omitempty"` + // index is a sequential increasing number, updating on each + // state update used for indexing to a specific state info, the first index is 1 + Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` +} + +func (m *StateInfoIndex) Reset() { *m = StateInfoIndex{} } +func (m *StateInfoIndex) String() string { return proto.CompactTextString(m) } +func (*StateInfoIndex) ProtoMessage() {} +func (*StateInfoIndex) Descriptor() ([]byte, []int) { + return fileDescriptor_486e5873fc407807, []int{0} +} +func (m *StateInfoIndex) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateInfoIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateInfoIndex.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 *StateInfoIndex) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateInfoIndex.Merge(m, src) +} +func (m *StateInfoIndex) XXX_Size() int { + return m.Size() +} +func (m *StateInfoIndex) XXX_DiscardUnknown() { + xxx_messageInfo_StateInfoIndex.DiscardUnknown(m) +} + +var xxx_messageInfo_StateInfoIndex proto.InternalMessageInfo + +func (m *StateInfoIndex) GetRollupId() string { + if m != nil { + return m.RollupId + } + return "" +} + +func (m *StateInfoIndex) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +// StateInfo defines a state of the rollup. +type StateInfo struct { + // stateInfoIndex defines what rollup the state belongs to + // and in which index it can be referenced + StateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=stateInfoIndex,proto3" json:"stateInfoIndex"` + // sequencer is the bech32-encoded address of the sequencer sent the update + Sequencer string `protobuf:"bytes,2,opt,name=sequencer,proto3" json:"sequencer,omitempty"` + // startHeight is the block height of the first block in the batch + StartHeight uint64 `protobuf:"varint,3,opt,name=startHeight,proto3" json:"startHeight,omitempty"` + // numBlocks is the number of blocks included in this batch update + NumBlocks uint64 `protobuf:"varint,4,opt,name=numBlocks,proto3" json:"numBlocks,omitempty"` + // DAPath is the description of the location on the DA layer + DAPath string `protobuf:"bytes,5,opt,name=DAPath,proto3" json:"DAPath,omitempty"` + // version is the version of the rollup + Version uint64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"` + // creationHeight is the height at which the UpdateState took place + CreationHeight uint64 `protobuf:"varint,7,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` + // status is the status of the state update + Status StateStatus `protobuf:"varint,8,opt,name=status,proto3,enum=nucleic.rollup.StateStatus" json:"status,omitempty"` + // BDs is a list of block description objects (one per block) + // the list must be ordered by height, starting from startHeight to startHeight+numBlocks-1 + BDs BlockDescriptors `protobuf:"bytes,9,opt,name=BDs,proto3" json:"BDs"` +} + +func (m *StateInfo) Reset() { *m = StateInfo{} } +func (m *StateInfo) String() string { return proto.CompactTextString(m) } +func (*StateInfo) ProtoMessage() {} +func (*StateInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_486e5873fc407807, []int{1} +} +func (m *StateInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateInfo.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 *StateInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateInfo.Merge(m, src) +} +func (m *StateInfo) XXX_Size() int { + return m.Size() +} +func (m *StateInfo) XXX_DiscardUnknown() { + xxx_messageInfo_StateInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_StateInfo proto.InternalMessageInfo + +func (m *StateInfo) GetStateInfoIndex() StateInfoIndex { + if m != nil { + return m.StateInfoIndex + } + return StateInfoIndex{} +} + +func (m *StateInfo) GetSequencer() string { + if m != nil { + return m.Sequencer + } + return "" +} + +func (m *StateInfo) GetStartHeight() uint64 { + if m != nil { + return m.StartHeight + } + return 0 +} + +func (m *StateInfo) GetNumBlocks() uint64 { + if m != nil { + return m.NumBlocks + } + return 0 +} + +func (m *StateInfo) GetDAPath() string { + if m != nil { + return m.DAPath + } + return "" +} + +func (m *StateInfo) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *StateInfo) GetCreationHeight() uint64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +func (m *StateInfo) GetStatus() StateStatus { + if m != nil { + return m.Status + } + return StateStatus_PENDING +} + +func (m *StateInfo) GetBDs() BlockDescriptors { + if m != nil { + return m.BDs + } + return BlockDescriptors{} +} + +func init() { + proto.RegisterEnum("nucleic.rollup.StateStatus", StateStatus_name, StateStatus_value) + proto.RegisterType((*StateInfoIndex)(nil), "nucleic.rollup.StateInfoIndex") + proto.RegisterType((*StateInfo)(nil), "nucleic.rollup.StateInfo") +} + +func init() { proto.RegisterFile("nucleic/rollup/state.proto", fileDescriptor_486e5873fc407807) } + +var fileDescriptor_486e5873fc407807 = []byte{ + // 428 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x4f, 0x6f, 0xd3, 0x30, + 0x14, 0x8f, 0x69, 0xd7, 0x36, 0xaf, 0x10, 0x55, 0xd6, 0x84, 0xac, 0x82, 0x42, 0xb4, 0x03, 0xaa, + 0x90, 0x48, 0xc4, 0x76, 0x80, 0xeb, 0xa2, 0x04, 0x88, 0x98, 0xaa, 0x29, 0x43, 0x1c, 0x76, 0x4b, + 0x33, 0x93, 0x46, 0xcb, 0xec, 0x60, 0x3b, 0x30, 0x6e, 0x7c, 0x04, 0x3e, 0xd6, 0x8e, 0x3b, 0x72, + 0x42, 0xa8, 0xfd, 0x22, 0x28, 0x4e, 0xba, 0xb5, 0xd1, 0x6e, 0xfe, 0xbd, 0xdf, 0x9f, 0xf7, 0x9e, + 0xf5, 0x60, 0xca, 0xaa, 0xb4, 0xa0, 0x79, 0xea, 0x09, 0x5e, 0x14, 0x55, 0xe9, 0x49, 0x95, 0x28, + 0xea, 0x96, 0x82, 0x2b, 0x8e, 0xad, 0x96, 0x73, 0x1b, 0x6e, 0xba, 0x9f, 0xf1, 0x8c, 0x6b, 0xca, + 0xab, 0x5f, 0x8d, 0x6a, 0xda, 0x4d, 0x58, 0x14, 0x3c, 0xbd, 0x6c, 0xb8, 0x03, 0x1f, 0xac, 0xb3, + 0x3a, 0x30, 0x62, 0x5f, 0x79, 0xc4, 0x2e, 0xe8, 0x35, 0x9e, 0xc2, 0xa8, 0xd1, 0x45, 0x17, 0x04, + 0x39, 0x68, 0x66, 0xc6, 0x77, 0x18, 0xef, 0xc3, 0x5e, 0x5e, 0x8b, 0xc8, 0x23, 0x07, 0xcd, 0xfa, + 0x71, 0x03, 0x0e, 0x7e, 0xf5, 0xc0, 0xbc, 0x0b, 0xc1, 0x27, 0x60, 0xc9, 0x9d, 0x44, 0x9d, 0x32, + 0x3e, 0xb4, 0xdd, 0xdd, 0x61, 0xdd, 0xdd, 0xbe, 0x7e, 0xff, 0xe6, 0xef, 0x0b, 0x23, 0xee, 0x78, + 0xf1, 0x73, 0x30, 0x25, 0xfd, 0x56, 0x51, 0x96, 0x52, 0xa1, 0xbb, 0x9a, 0xf1, 0x7d, 0x01, 0x3b, + 0x30, 0x96, 0x2a, 0x11, 0xea, 0x23, 0xcd, 0xb3, 0xa5, 0x22, 0x3d, 0x3d, 0xd5, 0x76, 0xa9, 0xf6, + 0xb3, 0xea, 0xca, 0xaf, 0x37, 0x96, 0xa4, 0xaf, 0xf9, 0xfb, 0x02, 0x7e, 0x0a, 0x83, 0xe0, 0xf8, + 0x34, 0x51, 0x4b, 0xb2, 0xa7, 0xa3, 0x5b, 0x84, 0x09, 0x0c, 0xbf, 0x53, 0x21, 0x73, 0xce, 0xc8, + 0x40, 0x7b, 0x36, 0x10, 0xbf, 0x04, 0x2b, 0x15, 0x34, 0x51, 0x39, 0x67, 0x6d, 0xd3, 0xa1, 0x16, + 0x74, 0xaa, 0xf8, 0x08, 0x06, 0xf5, 0x26, 0x95, 0x24, 0x23, 0x07, 0xcd, 0xac, 0xc3, 0x67, 0x0f, + 0x6e, 0x7f, 0xa6, 0x25, 0x71, 0x2b, 0xc5, 0xef, 0xa0, 0xe7, 0x07, 0x92, 0x98, 0xfa, 0xbf, 0x9c, + 0xae, 0x43, 0xcf, 0x1c, 0x50, 0x99, 0x8a, 0xbc, 0x54, 0x5c, 0xc8, 0xf6, 0xc7, 0x6a, 0xcb, 0xab, + 0xb7, 0x30, 0xde, 0x0a, 0xc4, 0x63, 0x18, 0x9e, 0x86, 0xf3, 0x20, 0x9a, 0x7f, 0x98, 0x18, 0xf8, + 0x09, 0x98, 0xef, 0xa3, 0xf9, 0xf1, 0x49, 0x74, 0x1e, 0x06, 0x13, 0x84, 0x1f, 0xc3, 0x28, 0x0e, + 0xbf, 0x84, 0xf1, 0xe7, 0x30, 0x98, 0xf4, 0xfc, 0x4f, 0x37, 0x2b, 0x1b, 0xdd, 0xae, 0x6c, 0xf4, + 0x6f, 0x65, 0xa3, 0xdf, 0x6b, 0xdb, 0xb8, 0x5d, 0xdb, 0xc6, 0x9f, 0xb5, 0x6d, 0x9c, 0xbf, 0xc9, + 0x72, 0xb5, 0xac, 0x16, 0x6e, 0xca, 0xaf, 0xbc, 0x76, 0x92, 0xd7, 0x8c, 0xaa, 0x1f, 0x5c, 0x5c, + 0x6e, 0xb0, 0x77, 0xbd, 0x39, 0x29, 0xf5, 0xb3, 0xa4, 0x72, 0x31, 0xd0, 0x37, 0x75, 0xf4, 0x3f, + 0x00, 0x00, 0xff, 0xff, 0xe1, 0x1e, 0x4b, 0xa4, 0xb3, 0x02, 0x00, 0x00, +} + +func (m *StateInfoIndex) 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 *StateInfoIndex) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateInfoIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Index != 0 { + i = encodeVarintState(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x10 + } + if len(m.RollupId) > 0 { + i -= len(m.RollupId) + copy(dAtA[i:], m.RollupId) + i = encodeVarintState(dAtA, i, uint64(len(m.RollupId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StateInfo) 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 *StateInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BDs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintState(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + if m.Status != 0 { + i = encodeVarintState(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x40 + } + if m.CreationHeight != 0 { + i = encodeVarintState(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x38 + } + if m.Version != 0 { + i = encodeVarintState(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x30 + } + if len(m.DAPath) > 0 { + i -= len(m.DAPath) + copy(dAtA[i:], m.DAPath) + i = encodeVarintState(dAtA, i, uint64(len(m.DAPath))) + i-- + dAtA[i] = 0x2a + } + if m.NumBlocks != 0 { + i = encodeVarintState(dAtA, i, uint64(m.NumBlocks)) + i-- + dAtA[i] = 0x20 + } + if m.StartHeight != 0 { + i = encodeVarintState(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.Sequencer) > 0 { + i -= len(m.Sequencer) + copy(dAtA[i:], m.Sequencer) + i = encodeVarintState(dAtA, i, uint64(len(m.Sequencer))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.StateInfoIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintState(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintState(dAtA []byte, offset int, v uint64) int { + offset -= sovState(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StateInfoIndex) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollupId) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if m.Index != 0 { + n += 1 + sovState(uint64(m.Index)) + } + return n +} + +func (m *StateInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateInfoIndex.Size() + n += 1 + l + sovState(uint64(l)) + l = len(m.Sequencer) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if m.StartHeight != 0 { + n += 1 + sovState(uint64(m.StartHeight)) + } + if m.NumBlocks != 0 { + n += 1 + sovState(uint64(m.NumBlocks)) + } + l = len(m.DAPath) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if m.Version != 0 { + n += 1 + sovState(uint64(m.Version)) + } + if m.CreationHeight != 0 { + n += 1 + sovState(uint64(m.CreationHeight)) + } + if m.Status != 0 { + n += 1 + sovState(uint64(m.Status)) + } + l = m.BDs.Size() + n += 1 + l + sovState(uint64(l)) + return n +} + +func sovState(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozState(x uint64) (n int) { + return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StateInfoIndex) 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 ErrIntOverflowState + } + 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: StateInfoIndex: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateInfoIndex: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollupId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollupId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipState(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StateInfo) 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 ErrIntOverflowState + } + 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: StateInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfoIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StateInfoIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sequencer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) + } + m.StartHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumBlocks", wireType) + } + m.NumBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DAPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DAPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= StateStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BDs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BDs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipState(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipState(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, ErrIntOverflowState + } + 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, ErrIntOverflowState + } + 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, ErrIntOverflowState + } + 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, ErrInvalidLengthState + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupState + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthState + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthState = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowState = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupState = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollup/types/tx.pb.go b/x/rollup/types/tx.pb.go new file mode 100644 index 00000000..5f8a2b75 --- /dev/null +++ b/x/rollup/types/tx.pb.go @@ -0,0 +1,851 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollup/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + 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 + +// MsgCreateRollup creates a rollup app on the share sequencer chain +type MsgCreateRollup struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + RollupId string `protobuf:"bytes,2,opt,name=rollup_id,json=rollupId,proto3" json:"rollup_id,omitempty"` +} + +func (m *MsgCreateRollup) Reset() { *m = MsgCreateRollup{} } +func (m *MsgCreateRollup) String() string { return proto.CompactTextString(m) } +func (*MsgCreateRollup) ProtoMessage() {} +func (*MsgCreateRollup) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a6b771ffd57ed2, []int{0} +} +func (m *MsgCreateRollup) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateRollup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateRollup.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 *MsgCreateRollup) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateRollup.Merge(m, src) +} +func (m *MsgCreateRollup) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateRollup) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateRollup.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateRollup proto.InternalMessageInfo + +func (m *MsgCreateRollup) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgCreateRollup) GetRollupId() string { + if m != nil { + return m.RollupId + } + return "" +} + +type MsgCreateRollupResponse struct { +} + +func (m *MsgCreateRollupResponse) Reset() { *m = MsgCreateRollupResponse{} } +func (m *MsgCreateRollupResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateRollupResponse) ProtoMessage() {} +func (*MsgCreateRollupResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a6b771ffd57ed2, []int{1} +} +func (m *MsgCreateRollupResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateRollupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateRollupResponse.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 *MsgCreateRollupResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateRollupResponse.Merge(m, src) +} +func (m *MsgCreateRollupResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateRollupResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateRollupResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateRollupResponse proto.InternalMessageInfo + +type MsgUpdateState struct { +} + +func (m *MsgUpdateState) Reset() { *m = MsgUpdateState{} } +func (m *MsgUpdateState) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateState) ProtoMessage() {} +func (*MsgUpdateState) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a6b771ffd57ed2, []int{2} +} +func (m *MsgUpdateState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateState.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 *MsgUpdateState) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateState.Merge(m, src) +} +func (m *MsgUpdateState) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateState) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateState.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateState proto.InternalMessageInfo + +type MsgUpdateStateResponse struct { +} + +func (m *MsgUpdateStateResponse) Reset() { *m = MsgUpdateStateResponse{} } +func (m *MsgUpdateStateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateStateResponse) ProtoMessage() {} +func (*MsgUpdateStateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b3a6b771ffd57ed2, []int{3} +} +func (m *MsgUpdateStateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateStateResponse.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 *MsgUpdateStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateStateResponse.Merge(m, src) +} +func (m *MsgUpdateStateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateStateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateStateResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateRollup)(nil), "nucleic.rollup.MsgCreateRollup") + proto.RegisterType((*MsgCreateRollupResponse)(nil), "nucleic.rollup.MsgCreateRollupResponse") + proto.RegisterType((*MsgUpdateState)(nil), "nucleic.rollup.MsgUpdateState") + proto.RegisterType((*MsgUpdateStateResponse)(nil), "nucleic.rollup.MsgUpdateStateResponse") +} + +func init() { proto.RegisterFile("nucleic/rollup/tx.proto", fileDescriptor_b3a6b771ffd57ed2) } + +var fileDescriptor_b3a6b771ffd57ed2 = []byte{ + // 261 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x29, 0x2d, 0xd0, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xe8, 0x41, 0x24, 0x94, 0x3c, 0xb8, 0xf8, 0x7d, 0x8b, + 0xd3, 0x9d, 0x8b, 0x52, 0x13, 0x4b, 0x52, 0x83, 0xc0, 0x42, 0x42, 0x12, 0x5c, 0xec, 0xc9, 0x20, + 0x7e, 0x7e, 0x91, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x8c, 0x2b, 0x24, 0xcd, 0xc5, 0x09, + 0xd1, 0x16, 0x9f, 0x99, 0x22, 0xc1, 0x04, 0x96, 0xe3, 0x80, 0x08, 0x78, 0xa6, 0x28, 0x49, 0x72, + 0x89, 0xa3, 0x99, 0x14, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0xaa, 0x24, 0xc0, 0xc5, 0xe7, + 0x5b, 0x9c, 0x1e, 0x5a, 0x90, 0x92, 0x58, 0x92, 0x1a, 0x5c, 0x92, 0x58, 0x92, 0xaa, 0x24, 0xc1, + 0x25, 0x86, 0x2a, 0x02, 0x53, 0x6b, 0xb4, 0x8d, 0x91, 0x8b, 0xd9, 0xb7, 0x38, 0x5d, 0x28, 0x82, + 0x8b, 0x07, 0xc5, 0x55, 0xf2, 0x7a, 0xa8, 0x2e, 0xd7, 0x43, 0xb3, 0x4c, 0x4a, 0x9d, 0x80, 0x02, + 0x98, 0x0d, 0x42, 0xa1, 0x5c, 0xdc, 0x48, 0x16, 0x0b, 0xc9, 0x61, 0xd1, 0x87, 0x24, 0x2f, 0xa5, + 0x86, 0x5f, 0x1e, 0x66, 0xac, 0x93, 0xf7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, + 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, + 0x44, 0x19, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0xcd, 0xd2, + 0xcd, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0x86, 0xf1, 0xf5, 0x2b, 0xe0, 0x31, 0x55, 0x59, 0x90, + 0x5a, 0x9c, 0xc4, 0x06, 0x8e, 0x2d, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xac, 0xb0, + 0xb0, 0xc8, 0x01, 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 { + CreateRollup(ctx context.Context, in *MsgCreateRollup, opts ...grpc.CallOption) (*MsgCreateRollupResponse, error) + UpdateState(ctx context.Context, in *MsgUpdateState, opts ...grpc.CallOption) (*MsgUpdateStateResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateRollup(ctx context.Context, in *MsgCreateRollup, opts ...grpc.CallOption) (*MsgCreateRollupResponse, error) { + out := new(MsgCreateRollupResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollup.Msg/CreateRollup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateState(ctx context.Context, in *MsgUpdateState, opts ...grpc.CallOption) (*MsgUpdateStateResponse, error) { + out := new(MsgUpdateStateResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollup.Msg/UpdateState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + CreateRollup(context.Context, *MsgCreateRollup) (*MsgCreateRollupResponse, error) + UpdateState(context.Context, *MsgUpdateState) (*MsgUpdateStateResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateRollup(ctx context.Context, req *MsgCreateRollup) (*MsgCreateRollupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateRollup not implemented") +} +func (*UnimplementedMsgServer) UpdateState(ctx context.Context, req *MsgUpdateState) (*MsgUpdateStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateState not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateRollup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateRollup) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateRollup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollup.Msg/CreateRollup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateRollup(ctx, req.(*MsgCreateRollup)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateState) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollup.Msg/UpdateState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateState(ctx, req.(*MsgUpdateState)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "nucleic.rollup.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateRollup", + Handler: _Msg_CreateRollup_Handler, + }, + { + MethodName: "UpdateState", + Handler: _Msg_UpdateState_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "nucleic/rollup/tx.proto", +} + +func (m *MsgCreateRollup) 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 *MsgCreateRollup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateRollup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RollupId) > 0 { + i -= len(m.RollupId) + copy(dAtA[i:], m.RollupId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollupId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateRollupResponse) 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 *MsgCreateRollupResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateRollupResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateState) 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 *MsgUpdateState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateStateResponse) 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 *MsgUpdateStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateStateResponse) 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 *MsgCreateRollup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollupId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreateRollupResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateStateResponse) 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 *MsgCreateRollup) 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: MsgCreateRollup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateRollup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollupId", 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.RollupId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateRollupResponse) 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: MsgCreateRollupResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateRollupResponse: 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 (m *MsgUpdateState) 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: MsgUpdateState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateState: 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 (m *MsgUpdateStateResponse) 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: MsgUpdateStateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateStateResponse: 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") +) From 59c2f0b5fec4d8e0bd359da66254c6439c79397a Mon Sep 17 00:00:00 2001 From: tnv1 Date: Mon, 15 Apr 2024 14:37:42 +0700 Subject: [PATCH 02/12] Add more implementations --- app/upgrades.go | 2 +- proto/nucleic/rollup/bank.proto | 53 ++ proto/nucleic/rollup/rollup.proto | 63 ++ x/rollup/client/cli/query.go | 1 + x/rollup/client/cli/tx.go | 1 + x/rollup/keeper/keeper.go | 46 + x/rollup/keeper/msg_server.go | 29 + x/rollup/keeper/params.go | 33 + x/rollup/keeper/rollup.go | 20 + x/rollup/types/bank.pb.go | 986 +++++++++++++++++++ x/rollup/types/keys.go | 18 + x/rollup/types/params.go | 32 + x/rollup/types/rollup.pb.go | 1484 +++++++++++++++++++++++++++++ x/rollup/types/rollup_keys.go | 38 + 14 files changed, 2805 insertions(+), 1 deletion(-) create mode 100644 proto/nucleic/rollup/bank.proto create mode 100644 proto/nucleic/rollup/rollup.proto create mode 100644 x/rollup/client/cli/query.go create mode 100644 x/rollup/client/cli/tx.go create mode 100644 x/rollup/keeper/msg_server.go create mode 100644 x/rollup/keeper/params.go create mode 100644 x/rollup/keeper/rollup.go create mode 100644 x/rollup/types/bank.pb.go create mode 100644 x/rollup/types/keys.go create mode 100644 x/rollup/types/params.go create mode 100644 x/rollup/types/rollup.pb.go create mode 100644 x/rollup/types/rollup_keys.go diff --git a/app/upgrades.go b/app/upgrades.go index a932695b..4021d1ac 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -65,7 +65,7 @@ func (app *EveApp) RegisterUpgradeHandlers() { // register store loader for current upgrade for _, upgrade := range Upgrades { if upgradeInfo.Name == upgrade.UpgradeName { - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &upgrade.StoreUpgrades)) // nolint:gosec + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &upgrade.StoreUpgrades)) break } } diff --git a/proto/nucleic/rollup/bank.proto b/proto/nucleic/rollup/bank.proto new file mode 100644 index 00000000..60f0818e --- /dev/null +++ b/proto/nucleic/rollup/bank.proto @@ -0,0 +1,53 @@ +syntax = "proto3"; +package nucleic.rollup; + +option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; + +import "gogoproto/gogo.proto"; + + +// DenomUnit represents a struct that describes a given +// denomination unit of the basic token. +message DenomUnit { + // denom represents the string name of the given denom unit (e.g uatom). + string denom = 1; + // exponent represents power of 10 exponent that one must + // raise the base_denom to in order to equal the given DenomUnit's denom + // 1 denom = 10^exponent base_denom + // (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with + // exponent = 6, thus: 1 atom = 10^6 uatom). + uint32 exponent = 2; + // aliases is a list of string aliases for the given denom + repeated string aliases = 3; +} + +// Metadata represents a struct that describes +// a basic token. +message TokenMetadata { + string description = 1; + // denom_units represents the list of DenomUnit's for a given coin + repeated DenomUnit denom_units = 2; + // base represents the base denom (should be the DenomUnit with exponent = 0). + string base = 3; + // display indicates the suggested denom that should be + // displayed in clients. + string display = 4; + // name defines the name of the token (eg: Cosmos Atom) + // + // Since: cosmos-sdk 0.43 + string name = 5; + // symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + // be the same as the display. + // + // Since: cosmos-sdk 0.43 + string symbol = 6; + // URI to a document (on or off-chain) that contains additional information. Optional. + // + // Since: cosmos-sdk 0.46 + string uri = 7 [(gogoproto.customname) = "URI"]; + // URIHash is a sha256 hash of a document pointed by URI. It's used to verify that + // the document didn't change. Optional. + // + // Since: cosmos-sdk 0.46 + string uri_hash = 8 [(gogoproto.customname) = "URIHash"]; +} \ No newline at end of file diff --git a/proto/nucleic/rollup/rollup.proto b/proto/nucleic/rollup/rollup.proto new file mode 100644 index 00000000..20a5ab2d --- /dev/null +++ b/proto/nucleic/rollup/rollup.proto @@ -0,0 +1,63 @@ +syntax = "proto3"; +package nucleic.rollup; + +option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "nucleic/rollup/state.proto"; +import "nucleic/rollup/bank.proto"; + +// GenesisAccount is a struct for the genesis account for the Rollup +message GenesisAccount { + // amount of coins to be sent to the genesis address + cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; + // address is a bech-32 address of the genesis account + string address = 2; +} + +// RollupGenesisState is a partial repr of the state the hub can expect the Rollup to be in upon genesis +message RollupGenesisState { + // genesis_accounts is a list of token allocations + repeated GenesisAccount genesis_accounts = 1; + // is_genesis_event is a boolean that indicates if the genesis event has occured + bool is_genesis_event = 2; +} + + +// Rollup defines a Rollup object. First the Rollup is created and then +// sequencers can be created and attached. The Rollup is identified by RollupId +message Rollup { + // The unique identifier of the Rollup chain. + // The RollupId follows the same standard as cosmos chain_id. + string rollup_id = 1; + // creator is the bech32-encoded address of the Rollup creator. + string creator = 2; + // version is the software and configuration version. + // starts from 1 and increases by one on every MsgUpdateState + uint64 version = 3; + // maxSequencers is the maximum number of sequencers. + uint64 maxSequencers = 4; + // permissionedAddresses is a bech32-encoded address list of the sequencers that are allowed to serve this RollupId. + // In the case of an empty list, the Rollup is considered permissionless. + repeated string permissionedAddresses = 5; + // tokenMetadata is a list of TokenMetadata that are registered on this Rollup + repeated TokenMetadata tokenMetadata = 6; + // genesis_state is a partial repr of the state the hub can expect the Rollup to be in upon genesis + RollupGenesisState genesis_state = 7 [(gogoproto.nullable) = false]; + // channel_id will be set to the canonical IBC channel of the Rollup. + string channel_id = 8; + // frozen is a boolean that indicates if the Rollup is frozen. + bool frozen = 9; +} + +// Rollup summary is a compact representation of Rollup +message RollupSummary { + // The unique identifier of the Rollup chain. + // The RollupId follows the same standard as cosmos chain_id. + string rollup_id = 1; + // Defines the index of the last Rollup UpdateState. + StateInfoIndex latestStateIndex = 2; + // Defines the index of the last Rollup UpdateState that was finalized. + StateInfoIndex latestFinalizedStateIndex = 3; +} \ No newline at end of file diff --git a/x/rollup/client/cli/query.go b/x/rollup/client/cli/query.go new file mode 100644 index 00000000..7f1e458c --- /dev/null +++ b/x/rollup/client/cli/query.go @@ -0,0 +1 @@ +package cli diff --git a/x/rollup/client/cli/tx.go b/x/rollup/client/cli/tx.go new file mode 100644 index 00000000..7f1e458c --- /dev/null +++ b/x/rollup/client/cli/tx.go @@ -0,0 +1 @@ +package cli diff --git a/x/rollup/keeper/keeper.go b/x/rollup/keeper/keeper.go index a4cc4f6a..d823e764 100644 --- a/x/rollup/keeper/keeper.go +++ b/x/rollup/keeper/keeper.go @@ -1,4 +1,50 @@ package keeper +import ( + "fmt" + + "cosmossdk.io/core/store" + "cosmossdk.io/log" + "cosmossdk.io/x/circuit/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + type Keeper struct { + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string +} + +func NewKeeper( + cdc codec.BinaryCodec, + storeService store.KVStoreService, + logger log.Logger, + authority string, +) Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) + } + + return Keeper{ + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, + } +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) } diff --git a/x/rollup/keeper/msg_server.go b/x/rollup/keeper/msg_server.go new file mode 100644 index 00000000..29464179 --- /dev/null +++ b/x/rollup/keeper/msg_server.go @@ -0,0 +1,29 @@ +package keeper + +import ( + "context" + + "github.com/eve-network/eve/x/rollup/types" +) + +type msgServer struct { + Keeper +} + +// CreateRollup implements types.MsgServer. +func (m msgServer) CreateRollup(context.Context, *types.MsgCreateRollup) (*types.MsgCreateRollupResponse, error) { + panic("unimplemented") +} + +// UpdateState implements types.MsgServer. +func (m msgServer) UpdateState(context.Context, *types.MsgUpdateState) (*types.MsgUpdateStateResponse, error) { + panic("unimplemented") +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/rollup/keeper/params.go b/x/rollup/keeper/params.go new file mode 100644 index 00000000..5642c03d --- /dev/null +++ b/x/rollup/keeper/params.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "context" + + "github.com/eve-network/eve/x/rollup/types" + + "github.com/cosmos/cosmos-sdk/runtime" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set the params +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/rollup/keeper/rollup.go b/x/rollup/keeper/rollup.go new file mode 100644 index 00000000..f67d73f2 --- /dev/null +++ b/x/rollup/keeper/rollup.go @@ -0,0 +1,20 @@ +package keeper + +import ( + "github.com/eve-network/eve/x/rollup/types" + + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k Keeper) SetRollup(ctx sdk.Context, rollup types.Rollup) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz, err := k.cdc.Marshal(&rollup) + if err != nil { + return err + } + store.Set(types.RollappKey( + rollup.RollupId, + ), bz) + return nil +} diff --git a/x/rollup/types/bank.pb.go b/x/rollup/types/bank.pb.go new file mode 100644 index 00000000..6c8b6ec3 --- /dev/null +++ b/x/rollup/types/bank.pb.go @@ -0,0 +1,986 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollup/bank.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 + +// DenomUnit represents a struct that describes a given +// denomination unit of the basic token. +type DenomUnit struct { + // denom represents the string name of the given denom unit (e.g uatom). + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + // exponent represents power of 10 exponent that one must + // raise the base_denom to in order to equal the given DenomUnit's denom + // 1 denom = 10^exponent base_denom + // (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with + // exponent = 6, thus: 1 atom = 10^6 uatom). + Exponent uint32 `protobuf:"varint,2,opt,name=exponent,proto3" json:"exponent,omitempty"` + // aliases is a list of string aliases for the given denom + Aliases []string `protobuf:"bytes,3,rep,name=aliases,proto3" json:"aliases,omitempty"` +} + +func (m *DenomUnit) Reset() { *m = DenomUnit{} } +func (m *DenomUnit) String() string { return proto.CompactTextString(m) } +func (*DenomUnit) ProtoMessage() {} +func (*DenomUnit) Descriptor() ([]byte, []int) { + return fileDescriptor_90294fe5762ef687, []int{0} +} +func (m *DenomUnit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DenomUnit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DenomUnit.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 *DenomUnit) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomUnit.Merge(m, src) +} +func (m *DenomUnit) XXX_Size() int { + return m.Size() +} +func (m *DenomUnit) XXX_DiscardUnknown() { + xxx_messageInfo_DenomUnit.DiscardUnknown(m) +} + +var xxx_messageInfo_DenomUnit proto.InternalMessageInfo + +func (m *DenomUnit) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *DenomUnit) GetExponent() uint32 { + if m != nil { + return m.Exponent + } + return 0 +} + +func (m *DenomUnit) GetAliases() []string { + if m != nil { + return m.Aliases + } + return nil +} + +// Metadata represents a struct that describes +// a basic token. +type TokenMetadata struct { + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + // denom_units represents the list of DenomUnit's for a given coin + DenomUnits []*DenomUnit `protobuf:"bytes,2,rep,name=denom_units,json=denomUnits,proto3" json:"denom_units,omitempty"` + // base represents the base denom (should be the DenomUnit with exponent = 0). + Base string `protobuf:"bytes,3,opt,name=base,proto3" json:"base,omitempty"` + // display indicates the suggested denom that should be + // displayed in clients. + Display string `protobuf:"bytes,4,opt,name=display,proto3" json:"display,omitempty"` + // name defines the name of the token (eg: Cosmos Atom) + // + // Since: cosmos-sdk 0.43 + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` + // symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + // be the same as the display. + // + // Since: cosmos-sdk 0.43 + Symbol string `protobuf:"bytes,6,opt,name=symbol,proto3" json:"symbol,omitempty"` + // URI to a document (on or off-chain) that contains additional information. Optional. + // + // Since: cosmos-sdk 0.46 + URI string `protobuf:"bytes,7,opt,name=uri,proto3" json:"uri,omitempty"` + // URIHash is a sha256 hash of a document pointed by URI. It's used to verify that + // the document didn't change. Optional. + // + // Since: cosmos-sdk 0.46 + URIHash string `protobuf:"bytes,8,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` +} + +func (m *TokenMetadata) Reset() { *m = TokenMetadata{} } +func (m *TokenMetadata) String() string { return proto.CompactTextString(m) } +func (*TokenMetadata) ProtoMessage() {} +func (*TokenMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_90294fe5762ef687, []int{1} +} +func (m *TokenMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TokenMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TokenMetadata.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 *TokenMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenMetadata.Merge(m, src) +} +func (m *TokenMetadata) XXX_Size() int { + return m.Size() +} +func (m *TokenMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_TokenMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenMetadata proto.InternalMessageInfo + +func (m *TokenMetadata) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *TokenMetadata) GetDenomUnits() []*DenomUnit { + if m != nil { + return m.DenomUnits + } + return nil +} + +func (m *TokenMetadata) GetBase() string { + if m != nil { + return m.Base + } + return "" +} + +func (m *TokenMetadata) GetDisplay() string { + if m != nil { + return m.Display + } + return "" +} + +func (m *TokenMetadata) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *TokenMetadata) GetSymbol() string { + if m != nil { + return m.Symbol + } + return "" +} + +func (m *TokenMetadata) GetURI() string { + if m != nil { + return m.URI + } + return "" +} + +func (m *TokenMetadata) GetURIHash() string { + if m != nil { + return m.URIHash + } + return "" +} + +func init() { + proto.RegisterType((*DenomUnit)(nil), "nucleic.rollup.DenomUnit") + proto.RegisterType((*TokenMetadata)(nil), "nucleic.rollup.TokenMetadata") +} + +func init() { proto.RegisterFile("nucleic/rollup/bank.proto", fileDescriptor_90294fe5762ef687) } + +var fileDescriptor_90294fe5762ef687 = []byte{ + // 369 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0x3f, 0x6f, 0xe2, 0x30, + 0x18, 0xc6, 0x09, 0x01, 0x02, 0x46, 0xdc, 0x60, 0xa1, 0x93, 0x61, 0x08, 0x11, 0xc3, 0x29, 0xcb, + 0x25, 0xba, 0xbb, 0xed, 0x46, 0xd4, 0xa1, 0xa8, 0xea, 0x62, 0x15, 0x55, 0xea, 0x82, 0x9c, 0xc4, + 0x22, 0x16, 0x89, 0x1d, 0xc5, 0x8e, 0x0a, 0x5f, 0xa1, 0x53, 0x3f, 0x56, 0x47, 0xc6, 0x4e, 0xa8, + 0x0a, 0x5f, 0xa4, 0x72, 0xfe, 0xa0, 0x76, 0x7b, 0x7e, 0xcf, 0xf3, 0xc8, 0x7e, 0x5f, 0xbd, 0x60, + 0xc6, 0x8b, 0x30, 0xa1, 0x2c, 0xf4, 0x73, 0x91, 0x24, 0x45, 0xe6, 0x07, 0x84, 0xef, 0xbd, 0x2c, + 0x17, 0x4a, 0xc0, 0x1f, 0x4d, 0xe4, 0xd5, 0xd1, 0x7c, 0xba, 0x13, 0x3b, 0x51, 0x45, 0xbe, 0x56, + 0x75, 0x6b, 0xf9, 0x08, 0x46, 0x37, 0x94, 0x8b, 0x74, 0xc3, 0x99, 0x82, 0x53, 0xd0, 0x8f, 0x34, + 0x20, 0xc3, 0x31, 0xdc, 0x11, 0xae, 0x01, 0xce, 0xc1, 0x90, 0x1e, 0x32, 0xc1, 0x29, 0x57, 0xa8, + 0xeb, 0x18, 0xee, 0x04, 0x5f, 0x19, 0x22, 0x60, 0x91, 0x84, 0x11, 0x49, 0x25, 0x32, 0x1d, 0xd3, + 0x1d, 0xe1, 0x16, 0x97, 0x2f, 0x5d, 0x30, 0x79, 0x10, 0x7b, 0xca, 0xef, 0xa9, 0x22, 0x11, 0x51, + 0x04, 0x3a, 0x60, 0x1c, 0x51, 0x19, 0xe6, 0x2c, 0x53, 0x4c, 0xf0, 0xe6, 0x8f, 0xaf, 0x16, 0xfc, + 0xaf, 0x1b, 0x5c, 0xa4, 0xdb, 0x82, 0x33, 0x25, 0x51, 0xd7, 0x31, 0xdd, 0xf1, 0xdf, 0x99, 0xf7, + 0x7d, 0x11, 0xef, 0x3a, 0x2f, 0x06, 0x51, 0x2b, 0x25, 0x84, 0xa0, 0x17, 0x10, 0x49, 0x91, 0x59, + 0x3d, 0x5b, 0x69, 0x3d, 0x5d, 0xc4, 0x64, 0x96, 0x90, 0x23, 0xea, 0x55, 0x76, 0x8b, 0xba, 0xcd, + 0x49, 0x4a, 0x51, 0xbf, 0x6e, 0x6b, 0x0d, 0x7f, 0x82, 0x81, 0x3c, 0xa6, 0x81, 0x48, 0xd0, 0xa0, + 0x72, 0x1b, 0x82, 0x33, 0x60, 0x16, 0x39, 0x43, 0x96, 0x36, 0x57, 0x56, 0x79, 0x5e, 0x98, 0x1b, + 0xbc, 0xc6, 0xda, 0x83, 0xbf, 0xc0, 0xb0, 0xc8, 0xd9, 0x36, 0x26, 0x32, 0x46, 0xc3, 0x2a, 0x1f, + 0x97, 0xe7, 0x85, 0xb5, 0xc1, 0xeb, 0x5b, 0x22, 0x63, 0x6c, 0x15, 0x39, 0xd3, 0x62, 0x75, 0xf7, + 0x56, 0xda, 0xc6, 0xa9, 0xb4, 0x8d, 0x8f, 0xd2, 0x36, 0x5e, 0x2f, 0x76, 0xe7, 0x74, 0xb1, 0x3b, + 0xef, 0x17, 0xbb, 0xf3, 0xf4, 0x67, 0xc7, 0x54, 0x5c, 0x04, 0x5e, 0x28, 0x52, 0xbf, 0xd9, 0xf3, + 0x37, 0xa7, 0xea, 0x59, 0xe4, 0xfb, 0x96, 0xfd, 0x43, 0x7b, 0x5d, 0x75, 0xcc, 0xa8, 0x0c, 0x06, + 0xd5, 0xe5, 0xfe, 0x7d, 0x06, 0x00, 0x00, 0xff, 0xff, 0x98, 0x1a, 0x3b, 0x32, 0xfc, 0x01, 0x00, + 0x00, +} + +func (m *DenomUnit) 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 *DenomUnit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DenomUnit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Aliases) > 0 { + for iNdEx := len(m.Aliases) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Aliases[iNdEx]) + copy(dAtA[i:], m.Aliases[iNdEx]) + i = encodeVarintBank(dAtA, i, uint64(len(m.Aliases[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if m.Exponent != 0 { + i = encodeVarintBank(dAtA, i, uint64(m.Exponent)) + i-- + dAtA[i] = 0x10 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintBank(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TokenMetadata) 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 *TokenMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TokenMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.URIHash) > 0 { + i -= len(m.URIHash) + copy(dAtA[i:], m.URIHash) + i = encodeVarintBank(dAtA, i, uint64(len(m.URIHash))) + i-- + dAtA[i] = 0x42 + } + if len(m.URI) > 0 { + i -= len(m.URI) + copy(dAtA[i:], m.URI) + i = encodeVarintBank(dAtA, i, uint64(len(m.URI))) + i-- + dAtA[i] = 0x3a + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintBank(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0x32 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintBank(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x2a + } + if len(m.Display) > 0 { + i -= len(m.Display) + copy(dAtA[i:], m.Display) + i = encodeVarintBank(dAtA, i, uint64(len(m.Display))) + i-- + dAtA[i] = 0x22 + } + if len(m.Base) > 0 { + i -= len(m.Base) + copy(dAtA[i:], m.Base) + i = encodeVarintBank(dAtA, i, uint64(len(m.Base))) + i-- + dAtA[i] = 0x1a + } + if len(m.DenomUnits) > 0 { + for iNdEx := len(m.DenomUnits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DenomUnits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBank(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintBank(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintBank(dAtA []byte, offset int, v uint64) int { + offset -= sovBank(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *DenomUnit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + if m.Exponent != 0 { + n += 1 + sovBank(uint64(m.Exponent)) + } + if len(m.Aliases) > 0 { + for _, s := range m.Aliases { + l = len(s) + n += 1 + l + sovBank(uint64(l)) + } + } + return n +} + +func (m *TokenMetadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Description) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + if len(m.DenomUnits) > 0 { + for _, e := range m.DenomUnits { + l = e.Size() + n += 1 + l + sovBank(uint64(l)) + } + } + l = len(m.Base) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + l = len(m.Display) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + l = len(m.URI) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + l = len(m.URIHash) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + return n +} + +func sovBank(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozBank(x uint64) (n int) { + return sovBank(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *DenomUnit) 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 ErrIntOverflowBank + } + 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: DenomUnit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DenomUnit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) + } + m.Exponent = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Exponent |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Aliases", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Aliases = append(m.Aliases, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBank(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBank + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TokenMetadata) 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 ErrIntOverflowBank + } + 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: TokenMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TokenMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomUnits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBank + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomUnits = append(m.DenomUnits, &DenomUnit{}) + if err := m.DenomUnits[len(m.DenomUnits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Base", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Base = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Display", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Display = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field URI", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.URI = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field URIHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.URIHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBank(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBank + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipBank(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, ErrIntOverflowBank + } + 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, ErrIntOverflowBank + } + 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, ErrIntOverflowBank + } + 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, ErrInvalidLengthBank + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupBank + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthBank + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthBank = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBank = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBank = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollup/types/keys.go b/x/rollup/types/keys.go new file mode 100644 index 00000000..1cb59525 --- /dev/null +++ b/x/rollup/types/keys.go @@ -0,0 +1,18 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "rollup" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_rollup" +) + +var ParamsKey = []byte("p_rollup") + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/rollup/types/params.go b/x/rollup/types/params.go new file mode 100644 index 00000000..4f3215e3 --- /dev/null +++ b/x/rollup/types/params.go @@ -0,0 +1,32 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} diff --git a/x/rollup/types/rollup.pb.go b/x/rollup/types/rollup.pb.go new file mode 100644 index 00000000..ee2930cc --- /dev/null +++ b/x/rollup/types/rollup.pb.go @@ -0,0 +1,1484 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollup/rollup.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "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 + +// GenesisAccount is a struct for the genesis account for the Rollup +type GenesisAccount struct { + // amount of coins to be sent to the genesis address + Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` + // address is a bech-32 address of the genesis account + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *GenesisAccount) Reset() { *m = GenesisAccount{} } +func (m *GenesisAccount) String() string { return proto.CompactTextString(m) } +func (*GenesisAccount) ProtoMessage() {} +func (*GenesisAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_ca266ab929c281b5, []int{0} +} +func (m *GenesisAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisAccount.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 *GenesisAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisAccount.Merge(m, src) +} +func (m *GenesisAccount) XXX_Size() int { + return m.Size() +} +func (m *GenesisAccount) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisAccount proto.InternalMessageInfo + +func (m *GenesisAccount) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +func (m *GenesisAccount) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +// RollupGenesisState is a partial repr of the state the hub can expect the Rollup to be in upon genesis +type RollupGenesisState struct { + // genesis_accounts is a list of token allocations + GenesisAccounts []*GenesisAccount `protobuf:"bytes,1,rep,name=genesis_accounts,json=genesisAccounts,proto3" json:"genesis_accounts,omitempty"` + // is_genesis_event is a boolean that indicates if the genesis event has occured + IsGenesisEvent bool `protobuf:"varint,2,opt,name=is_genesis_event,json=isGenesisEvent,proto3" json:"is_genesis_event,omitempty"` +} + +func (m *RollupGenesisState) Reset() { *m = RollupGenesisState{} } +func (m *RollupGenesisState) String() string { return proto.CompactTextString(m) } +func (*RollupGenesisState) ProtoMessage() {} +func (*RollupGenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_ca266ab929c281b5, []int{1} +} +func (m *RollupGenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RollupGenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RollupGenesisState.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 *RollupGenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_RollupGenesisState.Merge(m, src) +} +func (m *RollupGenesisState) XXX_Size() int { + return m.Size() +} +func (m *RollupGenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_RollupGenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_RollupGenesisState proto.InternalMessageInfo + +func (m *RollupGenesisState) GetGenesisAccounts() []*GenesisAccount { + if m != nil { + return m.GenesisAccounts + } + return nil +} + +func (m *RollupGenesisState) GetIsGenesisEvent() bool { + if m != nil { + return m.IsGenesisEvent + } + return false +} + +// Rollup defines a Rollup object. First the Rollup is created and then +// sequencers can be created and attached. The Rollup is identified by RollupId +type Rollup struct { + // The unique identifier of the Rollup chain. + // The RollupId follows the same standard as cosmos chain_id. + RollupId string `protobuf:"bytes,1,opt,name=rollup_id,json=rollupId,proto3" json:"rollup_id,omitempty"` + // creator is the bech32-encoded address of the Rollup creator. + Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` + // version is the software and configuration version. + // starts from 1 and increases by one on every MsgUpdateState + Version uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` + // maxSequencers is the maximum number of sequencers. + MaxSequencers uint64 `protobuf:"varint,4,opt,name=maxSequencers,proto3" json:"maxSequencers,omitempty"` + // permissionedAddresses is a bech32-encoded address list of the sequencers that are allowed to serve this RollupId. + // In the case of an empty list, the Rollup is considered permissionless. + PermissionedAddresses []string `protobuf:"bytes,5,rep,name=permissionedAddresses,proto3" json:"permissionedAddresses,omitempty"` + // tokenMetadata is a list of TokenMetadata that are registered on this Rollup + TokenMetadata []*TokenMetadata `protobuf:"bytes,6,rep,name=tokenMetadata,proto3" json:"tokenMetadata,omitempty"` + // genesis_state is a partial repr of the state the hub can expect the Rollup to be in upon genesis + GenesisState RollupGenesisState `protobuf:"bytes,7,opt,name=genesis_state,json=genesisState,proto3" json:"genesis_state"` + // channel_id will be set to the canonical IBC channel of the Rollup. + ChannelId string `protobuf:"bytes,8,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // frozen is a boolean that indicates if the Rollup is frozen. + Frozen bool `protobuf:"varint,9,opt,name=frozen,proto3" json:"frozen,omitempty"` +} + +func (m *Rollup) Reset() { *m = Rollup{} } +func (m *Rollup) String() string { return proto.CompactTextString(m) } +func (*Rollup) ProtoMessage() {} +func (*Rollup) Descriptor() ([]byte, []int) { + return fileDescriptor_ca266ab929c281b5, []int{2} +} +func (m *Rollup) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Rollup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Rollup.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 *Rollup) XXX_Merge(src proto.Message) { + xxx_messageInfo_Rollup.Merge(m, src) +} +func (m *Rollup) XXX_Size() int { + return m.Size() +} +func (m *Rollup) XXX_DiscardUnknown() { + xxx_messageInfo_Rollup.DiscardUnknown(m) +} + +var xxx_messageInfo_Rollup proto.InternalMessageInfo + +func (m *Rollup) GetRollupId() string { + if m != nil { + return m.RollupId + } + return "" +} + +func (m *Rollup) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *Rollup) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *Rollup) GetMaxSequencers() uint64 { + if m != nil { + return m.MaxSequencers + } + return 0 +} + +func (m *Rollup) GetPermissionedAddresses() []string { + if m != nil { + return m.PermissionedAddresses + } + return nil +} + +func (m *Rollup) GetTokenMetadata() []*TokenMetadata { + if m != nil { + return m.TokenMetadata + } + return nil +} + +func (m *Rollup) GetGenesisState() RollupGenesisState { + if m != nil { + return m.GenesisState + } + return RollupGenesisState{} +} + +func (m *Rollup) GetChannelId() string { + if m != nil { + return m.ChannelId + } + return "" +} + +func (m *Rollup) GetFrozen() bool { + if m != nil { + return m.Frozen + } + return false +} + +// Rollup summary is a compact representation of Rollup +type RollupSummary struct { + // The unique identifier of the Rollup chain. + // The RollupId follows the same standard as cosmos chain_id. + RollupId string `protobuf:"bytes,1,opt,name=rollup_id,json=rollupId,proto3" json:"rollup_id,omitempty"` + // Defines the index of the last Rollup UpdateState. + LatestStateIndex *StateInfoIndex `protobuf:"bytes,2,opt,name=latestStateIndex,proto3" json:"latestStateIndex,omitempty"` + // Defines the index of the last Rollup UpdateState that was finalized. + LatestFinalizedStateIndex *StateInfoIndex `protobuf:"bytes,3,opt,name=latestFinalizedStateIndex,proto3" json:"latestFinalizedStateIndex,omitempty"` +} + +func (m *RollupSummary) Reset() { *m = RollupSummary{} } +func (m *RollupSummary) String() string { return proto.CompactTextString(m) } +func (*RollupSummary) ProtoMessage() {} +func (*RollupSummary) Descriptor() ([]byte, []int) { + return fileDescriptor_ca266ab929c281b5, []int{3} +} +func (m *RollupSummary) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RollupSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RollupSummary.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 *RollupSummary) XXX_Merge(src proto.Message) { + xxx_messageInfo_RollupSummary.Merge(m, src) +} +func (m *RollupSummary) XXX_Size() int { + return m.Size() +} +func (m *RollupSummary) XXX_DiscardUnknown() { + xxx_messageInfo_RollupSummary.DiscardUnknown(m) +} + +var xxx_messageInfo_RollupSummary proto.InternalMessageInfo + +func (m *RollupSummary) GetRollupId() string { + if m != nil { + return m.RollupId + } + return "" +} + +func (m *RollupSummary) GetLatestStateIndex() *StateInfoIndex { + if m != nil { + return m.LatestStateIndex + } + return nil +} + +func (m *RollupSummary) GetLatestFinalizedStateIndex() *StateInfoIndex { + if m != nil { + return m.LatestFinalizedStateIndex + } + return nil +} + +func init() { + proto.RegisterType((*GenesisAccount)(nil), "nucleic.rollup.GenesisAccount") + proto.RegisterType((*RollupGenesisState)(nil), "nucleic.rollup.RollupGenesisState") + proto.RegisterType((*Rollup)(nil), "nucleic.rollup.Rollup") + proto.RegisterType((*RollupSummary)(nil), "nucleic.rollup.RollupSummary") +} + +func init() { proto.RegisterFile("nucleic/rollup/rollup.proto", fileDescriptor_ca266ab929c281b5) } + +var fileDescriptor_ca266ab929c281b5 = []byte{ + // 556 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x6f, 0xd3, 0x30, + 0x14, 0x6e, 0xe8, 0xe8, 0x16, 0x8f, 0x96, 0xca, 0x02, 0x94, 0x76, 0x5a, 0xa8, 0x2a, 0x0e, 0xb9, + 0x90, 0xa8, 0x03, 0x89, 0xf3, 0x36, 0x01, 0x2a, 0x68, 0x97, 0x94, 0x13, 0x42, 0xaa, 0xdc, 0xe4, + 0x2d, 0xb3, 0x9a, 0xd8, 0x25, 0x76, 0x4a, 0xb7, 0x13, 0x57, 0x6e, 0xfc, 0xac, 0x1d, 0x77, 0x42, + 0x9c, 0x10, 0x6a, 0xff, 0x08, 0x8a, 0xed, 0x48, 0x6d, 0x37, 0x10, 0xa7, 0xe4, 0xbd, 0xef, 0xbd, + 0xf7, 0x3d, 0x7f, 0x9f, 0x8d, 0x0e, 0x58, 0x11, 0xa5, 0x40, 0xa3, 0x20, 0xe7, 0x69, 0x5a, 0xcc, + 0xcc, 0xc7, 0x9f, 0xe5, 0x5c, 0x72, 0xdc, 0x32, 0xa0, 0xaf, 0xb3, 0xdd, 0x47, 0x09, 0x4f, 0xb8, + 0x82, 0x82, 0xf2, 0x4f, 0x57, 0x75, 0xdd, 0x88, 0x8b, 0x8c, 0x8b, 0x60, 0x42, 0x04, 0x04, 0xf3, + 0xc1, 0x04, 0x24, 0x19, 0x04, 0x11, 0xa7, 0xcc, 0xe0, 0xdd, 0x2d, 0x0a, 0x21, 0x89, 0x04, 0x83, + 0x75, 0xb6, 0xb0, 0x09, 0x61, 0x53, 0x0d, 0xf5, 0x23, 0xd4, 0x7a, 0x0b, 0x0c, 0x04, 0x15, 0xc7, + 0x51, 0xc4, 0x0b, 0x26, 0xf1, 0x2b, 0xd4, 0x20, 0x59, 0xf9, 0xe7, 0x58, 0x3d, 0xcb, 0xdb, 0x3f, + 0xea, 0xf8, 0x9a, 0xd9, 0x2f, 0x99, 0x7d, 0xc3, 0xec, 0x9f, 0x72, 0xca, 0x4e, 0x76, 0xae, 0x7f, + 0x3d, 0xad, 0x85, 0xa6, 0x1c, 0x3b, 0x68, 0x97, 0xc4, 0x71, 0x0e, 0x42, 0x38, 0xf7, 0x7a, 0x96, + 0x67, 0x87, 0x55, 0xd8, 0xff, 0x66, 0x21, 0x1c, 0x2a, 0x6a, 0xc3, 0x35, 0x2a, 0x97, 0xc3, 0x43, + 0xd4, 0x4e, 0x74, 0x3c, 0x26, 0x9a, 0x5c, 0x38, 0x56, 0xaf, 0xee, 0xed, 0x1f, 0xb9, 0xfe, 0xa6, + 0x26, 0xfe, 0xe6, 0x8e, 0xe1, 0xc3, 0x64, 0x23, 0x16, 0xd8, 0x43, 0x6d, 0x2a, 0xc6, 0xd5, 0x34, + 0x98, 0x03, 0x93, 0x6a, 0x89, 0xbd, 0xb0, 0x45, 0x85, 0x69, 0x7e, 0x5d, 0x66, 0xfb, 0x5f, 0xeb, + 0xa8, 0xa1, 0x77, 0xc1, 0x07, 0xc8, 0xd6, 0xe3, 0xc7, 0x34, 0x56, 0x87, 0xb5, 0xc3, 0x3d, 0x9d, + 0x18, 0xc6, 0xe5, 0x69, 0xa2, 0x1c, 0x88, 0xe4, 0x79, 0x75, 0x1a, 0x13, 0x96, 0xc8, 0x1c, 0x72, + 0x41, 0x39, 0x73, 0xea, 0x3d, 0xcb, 0xdb, 0x09, 0xab, 0x10, 0x3f, 0x43, 0xcd, 0x8c, 0x2c, 0x46, + 0xf0, 0xb9, 0x00, 0x16, 0x41, 0x2e, 0x9c, 0x1d, 0x85, 0x6f, 0x26, 0xf1, 0x4b, 0xf4, 0x78, 0x06, + 0x79, 0x46, 0x45, 0xd9, 0x03, 0xf1, 0xb1, 0x16, 0x09, 0x84, 0x73, 0xbf, 0x57, 0xf7, 0xec, 0xf0, + 0x6e, 0x10, 0x9f, 0xa2, 0xa6, 0xe4, 0x53, 0x60, 0x67, 0x20, 0x49, 0x4c, 0x24, 0x71, 0x1a, 0x4a, + 0xa9, 0xc3, 0x6d, 0xa5, 0x3e, 0xac, 0x17, 0x85, 0x9b, 0x3d, 0xf8, 0x0c, 0x35, 0x2b, 0x8d, 0xd4, + 0xfd, 0x70, 0x76, 0x95, 0xc5, 0xfd, 0xed, 0x21, 0xb7, 0xcd, 0x32, 0x5e, 0x3f, 0x48, 0xd6, 0x0d, + 0x3c, 0x44, 0x28, 0xba, 0x20, 0x8c, 0x41, 0x5a, 0x2a, 0xb8, 0xa7, 0x64, 0xb2, 0x4d, 0x66, 0x18, + 0xe3, 0x27, 0xa8, 0x71, 0x9e, 0xf3, 0x2b, 0x60, 0x8e, 0xad, 0xac, 0x30, 0x51, 0xff, 0x87, 0x85, + 0x9a, 0x9a, 0x61, 0x54, 0x64, 0x19, 0xc9, 0x2f, 0xff, 0xed, 0xc4, 0x3b, 0xd4, 0x4e, 0x89, 0x04, + 0x21, 0x15, 0xe9, 0x90, 0xc5, 0xb0, 0x50, 0x96, 0xdc, 0x71, 0x4d, 0x4c, 0xc5, 0x39, 0x57, 0x55, + 0xe1, 0xad, 0x3e, 0xfc, 0x09, 0x75, 0x74, 0xee, 0x0d, 0x65, 0x24, 0xa5, 0x57, 0x10, 0xaf, 0x0d, + 0xad, 0xff, 0xd7, 0xd0, 0xbf, 0x0f, 0x38, 0x79, 0x7f, 0xbd, 0x74, 0xad, 0x9b, 0xa5, 0x6b, 0xfd, + 0x5e, 0xba, 0xd6, 0xf7, 0x95, 0x5b, 0xbb, 0x59, 0xb9, 0xb5, 0x9f, 0x2b, 0xb7, 0xf6, 0x71, 0x90, + 0x50, 0x79, 0x51, 0x4c, 0xfc, 0x88, 0x67, 0x81, 0x19, 0xff, 0x9c, 0x81, 0xfc, 0xc2, 0xf3, 0x69, + 0x15, 0x07, 0x8b, 0xea, 0x79, 0xca, 0xcb, 0x19, 0x88, 0x49, 0x43, 0x3d, 0xd0, 0x17, 0x7f, 0x02, + 0x00, 0x00, 0xff, 0xff, 0x76, 0x9b, 0xa9, 0xd8, 0x3c, 0x04, 0x00, 0x00, +} + +func (m *GenesisAccount) 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 *GenesisAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintRollup(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollup(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *RollupGenesisState) 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 *RollupGenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RollupGenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsGenesisEvent { + i-- + if m.IsGenesisEvent { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.GenesisAccounts) > 0 { + for iNdEx := len(m.GenesisAccounts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GenesisAccounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollup(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Rollup) 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 *Rollup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Rollup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Frozen { + i-- + if m.Frozen { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x48 + } + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintRollup(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0x42 + } + { + size, err := m.GenesisState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollup(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if len(m.TokenMetadata) > 0 { + for iNdEx := len(m.TokenMetadata) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TokenMetadata[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollup(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.PermissionedAddresses) > 0 { + for iNdEx := len(m.PermissionedAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PermissionedAddresses[iNdEx]) + copy(dAtA[i:], m.PermissionedAddresses[iNdEx]) + i = encodeVarintRollup(dAtA, i, uint64(len(m.PermissionedAddresses[iNdEx]))) + i-- + dAtA[i] = 0x2a + } + } + if m.MaxSequencers != 0 { + i = encodeVarintRollup(dAtA, i, uint64(m.MaxSequencers)) + i-- + dAtA[i] = 0x20 + } + if m.Version != 0 { + i = encodeVarintRollup(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x18 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintRollup(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0x12 + } + if len(m.RollupId) > 0 { + i -= len(m.RollupId) + copy(dAtA[i:], m.RollupId) + i = encodeVarintRollup(dAtA, i, uint64(len(m.RollupId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RollupSummary) 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 *RollupSummary) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RollupSummary) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LatestFinalizedStateIndex != nil { + { + size, err := m.LatestFinalizedStateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollup(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.LatestStateIndex != nil { + { + size, err := m.LatestStateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollup(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.RollupId) > 0 { + i -= len(m.RollupId) + copy(dAtA[i:], m.RollupId) + i = encodeVarintRollup(dAtA, i, uint64(len(m.RollupId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintRollup(dAtA []byte, offset int, v uint64) int { + offset -= sovRollup(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovRollup(uint64(l)) + l = len(m.Address) + if l > 0 { + n += 1 + l + sovRollup(uint64(l)) + } + return n +} + +func (m *RollupGenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.GenesisAccounts) > 0 { + for _, e := range m.GenesisAccounts { + l = e.Size() + n += 1 + l + sovRollup(uint64(l)) + } + } + if m.IsGenesisEvent { + n += 2 + } + return n +} + +func (m *Rollup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollupId) + if l > 0 { + n += 1 + l + sovRollup(uint64(l)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovRollup(uint64(l)) + } + if m.Version != 0 { + n += 1 + sovRollup(uint64(m.Version)) + } + if m.MaxSequencers != 0 { + n += 1 + sovRollup(uint64(m.MaxSequencers)) + } + if len(m.PermissionedAddresses) > 0 { + for _, s := range m.PermissionedAddresses { + l = len(s) + n += 1 + l + sovRollup(uint64(l)) + } + } + if len(m.TokenMetadata) > 0 { + for _, e := range m.TokenMetadata { + l = e.Size() + n += 1 + l + sovRollup(uint64(l)) + } + } + l = m.GenesisState.Size() + n += 1 + l + sovRollup(uint64(l)) + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovRollup(uint64(l)) + } + if m.Frozen { + n += 2 + } + return n +} + +func (m *RollupSummary) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollupId) + if l > 0 { + n += 1 + l + sovRollup(uint64(l)) + } + if m.LatestStateIndex != nil { + l = m.LatestStateIndex.Size() + n += 1 + l + sovRollup(uint64(l)) + } + if m.LatestFinalizedStateIndex != nil { + l = m.LatestFinalizedStateIndex.Size() + n += 1 + l + sovRollup(uint64(l)) + } + return n +} + +func sovRollup(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRollup(x uint64) (n int) { + return sovRollup(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisAccount) 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 ErrIntOverflowRollup + } + 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: GenesisAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollup + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollup + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + 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 ErrInvalidLengthRollup + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollup + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRollup(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRollup + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RollupGenesisState) 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 ErrIntOverflowRollup + } + 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: RollupGenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RollupGenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisAccounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollup + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollup + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GenesisAccounts = append(m.GenesisAccounts, &GenesisAccount{}) + if err := m.GenesisAccounts[len(m.GenesisAccounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsGenesisEvent", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsGenesisEvent = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRollup(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRollup + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Rollup) 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 ErrIntOverflowRollup + } + 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: Rollup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Rollup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollupId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + 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 ErrInvalidLengthRollup + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollup + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollupId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + 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 ErrInvalidLengthRollup + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollup + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSequencers", wireType) + } + m.MaxSequencers = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSequencers |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PermissionedAddresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + 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 ErrInvalidLengthRollup + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollup + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PermissionedAddresses = append(m.PermissionedAddresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenMetadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollup + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollup + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenMetadata = append(m.TokenMetadata, &TokenMetadata{}) + if err := m.TokenMetadata[len(m.TokenMetadata)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisState", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollup + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollup + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.GenesisState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + 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 ErrInvalidLengthRollup + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollup + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Frozen", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Frozen = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRollup(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRollup + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RollupSummary) 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 ErrIntOverflowRollup + } + 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: RollupSummary: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RollupSummary: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollupId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + 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 ErrInvalidLengthRollup + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollup + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollupId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestStateIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollup + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollup + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LatestStateIndex == nil { + m.LatestStateIndex = &StateInfoIndex{} + } + if err := m.LatestStateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFinalizedStateIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollup + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollup + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollup + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LatestFinalizedStateIndex == nil { + m.LatestFinalizedStateIndex = &StateInfoIndex{} + } + if err := m.LatestFinalizedStateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRollup(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRollup + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRollup(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, ErrIntOverflowRollup + } + 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, ErrIntOverflowRollup + } + 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, ErrIntOverflowRollup + } + 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, ErrInvalidLengthRollup + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRollup + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRollup + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRollup = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRollup = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRollup = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollup/types/rollup_keys.go b/x/rollup/types/rollup_keys.go new file mode 100644 index 00000000..4a93293a --- /dev/null +++ b/x/rollup/types/rollup_keys.go @@ -0,0 +1,38 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // RollappKeyPrefix is the prefix to retrieve all Rollapp + RollappKeyPrefix = "Rollapp/value/" + RollappByEIP155KeyPrefix = "RollappByEIP155/value/" +) + +// RollappKey returns the store key to retrieve a Rollapp from the index fields +func RollappKey( + rollappId string, +) []byte { + var key []byte + + rollappIdBytes := []byte(rollappId) + key = append(key, rollappIdBytes...) + key = append(key, []byte("/")...) + + return key +} + +// RollappByEIP155Key returns the store key to retrieve a Rollapp from the index fields +func RollappByEIP155Key( + eip155 uint64, +) []byte { + var key []byte + + eip155Bytes := make([]byte, 8) + binary.LittleEndian.PutUint64(eip155Bytes, eip155) + key = append(key, eip155Bytes...) + key = append(key, []byte("/")...) + + return key +} From e6c20be041adc5ece79831769e81a38939311ea3 Mon Sep 17 00:00:00 2001 From: tnv1 Date: Mon, 15 Apr 2024 14:46:10 +0700 Subject: [PATCH 03/12] Change name --- x/rollup/keeper/rollup.go | 2 +- x/rollup/types/rollup_keys.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/x/rollup/keeper/rollup.go b/x/rollup/keeper/rollup.go index f67d73f2..2424bed9 100644 --- a/x/rollup/keeper/rollup.go +++ b/x/rollup/keeper/rollup.go @@ -13,7 +13,7 @@ func (k Keeper) SetRollup(ctx sdk.Context, rollup types.Rollup) error { if err != nil { return err } - store.Set(types.RollappKey( + store.Set(types.RollupKey( rollup.RollupId, ), bz) return nil diff --git a/x/rollup/types/rollup_keys.go b/x/rollup/types/rollup_keys.go index 4a93293a..684fa2cc 100644 --- a/x/rollup/types/rollup_keys.go +++ b/x/rollup/types/rollup_keys.go @@ -5,26 +5,26 @@ import "encoding/binary" var _ binary.ByteOrder const ( - // RollappKeyPrefix is the prefix to retrieve all Rollapp - RollappKeyPrefix = "Rollapp/value/" - RollappByEIP155KeyPrefix = "RollappByEIP155/value/" + // RollupKeyPrefix is the prefix to retrieve all Rollup + RollupKeyPrefix = "Rollup/value/" + RollupByEIP155KeyPrefix = "RollupByEIP155/value/" ) -// RollappKey returns the store key to retrieve a Rollapp from the index fields -func RollappKey( - rollappId string, +// RollupKey returns the store key to retrieve a Rollup from the index fields +func RollupKey( + rollupId string, ) []byte { var key []byte - rollappIdBytes := []byte(rollappId) - key = append(key, rollappIdBytes...) + rollupIdBytes := []byte(rollupId) + key = append(key, rollupIdBytes...) key = append(key, []byte("/")...) return key } -// RollappByEIP155Key returns the store key to retrieve a Rollapp from the index fields -func RollappByEIP155Key( +// RollupByEIP155Key returns the store key to retrieve a Rollup from the index fields +func RollupByEIP155Key( eip155 uint64, ) []byte { var key []byte From 4dbbbe18df255c45ce47332444f819a12eef19ea Mon Sep 17 00:00:00 2001 From: tnv1 Date: Mon, 22 Apr 2024 13:39:29 +0700 Subject: [PATCH 04/12] Add more function for rollup --- x/rollup/keeper/rollup.go | 42 ++++++++++++++++++++++++++++++++--- x/rollup/types/rollup_keys.go | 8 ++----- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/x/rollup/keeper/rollup.go b/x/rollup/keeper/rollup.go index 2424bed9..5dd43cfb 100644 --- a/x/rollup/keeper/rollup.go +++ b/x/rollup/keeper/rollup.go @@ -3,6 +3,8 @@ package keeper import ( "github.com/eve-network/eve/x/rollup/types" + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -13,8 +15,42 @@ func (k Keeper) SetRollup(ctx sdk.Context, rollup types.Rollup) error { if err != nil { return err } - store.Set(types.RollupKey( - rollup.RollupId, - ), bz) + store.Set(types.RollupKey(rollup.RollupId), bz) return nil } + +func (k Keeper) GetRollup(ctx sdk.Context, rollupId string) (types.Rollup, bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + b := store.Get(types.RollupKey(rollupId)) + if b == nil { + return types.Rollup{}, false + } + + var val types.Rollup + err := k.cdc.Unmarshal(b, &val) + if err != nil { + return types.Rollup{}, false + } + return val, true +} + +func (k Keeper) RemoveRollup(ctx sdk.Context, rollupId string) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store.Delete(types.RollupKey(rollupId)) +} + +func (k Keeper) GetAllRollups(ctx sdk.Context) []types.Rollup { + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), []byte(types.RollupKeyPrefix)) + iter := prefixStore.Iterator(nil, nil) + defer iter.Close() + + var list []types.Rollup + + for ; iter.Valid(); iter.Next() { + var val types.Rollup + k.cdc.MustUnmarshal(iter.Value(), &val) + list = append(list, val) + } + + return list +} diff --git a/x/rollup/types/rollup_keys.go b/x/rollup/types/rollup_keys.go index 684fa2cc..6dfafe37 100644 --- a/x/rollup/types/rollup_keys.go +++ b/x/rollup/types/rollup_keys.go @@ -11,9 +11,7 @@ const ( ) // RollupKey returns the store key to retrieve a Rollup from the index fields -func RollupKey( - rollupId string, -) []byte { +func RollupKey(rollupId string) []byte { var key []byte rollupIdBytes := []byte(rollupId) @@ -24,9 +22,7 @@ func RollupKey( } // RollupByEIP155Key returns the store key to retrieve a Rollup from the index fields -func RollupByEIP155Key( - eip155 uint64, -) []byte { +func RollupByEIP155Key(eip155 uint64) []byte { var key []byte eip155Bytes := make([]byte, 8) From 9590c92c40bb4dea5f4ffbecc312b27ff5f8cde1 Mon Sep 17 00:00:00 2001 From: tnv1 Date: Tue, 30 Apr 2024 00:27:34 +0700 Subject: [PATCH 05/12] Rewrite rollapp module --- go.mod | 4 +- proto/nucleic/{rollup => rollapp}/bank.proto | 18 +- proto/nucleic/rollapp/block_descriptor.proto | 20 + proto/nucleic/rollapp/genesis.proto | 22 + proto/nucleic/rollapp/params.proto | 34 + proto/nucleic/rollapp/query.proto | 113 + proto/nucleic/rollapp/rollapp.proto | 68 + proto/nucleic/rollapp/state_info.proto | 78 + proto/nucleic/rollapp/tx.proto | 76 + proto/nucleic/rollup/block.proto | 22 - proto/nucleic/rollup/genesis.proto | 12 - proto/nucleic/rollup/params.proto | 7 - proto/nucleic/rollup/query.proto | 42 - proto/nucleic/rollup/rollup.proto | 63 - proto/nucleic/rollup/state.proto | 52 - proto/nucleic/rollup/tx.proto | 29 - utils/ibc.go | 21 + x/rollapp/client/cli/query.go | 23 + x/rollapp/client/cli/tx.go | 22 + x/rollapp/genesis.go | 41 + .../block_height_to_finalization_queue.go | 125 + x/rollapp/keeper/grpc_query.go | 354 ++ x/rollapp/keeper/keeper.go | 183 + .../keeper/latest_finalized_state_index.go | 65 + x/rollapp/keeper/latest_state_info_index.go | 65 + x/{rollup => rollapp}/keeper/msg_server.go | 11 +- x/rollapp/keeper/params.go | 48 + x/rollapp/keeper/rollapp.go | 99 + x/rollapp/keeper/state_info.go | 78 + x/rollapp/module.go | 156 + x/{rollup => rollapp}/types/bank.pb.go | 60 +- .../types/block_descriptor.pb.go} | 175 +- x/rollapp/types/chain_id.go | 121 + x/rollapp/types/codec.go | 24 + x/rollapp/types/errors.go | 57 + x/rollapp/types/events.go | 13 + x/rollapp/types/expected_keepers.go | 42 + x/rollapp/types/genesis.go | 79 + x/rollapp/types/genesis.pb.go | 641 ++++ x/rollapp/types/hooks.go | 57 + .../key_block_height_to_finalization_queue.go | 24 + .../types/key_latest_finalized_state_index.go | 23 + .../types/key_latest_state_info_index.go | 23 + x/rollapp/types/key_rollapp.go | 38 + x/rollapp/types/key_state_info.go | 31 + x/{rollup => rollapp}/types/keys.go | 12 +- x/rollapp/types/params.go | 115 + x/rollapp/types/params.pb.go | 592 ++++ x/rollapp/types/query.pb.go | 3111 +++++++++++++++++ x/rollapp/types/query.pb.gw.go | 817 +++++ x/rollapp/types/rollapp.go | 81 + .../types/rollapp.pb.go} | 510 +-- x/rollapp/types/state_info.go | 47 + x/rollapp/types/state_info.pb.go | 1392 ++++++++ x/rollapp/types/token_metadata.go | 42 + x/rollapp/types/tx.pb.go | 1849 ++++++++++ x/rollup/client/cli/query.go | 1 - x/rollup/client/cli/tx.go | 1 - x/rollup/keeper/keeper.go | 50 - x/rollup/keeper/params.go | 33 - x/rollup/keeper/rollup.go | 56 - x/rollup/types/genesis.pb.go | 321 -- x/rollup/types/params.go | 32 - x/rollup/types/params.pb.go | 263 -- x/rollup/types/query.pb.go | 1079 ------ x/rollup/types/query.pb.gw.go | 319 -- x/rollup/types/rollup_keys.go | 34 - x/rollup/types/state.pb.go | 920 ----- x/rollup/types/tx.pb.go | 851 ----- 69 files changed, 11282 insertions(+), 4605 deletions(-) rename proto/nucleic/{rollup => rollapp}/bank.proto (83%) create mode 100644 proto/nucleic/rollapp/block_descriptor.proto create mode 100644 proto/nucleic/rollapp/genesis.proto create mode 100644 proto/nucleic/rollapp/params.proto create mode 100644 proto/nucleic/rollapp/query.proto create mode 100644 proto/nucleic/rollapp/rollapp.proto create mode 100644 proto/nucleic/rollapp/state_info.proto create mode 100644 proto/nucleic/rollapp/tx.proto delete mode 100644 proto/nucleic/rollup/block.proto delete mode 100644 proto/nucleic/rollup/genesis.proto delete mode 100644 proto/nucleic/rollup/params.proto delete mode 100644 proto/nucleic/rollup/query.proto delete mode 100644 proto/nucleic/rollup/rollup.proto delete mode 100644 proto/nucleic/rollup/state.proto delete mode 100644 proto/nucleic/rollup/tx.proto create mode 100644 utils/ibc.go create mode 100644 x/rollapp/client/cli/query.go create mode 100644 x/rollapp/client/cli/tx.go create mode 100644 x/rollapp/genesis.go create mode 100644 x/rollapp/keeper/block_height_to_finalization_queue.go create mode 100644 x/rollapp/keeper/grpc_query.go create mode 100644 x/rollapp/keeper/keeper.go create mode 100644 x/rollapp/keeper/latest_finalized_state_index.go create mode 100644 x/rollapp/keeper/latest_state_info_index.go rename x/{rollup => rollapp}/keeper/msg_server.go (54%) create mode 100644 x/rollapp/keeper/params.go create mode 100644 x/rollapp/keeper/rollapp.go create mode 100644 x/rollapp/keeper/state_info.go create mode 100644 x/rollapp/module.go rename x/{rollup => rollapp}/types/bank.pb.go (89%) rename x/{rollup/types/block.pb.go => rollapp/types/block_descriptor.pb.go} (66%) create mode 100644 x/rollapp/types/chain_id.go create mode 100644 x/rollapp/types/codec.go create mode 100644 x/rollapp/types/errors.go create mode 100644 x/rollapp/types/events.go create mode 100644 x/rollapp/types/expected_keepers.go create mode 100644 x/rollapp/types/genesis.go create mode 100644 x/rollapp/types/genesis.pb.go create mode 100644 x/rollapp/types/hooks.go create mode 100644 x/rollapp/types/key_block_height_to_finalization_queue.go create mode 100644 x/rollapp/types/key_latest_finalized_state_index.go create mode 100644 x/rollapp/types/key_latest_state_info_index.go create mode 100644 x/rollapp/types/key_rollapp.go create mode 100644 x/rollapp/types/key_state_info.go rename x/{rollup => rollapp}/types/keys.go (53%) create mode 100644 x/rollapp/types/params.go create mode 100644 x/rollapp/types/params.pb.go create mode 100644 x/rollapp/types/query.pb.go create mode 100644 x/rollapp/types/query.pb.gw.go create mode 100644 x/rollapp/types/rollapp.go rename x/{rollup/types/rollup.pb.go => rollapp/types/rollapp.pb.go} (62%) create mode 100644 x/rollapp/types/state_info.go create mode 100644 x/rollapp/types/state_info.pb.go create mode 100644 x/rollapp/types/token_metadata.go create mode 100644 x/rollapp/types/tx.pb.go delete mode 100644 x/rollup/client/cli/query.go delete mode 100644 x/rollup/client/cli/tx.go delete mode 100644 x/rollup/keeper/keeper.go delete mode 100644 x/rollup/keeper/params.go delete mode 100644 x/rollup/keeper/rollup.go delete mode 100644 x/rollup/types/genesis.pb.go delete mode 100644 x/rollup/types/params.go delete mode 100644 x/rollup/types/params.pb.go delete mode 100644 x/rollup/types/query.pb.go delete mode 100644 x/rollup/types/query.pb.gw.go delete mode 100644 x/rollup/types/rollup_keys.go delete mode 100644 x/rollup/types/state.pb.go delete mode 100644 x/rollup/types/tx.pb.go diff --git a/go.mod b/go.mod index 37868b7f..5ae43411 100644 --- a/go.mod +++ b/go.mod @@ -25,13 +25,14 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/grpc v1.62.1 - gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v2 v2.4.0 ) require ( cosmossdk.io/api v0.7.3 cosmossdk.io/client/v2 v2.0.0-beta.1 cosmossdk.io/core v0.12.0 + cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.3.1 cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.0.2 @@ -62,7 +63,6 @@ require ( cloud.google.com/go/storage v1.36.0 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect - cosmossdk.io/errors v1.0.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect diff --git a/proto/nucleic/rollup/bank.proto b/proto/nucleic/rollapp/bank.proto similarity index 83% rename from proto/nucleic/rollup/bank.proto rename to proto/nucleic/rollapp/bank.proto index 60f0818e..25cc741b 100644 --- a/proto/nucleic/rollup/bank.proto +++ b/proto/nucleic/rollapp/bank.proto @@ -1,11 +1,10 @@ syntax = "proto3"; -package nucleic.rollup; +package nucleic.rollapp; -option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; import "gogoproto/gogo.proto"; - // DenomUnit represents a struct that describes a given // denomination unit of the basic token. message DenomUnit { @@ -41,13 +40,14 @@ message TokenMetadata { // // Since: cosmos-sdk 0.43 string symbol = 6; - // URI to a document (on or off-chain) that contains additional information. Optional. + // URI to a document (on or off-chain) that contains additional information. + // Optional. // // Since: cosmos-sdk 0.46 - string uri = 7 [(gogoproto.customname) = "URI"]; - // URIHash is a sha256 hash of a document pointed by URI. It's used to verify that - // the document didn't change. Optional. + string uri = 7 [ (gogoproto.customname) = "URI" ]; + // URIHash is a sha256 hash of a document pointed by URI. It's used to verify + // that the document didn't change. Optional. // // Since: cosmos-sdk 0.46 - string uri_hash = 8 [(gogoproto.customname) = "URIHash"]; -} \ No newline at end of file + string uri_hash = 8 [ (gogoproto.customname) = "URIHash" ]; +} diff --git a/proto/nucleic/rollapp/block_descriptor.proto b/proto/nucleic/rollapp/block_descriptor.proto new file mode 100644 index 00000000..d896b33e --- /dev/null +++ b/proto/nucleic/rollapp/block_descriptor.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; + +// BlockDescriptor defines a single rollapp chain block description. +message BlockDescriptor { + // height is the height of the block + uint64 height = 1; + // stateRoot is a 32 byte array of the hash of the block (state root of the + // block) + bytes stateRoot = 2; +} + +// BlockDescriptors defines list of BlockDescriptor. +message BlockDescriptors { + repeated BlockDescriptor BD = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/nucleic/rollapp/genesis.proto b/proto/nucleic/rollapp/genesis.proto new file mode 100644 index 00000000..f0ce655b --- /dev/null +++ b/proto/nucleic/rollapp/genesis.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; +import "nucleic/rollapp/params.proto"; +import "nucleic/rollapp/rollapp.proto"; +import "nucleic/rollapp/state_info.proto"; + +// GenesisState defines the rollapp module's genesis state. +message GenesisState { + Params params = 1 [ (gogoproto.nullable) = false ]; + repeated Rollapp rollappList = 2 [ (gogoproto.nullable) = false ]; + repeated StateInfo stateInfoList = 3 [ (gogoproto.nullable) = false ]; + repeated StateInfoIndex latestStateInfoIndexList = 4 + [ (gogoproto.nullable) = false ]; + repeated StateInfoIndex latestFinalizedStateIndexList = 5 + [ (gogoproto.nullable) = false ]; + repeated BlockHeightToFinalizationQueue blockHeightToFinalizationQueueList = 6 + [ (gogoproto.nullable) = false ]; +} diff --git a/proto/nucleic/rollapp/params.proto b/proto/nucleic/rollapp/params.proto new file mode 100644 index 00000000..ec9ecd70 --- /dev/null +++ b/proto/nucleic/rollapp/params.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; + +message DeployerParams { + // address is a bech32-encoded address of the + // accounts that are allowed to create a rollapp. + string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; +} + +// Params defines the parameters for the module. +message Params { + option (gogoproto.goproto_stringer) = false; + + // dispute_period_in_blocks the number of blocks it takes + // to change a status of a state from received to finalized. + // during that period, any user could submit fraud proof + uint64 dispute_period_in_blocks = 1 + [ (gogoproto.moretags) = "yaml:\"dispute_period_in_blocks\"" ]; + + // deployer_whitelist is a list of the + // accounts that are allowed to create a rollapp and maximum number of + // rollapps. In the case of an empty list, there are no restrictions + repeated DeployerParams deployer_whitelist = 2 [ + (gogoproto.moretags) = "yaml:\"deployer_whitelist\"", + (gogoproto.nullable) = false + ]; + + bool rollapps_enabled = 3 + [ (gogoproto.moretags) = "yaml:\"rollapps_enabled\"" ]; +} diff --git a/proto/nucleic/rollapp/query.proto b/proto/nucleic/rollapp/query.proto new file mode 100644 index 00000000..e202b9e5 --- /dev/null +++ b/proto/nucleic/rollapp/query.proto @@ -0,0 +1,113 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "nucleic/rollapp/params.proto"; +import "nucleic/rollapp/rollapp.proto"; +import "nucleic/rollapp/state_info.proto"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/nucleic/rollapp/params"; + } + // Queries a Rollapp by index. + rpc Rollapp(QueryGetRollappRequest) returns (QueryGetRollappResponse) { + option (google.api.http).get = "/nucleic/rollapp/rollapp/{rollappId}"; + } + + // Queries a Rollapp by index. + rpc RollappByEIP155(QueryGetRollappByEIP155Request) + returns (QueryGetRollappResponse) { + option (google.api.http).get = "/nucleic/rollapp/eip155/{eip155}"; + } + + // Queries a list of Rollapp items. + rpc RollappAll(QueryAllRollappRequest) returns (QueryAllRollappResponse) { + option (google.api.http).get = "/nucleic/rollapp/rollapp"; + } + + // Queries a LatestHeight by rollapp-id. + rpc LatestHeight(QueryGetLatestHeightRequest) + returns (QueryGetLatestHeightResponse) { + option (google.api.http).get = "/nucleic/rollapp/latest_height/{rollappId}"; + } + + // Queries a LatestStateIndex by rollapp-id. + rpc LatestStateIndex(QueryGetLatestStateIndexRequest) + returns (QueryGetLatestStateIndexResponse) { + option (google.api.http).get = + "/nucleic/rollapp/latest_state_index/{rollappId}"; + } + + // Queries a StateInfo by index. + rpc StateInfo(QueryGetStateInfoRequest) returns (QueryGetStateInfoResponse) { + option (google.api.http).get = + "/nucleic/rollapp/state_info/{rollappId}/{index}"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryGetRollappRequest { string rollappId = 1; } + +message QueryGetRollappByEIP155Request { uint64 eip155 = 1; } + +message QueryGetLatestHeightRequest { + string rollappId = 1; + bool finalized = 2; +} + +message QueryGetLatestHeightResponse { uint64 height = 1; } + +message QueryGetLatestStateIndexRequest { + string rollappId = 1; + bool finalized = 2; +} + +message QueryGetLatestStateIndexResponse { + StateInfoIndex stateIndex = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryGetRollappResponse { + Rollapp rollapp = 1 [ (gogoproto.nullable) = false ]; + // Defines the index of the last rollapp UpdateState. + StateInfoIndex latestStateIndex = 2; + // Defines the index of the last rollapp UpdateState that was finalized. + StateInfoIndex latestFinalizedStateIndex = 3; + + uint64 latestHeight = 4; + uint64 latestFinalizedHeight = 5; +} + +message QueryAllRollappRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllRollappResponse { + repeated RollappSummary rollapp = 1 [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryGetStateInfoRequest { + string rollappId = 1; + uint64 index = 2; + uint64 height = 3; + bool finalized = 4; +} + +message QueryGetStateInfoResponse { + StateInfo stateInfo = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/nucleic/rollapp/rollapp.proto b/proto/nucleic/rollapp/rollapp.proto new file mode 100644 index 00000000..04e68097 --- /dev/null +++ b/proto/nucleic/rollapp/rollapp.proto @@ -0,0 +1,68 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "nucleic/rollapp/state_info.proto"; +import "nucleic/rollapp/bank.proto"; + +// GenesisAccount is a struct for the genesis account for the rollapp +message GenesisAccount { + // amount of coins to be sent to the genesis address + cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false ]; + // address is a bech-32 address of the genesis account + string address = 2; +} + +// RollappGenesisState is a partial repr of the state the hub can expect the +// rollapp to be in upon genesis +message RollappGenesisState { + // genesis_accounts is a list of token allocations + repeated GenesisAccount genesis_accounts = 1; + // is_genesis_event is a boolean that indicates if the genesis event has + // occured + bool is_genesis_event = 2; +} + +// Rollapp defines a rollapp object. First the RollApp is created and then +// sequencers can be created and attached. The RollApp is identified by +// rollappId +message Rollapp { + // The unique identifier of the rollapp chain. + // The rollappId follows the same standard as cosmos chain_id. + string rollappId = 1; + // creator is the bech32-encoded address of the rollapp creator. + string creator = 2; + // version is the software and configuration version. + // starts from 1 and increases by one on every MsgUpdateState + uint64 version = 3; + // maxSequencers is the maximum number of sequencers. + uint64 maxSequencers = 4; + // permissionedAddresses is a bech32-encoded address list of the sequencers + // that are allowed to serve this rollappId. In the case of an empty list, the + // rollapp is considered permissionless. + repeated string permissionedAddresses = 5; + // tokenMetadata is a list of TokenMetadata that are registered on this + // rollapp + repeated TokenMetadata tokenMetadata = 6; + // genesis_state is a partial repr of the state the hub can expect the rollapp + // to be in upon genesis + RollappGenesisState genesis_state = 7 [ (gogoproto.nullable) = false ]; + // channel_id will be set to the canonical IBC channel of the rollapp. + string channel_id = 8; + // frozen is a boolean that indicates if the rollapp is frozen. + bool frozen = 9; +} + +// Rollapp summary is a compact representation of Rollapp +message RollappSummary { + // The unique identifier of the rollapp chain. + // The rollappId follows the same standard as cosmos chain_id. + string rollappId = 1; + // Defines the index of the last rollapp UpdateState. + StateInfoIndex latestStateIndex = 2; + // Defines the index of the last rollapp UpdateState that was finalized. + StateInfoIndex latestFinalizedStateIndex = 3; +} diff --git a/proto/nucleic/rollapp/state_info.proto b/proto/nucleic/rollapp/state_info.proto new file mode 100644 index 00000000..60d1f26e --- /dev/null +++ b/proto/nucleic/rollapp/state_info.proto @@ -0,0 +1,78 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; +import "nucleic/rollapp/block_descriptor.proto"; + +// StateInfoIndex is the data used for indexing and retrieving a StateInfo +// it updated and saved with every UpdateState in StateInfo. +// We use the this structure also for: +// 1. LatestStateInfoIndex which defines the rollapps' current (latest) index of +// the last UpdateState +// 2. LatestFinalizedStateIndex which defines the rollapps' current (latest) +// index of the latest StateInfo that was finalized +message StateInfoIndex { + // rollappId is the rollapp that the sequencer belongs to and asking to update + // it used to identify the what rollapp a StateInfo belongs + // The rollappId follows the same standard as cosmos chain_id + string rollappId = 1; + // index is a sequential increasing number, updating on each + // state update used for indexing to a specific state info, the first index is + // 1 + uint64 index = 2; +} + +// StateInfo defines a rollapps' state. +message StateInfo { + // stateInfoIndex defines what rollapp the state belongs to + // and in which index it can be referenced + StateInfoIndex stateInfoIndex = 1 [ (gogoproto.nullable) = false ]; + // sequencer is the bech32-encoded address of the sequencer sent the update + string sequencer = 2; + // startHeight is the block height of the first block in the batch + uint64 startHeight = 3; + // numBlocks is the number of blocks included in this batch update + uint64 numBlocks = 4; + // DAPath is the description of the location on the DA layer + string DAPath = 5; + // version is the version of the rollapp + uint64 version = 6; + // creationHeight is the height at which the UpdateState took place + uint64 creationHeight = 7; + // status is the status of the state update + Status status = 8; + // BDs is a list of block description objects (one per block) + // the list must be ordered by height, starting from startHeight to + // startHeight+numBlocks-1 + BlockDescriptors BDs = 9 [ (gogoproto.nullable) = false ]; +} + +// StateInfoSummary is a compact representation of StateInfo +message StateInfoSummary { + // stateInfoIndex defines what rollapp the state belongs to + // and in which index it can be referenced + StateInfoIndex stateInfoIndex = 1 [ (gogoproto.nullable) = false ]; + // status is the status of the state update + Status status = 2; + // creationHeight is the height at which the UpdateState took place + uint64 creationHeight = 3; +} + +// BlockHeightToFinalizationQueue defines a map from block height to list of +// states to finalized +message BlockHeightToFinalizationQueue { + // creationHeight is the block height that the state should be finalized + uint64 creationHeight = 1; + // finalizationQueue is a list of states that are waiting to be finalized + // when the block height becomes creationHeight + repeated StateInfoIndex finalizationQueue = 2 + [ (gogoproto.nullable) = false ]; +} + +enum Status { + PENDING = 0; + FINALIZED = 1; + REVERTED = 3; +} diff --git a/proto/nucleic/rollapp/tx.proto b/proto/nucleic/rollapp/tx.proto new file mode 100644 index 00000000..df899602 --- /dev/null +++ b/proto/nucleic/rollapp/tx.proto @@ -0,0 +1,76 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; +import "nucleic/rollapp/block_descriptor.proto"; +import "nucleic/rollapp/bank.proto"; +import "nucleic/rollapp/rollapp.proto"; + +// Msg defines the Msg service. +service Msg { + rpc CreateRollapp(MsgCreateRollapp) returns (MsgCreateRollappResponse); + rpc UpdateState(MsgUpdateState) returns (MsgUpdateStateResponse); + rpc TriggerGenesisEvent(MsgRollappGenesisEvent) + returns (MsgRollappGenesisEventResponse); +} + +// MsgCreateRollapp creates a new rollapp chain on the hub. +message MsgCreateRollapp { + // creator is the bech32-encoded address of the rollapp creator + string creator = 1; + // rollappId is the unique identifier of the rollapp chain. + // The rollappId follows the same standard as cosmos chain_id + string rollappId = 2; // [(gogoproto.customname) = "ChainID"]; + // maxSequencers is the maximum number of sequencers + uint64 maxSequencers = 6; + // permissionedAddresses is a bech32-encoded address list of the + // sequencers that are allowed to serve this rollappId. + // In the case of an empty list, the rollapp is considered permissionless + repeated string permissionedAddresses = 7; + // metadata provides the client information for all the registered tokens. + repeated TokenMetadata metadatas = 8 [ (gogoproto.nullable) = false ]; + // genesis_accounts for the rollapp on the hub + repeated GenesisAccount genesis_accounts = 9 [ (gogoproto.nullable) = false ]; +} + +message MsgCreateRollappResponse {} + +// MsgUpdateState updates a rollapp state with a block batch. +// a block batch is a list of ordered blocks (by height) +message MsgUpdateState { + // creator is the bech32-encoded address of the sequencer sending the update + string creator = 1; + // rollappId is the rollapp that the sequencer belongs to and asking to update + // The rollappId follows the same standard as cosmos chain_id + string rollappId = 2; + // startHeight is the block height of the first block in the batch + uint64 startHeight = 3; + // numBlocks is the number of blocks included in this batch update + uint64 numBlocks = 4; + // DAPath is the description of the location on the DA layer + string DAPath = 5; + // version is the version of the rollapp + uint64 version = 6; + // BDs is a list of block description objects (one per block) + // the list must be ordered by height, starting from startHeight to + // startHeight+numBlocks-1 + BlockDescriptors BDs = 7 [ (gogoproto.nullable) = false ]; +} + +message MsgUpdateStateResponse {} + +// MsgRollappGenesisEvent is the message type for triggering the genesis event +// of the rollapp +message MsgRollappGenesisEvent { + // address is the bech32-encoded address of the sender + string address = 1; + // channel_id is the rollapp channel id on the hub + string channel_id = 2; + // rollapp_id is the rollapp id we want to mint tokens on the hub. + // Used for validation against channel_id to reduce error surface. + string rollapp_id = 3; +} + +message MsgRollappGenesisEventResponse {} diff --git a/proto/nucleic/rollup/block.proto b/proto/nucleic/rollup/block.proto deleted file mode 100644 index ed0bdda9..00000000 --- a/proto/nucleic/rollup/block.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; -package nucleic.rollup; - -option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; - -import "gogoproto/gogo.proto"; - -// BlockDescriptor defines a single rollup chain block description. -message BlockDescriptor { - // height is the height of the block - uint64 height = 1; - // stateRoot is a 32 byte array of the hash of the block (state root of the block) - bytes stateRoot = 2; - // intermediateStatesRoot is a 32 byte array representing - // the root of a Merkle tree built from the ISRs of the block (Intermediate State Roots) - bytes intermediateStatesRoot = 3; - } - - // BlockDescriptors defines list of BlockDescriptor. - message BlockDescriptors { - repeated BlockDescriptor BD = 1 [(gogoproto.nullable) = false]; - } \ No newline at end of file diff --git a/proto/nucleic/rollup/genesis.proto b/proto/nucleic/rollup/genesis.proto deleted file mode 100644 index 1184e938..00000000 --- a/proto/nucleic/rollup/genesis.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package nucleic.rollup; - -option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; - -import "gogoproto/gogo.proto"; -import "nucleic/rollup/params.proto"; - -// GenesisState defines the rollup module's genesis state. -message GenesisState { - Params params = 1 [ (gogoproto.nullable) = false ]; -} \ No newline at end of file diff --git a/proto/nucleic/rollup/params.proto b/proto/nucleic/rollup/params.proto deleted file mode 100644 index a3169295..00000000 --- a/proto/nucleic/rollup/params.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; -package nucleic.rollup; - -option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; - -// Params defines the parameters for the module. -message Params {} \ No newline at end of file diff --git a/proto/nucleic/rollup/query.proto b/proto/nucleic/rollup/query.proto deleted file mode 100644 index dde2cb2c..00000000 --- a/proto/nucleic/rollup/query.proto +++ /dev/null @@ -1,42 +0,0 @@ -syntax = "proto3"; -package nucleic.rollup; - -option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; - -import "google/api/annotations.proto"; - -service Query { - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/nucleicnetwork/nucleic/rollup/params"; - } - rpc Rollup(QueryRollupRequest) returns (QueryRollupResponse) { - option (google.api.http).get = "/nucleicnetwork/nucleic/rollup/{rollup_id}"; - } - rpc AllRollup(QueryAllRollupRequest) returns (QueryAllRollupResponse) { - option (google.api.http).get = "/nucleicnetwork/nucleic/rollup"; - } -} - -message QueryParamsRequest { - -} - -message QueryParamsResponse { - -} - -message QueryRollupRequest { - string rollup_id = 1; -} - -message QueryRollupResponse { - -} - -message QueryAllRollupRequest { - -} - -message QueryAllRollupResponse { - -} \ No newline at end of file diff --git a/proto/nucleic/rollup/rollup.proto b/proto/nucleic/rollup/rollup.proto deleted file mode 100644 index 20a5ab2d..00000000 --- a/proto/nucleic/rollup/rollup.proto +++ /dev/null @@ -1,63 +0,0 @@ -syntax = "proto3"; -package nucleic.rollup; - -option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; - -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "nucleic/rollup/state.proto"; -import "nucleic/rollup/bank.proto"; - -// GenesisAccount is a struct for the genesis account for the Rollup -message GenesisAccount { - // amount of coins to be sent to the genesis address - cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; - // address is a bech-32 address of the genesis account - string address = 2; -} - -// RollupGenesisState is a partial repr of the state the hub can expect the Rollup to be in upon genesis -message RollupGenesisState { - // genesis_accounts is a list of token allocations - repeated GenesisAccount genesis_accounts = 1; - // is_genesis_event is a boolean that indicates if the genesis event has occured - bool is_genesis_event = 2; -} - - -// Rollup defines a Rollup object. First the Rollup is created and then -// sequencers can be created and attached. The Rollup is identified by RollupId -message Rollup { - // The unique identifier of the Rollup chain. - // The RollupId follows the same standard as cosmos chain_id. - string rollup_id = 1; - // creator is the bech32-encoded address of the Rollup creator. - string creator = 2; - // version is the software and configuration version. - // starts from 1 and increases by one on every MsgUpdateState - uint64 version = 3; - // maxSequencers is the maximum number of sequencers. - uint64 maxSequencers = 4; - // permissionedAddresses is a bech32-encoded address list of the sequencers that are allowed to serve this RollupId. - // In the case of an empty list, the Rollup is considered permissionless. - repeated string permissionedAddresses = 5; - // tokenMetadata is a list of TokenMetadata that are registered on this Rollup - repeated TokenMetadata tokenMetadata = 6; - // genesis_state is a partial repr of the state the hub can expect the Rollup to be in upon genesis - RollupGenesisState genesis_state = 7 [(gogoproto.nullable) = false]; - // channel_id will be set to the canonical IBC channel of the Rollup. - string channel_id = 8; - // frozen is a boolean that indicates if the Rollup is frozen. - bool frozen = 9; -} - -// Rollup summary is a compact representation of Rollup -message RollupSummary { - // The unique identifier of the Rollup chain. - // The RollupId follows the same standard as cosmos chain_id. - string rollup_id = 1; - // Defines the index of the last Rollup UpdateState. - StateInfoIndex latestStateIndex = 2; - // Defines the index of the last Rollup UpdateState that was finalized. - StateInfoIndex latestFinalizedStateIndex = 3; -} \ No newline at end of file diff --git a/proto/nucleic/rollup/state.proto b/proto/nucleic/rollup/state.proto deleted file mode 100644 index 5682e82e..00000000 --- a/proto/nucleic/rollup/state.proto +++ /dev/null @@ -1,52 +0,0 @@ -syntax = "proto3"; -package nucleic.rollup; - -option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; - -import "gogoproto/gogo.proto"; -import "nucleic/rollup/block.proto"; - -// StateInfoIndex is the data used for indexing and retrieving a StateInfo -// it updated and saved with every UpdateState in StateInfo. -// We use the this structure also for: -// 1. LatestStateInfoIndex which defines the rollups' current (latest) index of the last UpdateState -// 2. LatestFinalizedStateIndex which defines the rollups' current (latest) index of the latest StateInfo that was finalized -message StateInfoIndex { - // rollupId is the rollup that the sequencer belongs to and asking to update - // it used to identify the what rollup a StateInfo belongs - // The rollupId follows the same standard as cosmos chain_id - string rollupId = 1; - // index is a sequential increasing number, updating on each - // state update used for indexing to a specific state info, the first index is 1 - uint64 index = 2; -} - -enum StateStatus { - PENDING = 0; - FINALIZED = 1; - REVERTED = 3; -} - -// StateInfo defines a state of the rollup. -message StateInfo { - // stateInfoIndex defines what rollup the state belongs to - // and in which index it can be referenced - StateInfoIndex stateInfoIndex = 1 [(gogoproto.nullable) = false]; - // sequencer is the bech32-encoded address of the sequencer sent the update - string sequencer = 2; - // startHeight is the block height of the first block in the batch - uint64 startHeight = 3; - // numBlocks is the number of blocks included in this batch update - uint64 numBlocks = 4; - // DAPath is the description of the location on the DA layer - string DAPath = 5; - // version is the version of the rollup - uint64 version = 6; - // creationHeight is the height at which the UpdateState took place - uint64 creationHeight = 7; - // status is the status of the state update - StateStatus status = 8; - // BDs is a list of block description objects (one per block) - // the list must be ordered by height, starting from startHeight to startHeight+numBlocks-1 - BlockDescriptors BDs = 9 [(gogoproto.nullable) = false]; -} diff --git a/proto/nucleic/rollup/tx.proto b/proto/nucleic/rollup/tx.proto deleted file mode 100644 index 9f4b3566..00000000 --- a/proto/nucleic/rollup/tx.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; -package nucleic.rollup; - -option go_package = "github.com/nucleic-network/nucleic/x/rollup/types"; - - -// Msg defines the Msg service -service Msg { - rpc CreateRollup(MsgCreateRollup) returns (MsgCreateRollupResponse); - rpc UpdateState(MsgUpdateState) returns (MsgUpdateStateResponse); -} - -// MsgCreateRollup creates a rollup app on the share sequencer chain -message MsgCreateRollup { - string creator = 1; - string rollup_id = 2; - -} -message MsgCreateRollupResponse { - -} - -message MsgUpdateState { - -} - -message MsgUpdateStateResponse { - -} \ No newline at end of file diff --git a/utils/ibc.go b/utils/ibc.go new file mode 100644 index 00000000..5a24b6ce --- /dev/null +++ b/utils/ibc.go @@ -0,0 +1,21 @@ +package utils + +import ( + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" +) + +const ( + ibcPort = "transfer" +) + +func GetForeignIBCDenom(channelId, denom string) string { + return GetForeignDenomTrace(channelId, denom).IBCDenom() +} + +func GetForeignDenomTrace(channelId, denom string) transfertypes.DenomTrace { + sourcePrefix := transfertypes.GetDenomPrefix(ibcPort, channelId) + // NOTE: sourcePrefix contains the trailing "/" + prefixedDenom := sourcePrefix + denom + // construct the denomination trace from the full raw denomination + return transfertypes.ParseDenomTrace(prefixedDenom) +} diff --git a/x/rollapp/client/cli/query.go b/x/rollapp/client/cli/query.go new file mode 100644 index 00000000..c892000c --- /dev/null +++ b/x/rollapp/client/cli/query.go @@ -0,0 +1,23 @@ +package cli + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/eve-network/eve/x/rollapp/types" + "github.com/spf13/cobra" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd(queryRoute string) *cobra.Command { + // Group markets queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + return cmd +} diff --git a/x/rollapp/client/cli/tx.go b/x/rollapp/client/cli/tx.go new file mode 100644 index 00000000..41cf8a6c --- /dev/null +++ b/x/rollapp/client/cli/tx.go @@ -0,0 +1,22 @@ +package cli + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/eve-network/eve/x/rollapp/types" + "github.com/spf13/cobra" +) + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + return cmd +} diff --git a/x/rollapp/genesis.go b/x/rollapp/genesis.go new file mode 100644 index 00000000..c6e7c1b6 --- /dev/null +++ b/x/rollapp/genesis.go @@ -0,0 +1,41 @@ +package rollapp + +import ( + "github.com/eve-network/eve/x/rollapp/keeper" + "github.com/eve-network/eve/x/rollapp/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// InitGenesis initializes the capability module's state from a provided genesis +// state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + k.SetParams(ctx, genState.Params) + // Validate all other genesis fields are empty + genesisFields := []int{ + len(genState.RollappList), + len(genState.StateInfoList), + len(genState.LatestStateInfoIndexList), + len(genState.LatestFinalizedStateIndexList), + len(genState.BlockHeightToFinalizationQueueList), + } + for _, fieldLength := range genesisFields { + if fieldLength != 0 { + panic("Only params can be initialized at genesis") + } + } +} + +// ExportGenesis returns the capability module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + genesis.RollappList = k.GetAllRollapps(ctx) + genesis.StateInfoList = k.GetAllStateInfo(ctx) + genesis.LatestStateInfoIndexList = k.GetAllLatestStateInfoIndex(ctx) + genesis.LatestFinalizedStateIndexList = k.GetAllLatestFinalizedStateIndex(ctx) + genesis.BlockHeightToFinalizationQueueList = k.GetAllBlockHeightToFinalizationQueue(ctx) + + return genesis +} diff --git a/x/rollapp/keeper/block_height_to_finalization_queue.go b/x/rollapp/keeper/block_height_to_finalization_queue.go new file mode 100644 index 00000000..4173ed8f --- /dev/null +++ b/x/rollapp/keeper/block_height_to_finalization_queue.go @@ -0,0 +1,125 @@ +package keeper + +import ( + "fmt" + + "github.com/eve-network/eve/x/rollapp/types" + + "cosmossdk.io/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// FinalizeQueue is called every block to finalize states when their dispute period over. +func (k Keeper) FinalizeQueue(ctx sdk.Context) error { + if uint64(ctx.BlockHeight()) < k.DisputePeriodInBlocks(ctx) { + return nil + } + // TODO: need implement this + return nil +} + +func (k Keeper) finalizePending(ctx sdk.Context, pendingFinalizationQueue []types.BlockHeightToFinalizationQueue) error { + // Iterate over all the pending finalization queue + for _, blockHeightToFinalizationQueue := range pendingFinalizationQueue { + // finalize pending states + for _, stateInfoIndex := range blockHeightToFinalizationQueue.FinalizationQueue { + stateInfo := k.MustGetStateInfo(ctx, stateInfoIndex.RollappId, stateInfoIndex.Index) + if stateInfo.Status != types.Status_PENDING { + panic(fmt.Sprintf("invariant broken: stateInfo is not in pending state: rollapp: %s: status: %s", stateInfoIndex.RollappId, stateInfo.Status)) + } + stateInfo.Finalize() + // update the status of the stateInfo + k.SetStateInfo(ctx, stateInfo) + // update the LatestStateInfoIndex of the rollapp + k.SetLatestFinalizedStateIndex(ctx, stateInfoIndex) + // call the after-update-state hook + keeperHooks := k.GetHooks() + err := keeperHooks.AfterStateFinalized(ctx, stateInfoIndex.RollappId, &stateInfo) + if err != nil { + return fmt.Errorf("after state finalized: %w", err) + } + + // emit event + ctx.EventManager().EmitEvent( + sdk.NewEvent(types.EventTypeStateUpdate, + stateInfo.GetEvents()..., + ), + ) + } + k.RemoveBlockHeightToFinalizationQueue(ctx, blockHeightToFinalizationQueue.CreationHeight) + } + return nil +} + +// SetBlockHeightToFinalizationQueue set a specific blockHeightToFinalizationQueue in the store from its index +func (k Keeper) SetBlockHeightToFinalizationQueue(ctx sdk.Context, blockHeightToFinalizationQueue types.BlockHeightToFinalizationQueue) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeightToFinalizationQueueKeyPrefix)) + b := k.cdc.MustMarshal(&blockHeightToFinalizationQueue) + store.Set(types.BlockHeightToFinalizationQueueKey( + blockHeightToFinalizationQueue.CreationHeight, + ), b) +} + +// GetBlockHeightToFinalizationQueue returns a blockHeightToFinalizationQueue from its index +func (k Keeper) GetBlockHeightToFinalizationQueue( + ctx sdk.Context, + creationHeight uint64, +) (val types.BlockHeightToFinalizationQueue, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeightToFinalizationQueueKeyPrefix)) + + b := store.Get(types.BlockHeightToFinalizationQueueKey( + creationHeight, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveBlockHeightToFinalizationQueue removes a blockHeightToFinalizationQueue from the store +func (k Keeper) RemoveBlockHeightToFinalizationQueue( + ctx sdk.Context, + creationHeight uint64, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeightToFinalizationQueueKeyPrefix)) + store.Delete(types.BlockHeightToFinalizationQueueKey( + creationHeight, + )) +} + +// GetAllFinalizationQueueUntilHeight returns all the blockHeightToFinalizationQueues with creation height equal or less to the input height +func (k Keeper) GetAllFinalizationQueueUntilHeight(ctx sdk.Context, height uint64) (list []types.BlockHeightToFinalizationQueue) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeightToFinalizationQueueKeyPrefix)) + iterator := store.Iterator(nil, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.BlockHeightToFinalizationQueue + k.cdc.MustUnmarshal(iterator.Value(), &val) + if height < val.CreationHeight { + break + } + list = append(list, val) + } + + return +} + +// GetAllBlockHeightToFinalizationQueue returns all blockHeightToFinalizationQueue +func (k Keeper) GetAllBlockHeightToFinalizationQueue(ctx sdk.Context) (list []types.BlockHeightToFinalizationQueue) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeightToFinalizationQueueKeyPrefix)) + iterator := store.Iterator(nil, nil) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.BlockHeightToFinalizationQueue + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/rollapp/keeper/grpc_query.go b/x/rollapp/keeper/grpc_query.go new file mode 100644 index 00000000..d6268983 --- /dev/null +++ b/x/rollapp/keeper/grpc_query.go @@ -0,0 +1,354 @@ +package keeper + +import ( + "context" + + "github.com/eve-network/eve/x/rollapp/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" +) + +var _ types.QueryServer = Keeper{} + +// LatestHeight implements types.QueryServer. +func (k Keeper) LatestHeight(c context.Context, req *types.QueryGetLatestHeightRequest) (*types.QueryGetLatestHeightResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + var val types.StateInfoIndex + var found bool + if req.Finalized { + val, found = k.GetLatestFinalizedStateIndex( + ctx, + req.RollappId, + ) + } else { + val, found = k.GetLatestStateInfoIndex( + ctx, + req.RollappId, + ) + } + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + state := k.MustGetStateInfo(ctx, req.RollappId, val.Index) + + return &types.QueryGetLatestHeightResponse{ + Height: state.GetLatestHeight(), + }, nil +} + +// LatestStateIndex implements types.QueryServer. +func (k Keeper) LatestStateIndex(c context.Context, req *types.QueryGetLatestStateIndexRequest) (*types.QueryGetLatestStateIndexResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + var val types.StateInfoIndex + var found bool + if req.Finalized { + val, found = k.GetLatestFinalizedStateIndex( + ctx, + req.RollappId, + ) + } else { + val, found = k.GetLatestStateInfoIndex( + ctx, + req.RollappId, + ) + } + + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetLatestStateIndexResponse{StateIndex: val}, nil +} + +// Params implements types.QueryServer. +func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} + +// Rollapp implements types.QueryServer. +func (k Keeper) Rollapp(c context.Context, req *types.QueryGetRollappRequest) (*types.QueryGetRollappResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetRollapp( + ctx, + req.RollappId, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + rollappResponse := &types.QueryGetRollappResponse{Rollapp: val} + latestStateInfoIndex, found := k.GetLatestStateInfoIndex(ctx, val.RollappId) + if found { + rollappResponse.LatestStateIndex = &latestStateInfoIndex + } + latestFinalizedStateInfoIndex, found := k.GetLatestFinalizedStateIndex(ctx, val.RollappId) + if found { + rollappResponse.LatestFinalizedStateIndex = &latestFinalizedStateInfoIndex + } + + return rollappResponse, nil +} + +// RollappAll implements types.QueryServer. +func (k Keeper) RollappAll(c context.Context, req *types.QueryAllRollappRequest) (*types.QueryAllRollappResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var rollapps []types.RollappSummary + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(k.storeKey) + rollappStore := prefix.NewStore(store, types.KeyPrefix(types.RollappKeyPrefix)) + + pageRes, err := query.Paginate(rollappStore, req.Pagination, func(key, value []byte) error { + var rollapp types.Rollapp + if err := k.cdc.Unmarshal(value, &rollapp); err != nil { + return err + } + rollappSummary := types.RollappSummary{ + RollappId: rollapp.RollappId, + } + latestStateInfoIndex, found := k.GetLatestStateInfoIndex(ctx, rollapp.RollappId) + if found { + rollappSummary.LatestStateIndex = &latestStateInfoIndex + } + latestFinalizedStateInfoIndex, found := k.GetLatestFinalizedStateIndex(ctx, rollapp.RollappId) + if found { + rollappSummary.LatestFinalizedStateIndex = &latestFinalizedStateInfoIndex + } + + rollapps = append(rollapps, rollappSummary) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllRollappResponse{Rollapp: rollapps, Pagination: pageRes}, nil +} + +// RollappByEIP155 implements types.QueryServer. +func (k Keeper) RollappByEIP155(c context.Context, req *types.QueryGetRollappByEIP155Request) (*types.QueryGetRollappResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetRollappByEIP155( + ctx, + req.Eip155, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + rollappResponse := &types.QueryGetRollappResponse{Rollapp: val} + latestStateInfoIndex, found := k.GetLatestStateInfoIndex(ctx, val.RollappId) + if found { + rollappResponse.LatestStateIndex = &latestStateInfoIndex + } + latestFinalizedStateInfoIndex, found := k.GetLatestFinalizedStateIndex(ctx, val.RollappId) + if found { + rollappResponse.LatestFinalizedStateIndex = &latestFinalizedStateInfoIndex + } + + return rollappResponse, nil +} + +// StateInfo implements types.QueryServer. +func (k Keeper) StateInfo(c context.Context, req *types.QueryGetStateInfoRequest) (*types.QueryGetStateInfoResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(c) + + if req.Height == 0 && req.Index == 0 { + if req.Finalized { + latestFinalizedStateIndex, found := k.GetLatestFinalizedStateIndex(ctx, req.RollappId) + if !found { + return nil, errorsmod.Wrapf(types.ErrNoFinalizedStateYetForRollapp, + "LatestFinalizedStateIndex wasn't found for rollappId=%s", req.RollappId) + } + req.Index = latestFinalizedStateIndex.Index + } else { + latestStateIndex, found := k.GetLatestStateInfoIndex(ctx, req.RollappId) + if !found { + if _, exists := k.GetRollapp(ctx, req.RollappId); !exists { + return nil, types.ErrRollappNotRegistered + } + return nil, status.Error(codes.NotFound, "not found") + } + req.Index = latestStateIndex.Index + } + } + + var stateInfo types.StateInfo + if req.Index != 0 { + val, found := k.GetStateInfo(ctx, req.RollappId, req.Index) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + stateInfo = val + } else if req.Height != 0 { + val, err := k.FindStateInfoByHeight(ctx, req.RollappId, req.Height) + if err != nil { + return nil, err + } + stateInfo = *val + } + + return &types.QueryGetStateInfoResponse{StateInfo: stateInfo}, nil +} + +func (k Keeper) FindStateInfoByHeight(ctx sdk.Context, rollappId string, height uint64) (*types.StateInfo, error) { + // check that height not zero + if height == 0 { + return nil, types.ErrInvalidHeight + } + + _, found := k.GetRollapp(ctx, rollappId) + if !found { + return nil, types.ErrUnknownRollappID + } + + stateInfoIndex, found := k.GetLatestStateInfoIndex(ctx, rollappId) + if !found { + return nil, errorsmod.Wrapf(types.ErrNotFound, + "LatestStateInfoIndex wasn't found for rollappId=%s", + rollappId) + } + // initial interval to search in + startInfoIndex := uint64(1) // see TODO bellow + endInfoIndex := stateInfoIndex.Index + + // get state info + LatestStateInfo, found := k.GetStateInfo(ctx, rollappId, endInfoIndex) + if !found { + return nil, errorsmod.Wrapf(types.ErrNotFound, + "StateInfo wasn't found for rollappId=%s, index=%d", + rollappId, endInfoIndex) + } + + // check that height exists + if height >= LatestStateInfo.StartHeight+LatestStateInfo.NumBlocks { + return nil, errorsmod.Wrapf(types.ErrStateNotExists, + "rollappId=%s, height=%d", + rollappId, height) + } + + // check if the height belongs to this batch + if height >= LatestStateInfo.StartHeight { + return &LatestStateInfo, nil + } + + maxNumberOfSteps := endInfoIndex - startInfoIndex + 1 + stepNum := uint64(0) + for ; stepNum < maxNumberOfSteps; stepNum += 1 { + // we know that endInfoIndex > startInfoIndex + // otherwise the height should have been found + if endInfoIndex <= startInfoIndex { + return nil, errorsmod.Wrapf(types.ErrLogic, + "endInfoIndex should be != than startInfoIndex rollappId=%s, startInfoIndex=%d, endInfoIndex=%d", + rollappId, startInfoIndex, endInfoIndex) + } + // 1. get state info + startStateInfo, found := k.GetStateInfo(ctx, rollappId, startInfoIndex) + if !found { + // TODO: + // if stateInfo is missing it won't be logic error if history deletion be implemented + // for that we will have to check the oldest we have + return nil, errorsmod.Wrapf(types.ErrNotFound, + "StateInfo wasn't found for rollappId=%s, index=%d", + rollappId, startInfoIndex) + } + endStateInfo, found := k.GetStateInfo(ctx, rollappId, endInfoIndex) + if !found { + return nil, errorsmod.Wrapf(types.ErrNotFound, + "StateInfo wasn't found for rollappId=%s, index=%d", + rollappId, endInfoIndex) + } + startHeight := startStateInfo.StartHeight + endHeight := endStateInfo.StartHeight + endStateInfo.NumBlocks - 1 + + // 2. check startStateInfo + if height >= startStateInfo.StartHeight && + (startStateInfo.StartHeight+startStateInfo.NumBlocks) > height { + return &startStateInfo, nil + } + + // 3. check endStateInfo + if height >= endStateInfo.StartHeight && + (endStateInfo.StartHeight+endStateInfo.NumBlocks) > height { + return &endStateInfo, nil + } + + // 4. calculate the average blocks per batch + avgBlocksPerBatch := (endHeight - startHeight + 1) / (endInfoIndex - startInfoIndex + 1) + if avgBlocksPerBatch == 0 { + return nil, errorsmod.Wrapf(types.ErrLogic, + "avgBlocksPerBatch is zero!!! rollappId=%s, endHeight=%d, startHeight=%d, endInfoIndex=%d, startInfoIndex=%d", + rollappId, endHeight, startHeight, endInfoIndex, startInfoIndex) + } + + // 5. load the candidate block batch + infoIndexStep := (height - startHeight) / avgBlocksPerBatch + if infoIndexStep == 0 { + infoIndexStep = 1 + } + candidateInfoIndex := startInfoIndex + infoIndexStep + if candidateInfoIndex > endInfoIndex { + // skip to the last, probably the steps to big + candidateInfoIndex = endInfoIndex + } + if candidateInfoIndex == endInfoIndex { + candidateInfoIndex = endInfoIndex - 1 + } + candidateStateInfo, found := k.GetStateInfo(ctx, rollappId, candidateInfoIndex) + if !found { + return nil, errorsmod.Wrapf(types.ErrNotFound, + "StateInfo wasn't found for rollappId=%s, index=%d", + rollappId, candidateInfoIndex) + } + + // 6. check the candidate + if candidateStateInfo.StartHeight > height { + endInfoIndex = candidateInfoIndex - 1 + } else { + if candidateStateInfo.StartHeight+candidateStateInfo.NumBlocks-1 < height { + startInfoIndex = candidateInfoIndex + 1 + } else { + return &candidateStateInfo, nil + } + } + } + + return nil, errorsmod.Wrapf(types.ErrLogic, + "More searching steps than indexes! rollappId=%s, stepNum=%d, maxNumberOfSteps=%d", + rollappId, stepNum, maxNumberOfSteps) +} diff --git a/x/rollapp/keeper/keeper.go b/x/rollapp/keeper/keeper.go new file mode 100644 index 00000000..9fe6b17f --- /dev/null +++ b/x/rollapp/keeper/keeper.go @@ -0,0 +1,183 @@ +package keeper + +import ( + "fmt" + + "github.com/eve-network/eve/utils" + "github.com/eve-network/eve/x/rollapp/types" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + hooks types.MultiRollappHooks + paramstore paramtypes.Subspace + + ibcclientKeeper types.IBCClientKeeper + transferKeeper types.TransferKeeper + channelKeeper types.ChannelKeeper + bankKeeper types.BankKeeper + denommetadataKeeper types.DenomMetadataKeeper + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string +} + +func NewKeeper( + cdc codec.BinaryCodec, + storeKey, + memKey storetypes.StoreKey, + ps paramtypes.Subspace, + ibcclientKeeper types.IBCClientKeeper, + transferKeeper types.TransferKeeper, + channelKeeper types.ChannelKeeper, + bankKeeper types.BankKeeper, + denommetadataKeeper types.DenomMetadataKeeper, + authority string, +) *Keeper { + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + paramstore: ps, + hooks: nil, + ibcclientKeeper: ibcclientKeeper, + transferKeeper: transferKeeper, + channelKeeper: channelKeeper, + bankKeeper: bankKeeper, + denommetadataKeeper: denommetadataKeeper, + authority: authority, + } +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k *Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} + +// TriggerRollappGenesisEvent triggers the genesis event for the rollapp. +func (k Keeper) TriggerRollappGenesisEvent(ctx sdk.Context, rollapp types.Rollapp) error { + // Validate it hasn't been triggered yet + if rollapp.GenesisState.IsGenesisEvent { + return types.ErrGenesisEventAlreadyTriggered + } + + if err := k.registerDenomMetadata(ctx, rollapp); err != nil { + return errorsmod.Wrapf(types.ErrRegisterDenomMetadataFailed, "register denom metadata: %s", err) + } + + if err := k.mintRollappGenesisTokens(ctx, rollapp); err != nil { + return errorsmod.Wrapf(types.ErrMintTokensFailed, "mint rollapp genesis tokens: %s", err) + } + + rollapp.GenesisState.IsGenesisEvent = true + k.SetRollapp(ctx, rollapp) + return nil +} + +// registerDenomMetadata registers the denom metadata for the IBC token +func (k Keeper) registerDenomMetadata(ctx sdk.Context, rollapp types.Rollapp) error { + for i := range rollapp.TokenMetadata { + denomTrace := utils.GetForeignDenomTrace(rollapp.ChannelId, rollapp.TokenMetadata[i].Base) + traceHash := denomTrace.Hash() + // if the denom trace does not exist, add it + if !k.transferKeeper.HasDenomTrace(ctx, traceHash) { + k.transferKeeper.SetDenomTrace(ctx, denomTrace) + } + + ibcBaseDenom := denomTrace.IBCDenom() + + // create a new token denom metadata where it's base = ibcDenom, + // and the rest of the fields are taken from rollapp.metadata + metadata := banktypes.Metadata{ + Description: "auto-generated metadata for " + ibcBaseDenom + " from rollapp " + rollapp.RollappId, + Base: ibcBaseDenom, + DenomUnits: make([]*banktypes.DenomUnit, len(rollapp.TokenMetadata[i].DenomUnits)), + Display: rollapp.TokenMetadata[i].Display, + Name: rollapp.TokenMetadata[i].Name, + Symbol: rollapp.TokenMetadata[i].Symbol, + URI: rollapp.TokenMetadata[i].URI, + URIHash: rollapp.TokenMetadata[i].URIHash, + } + // Copy DenomUnits slice + for j, du := range rollapp.TokenMetadata[i].DenomUnits { + newDu := banktypes.DenomUnit{ + Aliases: du.Aliases, + Denom: du.Denom, + Exponent: du.Exponent, + } + // base denom_unit should be the same as baseDenom + if newDu.Exponent == 0 { + newDu.Denom = ibcBaseDenom + newDu.Aliases = append(newDu.Aliases, du.Denom) + } + metadata.DenomUnits[j] = &newDu + } + + // validate metadata + if validity := metadata.Validate(); validity != nil { + return fmt.Errorf("invalid denom metadata on genesis event: %w", validity) + } + + // save the new token denom metadata + if err := k.denommetadataKeeper.CreateDenomMetadata(ctx, metadata); err != nil { + return fmt.Errorf("create denom metadata: %w", err) + } + + k.Logger(ctx).Info("registered denom metadata for IBC token", "rollappID", rollapp.RollappId, "denom", ibcBaseDenom) + } + return nil +} + +func (k Keeper) mintRollappGenesisTokens(ctx sdk.Context, rollapp types.Rollapp) error { + for _, acc := range rollapp.GenesisState.GenesisAccounts { + ibcBaseDenom := utils.GetForeignDenomTrace(rollapp.ChannelId, acc.Amount.Denom).IBCDenom() + coinsToMint := sdk.NewCoins(sdk.NewCoin(ibcBaseDenom, acc.Amount.Amount)) + + if err := k.bankKeeper.MintCoins(ctx, types.ModuleName, coinsToMint); err != nil { + return fmt.Errorf("mint coins: %w", err) + } + + accAddress, err := sdk.AccAddressFromBech32(acc.Address) + if err != nil { + return fmt.Errorf("convert account address: %w", err) + } + + if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, accAddress, coinsToMint); err != nil { + return fmt.Errorf("send coins to account: %w", err) + } + } + return nil +} + +/* -------------------------------------------------------------------------- */ +/* Hooks */ +/* -------------------------------------------------------------------------- */ + +// Set the rollapp hooks +func (k *Keeper) SetHooks(sh types.MultiRollappHooks) { + if k.hooks != nil { + panic("cannot set rollapp hooks twice") + } + k.hooks = sh +} + +func (k *Keeper) GetHooks() types.MultiRollappHooks { + return k.hooks +} diff --git a/x/rollapp/keeper/latest_finalized_state_index.go b/x/rollapp/keeper/latest_finalized_state_index.go new file mode 100644 index 00000000..8784f718 --- /dev/null +++ b/x/rollapp/keeper/latest_finalized_state_index.go @@ -0,0 +1,65 @@ +package keeper + +import ( + "github.com/eve-network/eve/x/rollapp/types" + + "cosmossdk.io/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// LatestFinalizedStateIndex defines the rollapps' current (latest) index of the latest StateInfo that was finalized + +// SetLatestFinalizedStateIndex set a specific latestFinalizedStateIndex in the store from its index +func (k Keeper) SetLatestFinalizedStateIndex(ctx sdk.Context, latestFinalizedStateIndex types.StateInfoIndex) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestFinalizedStateIndexKeyPrefix)) + b := k.cdc.MustMarshal(&latestFinalizedStateIndex) + store.Set(types.LatestFinalizedStateIndexKey( + latestFinalizedStateIndex.RollappId, + ), b) +} + +// GetLatestFinalizedStateIndex returns a latestFinalizedStateIndex from its index +func (k Keeper) GetLatestFinalizedStateIndex( + ctx sdk.Context, + rollappId string, +) (val types.StateInfoIndex, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestFinalizedStateIndexKeyPrefix)) + + b := store.Get(types.LatestFinalizedStateIndexKey( + rollappId, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveLatestFinalizedStateIndex removes a latestFinalizedStateIndex from the store +func (k Keeper) RemoveLatestFinalizedStateIndex( + ctx sdk.Context, + rollappId string, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestFinalizedStateIndexKeyPrefix)) + store.Delete(types.LatestFinalizedStateIndexKey( + rollappId, + )) +} + +// GetAllLatestFinalizedStateIndex returns all latestFinalizedStateIndex +func (k Keeper) GetAllLatestFinalizedStateIndex(ctx sdk.Context) (list []types.StateInfoIndex) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestFinalizedStateIndexKeyPrefix)) + iterator := store.Iterator(nil, nil) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.StateInfoIndex + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/rollapp/keeper/latest_state_info_index.go b/x/rollapp/keeper/latest_state_info_index.go new file mode 100644 index 00000000..1d5d7d8c --- /dev/null +++ b/x/rollapp/keeper/latest_state_info_index.go @@ -0,0 +1,65 @@ +package keeper + +import ( + "github.com/eve-network/eve/x/rollapp/types" + + "cosmossdk.io/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// LatestStateInfoIndex defines the rollapps' current (latest) index of the last UpdateState + +// SetLatestStateInfoIndex set a specific latestStateInfoIndex in the store from its index +func (k Keeper) SetLatestStateInfoIndex(ctx sdk.Context, latestStateInfoIndex types.StateInfoIndex) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestStateInfoIndexKeyPrefix)) + b := k.cdc.MustMarshal(&latestStateInfoIndex) + store.Set(types.LatestStateInfoIndexKey( + latestStateInfoIndex.RollappId, + ), b) +} + +// GetLatestStateInfoIndex returns a latestStateInfoIndex from its index +func (k Keeper) GetLatestStateInfoIndex( + ctx sdk.Context, + rollappId string, +) (val types.StateInfoIndex, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestStateInfoIndexKeyPrefix)) + + b := store.Get(types.LatestStateInfoIndexKey( + rollappId, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveLatestStateInfoIndex removes a latestStateInfoIndex from the store +func (k Keeper) RemoveLatestStateInfoIndex( + ctx sdk.Context, + rollappId string, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestStateInfoIndexKeyPrefix)) + store.Delete(types.LatestStateInfoIndexKey( + rollappId, + )) +} + +// GetAllLatestStateInfoIndex returns all latestStateInfoIndex +func (k Keeper) GetAllLatestStateInfoIndex(ctx sdk.Context) (list []types.StateInfoIndex) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestStateInfoIndexKeyPrefix)) + iterator := store.Iterator(nil, nil) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.StateInfoIndex + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/rollup/keeper/msg_server.go b/x/rollapp/keeper/msg_server.go similarity index 54% rename from x/rollup/keeper/msg_server.go rename to x/rollapp/keeper/msg_server.go index 29464179..3cee49b5 100644 --- a/x/rollup/keeper/msg_server.go +++ b/x/rollapp/keeper/msg_server.go @@ -3,15 +3,20 @@ package keeper import ( "context" - "github.com/eve-network/eve/x/rollup/types" + "github.com/eve-network/eve/x/rollapp/types" ) type msgServer struct { Keeper } -// CreateRollup implements types.MsgServer. -func (m msgServer) CreateRollup(context.Context, *types.MsgCreateRollup) (*types.MsgCreateRollupResponse, error) { +// CreateRollapp implements types.MsgServer. +func (m msgServer) CreateRollapp(context.Context, *types.MsgCreateRollapp) (*types.MsgCreateRollappResponse, error) { + panic("unimplemented") +} + +// TriggerGenesisEvent implements types.MsgServer. +func (m msgServer) TriggerGenesisEvent(context.Context, *types.MsgRollappGenesisEvent) (*types.MsgRollappGenesisEventResponse, error) { panic("unimplemented") } diff --git a/x/rollapp/keeper/params.go b/x/rollapp/keeper/params.go new file mode 100644 index 00000000..bc5eb178 --- /dev/null +++ b/x/rollapp/keeper/params.go @@ -0,0 +1,48 @@ +package keeper + +import ( + "github.com/eve-network/eve/x/rollapp/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + return types.NewParams( + k.RollappsEnabled(ctx), + k.DisputePeriodInBlocks(ctx), + k.DeployerWhitelist(ctx), + ) +} + +// SetParams set the params +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramstore.SetParamSet(ctx, ¶ms) +} + +// DisputePeriodInBlocks returns the DisputePeriodInBlocks param +func (k Keeper) DisputePeriodInBlocks(ctx sdk.Context) (res uint64) { + k.paramstore.Get(ctx, types.KeyDisputePeriodInBlocks, &res) + return +} + +// DeployerWhitelist returns the DeployerWhitelist param +func (k Keeper) DeployerWhitelist(ctx sdk.Context) (res []types.DeployerParams) { + k.paramstore.Get(ctx, types.KeyDeployerWhitelist, &res) + return +} + +func (k Keeper) RollappsEnabled(ctx sdk.Context) (res bool) { + k.paramstore.Get(ctx, types.KeyRollappsEnabled, &res) + return +} + +func (k Keeper) IsAddressInDeployerWhiteList(ctx sdk.Context, address string) bool { + whitelist := k.DeployerWhitelist(ctx) + for _, item := range whitelist { + if item.Address == address { + return true + } + } + return false +} diff --git a/x/rollapp/keeper/rollapp.go b/x/rollapp/keeper/rollapp.go new file mode 100644 index 00000000..1390dbc2 --- /dev/null +++ b/x/rollapp/keeper/rollapp.go @@ -0,0 +1,99 @@ +package keeper + +import ( + "github.com/eve-network/eve/x/rollapp/types" + + "cosmossdk.io/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// SetRollapp set a specific rollapp in the store from its index +func (k Keeper) SetRollapp(ctx sdk.Context, rollapp types.Rollapp) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappKeyPrefix)) + b := k.cdc.MustMarshal(&rollapp) + store.Set(types.RollappKey( + rollapp.RollappId, + ), b) + + // check if chain-id is EVM compatible. no err check as rollapp is already validated + rollappID, _ := types.NewChainID(rollapp.RollappId) + if !rollappID.IsEIP155() { + return + } + + // In case the chain id is EVM compatible, we store it by EIP155 id, to be retrievable by EIP155 id key + store = prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappByEIP155KeyPrefix)) + store.Set(types.RollappByEIP155Key( + rollappID.GetEIP155ID(), + ), b) +} + +// GetRollappByEIP155 returns a rollapp from its EIP155 id (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md) for EVM compatible rollapps +func (k Keeper) GetRollappByEIP155( + ctx sdk.Context, + eip155 uint64, +) (val types.Rollapp, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappByEIP155KeyPrefix)) + + b := store.Get(types.RollappByEIP155Key( + eip155, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// GetRollapp returns a rollapp from its chain name +func (k Keeper) GetRollapp( + ctx sdk.Context, + rollappId string, +) (val types.Rollapp, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappKeyPrefix)) + + b := store.Get(types.RollappKey( + rollappId, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveRollapp removes a rollapp from the store using rollapp name +func (k Keeper) RemoveRollapp( + ctx sdk.Context, + rollappId string, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappKeyPrefix)) + store.Delete(types.RollappKey( + rollappId, + )) +} + +// GetAllRollapp returns all rollapp +func (k Keeper) GetAllRollapps(ctx sdk.Context) (list []types.Rollapp) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappKeyPrefix)) + iterator := store.Iterator(nil, nil) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.Rollapp + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} + +// IsRollappStarted returns true if the rollapp is started +func (k Keeper) IsRollappStarted(ctx sdk.Context, rollappId string) bool { + _, found := k.GetLatestStateInfoIndex(ctx, rollappId) + return found +} diff --git a/x/rollapp/keeper/state_info.go b/x/rollapp/keeper/state_info.go new file mode 100644 index 00000000..105cc5b3 --- /dev/null +++ b/x/rollapp/keeper/state_info.go @@ -0,0 +1,78 @@ +package keeper + +import ( + "fmt" + + "github.com/eve-network/eve/x/rollapp/types" + + "cosmossdk.io/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// SetStateInfo set a specific stateInfo in the store from its index +func (k Keeper) SetStateInfo(ctx sdk.Context, stateInfo types.StateInfo) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateInfoKeyPrefix)) + b := k.cdc.MustMarshal(&stateInfo) + store.Set(types.StateInfoKey( + stateInfo.StateInfoIndex, + ), b) +} + +// GetStateInfo returns a stateInfo from its index +func (k Keeper) GetStateInfo( + ctx sdk.Context, + rollappId string, + index uint64, +) (val types.StateInfo, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateInfoKeyPrefix)) + + b := store.Get(types.StateInfoKey( + types.StateInfoIndex{RollappId: rollappId, Index: index}, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +func (k Keeper) MustGetStateInfo(ctx sdk.Context, + rollappId string, + index uint64, +) (val types.StateInfo) { + val, found := k.GetStateInfo(ctx, rollappId, index) + if !found { + panic(fmt.Sprintf("stateInfo not found for rollappId: %s, index: %d", rollappId, index)) + } + return +} + +// RemoveStateInfo removes a stateInfo from the store +func (k Keeper) RemoveStateInfo( + ctx sdk.Context, + rollappId string, + index uint64, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateInfoKeyPrefix)) + store.Delete(types.StateInfoKey( + types.StateInfoIndex{RollappId: rollappId, Index: index}, + )) +} + +// GetAllStateInfo returns all stateInfo +func (k Keeper) GetAllStateInfo(ctx sdk.Context) (list []types.StateInfo) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateInfoKeyPrefix)) + iterator := store.Iterator(nil, nil) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.StateInfo + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/rollapp/module.go b/x/rollapp/module.go new file mode 100644 index 00000000..becedf0e --- /dev/null +++ b/x/rollapp/module.go @@ -0,0 +1,156 @@ +package rollapp + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "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" + "github.com/eve-network/eve/x/rollapp/client/cli" + "github.com/eve-network/eve/x/rollapp/keeper" + "github.com/eve-network/eve/x/rollapp/types" +) + +var ( + _ module.AppModuleBasic = AppModuleBasic{} + _ module.HasGenesisBasics = AppModuleBasic{} + + _ appmodule.AppModule = AppModule{} + _ appmodule.HasEndBlocker = AppModule{} + _ module.HasConsensusVersion = AppModule{} + _ module.HasGenesis = AppModule{} + _ module.HasServices = AppModule{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the independent methodsa Cosmos SDK module +// needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs +// to/from []byte in order to persist them in the module's KVStore +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the 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 module. The subcommands of this root command are used by end-users +// to generate new transactions containing messages defined in the module +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by +// end-users to generate new queries to the subset of the state defined by the module +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd(types.StoreKey) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default +// GenesisState need to be defined by the module developer and is primarily used for testing +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config 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() +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + // TODO(CORE-380): Add dependent keepers (prices, fee-tiers) +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + } +} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// IsOnePerModuleType is a marker function just indicates that this is a one-per-module type. +func (am AppModule) IsOnePerModuleType() {} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each +// consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should +// be set to 1 +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// EndBlock contains the logic that is automatically triggered at the end of each block +func (am AppModule) EndBlock(ctx context.Context) error { + return nil +} diff --git a/x/rollup/types/bank.pb.go b/x/rollapp/types/bank.pb.go similarity index 89% rename from x/rollup/types/bank.pb.go rename to x/rollapp/types/bank.pb.go index 6c8b6ec3..87acfd4d 100644 --- a/x/rollup/types/bank.pb.go +++ b/x/rollapp/types/bank.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nucleic/rollup/bank.proto +// source: nucleic/rollapp/bank.proto package types @@ -42,7 +42,7 @@ func (m *DenomUnit) Reset() { *m = DenomUnit{} } func (m *DenomUnit) String() string { return proto.CompactTextString(m) } func (*DenomUnit) ProtoMessage() {} func (*DenomUnit) Descriptor() ([]byte, []int) { - return fileDescriptor_90294fe5762ef687, []int{0} + return fileDescriptor_4c717c0caac1e65d, []int{0} } func (m *DenomUnit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -127,7 +127,7 @@ func (m *TokenMetadata) Reset() { *m = TokenMetadata{} } func (m *TokenMetadata) String() string { return proto.CompactTextString(m) } func (*TokenMetadata) ProtoMessage() {} func (*TokenMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_90294fe5762ef687, []int{1} + return fileDescriptor_4c717c0caac1e65d, []int{1} } func (m *TokenMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -213,37 +213,37 @@ func (m *TokenMetadata) GetURIHash() string { } func init() { - proto.RegisterType((*DenomUnit)(nil), "nucleic.rollup.DenomUnit") - proto.RegisterType((*TokenMetadata)(nil), "nucleic.rollup.TokenMetadata") + proto.RegisterType((*DenomUnit)(nil), "nucleic.rollapp.DenomUnit") + proto.RegisterType((*TokenMetadata)(nil), "nucleic.rollapp.TokenMetadata") } -func init() { proto.RegisterFile("nucleic/rollup/bank.proto", fileDescriptor_90294fe5762ef687) } +func init() { proto.RegisterFile("nucleic/rollapp/bank.proto", fileDescriptor_4c717c0caac1e65d) } -var fileDescriptor_90294fe5762ef687 = []byte{ +var fileDescriptor_4c717c0caac1e65d = []byte{ // 369 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0x3f, 0x6f, 0xe2, 0x30, - 0x18, 0xc6, 0x09, 0x01, 0x02, 0x46, 0xdc, 0x60, 0xa1, 0x93, 0x61, 0x08, 0x11, 0xc3, 0x29, 0xcb, - 0x25, 0xba, 0xbb, 0xed, 0x46, 0xd4, 0xa1, 0xa8, 0xea, 0x62, 0x15, 0x55, 0xea, 0x82, 0x9c, 0xc4, - 0x22, 0x16, 0x89, 0x1d, 0xc5, 0x8e, 0x0a, 0x5f, 0xa1, 0x53, 0x3f, 0x56, 0x47, 0xc6, 0x4e, 0xa8, - 0x0a, 0x5f, 0xa4, 0x72, 0xfe, 0xa0, 0x76, 0x7b, 0x7e, 0xcf, 0xf3, 0xc8, 0x7e, 0x5f, 0xbd, 0x60, - 0xc6, 0x8b, 0x30, 0xa1, 0x2c, 0xf4, 0x73, 0x91, 0x24, 0x45, 0xe6, 0x07, 0x84, 0xef, 0xbd, 0x2c, - 0x17, 0x4a, 0xc0, 0x1f, 0x4d, 0xe4, 0xd5, 0xd1, 0x7c, 0xba, 0x13, 0x3b, 0x51, 0x45, 0xbe, 0x56, - 0x75, 0x6b, 0xf9, 0x08, 0x46, 0x37, 0x94, 0x8b, 0x74, 0xc3, 0x99, 0x82, 0x53, 0xd0, 0x8f, 0x34, - 0x20, 0xc3, 0x31, 0xdc, 0x11, 0xae, 0x01, 0xce, 0xc1, 0x90, 0x1e, 0x32, 0xc1, 0x29, 0x57, 0xa8, - 0xeb, 0x18, 0xee, 0x04, 0x5f, 0x19, 0x22, 0x60, 0x91, 0x84, 0x11, 0x49, 0x25, 0x32, 0x1d, 0xd3, - 0x1d, 0xe1, 0x16, 0x97, 0x2f, 0x5d, 0x30, 0x79, 0x10, 0x7b, 0xca, 0xef, 0xa9, 0x22, 0x11, 0x51, - 0x04, 0x3a, 0x60, 0x1c, 0x51, 0x19, 0xe6, 0x2c, 0x53, 0x4c, 0xf0, 0xe6, 0x8f, 0xaf, 0x16, 0xfc, - 0xaf, 0x1b, 0x5c, 0xa4, 0xdb, 0x82, 0x33, 0x25, 0x51, 0xd7, 0x31, 0xdd, 0xf1, 0xdf, 0x99, 0xf7, - 0x7d, 0x11, 0xef, 0x3a, 0x2f, 0x06, 0x51, 0x2b, 0x25, 0x84, 0xa0, 0x17, 0x10, 0x49, 0x91, 0x59, - 0x3d, 0x5b, 0x69, 0x3d, 0x5d, 0xc4, 0x64, 0x96, 0x90, 0x23, 0xea, 0x55, 0x76, 0x8b, 0xba, 0xcd, - 0x49, 0x4a, 0x51, 0xbf, 0x6e, 0x6b, 0x0d, 0x7f, 0x82, 0x81, 0x3c, 0xa6, 0x81, 0x48, 0xd0, 0xa0, - 0x72, 0x1b, 0x82, 0x33, 0x60, 0x16, 0x39, 0x43, 0x96, 0x36, 0x57, 0x56, 0x79, 0x5e, 0x98, 0x1b, - 0xbc, 0xc6, 0xda, 0x83, 0xbf, 0xc0, 0xb0, 0xc8, 0xd9, 0x36, 0x26, 0x32, 0x46, 0xc3, 0x2a, 0x1f, - 0x97, 0xe7, 0x85, 0xb5, 0xc1, 0xeb, 0x5b, 0x22, 0x63, 0x6c, 0x15, 0x39, 0xd3, 0x62, 0x75, 0xf7, - 0x56, 0xda, 0xc6, 0xa9, 0xb4, 0x8d, 0x8f, 0xd2, 0x36, 0x5e, 0x2f, 0x76, 0xe7, 0x74, 0xb1, 0x3b, - 0xef, 0x17, 0xbb, 0xf3, 0xf4, 0x67, 0xc7, 0x54, 0x5c, 0x04, 0x5e, 0x28, 0x52, 0xbf, 0xd9, 0xf3, - 0x37, 0xa7, 0xea, 0x59, 0xe4, 0xfb, 0x96, 0xfd, 0x43, 0x7b, 0x5d, 0x75, 0xcc, 0xa8, 0x0c, 0x06, - 0xd5, 0xe5, 0xfe, 0x7d, 0x06, 0x00, 0x00, 0xff, 0xff, 0x98, 0x1a, 0x3b, 0x32, 0xfc, 0x01, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xb1, 0x6a, 0xeb, 0x30, + 0x18, 0x85, 0xe3, 0x38, 0x89, 0x13, 0x85, 0x70, 0x41, 0x84, 0x8b, 0xae, 0x07, 0xc7, 0x64, 0xb8, + 0x78, 0xb9, 0x36, 0xe4, 0x8e, 0xdd, 0x42, 0x87, 0x06, 0xda, 0x45, 0x34, 0x14, 0xba, 0x04, 0xd9, + 0x16, 0xb1, 0x88, 0x2d, 0x19, 0x4b, 0xa6, 0xc9, 0x33, 0x74, 0xe9, 0x63, 0x75, 0xcc, 0xd8, 0x29, + 0x14, 0xe7, 0x45, 0x8a, 0x1c, 0x3b, 0x94, 0x6e, 0xe7, 0x3b, 0xe7, 0x20, 0xfd, 0x3f, 0x3f, 0xb0, + 0x79, 0x19, 0xa5, 0x94, 0x45, 0x41, 0x21, 0xd2, 0x94, 0xe4, 0x79, 0x10, 0x12, 0xbe, 0xf3, 0xf3, + 0x42, 0x28, 0x01, 0x7f, 0x35, 0x99, 0xdf, 0x64, 0xf6, 0x74, 0x2b, 0xb6, 0xa2, 0xce, 0x02, 0xad, + 0x2e, 0xb5, 0xf9, 0x13, 0x18, 0xdd, 0x52, 0x2e, 0xb2, 0x35, 0x67, 0x0a, 0x4e, 0x41, 0x3f, 0xd6, + 0x80, 0x0c, 0xd7, 0xf0, 0x46, 0xf8, 0x02, 0xd0, 0x06, 0x43, 0xba, 0xcf, 0x05, 0xa7, 0x5c, 0xa1, + 0xae, 0x6b, 0x78, 0x13, 0x7c, 0x65, 0x88, 0x80, 0x45, 0x52, 0x46, 0x24, 0x95, 0xc8, 0x74, 0x4d, + 0x6f, 0x84, 0x5b, 0x9c, 0xbf, 0x76, 0xc1, 0xe4, 0x51, 0xec, 0x28, 0x7f, 0xa0, 0x8a, 0xc4, 0x44, + 0x11, 0xe8, 0x82, 0x71, 0x4c, 0x65, 0x54, 0xb0, 0x5c, 0x31, 0xc1, 0x9b, 0x3f, 0xbe, 0x5b, 0xf0, + 0x46, 0x37, 0xb8, 0xc8, 0x36, 0x25, 0x67, 0x4a, 0xa2, 0xae, 0x6b, 0x7a, 0xe3, 0x85, 0xed, 0xff, + 0xd8, 0xc4, 0xbf, 0x0e, 0x8c, 0x41, 0xdc, 0x4a, 0x09, 0x21, 0xe8, 0x85, 0x44, 0x52, 0x64, 0xd6, + 0xef, 0xd6, 0x5a, 0x8f, 0x17, 0x33, 0x99, 0xa7, 0xe4, 0x80, 0x7a, 0xb5, 0xdd, 0xa2, 0x6e, 0x73, + 0x92, 0x51, 0xd4, 0xbf, 0xb4, 0xb5, 0x86, 0xbf, 0xc1, 0x40, 0x1e, 0xb2, 0x50, 0xa4, 0x68, 0x50, + 0xbb, 0x0d, 0xc1, 0x3f, 0xc0, 0x2c, 0x0b, 0x86, 0x2c, 0x6d, 0x2e, 0xad, 0xea, 0x34, 0x33, 0xd7, + 0x78, 0x85, 0xb5, 0x07, 0xff, 0x82, 0x61, 0x59, 0xb0, 0x4d, 0x42, 0x64, 0x82, 0x86, 0x75, 0x3e, + 0xae, 0x4e, 0x33, 0x6b, 0x8d, 0x57, 0x77, 0x44, 0x26, 0xd8, 0x2a, 0x0b, 0xa6, 0xc5, 0xf2, 0xfe, + 0xbd, 0x72, 0x8c, 0x63, 0xe5, 0x18, 0x9f, 0x95, 0x63, 0xbc, 0x9d, 0x9d, 0xce, 0xf1, 0xec, 0x74, + 0x3e, 0xce, 0x4e, 0xe7, 0x79, 0xb1, 0x65, 0x2a, 0x29, 0x43, 0x3f, 0x12, 0x59, 0xd0, 0x2c, 0xfa, + 0x8f, 0x53, 0xf5, 0x22, 0x8a, 0x5d, 0xcb, 0xc1, 0xfe, 0x7a, 0x60, 0x75, 0xc8, 0xa9, 0x0c, 0x07, + 0xf5, 0xed, 0xfe, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x46, 0x8f, 0xaf, 0xaf, 0x00, 0x02, 0x00, 0x00, } diff --git a/x/rollup/types/block.pb.go b/x/rollapp/types/block_descriptor.pb.go similarity index 66% rename from x/rollup/types/block.pb.go rename to x/rollapp/types/block_descriptor.pb.go index 95dc3a16..b32b4aed 100644 --- a/x/rollup/types/block.pb.go +++ b/x/rollapp/types/block_descriptor.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nucleic/rollup/block.proto +// source: nucleic/rollapp/block_descriptor.proto package types @@ -23,22 +23,19 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// BlockDescriptor defines a single rollup chain block description. +// BlockDescriptor defines a single rollapp chain block description. type BlockDescriptor struct { // height is the height of the block Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` // stateRoot is a 32 byte array of the hash of the block (state root of the block) StateRoot []byte `protobuf:"bytes,2,opt,name=stateRoot,proto3" json:"stateRoot,omitempty"` - // intermediateStatesRoot is a 32 byte array representing - // the root of a Merkle tree built from the ISRs of the block (Intermediate State Roots) - IntermediateStatesRoot []byte `protobuf:"bytes,3,opt,name=intermediateStatesRoot,proto3" json:"intermediateStatesRoot,omitempty"` } func (m *BlockDescriptor) Reset() { *m = BlockDescriptor{} } func (m *BlockDescriptor) String() string { return proto.CompactTextString(m) } func (*BlockDescriptor) ProtoMessage() {} func (*BlockDescriptor) Descriptor() ([]byte, []int) { - return fileDescriptor_fafc17eae1e5eff4, []int{0} + return fileDescriptor_fccbdab1f9ac4db2, []int{0} } func (m *BlockDescriptor) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -81,13 +78,6 @@ func (m *BlockDescriptor) GetStateRoot() []byte { return nil } -func (m *BlockDescriptor) GetIntermediateStatesRoot() []byte { - if m != nil { - return m.IntermediateStatesRoot - } - return nil -} - // BlockDescriptors defines list of BlockDescriptor. type BlockDescriptors struct { BD []BlockDescriptor `protobuf:"bytes,1,rep,name=BD,proto3" json:"BD"` @@ -97,7 +87,7 @@ func (m *BlockDescriptors) Reset() { *m = BlockDescriptors{} } func (m *BlockDescriptors) String() string { return proto.CompactTextString(m) } func (*BlockDescriptors) ProtoMessage() {} func (*BlockDescriptors) Descriptor() ([]byte, []int) { - return fileDescriptor_fafc17eae1e5eff4, []int{1} + return fileDescriptor_fccbdab1f9ac4db2, []int{1} } func (m *BlockDescriptors) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -134,31 +124,31 @@ func (m *BlockDescriptors) GetBD() []BlockDescriptor { } func init() { - proto.RegisterType((*BlockDescriptor)(nil), "nucleic.rollup.BlockDescriptor") - proto.RegisterType((*BlockDescriptors)(nil), "nucleic.rollup.BlockDescriptors") + proto.RegisterType((*BlockDescriptor)(nil), "nucleic.rollapp.BlockDescriptor") + proto.RegisterType((*BlockDescriptors)(nil), "nucleic.rollapp.BlockDescriptors") } -func init() { proto.RegisterFile("nucleic/rollup/block.proto", fileDescriptor_fafc17eae1e5eff4) } +func init() { + proto.RegisterFile("nucleic/rollapp/block_descriptor.proto", fileDescriptor_fccbdab1f9ac4db2) +} -var fileDescriptor_fafc17eae1e5eff4 = []byte{ - // 261 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xca, 0x2b, 0x4d, 0xce, - 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x29, 0x2d, 0xd0, 0x4f, 0xca, 0xc9, 0x4f, 0xce, - 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0xe9, 0x41, 0xe4, 0xa4, 0x44, 0xd2, - 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x52, 0x3d, 0x17, 0xbf, 0x13, 0x48, - 0x93, 0x4b, 0x6a, 0x71, 0x72, 0x51, 0x66, 0x41, 0x49, 0x7e, 0x91, 0x90, 0x18, 0x17, 0x5b, 0x46, - 0x6a, 0x66, 0x7a, 0x46, 0x89, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x4b, 0x10, 0x94, 0x27, 0x24, 0xc3, - 0xc5, 0x59, 0x5c, 0x92, 0x58, 0x92, 0x1a, 0x94, 0x9f, 0x5f, 0x22, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, - 0x13, 0x84, 0x10, 0x10, 0x32, 0xe3, 0x12, 0xcb, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4d, 0x4d, 0xc9, - 0x4c, 0x2c, 0x49, 0x0d, 0x06, 0x49, 0x14, 0x83, 0x95, 0x32, 0x83, 0x95, 0xe2, 0x90, 0x55, 0xf2, - 0xe4, 0x12, 0x40, 0x73, 0x40, 0xb1, 0x90, 0x29, 0x17, 0x93, 0x93, 0x8b, 0x04, 0xa3, 0x02, 0xb3, - 0x06, 0xb7, 0x91, 0xbc, 0x1e, 0xaa, 0x3f, 0xf4, 0xd0, 0x54, 0x3b, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, - 0x10, 0xc4, 0xe4, 0xe4, 0xe2, 0xe4, 0x7d, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, - 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, - 0x51, 0x86, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, 0xe3, 0x74, - 0xf3, 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0x61, 0x7c, 0xfd, 0x0a, 0x58, 0x20, 0x96, 0x54, 0x16, - 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xc3, 0xc7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xd5, 0xae, 0x65, - 0x87, 0x63, 0x01, 0x00, 0x00, +var fileDescriptor_fccbdab1f9ac4db2 = []byte{ + // 239 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcb, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0x4f, 0xca, 0xc9, 0x4f, + 0xce, 0x8e, 0x4f, 0x49, 0x2d, 0x4e, 0x2e, 0xca, 0x2c, 0x28, 0xc9, 0x2f, 0xd2, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0xe2, 0x87, 0xaa, 0xd3, 0x83, 0xaa, 0x93, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, + 0xcb, 0xe9, 0x83, 0x58, 0x10, 0x65, 0x4a, 0xee, 0x5c, 0xfc, 0x4e, 0x20, 0x03, 0x5c, 0xe0, 0xfa, + 0x85, 0xc4, 0xb8, 0xd8, 0x32, 0x52, 0x33, 0xd3, 0x33, 0x4a, 0x24, 0x18, 0x15, 0x18, 0x35, 0x58, + 0x82, 0xa0, 0x3c, 0x21, 0x19, 0x2e, 0xce, 0xe2, 0x92, 0xc4, 0x92, 0xd4, 0xa0, 0xfc, 0xfc, 0x12, + 0x09, 0x26, 0x05, 0x46, 0x0d, 0x9e, 0x20, 0x84, 0x80, 0x92, 0x17, 0x97, 0x00, 0x9a, 0x41, 0xc5, + 0x42, 0x66, 0x5c, 0x4c, 0x4e, 0x2e, 0x12, 0x8c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0x0a, 0x7a, 0x68, + 0x0e, 0xd2, 0x43, 0x53, 0xee, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x93, 0x93, 0x8b, 0x93, + 0xcf, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, + 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x19, 0xa5, 0x67, 0x96, 0x64, + 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0xcd, 0xd3, 0xcd, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, + 0xca, 0x86, 0xf1, 0xf5, 0x2b, 0xe0, 0x41, 0x53, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, + 0xa9, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x04, 0xbd, 0xa4, 0xe6, 0x3a, 0x01, 0x00, 0x00, } func (m *BlockDescriptor) Marshal() (dAtA []byte, err error) { @@ -181,22 +171,15 @@ func (m *BlockDescriptor) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.IntermediateStatesRoot) > 0 { - i -= len(m.IntermediateStatesRoot) - copy(dAtA[i:], m.IntermediateStatesRoot) - i = encodeVarintBlock(dAtA, i, uint64(len(m.IntermediateStatesRoot))) - i-- - dAtA[i] = 0x1a - } if len(m.StateRoot) > 0 { i -= len(m.StateRoot) copy(dAtA[i:], m.StateRoot) - i = encodeVarintBlock(dAtA, i, uint64(len(m.StateRoot))) + i = encodeVarintBlockDescriptor(dAtA, i, uint64(len(m.StateRoot))) i-- dAtA[i] = 0x12 } if m.Height != 0 { - i = encodeVarintBlock(dAtA, i, uint64(m.Height)) + i = encodeVarintBlockDescriptor(dAtA, i, uint64(m.Height)) i-- dAtA[i] = 0x8 } @@ -231,7 +214,7 @@ func (m *BlockDescriptors) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintBlock(dAtA, i, uint64(size)) + i = encodeVarintBlockDescriptor(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -240,8 +223,8 @@ func (m *BlockDescriptors) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintBlock(dAtA []byte, offset int, v uint64) int { - offset -= sovBlock(v) +func encodeVarintBlockDescriptor(dAtA []byte, offset int, v uint64) int { + offset -= sovBlockDescriptor(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -258,15 +241,11 @@ func (m *BlockDescriptor) Size() (n int) { var l int _ = l if m.Height != 0 { - n += 1 + sovBlock(uint64(m.Height)) + n += 1 + sovBlockDescriptor(uint64(m.Height)) } l = len(m.StateRoot) if l > 0 { - n += 1 + l + sovBlock(uint64(l)) - } - l = len(m.IntermediateStatesRoot) - if l > 0 { - n += 1 + l + sovBlock(uint64(l)) + n += 1 + l + sovBlockDescriptor(uint64(l)) } return n } @@ -280,17 +259,17 @@ func (m *BlockDescriptors) Size() (n int) { if len(m.BD) > 0 { for _, e := range m.BD { l = e.Size() - n += 1 + l + sovBlock(uint64(l)) + n += 1 + l + sovBlockDescriptor(uint64(l)) } } return n } -func sovBlock(x uint64) (n int) { +func sovBlockDescriptor(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } -func sozBlock(x uint64) (n int) { - return sovBlock(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozBlockDescriptor(x uint64) (n int) { + return sovBlockDescriptor(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *BlockDescriptor) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -300,7 +279,7 @@ func (m *BlockDescriptor) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowBlock + return ErrIntOverflowBlockDescriptor } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -328,7 +307,7 @@ func (m *BlockDescriptor) Unmarshal(dAtA []byte) error { m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowBlock + return ErrIntOverflowBlockDescriptor } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -347,7 +326,7 @@ func (m *BlockDescriptor) Unmarshal(dAtA []byte) error { var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowBlock + return ErrIntOverflowBlockDescriptor } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -360,11 +339,11 @@ func (m *BlockDescriptor) Unmarshal(dAtA []byte) error { } } if byteLen < 0 { - return ErrInvalidLengthBlock + return ErrInvalidLengthBlockDescriptor } postIndex := iNdEx + byteLen if postIndex < 0 { - return ErrInvalidLengthBlock + return ErrInvalidLengthBlockDescriptor } if postIndex > l { return io.ErrUnexpectedEOF @@ -374,48 +353,14 @@ func (m *BlockDescriptor) Unmarshal(dAtA []byte) error { m.StateRoot = []byte{} } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IntermediateStatesRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthBlock - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthBlock - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IntermediateStatesRoot = append(m.IntermediateStatesRoot[:0], dAtA[iNdEx:postIndex]...) - if m.IntermediateStatesRoot == nil { - m.IntermediateStatesRoot = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipBlock(dAtA[iNdEx:]) + skippy, err := skipBlockDescriptor(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBlock + return ErrInvalidLengthBlockDescriptor } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -437,7 +382,7 @@ func (m *BlockDescriptors) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowBlock + return ErrIntOverflowBlockDescriptor } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -465,7 +410,7 @@ func (m *BlockDescriptors) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowBlock + return ErrIntOverflowBlockDescriptor } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -478,11 +423,11 @@ func (m *BlockDescriptors) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthBlock + return ErrInvalidLengthBlockDescriptor } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthBlock + return ErrInvalidLengthBlockDescriptor } if postIndex > l { return io.ErrUnexpectedEOF @@ -494,12 +439,12 @@ func (m *BlockDescriptors) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipBlock(dAtA[iNdEx:]) + skippy, err := skipBlockDescriptor(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBlock + return ErrInvalidLengthBlockDescriptor } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -513,7 +458,7 @@ func (m *BlockDescriptors) Unmarshal(dAtA []byte) error { } return nil } -func skipBlock(dAtA []byte) (n int, err error) { +func skipBlockDescriptor(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 @@ -521,7 +466,7 @@ func skipBlock(dAtA []byte) (n int, err error) { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowBlock + return 0, ErrIntOverflowBlockDescriptor } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -538,7 +483,7 @@ func skipBlock(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowBlock + return 0, ErrIntOverflowBlockDescriptor } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -554,7 +499,7 @@ func skipBlock(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowBlock + return 0, ErrIntOverflowBlockDescriptor } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -567,14 +512,14 @@ func skipBlock(dAtA []byte) (n int, err error) { } } if length < 0 { - return 0, ErrInvalidLengthBlock + return 0, ErrInvalidLengthBlockDescriptor } iNdEx += length case 3: depth++ case 4: if depth == 0 { - return 0, ErrUnexpectedEndOfGroupBlock + return 0, ErrUnexpectedEndOfGroupBlockDescriptor } depth-- case 5: @@ -583,7 +528,7 @@ func skipBlock(dAtA []byte) (n int, err error) { return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { - return 0, ErrInvalidLengthBlock + return 0, ErrInvalidLengthBlockDescriptor } if depth == 0 { return iNdEx, nil @@ -593,7 +538,7 @@ func skipBlock(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthBlock = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowBlock = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupBlock = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthBlockDescriptor = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBlockDescriptor = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBlockDescriptor = fmt.Errorf("proto: unexpected end of group") ) diff --git a/x/rollapp/types/chain_id.go b/x/rollapp/types/chain_id.go new file mode 100644 index 00000000..803f71c7 --- /dev/null +++ b/x/rollapp/types/chain_id.go @@ -0,0 +1,121 @@ +package types + +import ( + "fmt" + "math/big" + "regexp" + "strconv" + "strings" + + errorsmod "cosmossdk.io/errors" +) + +var ( + regexChainID = `[a-z]{1,}` + regexEIP155Separator = `_{1}` + regexEIP155 = `[1-9][0-9]*` + regexEpochSeparator = `-{1}` + regexEpoch = `[1-9][0-9]*` + ethermintChainID = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)%s(%s)$`, + regexChainID, + regexEIP155Separator, + regexEIP155, + regexEpochSeparator, + regexEpoch)) +) + +type ChainID struct { + chainID string + name string + eip155ID *big.Int + revision uint64 +} + +func NewChainID(id string) (ChainID, error) { + chainID := strings.TrimSpace(id) + + if chainID == "" { + return ChainID{}, errorsmod.Wrapf(ErrInvalidRollappID, "empty") + } + + if len(chainID) > 48 { + return ChainID{}, errorsmod.Wrapf(ErrInvalidRollappID, "exceeds 48 chars: %s: len: %d", chainID, len(chainID)) + } + + eip155, err := getEIP155ID(chainID) + if err != nil { + return ChainID{}, err + } + revision, err := getRevisionNumber(chainID) + if err != nil { + return ChainID{}, err + } + matches := strings.Split(chainID, "-") + + if matches[0] == "" { + return ChainID{}, errorsmod.Wrapf(ErrInvalidRollappID, "empty chain id before '-'") + } + + return ChainID{ + chainID: chainID, + eip155ID: eip155, + revision: revision, + name: matches[0], + }, nil +} + +// getEIP155ID parses a string chain identifier's epoch to an Ethereum-compatible +// chain-id in *big.Int format. The function returns an error if the chain-id has an invalid format +func getEIP155ID(chainID string) (*big.Int, error) { + matches := ethermintChainID.FindStringSubmatch(chainID) + + if matches == nil || len(matches) != 4 || matches[1] == "" { + return nil, nil + } + // verify that the chain-id entered is a base 10 integer + chainIDInt, ok := new(big.Int).SetString(matches[2], 10) + if !ok { + return nil, errorsmod.Wrapf(ErrInvalidRollappID, "epoch %s must be base-10 integer format", matches[2]) + } + + return chainIDInt, nil +} + +// getEIP155ID parses a string chain identifier and returns the revision number +func getRevisionNumber(chainID string) (uint64, error) { + matches := strings.Split(chainID, "-") + if len(matches) == 1 { + return 0, nil + } + if len(matches) != 2 { + return 0, errorsmod.Wrapf(ErrInvalidRollappID, "unable to parse revision number") + } + revision, err := strconv.ParseUint(matches[1], 0, 64) + if err != nil { + return 0, errorsmod.Wrapf(ErrInvalidRollappID, "unable to parse revision number: error: %v", err) + } + return revision, nil +} + +func (c *ChainID) IsEIP155() bool { + return c.eip155ID != nil +} + +func (c *ChainID) GetChainID() string { + return c.chainID +} + +func (c *ChainID) GetName() string { + return c.name +} + +func (c *ChainID) GetEIP155ID() uint64 { + if c.eip155ID != nil { + return c.eip155ID.Uint64() + } + return 0 +} + +func (c *ChainID) GetRevisionNumber() uint64 { + return c.revision +} diff --git a/x/rollapp/types/codec.go b/x/rollapp/types/codec.go new file mode 100644 index 00000000..e7dd5575 --- /dev/null +++ b/x/rollapp/types/codec.go @@ -0,0 +1,24 @@ +package types + +import ( + "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/msgservice" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgCreateRollapp{}, "rollapp/CreateRollapp", nil) + cdc.RegisterConcrete(&MsgUpdateState{}, "rollapp/UpdateState", nil) + cdc.RegisterConcrete(&MsgRollappGenesisEvent{}, "rollapp/RollappGenesisEvent", nil) +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateRollapp{}, &MsgUpdateState{}, &MsgRollappGenesisEvent{}) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) diff --git a/x/rollapp/types/errors.go b/x/rollapp/types/errors.go new file mode 100644 index 00000000..2f7eb4bb --- /dev/null +++ b/x/rollapp/types/errors.go @@ -0,0 +1,57 @@ +package types + +// DONTCOVER + +import ( + errorsmod "cosmossdk.io/errors" +) + +// x/rollapp module sentinel errors +var ( + ErrRollappExists = errorsmod.Register(ModuleName, 1000, "rollapp already exists for this rollapp-id; must use new rollapp-id") + ErrInvalidMaxSequencers = errorsmod.Register(ModuleName, 1001, "invalid max sequencers") + ErrInvalidCreatorAddress = errorsmod.Register(ModuleName, 1002, "invalid creator address") + ErrInvalidPermissionedAddress = errorsmod.Register(ModuleName, 1003, "invalid permissioned address") + ErrPermissionedAddressesDuplicate = errorsmod.Register(ModuleName, 1004, "permissioned-address has duplicates") + ErrInvalidNumBlocks = errorsmod.Register(ModuleName, 1005, "invalid number of blocks") + ErrInvalidBlockSequence = errorsmod.Register(ModuleName, 1006, "invalid block sequence") + ErrUnknownRollappID = errorsmod.Register(ModuleName, 1007, "rollapp does not exist") + ErrVersionMismatch = errorsmod.Register(ModuleName, 1008, "rollapp version mismatch") + ErrWrongBlockHeight = errorsmod.Register(ModuleName, 1009, "start-height does not match rollapps state") + ErrMultiUpdateStateInBlock = errorsmod.Register(ModuleName, 1010, "only one state update can take place per block") + ErrInvalidStateRoot = errorsmod.Register(ModuleName, 1011, "invalid blocks state root") + ErrUnauthorizedRollappCreator = errorsmod.Register(ModuleName, 1013, "rollapp creator not registered in the whitelist") + ErrInvalidClientType = errorsmod.Register(ModuleName, 1014, "client type of the rollapp isn't dymint") + ErrHeightStateNotFinalized = errorsmod.Register(ModuleName, 1015, "rollapp block on this height was not finalized yet") + ErrInvalidAppHash = errorsmod.Register(ModuleName, 1016, "the app hash is different from the finalized state root") + ErrStateNotExists = errorsmod.Register(ModuleName, 1017, "state of this height doesn't exist") + ErrInvalidHeight = errorsmod.Register(ModuleName, 1018, "invalid rollapp height") + ErrRollappCreatorExceedMaximumRollapps = errorsmod.Register(ModuleName, 1019, "rollapp creator exceeds maximum allowed rollapps as registered in the whitelist") + ErrInvalidRollappID = errorsmod.Register(ModuleName, 1020, "invalid rollapp-id") + ErrEIP155Exists = errorsmod.Register(ModuleName, 1021, "EIP155 already exists; must use unique EIP155 identifier") + ErrRollappsDisabled = errorsmod.Register(ModuleName, 1022, "rollapps are disabled") + ErrInvalidTokenMetadata = errorsmod.Register(ModuleName, 1023, "invalid token metadata") + ErrNoFinalizedStateYetForRollapp = errorsmod.Register(ModuleName, 1024, "no finalized state yet for rollapp") + ErrInvalidClientState = errorsmod.Register(ModuleName, 1025, "invalid client state") + ErrInvalidSequencer = errorsmod.Register(ModuleName, 1026, "invalid sequencer") + ErrInvalidGenesisChannelId = errorsmod.Register(ModuleName, 1027, "invalid genesis channel id") + ErrGenesisEventNotTriggered = errorsmod.Register(ModuleName, 1028, "genesis event not triggered yet") + ErrGenesisEventAlreadyTriggered = errorsmod.Register(ModuleName, 1029, "genesis event already triggered") + ErrTooManyPermissionedAddresses = errorsmod.Register(ModuleName, 1030, "invalid number of permissioned addresses") + ErrInvalidGenesisAccount = errorsmod.Register(ModuleName, 1031, "invalid genesis account") + ErrMintTokensFailed = errorsmod.Register(ModuleName, 1032, "failed to mint tokens") + ErrRegisterDenomMetadataFailed = errorsmod.Register(ModuleName, 1033, "failed to register denom metadata") + ErrMismatchedChannelID = errorsmod.Register(ModuleName, 1034, "mismatched channel id") + ErrRollappNotRegistered = errorsmod.Register(ModuleName, 1035, "rollapp not registered") + ErrUnknownRequest = errorsmod.Register(ModuleName, 1036, "unknown request") + ErrNotFound = errorsmod.Register(ModuleName, 1037, "not found") + ErrLogic = errorsmod.Register(ModuleName, 1038, "internal logic error") + ErrUnauthorized = errorsmod.Register(ModuleName, 1039, "unauthorized") + ErrInvalidAddress = errorsmod.Register(ModuleName, 1040, "invalid address") + + /* ------------------------------ fraud related ----------------------------- */ + ErrDisputeAlreadyFinalized = errorsmod.Register(ModuleName, 2000, "disputed height already finalized") + ErrDisputeAlreadyReverted = errorsmod.Register(ModuleName, 2001, "disputed height already reverted") + ErrWrongClientId = errorsmod.Register(ModuleName, 2002, "client id does not match the rollapp") + ErrWrongProposerAddr = errorsmod.Register(ModuleName, 2003, "wrong proposer address") +) diff --git a/x/rollapp/types/events.go b/x/rollapp/types/events.go new file mode 100644 index 00000000..303f4cc3 --- /dev/null +++ b/x/rollapp/types/events.go @@ -0,0 +1,13 @@ +package types + +const ( + EventTypeStateUpdate = "state_update" + EventTypeStatusChange = "status_change" + + AttributeKeyRollappId = "rollapp_id" + AttributeKeyStateInfoIndex = "state_info_index" + AttributeKeyStartHeight = "start_height" + AttributeKeyNumBlocks = "num_blocks" + AttributeKeyDAPath = "da_path" + AttributeKeyStatus = "status" +) diff --git a/x/rollapp/types/expected_keepers.go b/x/rollapp/types/expected_keepers.go new file mode 100644 index 00000000..1b2735c1 --- /dev/null +++ b/x/rollapp/types/expected_keepers.go @@ -0,0 +1,42 @@ +package types + +import ( + cmbytes "github.com/cometbft/cometbft/libs/bytes" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +// AccountKeeper defines the expected account keeper used for simulations (noalias) +type AccountKeeper interface { + GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error +} + +type IBCClientKeeper interface { + GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool) + SetClientState(ctx sdk.Context, clientID string, clientState exported.ClientState) +} + +type TransferKeeper interface { + HasDenomTrace(ctx sdk.Context, denomTraceHash cmbytes.HexBytes) bool + SetDenomTrace(ctx sdk.Context, denomTrace transfertypes.DenomTrace) +} + +type ChannelKeeper interface { + GetChannelClientState(ctx sdk.Context, portID, channelID string) (string, exported.ClientState, error) +} + +type DenomMetadataKeeper interface { + CreateDenomMetadata(ctx sdk.Context, metadata banktypes.Metadata) error +} diff --git a/x/rollapp/types/genesis.go b/x/rollapp/types/genesis.go new file mode 100644 index 00000000..fc92a78f --- /dev/null +++ b/x/rollapp/types/genesis.go @@ -0,0 +1,79 @@ +package types + +import ( + "errors" +) + +// DefaultIndex is the default capability global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default Capability genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + RollappList: []Rollapp{}, + StateInfoList: []StateInfo{}, + LatestStateInfoIndexList: []StateInfoIndex{}, + LatestFinalizedStateIndexList: []StateInfoIndex{}, + BlockHeightToFinalizationQueueList: []BlockHeightToFinalizationQueue{}, + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // Check for duplicated index in rollapp + rollappIndexMap := make(map[string]struct{}) + + for _, elem := range gs.RollappList { + index := string(RollappKey(elem.RollappId)) + if _, ok := rollappIndexMap[index]; ok { + return errors.New("duplicated index for rollapp") + } + rollappIndexMap[index] = struct{}{} + } + // Check for duplicated index in stateInfo + stateInfoIndexMap := make(map[string]struct{}) + + for _, elem := range gs.StateInfoList { + index := string(StateInfoKey(elem.StateInfoIndex)) + if _, ok := stateInfoIndexMap[index]; ok { + return errors.New("duplicated index for stateInfo") + } + stateInfoIndexMap[index] = struct{}{} + } + // Check for duplicated index in latestStateInfoIndex + latestStateInfoIndexIndexMap := make(map[string]struct{}) + + for _, elem := range gs.LatestStateInfoIndexList { + index := string(LatestStateInfoIndexKey(elem.RollappId)) + if _, ok := latestStateInfoIndexIndexMap[index]; ok { + return errors.New("duplicated index for latestStateInfoIndex") + } + latestStateInfoIndexIndexMap[index] = struct{}{} + } + // Check for duplicated index in latestFinalizedStateIndex + latestFinalizedStateIndexIndexMap := make(map[string]struct{}) + + for _, elem := range gs.LatestFinalizedStateIndexList { + index := string(LatestFinalizedStateIndexKey(elem.RollappId)) + if _, ok := latestFinalizedStateIndexIndexMap[index]; ok { + return errors.New("duplicated index for latestFinalizedStateIndex") + } + latestFinalizedStateIndexIndexMap[index] = struct{}{} + } + // Check for duplicated index in blockHeightToFinalizationQueue + blockHeightToFinalizationQueueIndexMap := make(map[string]struct{}) + + for _, elem := range gs.BlockHeightToFinalizationQueueList { + index := string(BlockHeightToFinalizationQueueKey(elem.CreationHeight)) + if _, ok := blockHeightToFinalizationQueueIndexMap[index]; ok { + return errors.New("duplicated index for blockHeightToFinalizationQueue") + } + blockHeightToFinalizationQueueIndexMap[index] = struct{}{} + } + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/rollapp/types/genesis.pb.go b/x/rollapp/types/genesis.pb.go new file mode 100644 index 00000000..f98860fc --- /dev/null +++ b/x/rollapp/types/genesis.pb.go @@ -0,0 +1,641 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/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 rollapp module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + RollappList []Rollapp `protobuf:"bytes,2,rep,name=rollappList,proto3" json:"rollappList"` + StateInfoList []StateInfo `protobuf:"bytes,3,rep,name=stateInfoList,proto3" json:"stateInfoList"` + LatestStateInfoIndexList []StateInfoIndex `protobuf:"bytes,4,rep,name=latestStateInfoIndexList,proto3" json:"latestStateInfoIndexList"` + LatestFinalizedStateIndexList []StateInfoIndex `protobuf:"bytes,5,rep,name=latestFinalizedStateIndexList,proto3" json:"latestFinalizedStateIndexList"` + BlockHeightToFinalizationQueueList []BlockHeightToFinalizationQueue `protobuf:"bytes,6,rep,name=blockHeightToFinalizationQueueList,proto3" json:"blockHeightToFinalizationQueueList"` +} + +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_165a9e3e67ef0cbd, []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) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetRollappList() []Rollapp { + if m != nil { + return m.RollappList + } + return nil +} + +func (m *GenesisState) GetStateInfoList() []StateInfo { + if m != nil { + return m.StateInfoList + } + return nil +} + +func (m *GenesisState) GetLatestStateInfoIndexList() []StateInfoIndex { + if m != nil { + return m.LatestStateInfoIndexList + } + return nil +} + +func (m *GenesisState) GetLatestFinalizedStateIndexList() []StateInfoIndex { + if m != nil { + return m.LatestFinalizedStateIndexList + } + return nil +} + +func (m *GenesisState) GetBlockHeightToFinalizationQueueList() []BlockHeightToFinalizationQueue { + if m != nil { + return m.BlockHeightToFinalizationQueueList + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "nucleic.rollapp.GenesisState") +} + +func init() { proto.RegisterFile("nucleic/rollapp/genesis.proto", fileDescriptor_165a9e3e67ef0cbd) } + +var fileDescriptor_165a9e3e67ef0cbd = []byte{ + // 364 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x31, 0x4f, 0xf2, 0x40, + 0x18, 0xc7, 0xdb, 0x17, 0x5e, 0x86, 0x43, 0x63, 0x72, 0x31, 0xb1, 0x69, 0xa4, 0x10, 0x26, 0x16, + 0xdb, 0x04, 0xe3, 0x6e, 0x18, 0x50, 0x12, 0x06, 0x05, 0x27, 0x17, 0x73, 0x94, 0xa3, 0x5c, 0x28, + 0x77, 0x4d, 0xef, 0x1a, 0xd1, 0xdd, 0xdd, 0x6f, 0xe1, 0x57, 0x61, 0x64, 0x74, 0x32, 0x06, 0xbe, + 0x88, 0xe1, 0xfa, 0x40, 0xb4, 0x0d, 0x44, 0xa7, 0x6b, 0xf3, 0xff, 0x3f, 0xbf, 0xdf, 0x33, 0x3c, + 0xa8, 0xc2, 0x13, 0x3f, 0xa4, 0xcc, 0xf7, 0x62, 0x11, 0x86, 0x24, 0x8a, 0xbc, 0x80, 0x72, 0x2a, + 0x99, 0x74, 0xa3, 0x58, 0x28, 0x81, 0x8f, 0x20, 0x76, 0x21, 0xb6, 0x8f, 0x03, 0x11, 0x08, 0x9d, + 0x79, 0xeb, 0xaf, 0xb4, 0x66, 0x9f, 0x66, 0x29, 0x11, 0x89, 0xc9, 0x14, 0x20, 0x76, 0xce, 0x01, + 0x2f, 0xc4, 0xb5, 0x6c, 0x2c, 0x15, 0x51, 0xf4, 0x81, 0xf1, 0x11, 0xe0, 0xeb, 0x6f, 0x45, 0x74, + 0x70, 0x95, 0xee, 0xd5, 0x5f, 0x67, 0xf8, 0x02, 0x95, 0x52, 0x83, 0x65, 0xd6, 0xcc, 0x46, 0xb9, + 0x79, 0xe2, 0x66, 0xf6, 0x74, 0x6f, 0x74, 0xdc, 0x2a, 0xce, 0x3f, 0xaa, 0x46, 0x0f, 0xca, 0xf8, + 0x12, 0x95, 0x21, 0xef, 0x32, 0xa9, 0xac, 0x7f, 0xb5, 0x42, 0xa3, 0xdc, 0xb4, 0x72, 0xb3, 0xbd, + 0xf4, 0x85, 0xe1, 0xef, 0x23, 0xb8, 0x8d, 0x0e, 0xf5, 0x76, 0x1d, 0x3e, 0x12, 0x9a, 0x51, 0xd0, + 0x0c, 0x3b, 0xc7, 0xe8, 0x6f, 0x5a, 0x40, 0xf9, 0x39, 0x86, 0x09, 0xb2, 0x42, 0xa2, 0xa8, 0x54, + 0xdb, 0x5e, 0x87, 0x0f, 0xe9, 0x4c, 0x23, 0x8b, 0x1a, 0x59, 0xdd, 0x8d, 0xd4, 0x55, 0xe0, 0xee, + 0xc4, 0xe0, 0x09, 0xaa, 0xa4, 0x59, 0x9b, 0x71, 0x12, 0xb2, 0x67, 0x3a, 0x84, 0xd2, 0xc6, 0xf3, + 0xff, 0x2f, 0x9e, 0xfd, 0x2c, 0xfc, 0x62, 0xa2, 0xfa, 0x20, 0x14, 0xfe, 0xe4, 0x9a, 0xb2, 0x60, + 0xac, 0xee, 0x04, 0x14, 0x89, 0x62, 0x82, 0xdf, 0x26, 0x34, 0xa1, 0x5a, 0x59, 0xd2, 0x4a, 0x2f, + 0xa7, 0x6c, 0xed, 0x1d, 0x85, 0x15, 0x7e, 0x21, 0x68, 0x75, 0xe7, 0x4b, 0xc7, 0x5c, 0x2c, 0x1d, + 0xf3, 0x73, 0xe9, 0x98, 0xaf, 0x2b, 0xc7, 0x58, 0xac, 0x1c, 0xe3, 0x7d, 0xe5, 0x18, 0xf7, 0xcd, + 0x80, 0xa9, 0x71, 0x32, 0x70, 0x7d, 0x31, 0xf5, 0x40, 0x7f, 0xc6, 0xa9, 0x7a, 0x14, 0xf1, 0x64, + 0xf3, 0xef, 0xcd, 0xb6, 0x27, 0xa8, 0x9e, 0x22, 0x2a, 0x07, 0x25, 0x7d, 0x7e, 0xe7, 0x5f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0xdc, 0x93, 0xc5, 0xd7, 0x25, 0x03, 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.BlockHeightToFinalizationQueueList) > 0 { + for iNdEx := len(m.BlockHeightToFinalizationQueueList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BlockHeightToFinalizationQueueList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.LatestFinalizedStateIndexList) > 0 { + for iNdEx := len(m.LatestFinalizedStateIndexList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LatestFinalizedStateIndexList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.LatestStateInfoIndexList) > 0 { + for iNdEx := len(m.LatestStateInfoIndexList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LatestStateInfoIndexList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.StateInfoList) > 0 { + for iNdEx := len(m.StateInfoList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.StateInfoList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.RollappList) > 0 { + for iNdEx := len(m.RollappList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RollappList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +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 + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.RollappList) > 0 { + for _, e := range m.RollappList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.StateInfoList) > 0 { + for _, e := range m.StateInfoList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.LatestStateInfoIndexList) > 0 { + for _, e := range m.LatestStateInfoIndexList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.LatestFinalizedStateIndexList) > 0 { + for _, e := range m.LatestFinalizedStateIndexList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.BlockHeightToFinalizationQueueList) > 0 { + for _, e := range m.BlockHeightToFinalizationQueueList { + 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 Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappList", 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.RollappList = append(m.RollappList, Rollapp{}) + if err := m.RollappList[len(m.RollappList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfoList", 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.StateInfoList = append(m.StateInfoList, StateInfo{}) + if err := m.StateInfoList[len(m.StateInfoList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestStateInfoIndexList", 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.LatestStateInfoIndexList = append(m.LatestStateInfoIndexList, StateInfoIndex{}) + if err := m.LatestStateInfoIndexList[len(m.LatestStateInfoIndexList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFinalizedStateIndexList", 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.LatestFinalizedStateIndexList = append(m.LatestFinalizedStateIndexList, StateInfoIndex{}) + if err := m.LatestFinalizedStateIndexList[len(m.LatestFinalizedStateIndexList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeightToFinalizationQueueList", 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.BlockHeightToFinalizationQueueList = append(m.BlockHeightToFinalizationQueueList, BlockHeightToFinalizationQueue{}) + if err := m.BlockHeightToFinalizationQueueList[len(m.BlockHeightToFinalizationQueueList)-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") +) diff --git a/x/rollapp/types/hooks.go b/x/rollapp/types/hooks.go new file mode 100644 index 00000000..6718cedd --- /dev/null +++ b/x/rollapp/types/hooks.go @@ -0,0 +1,57 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// These can be utilized to communicate between a rollapp keeper and another +// keeper which must take particular actions when rollapp change state. +// The second keeper must implement this interface, which then the +// rollapp keeper can call. + +// RollappHooks event hooks for rollapp object (noalias) +type RollappHooks interface { + BeforeUpdateState(ctx sdk.Context, seqAddr, rollappId string) error // Must be called when a rollapp's state changes + AfterStateFinalized(ctx sdk.Context, rollappID string, stateInfo *StateInfo) error // Must be called when a rollapp's state changes + FraudSubmitted(ctx sdk.Context, rollappID string, height uint64, seqAddr string) error +} + +var _ RollappHooks = MultiRollappHooks{} + +// combine multiple rollapp hooks, all hook functions are run in array sequence +type MultiRollappHooks []RollappHooks + +// Creates hooks for the Rollapp Module. +func NewMultiRollappHooks(hooks ...RollappHooks) MultiRollappHooks { + return hooks +} + +func (h MultiRollappHooks) BeforeUpdateState(ctx sdk.Context, seqAddr, rollappId string) error { + for i := range h { + err := h[i].BeforeUpdateState(ctx, seqAddr, rollappId) + if err != nil { + return err + } + } + return nil +} + +func (h MultiRollappHooks) AfterStateFinalized(ctx sdk.Context, rollappID string, stateInfo *StateInfo) error { + for i := range h { + err := h[i].AfterStateFinalized(ctx, rollappID, stateInfo) + if err != nil { + return err + } + } + return nil +} + +func (h MultiRollappHooks) FraudSubmitted(ctx sdk.Context, rollappID string, height uint64, seqAddr string) error { + for i := range h { + err := h[i].FraudSubmitted(ctx, rollappID, height, seqAddr) + if err != nil { + return err + } + } + return nil +} diff --git a/x/rollapp/types/key_block_height_to_finalization_queue.go b/x/rollapp/types/key_block_height_to_finalization_queue.go new file mode 100644 index 00000000..efc53c77 --- /dev/null +++ b/x/rollapp/types/key_block_height_to_finalization_queue.go @@ -0,0 +1,24 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // BlockHeightToFinalizationQueueKeyPrefix is the prefix to retrieve all BlockHeightToFinalizationQueue + BlockHeightToFinalizationQueueKeyPrefix = "BlockHeightToFinalizationQueue/value/" +) + +// BlockHeightToFinalizationQueueKey returns the store key to retrieve a BlockHeightToFinalizationQueue from the index fields +func BlockHeightToFinalizationQueueKey( + creationHeight uint64, +) []byte { + var key []byte + + creationHeightBytes := make([]byte, 8) + binary.BigEndian.PutUint64(creationHeightBytes, creationHeight) + key = append(key, creationHeightBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/rollapp/types/key_latest_finalized_state_index.go b/x/rollapp/types/key_latest_finalized_state_index.go new file mode 100644 index 00000000..156d6035 --- /dev/null +++ b/x/rollapp/types/key_latest_finalized_state_index.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // LatestFinalizedStateIndexKeyPrefix is the prefix to retrieve all LatestFinalizedStateIndex + LatestFinalizedStateIndexKeyPrefix = "LatestFinalizedStateIndex/value/" +) + +// LatestFinalizedStateIndexKey returns the store key to retrieve a LatestFinalizedStateIndex from the index fields +func LatestFinalizedStateIndexKey( + rollappId string, +) []byte { + var key []byte + + rollappIdBytes := []byte(rollappId) + key = append(key, rollappIdBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/rollapp/types/key_latest_state_info_index.go b/x/rollapp/types/key_latest_state_info_index.go new file mode 100644 index 00000000..3c6eb3c3 --- /dev/null +++ b/x/rollapp/types/key_latest_state_info_index.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // LatestStateInfoIndexKeyPrefix is the prefix to retrieve all LatestStateInfoIndex + LatestStateInfoIndexKeyPrefix = "LatestStateInfoIndex/value/" +) + +// LatestStateInfoIndexKey returns the store key to retrieve a LatestStateInfoIndex from the index fields +func LatestStateInfoIndexKey( + rollappId string, +) []byte { + var key []byte + + rollappIdBytes := []byte(rollappId) + key = append(key, rollappIdBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/rollapp/types/key_rollapp.go b/x/rollapp/types/key_rollapp.go new file mode 100644 index 00000000..4a93293a --- /dev/null +++ b/x/rollapp/types/key_rollapp.go @@ -0,0 +1,38 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // RollappKeyPrefix is the prefix to retrieve all Rollapp + RollappKeyPrefix = "Rollapp/value/" + RollappByEIP155KeyPrefix = "RollappByEIP155/value/" +) + +// RollappKey returns the store key to retrieve a Rollapp from the index fields +func RollappKey( + rollappId string, +) []byte { + var key []byte + + rollappIdBytes := []byte(rollappId) + key = append(key, rollappIdBytes...) + key = append(key, []byte("/")...) + + return key +} + +// RollappByEIP155Key returns the store key to retrieve a Rollapp from the index fields +func RollappByEIP155Key( + eip155 uint64, +) []byte { + var key []byte + + eip155Bytes := make([]byte, 8) + binary.LittleEndian.PutUint64(eip155Bytes, eip155) + key = append(key, eip155Bytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/rollapp/types/key_state_info.go b/x/rollapp/types/key_state_info.go new file mode 100644 index 00000000..1b92f13a --- /dev/null +++ b/x/rollapp/types/key_state_info.go @@ -0,0 +1,31 @@ +package types + +import ( + "encoding/binary" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ binary.ByteOrder + +const ( + // StateInfoKeyPrefix is the prefix to retrieve all StateInfo + StateInfoKeyPrefix = "StateInfo/value/" +) + +// StateInfoKey returns the store key to retrieve a StateInfo from the index fields +func StateInfoKey( + stateInfoIndex StateInfoIndex, +) []byte { + var key []byte + // build the key bytes + rollappIdBytes := []byte(stateInfoIndex.RollappId) + stateInfoIndexBytes := sdk.Uint64ToBigEndian(stateInfoIndex.Index) + // concatenate the byte slices directly + key = append(key, rollappIdBytes...) + key = append(key, []byte("/")...) + key = append(key, stateInfoIndexBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/rollup/types/keys.go b/x/rollapp/types/keys.go similarity index 53% rename from x/rollup/types/keys.go rename to x/rollapp/types/keys.go index 1cb59525..aadec02e 100644 --- a/x/rollup/types/keys.go +++ b/x/rollapp/types/keys.go @@ -2,17 +2,21 @@ package types const ( // ModuleName defines the module name - ModuleName = "rollup" + ModuleName = "rollapp" // StoreKey defines the primary module store key StoreKey = ModuleName + // RouterKey is the message route for slashing + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key + QuerierRoute = ModuleName + // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_rollup" + MemStoreKey = "mem_rollapp" ) -var ParamsKey = []byte("p_rollup") - func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/rollapp/types/params.go b/x/rollapp/types/params.go new file mode 100644 index 00000000..9bb71f74 --- /dev/null +++ b/x/rollapp/types/params.go @@ -0,0 +1,115 @@ +package types + +import ( + "errors" + "fmt" + + "gopkg.in/yaml.v2" + + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +var ( + // KeyRollappsEnabled is store's key for RollappsEnabled Params + KeyRollappsEnabled = []byte("RollappsEnabled") + // DeployerWhitelist is store's key for DeployerWhitelist Params + KeyDeployerWhitelist = []byte("DeployerWhitelist") + // KeyDisputePeriodInBlocks is store's key for DisputePeriodInBlocks Params + KeyDisputePeriodInBlocks = []byte("DisputePeriodInBlocks") + // default value + DefaultDisputePeriodInBlocks uint64 = 3 + // MinDisputePeriodInBlocks is the minimum number of blocks for dispute period + MinDisputePeriodInBlocks uint64 = 1 +) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams( + enabled bool, + disputePeriodInBlocks uint64, + deployerWhitelist []DeployerParams, +) Params { + return Params{ + DisputePeriodInBlocks: disputePeriodInBlocks, + DeployerWhitelist: deployerWhitelist, + RollappsEnabled: enabled, + } +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams( + true, DefaultDisputePeriodInBlocks, []DeployerParams{}, + ) +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyDisputePeriodInBlocks, &p.DisputePeriodInBlocks, validateDisputePeriodInBlocks), + paramtypes.NewParamSetPair(KeyDeployerWhitelist, &p.DeployerWhitelist, validateDeployerWhitelist), + paramtypes.NewParamSetPair(KeyRollappsEnabled, &p.RollappsEnabled, func(_ interface{}) error { return nil }), + } +} + +// Validate validates the set of params +func (p Params) Validate() error { + if err := validateDisputePeriodInBlocks(p.DisputePeriodInBlocks); err != nil { + return err + } + + return validateDeployerWhitelist(p.DeployerWhitelist) +} + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} + +// validateDisputePeriodInBlocks validates the DisputePeriodInBlocks param +func validateDisputePeriodInBlocks(v interface{}) error { + disputePeriodInBlocks, ok := v.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", v) + } + + if disputePeriodInBlocks < MinDisputePeriodInBlocks { + return errors.New("dispute period cannot be lower than 1 block") + } + + return nil +} + +// validateDeployerWhitelist validates the DeployerWhitelist param +func validateDeployerWhitelist(v interface{}) error { + deployerWhitelist, ok := v.([]DeployerParams) + if !ok { + return fmt.Errorf("invalid parameter type: %T", v) + } + + // Check for duplicated index in deployer address + rollappDeployerIndexMap := make(map[string]struct{}) + + for i, item := range deployerWhitelist { + // check Bech32 format + if _, err := sdk.AccAddressFromBech32(item.Address); err != nil { + return fmt.Errorf("deployerWhitelist[%d] format error: %s", i, err.Error()) + } + + // check duplicate + if _, ok := rollappDeployerIndexMap[item.Address]; ok { + return errors.New("duplicated deployer address in deployerWhitelist") + } + rollappDeployerIndexMap[item.Address] = struct{}{} + } + + return nil +} diff --git a/x/rollapp/types/params.pb.go b/x/rollapp/types/params.pb.go new file mode 100644 index 00000000..dd91d06f --- /dev/null +++ b/x/rollapp/types/params.pb.go @@ -0,0 +1,592 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/params.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 + +type DeployerParams struct { + // address is a bech32-encoded address of the + // accounts that are allowed to create a rollapp. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` +} + +func (m *DeployerParams) Reset() { *m = DeployerParams{} } +func (m *DeployerParams) String() string { return proto.CompactTextString(m) } +func (*DeployerParams) ProtoMessage() {} +func (*DeployerParams) Descriptor() ([]byte, []int) { + return fileDescriptor_cd46fee5d70d5320, []int{0} +} +func (m *DeployerParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeployerParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeployerParams.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 *DeployerParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeployerParams.Merge(m, src) +} +func (m *DeployerParams) XXX_Size() int { + return m.Size() +} +func (m *DeployerParams) XXX_DiscardUnknown() { + xxx_messageInfo_DeployerParams.DiscardUnknown(m) +} + +var xxx_messageInfo_DeployerParams proto.InternalMessageInfo + +func (m *DeployerParams) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +// Params defines the parameters for the module. +type Params struct { + // dispute_period_in_blocks the number of blocks it takes + // to change a status of a state from received to finalized. + // during that period, any user could submit fraud proof + DisputePeriodInBlocks uint64 `protobuf:"varint,1,opt,name=dispute_period_in_blocks,json=disputePeriodInBlocks,proto3" json:"dispute_period_in_blocks,omitempty" yaml:"dispute_period_in_blocks"` + // deployer_whitelist is a list of the + // accounts that are allowed to create a rollapp and maximum number of rollapps. + // In the case of an empty list, there are no restrictions + DeployerWhitelist []DeployerParams `protobuf:"bytes,2,rep,name=deployer_whitelist,json=deployerWhitelist,proto3" json:"deployer_whitelist" yaml:"deployer_whitelist"` + RollappsEnabled bool `protobuf:"varint,3,opt,name=rollapps_enabled,json=rollappsEnabled,proto3" json:"rollapps_enabled,omitempty" yaml:"rollapps_enabled"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_cd46fee5d70d5320, []int{1} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetDisputePeriodInBlocks() uint64 { + if m != nil { + return m.DisputePeriodInBlocks + } + return 0 +} + +func (m *Params) GetDeployerWhitelist() []DeployerParams { + if m != nil { + return m.DeployerWhitelist + } + return nil +} + +func (m *Params) GetRollappsEnabled() bool { + if m != nil { + return m.RollappsEnabled + } + return false +} + +func init() { + proto.RegisterType((*DeployerParams)(nil), "nucleic.rollapp.DeployerParams") + proto.RegisterType((*Params)(nil), "nucleic.rollapp.Params") +} + +func init() { proto.RegisterFile("nucleic/rollapp/params.proto", fileDescriptor_cd46fee5d70d5320) } + +var fileDescriptor_cd46fee5d70d5320 = []byte{ + // 351 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc9, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0x2f, 0x48, 0x2c, 0x4a, + 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x87, 0xca, 0xea, 0x41, 0x65, 0xa5, + 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x72, 0xfa, 0x20, 0x16, 0x44, 0x99, 0x92, 0x1d, 0x17, 0x9f, + 0x4b, 0x6a, 0x41, 0x4e, 0x7e, 0x65, 0x6a, 0x51, 0x00, 0x58, 0xbb, 0x90, 0x0e, 0x17, 0x7b, 0x62, + 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xd0, 0xa7, 0x7b, + 0xf2, 0x7c, 0x95, 0x89, 0xb9, 0x39, 0x56, 0x4a, 0x50, 0x09, 0xa5, 0x20, 0x98, 0x12, 0xa5, 0xe5, + 0x4c, 0x5c, 0x6c, 0x50, 0x8d, 0x31, 0x5c, 0x12, 0x29, 0x99, 0xc5, 0x05, 0xa5, 0x25, 0xa9, 0xf1, + 0x05, 0xa9, 0x45, 0x99, 0xf9, 0x29, 0xf1, 0x99, 0x79, 0xf1, 0x49, 0x39, 0xf9, 0xc9, 0xd9, 0x10, + 0x93, 0x58, 0x9c, 0x94, 0x3f, 0xdd, 0x93, 0x97, 0x87, 0x98, 0x84, 0x4b, 0xa5, 0x52, 0x90, 0x28, + 0x54, 0x2a, 0x00, 0x2c, 0xe3, 0x99, 0xe7, 0x04, 0x16, 0x17, 0x2a, 0xe4, 0x12, 0x4a, 0x81, 0x3a, + 0x34, 0xbe, 0x3c, 0x23, 0xb3, 0x24, 0x35, 0x27, 0xb3, 0xb8, 0x44, 0x82, 0x49, 0x81, 0x59, 0x83, + 0xdb, 0x48, 0x5e, 0x0f, 0xcd, 0xb3, 0x7a, 0xa8, 0x7e, 0x72, 0x52, 0x3c, 0x71, 0x4f, 0x9e, 0xe1, + 0xd3, 0x3d, 0x79, 0x49, 0xa8, 0xe5, 0x18, 0x06, 0x29, 0x05, 0x09, 0xc2, 0x04, 0xc3, 0x61, 0x62, + 0x42, 0x6e, 0x5c, 0x02, 0x50, 0xf3, 0x8a, 0xe3, 0x53, 0xf3, 0x12, 0x93, 0x72, 0x52, 0x53, 0x24, + 0x98, 0x15, 0x18, 0x35, 0x38, 0x9c, 0xa4, 0x3f, 0xdd, 0x93, 0x17, 0x87, 0x98, 0x85, 0xae, 0x42, + 0x29, 0x88, 0x1f, 0x26, 0xe4, 0x0a, 0x11, 0xb1, 0x62, 0x99, 0xb1, 0x40, 0x9e, 0xc1, 0xc9, 0xe7, + 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, + 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x8c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, + 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xa1, 0x1e, 0xd1, 0xcd, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, + 0x86, 0xf1, 0xf5, 0x2b, 0xe0, 0xb1, 0x5c, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x8e, 0x3e, + 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa6, 0x00, 0xf9, 0x2e, 0x05, 0x02, 0x00, 0x00, +} + +func (m *DeployerParams) 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 *DeployerParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeployerParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintParams(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RollappsEnabled { + i-- + if m.RollappsEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.DeployerWhitelist) > 0 { + for iNdEx := len(m.DeployerWhitelist) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DeployerWhitelist[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.DisputePeriodInBlocks != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.DisputePeriodInBlocks)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *DeployerParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DisputePeriodInBlocks != 0 { + n += 1 + sovParams(uint64(m.DisputePeriodInBlocks)) + } + if len(m.DeployerWhitelist) > 0 { + for _, e := range m.DeployerWhitelist { + l = e.Size() + n += 1 + l + sovParams(uint64(l)) + } + } + if m.RollappsEnabled { + n += 2 + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *DeployerParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeployerParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeployerParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisputePeriodInBlocks", wireType) + } + m.DisputePeriodInBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DisputePeriodInBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeployerWhitelist", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DeployerWhitelist = append(m.DeployerWhitelist, DeployerParams{}) + if err := m.DeployerWhitelist[len(m.DeployerWhitelist)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappsEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RollappsEnabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollapp/types/query.pb.go b/x/rollapp/types/query.pb.go new file mode 100644 index 00000000..b2c27fd5 --- /dev/null +++ b/x/rollapp/types/query.pb.go @@ -0,0 +1,3111 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/query.proto + +package types + +import ( + context "context" + fmt "fmt" + query "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 + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type QueryGetRollappRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` +} + +func (m *QueryGetRollappRequest) Reset() { *m = QueryGetRollappRequest{} } +func (m *QueryGetRollappRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetRollappRequest) ProtoMessage() {} +func (*QueryGetRollappRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{2} +} +func (m *QueryGetRollappRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRollappRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRollappRequest.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 *QueryGetRollappRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRollappRequest.Merge(m, src) +} +func (m *QueryGetRollappRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRollappRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRollappRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRollappRequest proto.InternalMessageInfo + +func (m *QueryGetRollappRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +type QueryGetRollappByEIP155Request struct { + Eip155 uint64 `protobuf:"varint,1,opt,name=eip155,proto3" json:"eip155,omitempty"` +} + +func (m *QueryGetRollappByEIP155Request) Reset() { *m = QueryGetRollappByEIP155Request{} } +func (m *QueryGetRollappByEIP155Request) String() string { return proto.CompactTextString(m) } +func (*QueryGetRollappByEIP155Request) ProtoMessage() {} +func (*QueryGetRollappByEIP155Request) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{3} +} +func (m *QueryGetRollappByEIP155Request) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRollappByEIP155Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRollappByEIP155Request.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 *QueryGetRollappByEIP155Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRollappByEIP155Request.Merge(m, src) +} +func (m *QueryGetRollappByEIP155Request) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRollappByEIP155Request) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRollappByEIP155Request.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRollappByEIP155Request proto.InternalMessageInfo + +func (m *QueryGetRollappByEIP155Request) GetEip155() uint64 { + if m != nil { + return m.Eip155 + } + return 0 +} + +type QueryGetLatestHeightRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + Finalized bool `protobuf:"varint,2,opt,name=finalized,proto3" json:"finalized,omitempty"` +} + +func (m *QueryGetLatestHeightRequest) Reset() { *m = QueryGetLatestHeightRequest{} } +func (m *QueryGetLatestHeightRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestHeightRequest) ProtoMessage() {} +func (*QueryGetLatestHeightRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{4} +} +func (m *QueryGetLatestHeightRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLatestHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLatestHeightRequest.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 *QueryGetLatestHeightRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestHeightRequest.Merge(m, src) +} +func (m *QueryGetLatestHeightRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLatestHeightRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestHeightRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLatestHeightRequest proto.InternalMessageInfo + +func (m *QueryGetLatestHeightRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *QueryGetLatestHeightRequest) GetFinalized() bool { + if m != nil { + return m.Finalized + } + return false +} + +type QueryGetLatestHeightResponse struct { + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryGetLatestHeightResponse) Reset() { *m = QueryGetLatestHeightResponse{} } +func (m *QueryGetLatestHeightResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestHeightResponse) ProtoMessage() {} +func (*QueryGetLatestHeightResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{5} +} +func (m *QueryGetLatestHeightResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLatestHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLatestHeightResponse.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 *QueryGetLatestHeightResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestHeightResponse.Merge(m, src) +} +func (m *QueryGetLatestHeightResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLatestHeightResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestHeightResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLatestHeightResponse proto.InternalMessageInfo + +func (m *QueryGetLatestHeightResponse) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +type QueryGetLatestStateIndexRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + Finalized bool `protobuf:"varint,2,opt,name=finalized,proto3" json:"finalized,omitempty"` +} + +func (m *QueryGetLatestStateIndexRequest) Reset() { *m = QueryGetLatestStateIndexRequest{} } +func (m *QueryGetLatestStateIndexRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestStateIndexRequest) ProtoMessage() {} +func (*QueryGetLatestStateIndexRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{6} +} +func (m *QueryGetLatestStateIndexRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLatestStateIndexRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLatestStateIndexRequest.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 *QueryGetLatestStateIndexRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestStateIndexRequest.Merge(m, src) +} +func (m *QueryGetLatestStateIndexRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLatestStateIndexRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestStateIndexRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLatestStateIndexRequest proto.InternalMessageInfo + +func (m *QueryGetLatestStateIndexRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *QueryGetLatestStateIndexRequest) GetFinalized() bool { + if m != nil { + return m.Finalized + } + return false +} + +type QueryGetLatestStateIndexResponse struct { + StateIndex StateInfoIndex `protobuf:"bytes,1,opt,name=stateIndex,proto3" json:"stateIndex"` +} + +func (m *QueryGetLatestStateIndexResponse) Reset() { *m = QueryGetLatestStateIndexResponse{} } +func (m *QueryGetLatestStateIndexResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestStateIndexResponse) ProtoMessage() {} +func (*QueryGetLatestStateIndexResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{7} +} +func (m *QueryGetLatestStateIndexResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLatestStateIndexResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLatestStateIndexResponse.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 *QueryGetLatestStateIndexResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestStateIndexResponse.Merge(m, src) +} +func (m *QueryGetLatestStateIndexResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLatestStateIndexResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestStateIndexResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLatestStateIndexResponse proto.InternalMessageInfo + +func (m *QueryGetLatestStateIndexResponse) GetStateIndex() StateInfoIndex { + if m != nil { + return m.StateIndex + } + return StateInfoIndex{} +} + +type QueryGetRollappResponse struct { + Rollapp Rollapp `protobuf:"bytes,1,opt,name=rollapp,proto3" json:"rollapp"` + // Defines the index of the last rollapp UpdateState. + LatestStateIndex *StateInfoIndex `protobuf:"bytes,2,opt,name=latestStateIndex,proto3" json:"latestStateIndex,omitempty"` + // Defines the index of the last rollapp UpdateState that was finalized. + LatestFinalizedStateIndex *StateInfoIndex `protobuf:"bytes,3,opt,name=latestFinalizedStateIndex,proto3" json:"latestFinalizedStateIndex,omitempty"` + LatestHeight uint64 `protobuf:"varint,4,opt,name=latestHeight,proto3" json:"latestHeight,omitempty"` + LatestFinalizedHeight uint64 `protobuf:"varint,5,opt,name=latestFinalizedHeight,proto3" json:"latestFinalizedHeight,omitempty"` +} + +func (m *QueryGetRollappResponse) Reset() { *m = QueryGetRollappResponse{} } +func (m *QueryGetRollappResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetRollappResponse) ProtoMessage() {} +func (*QueryGetRollappResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{8} +} +func (m *QueryGetRollappResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRollappResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRollappResponse.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 *QueryGetRollappResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRollappResponse.Merge(m, src) +} +func (m *QueryGetRollappResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRollappResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRollappResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRollappResponse proto.InternalMessageInfo + +func (m *QueryGetRollappResponse) GetRollapp() Rollapp { + if m != nil { + return m.Rollapp + } + return Rollapp{} +} + +func (m *QueryGetRollappResponse) GetLatestStateIndex() *StateInfoIndex { + if m != nil { + return m.LatestStateIndex + } + return nil +} + +func (m *QueryGetRollappResponse) GetLatestFinalizedStateIndex() *StateInfoIndex { + if m != nil { + return m.LatestFinalizedStateIndex + } + return nil +} + +func (m *QueryGetRollappResponse) GetLatestHeight() uint64 { + if m != nil { + return m.LatestHeight + } + return 0 +} + +func (m *QueryGetRollappResponse) GetLatestFinalizedHeight() uint64 { + if m != nil { + return m.LatestFinalizedHeight + } + return 0 +} + +type QueryAllRollappRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllRollappRequest) Reset() { *m = QueryAllRollappRequest{} } +func (m *QueryAllRollappRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllRollappRequest) ProtoMessage() {} +func (*QueryAllRollappRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{9} +} +func (m *QueryAllRollappRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRollappRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllRollappRequest.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 *QueryAllRollappRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRollappRequest.Merge(m, src) +} +func (m *QueryAllRollappRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRollappRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRollappRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRollappRequest proto.InternalMessageInfo + +func (m *QueryAllRollappRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryAllRollappResponse struct { + Rollapp []RollappSummary `protobuf:"bytes,1,rep,name=rollapp,proto3" json:"rollapp"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllRollappResponse) Reset() { *m = QueryAllRollappResponse{} } +func (m *QueryAllRollappResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllRollappResponse) ProtoMessage() {} +func (*QueryAllRollappResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{10} +} +func (m *QueryAllRollappResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRollappResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllRollappResponse.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 *QueryAllRollappResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRollappResponse.Merge(m, src) +} +func (m *QueryAllRollappResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRollappResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRollappResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRollappResponse proto.InternalMessageInfo + +func (m *QueryAllRollappResponse) GetRollapp() []RollappSummary { + if m != nil { + return m.Rollapp + } + return nil +} + +func (m *QueryAllRollappResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryGetStateInfoRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` + Finalized bool `protobuf:"varint,4,opt,name=finalized,proto3" json:"finalized,omitempty"` +} + +func (m *QueryGetStateInfoRequest) Reset() { *m = QueryGetStateInfoRequest{} } +func (m *QueryGetStateInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetStateInfoRequest) ProtoMessage() {} +func (*QueryGetStateInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{11} +} +func (m *QueryGetStateInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetStateInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetStateInfoRequest.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 *QueryGetStateInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetStateInfoRequest.Merge(m, src) +} +func (m *QueryGetStateInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetStateInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetStateInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetStateInfoRequest proto.InternalMessageInfo + +func (m *QueryGetStateInfoRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *QueryGetStateInfoRequest) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *QueryGetStateInfoRequest) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *QueryGetStateInfoRequest) GetFinalized() bool { + if m != nil { + return m.Finalized + } + return false +} + +type QueryGetStateInfoResponse struct { + StateInfo StateInfo `protobuf:"bytes,1,opt,name=stateInfo,proto3" json:"stateInfo"` +} + +func (m *QueryGetStateInfoResponse) Reset() { *m = QueryGetStateInfoResponse{} } +func (m *QueryGetStateInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetStateInfoResponse) ProtoMessage() {} +func (*QueryGetStateInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{12} +} +func (m *QueryGetStateInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetStateInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetStateInfoResponse.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 *QueryGetStateInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetStateInfoResponse.Merge(m, src) +} +func (m *QueryGetStateInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetStateInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetStateInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetStateInfoResponse proto.InternalMessageInfo + +func (m *QueryGetStateInfoResponse) GetStateInfo() StateInfo { + if m != nil { + return m.StateInfo + } + return StateInfo{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "nucleic.rollapp.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "nucleic.rollapp.QueryParamsResponse") + proto.RegisterType((*QueryGetRollappRequest)(nil), "nucleic.rollapp.QueryGetRollappRequest") + proto.RegisterType((*QueryGetRollappByEIP155Request)(nil), "nucleic.rollapp.QueryGetRollappByEIP155Request") + proto.RegisterType((*QueryGetLatestHeightRequest)(nil), "nucleic.rollapp.QueryGetLatestHeightRequest") + proto.RegisterType((*QueryGetLatestHeightResponse)(nil), "nucleic.rollapp.QueryGetLatestHeightResponse") + proto.RegisterType((*QueryGetLatestStateIndexRequest)(nil), "nucleic.rollapp.QueryGetLatestStateIndexRequest") + proto.RegisterType((*QueryGetLatestStateIndexResponse)(nil), "nucleic.rollapp.QueryGetLatestStateIndexResponse") + proto.RegisterType((*QueryGetRollappResponse)(nil), "nucleic.rollapp.QueryGetRollappResponse") + proto.RegisterType((*QueryAllRollappRequest)(nil), "nucleic.rollapp.QueryAllRollappRequest") + proto.RegisterType((*QueryAllRollappResponse)(nil), "nucleic.rollapp.QueryAllRollappResponse") + proto.RegisterType((*QueryGetStateInfoRequest)(nil), "nucleic.rollapp.QueryGetStateInfoRequest") + proto.RegisterType((*QueryGetStateInfoResponse)(nil), "nucleic.rollapp.QueryGetStateInfoResponse") +} + +func init() { proto.RegisterFile("nucleic/rollapp/query.proto", fileDescriptor_faa12a617c368b49) } + +var fileDescriptor_faa12a617c368b49 = []byte{ + // 884 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x4f, 0xe3, 0x56, + 0x10, 0x8e, 0x21, 0x04, 0x32, 0x45, 0x02, 0xbd, 0x52, 0x08, 0x86, 0x26, 0x91, 0x8b, 0x20, 0x45, + 0x60, 0x37, 0x69, 0x43, 0x39, 0xb5, 0x02, 0x09, 0x28, 0x2a, 0x07, 0x6a, 0x4e, 0x6d, 0x85, 0xa8, + 0x93, 0x3c, 0x8c, 0x55, 0xc7, 0x36, 0xb1, 0xd3, 0x92, 0x22, 0x0e, 0xad, 0x7a, 0xea, 0xa9, 0x52, + 0xa5, 0x1e, 0xda, 0xc3, 0x1e, 0xf6, 0x1f, 0xd8, 0x3f, 0x83, 0x23, 0xd2, 0x5e, 0x76, 0x2f, 0xab, + 0x15, 0xec, 0x1f, 0xb2, 0xca, 0x7b, 0xe3, 0xc4, 0x3f, 0xe2, 0x4d, 0x90, 0xf6, 0x04, 0x7e, 0x33, + 0xdf, 0x37, 0x5f, 0xe6, 0xf3, 0xcc, 0x33, 0x2c, 0x59, 0xed, 0xba, 0x49, 0x8d, 0xba, 0xd2, 0xb2, + 0x4d, 0x53, 0x73, 0x1c, 0xe5, 0xb2, 0x4d, 0x5b, 0x1d, 0xd9, 0x69, 0xd9, 0x9e, 0x4d, 0x66, 0x30, + 0x28, 0x63, 0x50, 0x9c, 0xd3, 0x6d, 0xdd, 0x66, 0x31, 0xa5, 0xfb, 0x1f, 0x4f, 0x13, 0x97, 0x75, + 0xdb, 0xd6, 0x4d, 0xaa, 0x68, 0x8e, 0xa1, 0x68, 0x96, 0x65, 0x7b, 0x9a, 0x67, 0xd8, 0x96, 0x8b, + 0xd1, 0xf5, 0xba, 0xed, 0x36, 0x6d, 0x57, 0xa9, 0x69, 0x2e, 0xe5, 0xec, 0xca, 0x2f, 0xe5, 0x1a, + 0xf5, 0xb4, 0xb2, 0xe2, 0x68, 0xba, 0x61, 0xb1, 0x64, 0x9f, 0x29, 0xaa, 0xc6, 0xd1, 0x5a, 0x5a, + 0xd3, 0x67, 0xfa, 0x38, 0x1a, 0xc5, 0xbf, 0x18, 0x2e, 0x46, 0xc3, 0xae, 0xa7, 0x79, 0xf4, 0xcc, + 0xb0, 0xce, 0x51, 0xa8, 0x34, 0x07, 0xe4, 0xbb, 0xae, 0x80, 0x63, 0xc6, 0xaa, 0xd2, 0xcb, 0x36, + 0x75, 0x3d, 0xe9, 0x08, 0x3e, 0x0c, 0x9d, 0xba, 0x8e, 0x6d, 0xb9, 0x94, 0x54, 0x21, 0xc3, 0xab, + 0xe7, 0x84, 0xa2, 0x50, 0xfa, 0xa0, 0xb2, 0x20, 0x47, 0xba, 0x21, 0x73, 0xc0, 0x6e, 0xfa, 0xf6, + 0x55, 0x21, 0xa5, 0x62, 0xb2, 0xb4, 0x05, 0xf3, 0x8c, 0xed, 0x80, 0x7a, 0x2a, 0xcf, 0xc3, 0x3a, + 0x64, 0x19, 0xb2, 0x88, 0x3c, 0x6c, 0x30, 0xce, 0xac, 0xda, 0x3f, 0x90, 0xb6, 0x21, 0x1f, 0xc1, + 0xed, 0x76, 0xf6, 0x0e, 0x8f, 0xcb, 0xd5, 0xaa, 0x8f, 0x9f, 0x87, 0x0c, 0x35, 0x9c, 0x72, 0xb5, + 0xca, 0xc0, 0x69, 0x15, 0x9f, 0xa4, 0xef, 0x61, 0xc9, 0x47, 0x1e, 0x69, 0x1e, 0x75, 0xbd, 0x6f, + 0xa8, 0xa1, 0x5f, 0x78, 0x23, 0x95, 0xed, 0x46, 0xcf, 0x0d, 0x4b, 0x33, 0x8d, 0xdf, 0x68, 0x23, + 0x37, 0x56, 0x14, 0x4a, 0x53, 0x6a, 0xff, 0x40, 0xda, 0x82, 0xe5, 0xc1, 0xd4, 0xd8, 0xa3, 0x79, + 0xc8, 0x5c, 0xb0, 0x13, 0x5f, 0x12, 0x7f, 0x92, 0x4e, 0xa1, 0x10, 0xc6, 0x9d, 0x74, 0xad, 0x38, + 0xb4, 0x1a, 0xf4, 0xea, 0x7d, 0xc8, 0x32, 0xa0, 0x98, 0x4c, 0x8f, 0xd2, 0xf6, 0x00, 0xdc, 0xde, + 0x29, 0x5a, 0x58, 0x88, 0x59, 0x88, 0xc0, 0x73, 0x9b, 0xa5, 0xa1, 0x95, 0x01, 0xa0, 0xf4, 0x72, + 0x0c, 0x16, 0x62, 0x7e, 0x62, 0x89, 0x6d, 0x98, 0x44, 0x1e, 0xe4, 0xcf, 0xc5, 0xf8, 0x7d, 0x2b, + 0x39, 0xb1, 0x9f, 0x4e, 0xbe, 0x85, 0x59, 0x33, 0x22, 0x9c, 0xfd, 0xca, 0xe1, 0x12, 0xd5, 0x18, + 0x90, 0x9c, 0xc2, 0x22, 0x3f, 0xdb, 0xf7, 0x1b, 0x14, 0x60, 0x1d, 0x1f, 0x8d, 0x35, 0x99, 0x81, + 0x48, 0x30, 0x6d, 0x06, 0xbc, 0xcf, 0xa5, 0x99, 0xd3, 0xa1, 0x33, 0xf2, 0x05, 0x7c, 0x14, 0x21, + 0xc0, 0xe4, 0x09, 0x96, 0x3c, 0x38, 0x28, 0xfd, 0x84, 0xa3, 0xb2, 0x63, 0x9a, 0x91, 0x51, 0xd9, + 0x07, 0xe8, 0xef, 0x06, 0x6c, 0xee, 0xaa, 0xcc, 0x17, 0x89, 0xdc, 0x5d, 0x24, 0x32, 0x5f, 0x53, + 0xb8, 0x48, 0xe4, 0x63, 0x4d, 0xa7, 0x88, 0x55, 0x03, 0x48, 0xe9, 0xa9, 0x80, 0xee, 0x05, 0x4b, + 0xa0, 0x7b, 0x5f, 0x07, 0xdd, 0x1b, 0x1f, 0xd8, 0x24, 0x84, 0x9c, 0xb4, 0x9b, 0x4d, 0xad, 0xd5, + 0x89, 0x9a, 0x78, 0x10, 0x12, 0xc9, 0xed, 0x5b, 0x1b, 0x2a, 0x92, 0x57, 0x0f, 0xa9, 0xfc, 0x53, + 0x80, 0x9c, 0xff, 0x8e, 0xf5, 0x7c, 0x19, 0x6d, 0x4e, 0xe6, 0x60, 0xc2, 0xe8, 0xbd, 0x3d, 0x69, + 0x95, 0x3f, 0x04, 0xc6, 0x72, 0x3c, 0x38, 0x96, 0xe1, 0xa9, 0x4a, 0x47, 0xa7, 0xea, 0x47, 0x58, + 0x1c, 0xa0, 0x02, 0xbb, 0xf5, 0x15, 0x64, 0x5d, 0xff, 0x10, 0x0d, 0x11, 0x93, 0x5f, 0x2a, 0x6c, + 0x55, 0x1f, 0x52, 0xf9, 0x6f, 0x0a, 0x26, 0x18, 0x3b, 0xf1, 0x20, 0xc3, 0x17, 0x27, 0xf9, 0x24, + 0x46, 0x10, 0xdf, 0xce, 0xe2, 0xca, 0xbb, 0x93, 0xb8, 0x3c, 0xa9, 0xf0, 0xc7, 0xf3, 0x37, 0xff, + 0x8c, 0x2d, 0x92, 0x05, 0x65, 0xf0, 0x0d, 0x42, 0xfe, 0x12, 0x60, 0x12, 0xed, 0x24, 0x6b, 0x83, + 0x29, 0x63, 0x1b, 0x5b, 0x2c, 0x0d, 0x4f, 0xc4, 0xfa, 0x1b, 0xac, 0xfe, 0x2a, 0x59, 0x51, 0x12, + 0xee, 0x28, 0xe5, 0xba, 0x67, 0xda, 0x0d, 0xf9, 0x57, 0x80, 0x99, 0xc8, 0x92, 0x27, 0xca, 0xb0, + 0x5a, 0x91, 0xeb, 0xe0, 0x11, 0xe2, 0x4a, 0x4c, 0x9c, 0x44, 0x8a, 0x31, 0x71, 0xfc, 0x06, 0x51, + 0xae, 0xf9, 0xdf, 0x1b, 0xf2, 0xbb, 0x00, 0x80, 0xe8, 0x1d, 0xd3, 0x4c, 0x6a, 0x54, 0x6c, 0x5e, + 0x93, 0xb4, 0xc4, 0xa7, 0x4e, 0x2a, 0x32, 0x2d, 0x22, 0xc9, 0x25, 0x35, 0x8a, 0x3c, 0x11, 0x60, + 0x3a, 0x78, 0xd9, 0x90, 0x8d, 0xc4, 0x1f, 0x3a, 0xe0, 0xba, 0x13, 0x37, 0x47, 0xcc, 0x46, 0x3d, + 0x15, 0xa6, 0x67, 0x83, 0xac, 0xc7, 0xf4, 0xf0, 0x9d, 0x75, 0xc6, 0x47, 0x27, 0x64, 0xdf, 0x33, + 0x01, 0x66, 0xa3, 0xf7, 0x0e, 0xf9, 0x6c, 0x48, 0xdd, 0xd8, 0x0d, 0x28, 0x96, 0x1f, 0x81, 0x40, + 0xb5, 0x5f, 0x32, 0xb5, 0x65, 0xa2, 0x24, 0xa9, 0xf5, 0x3f, 0x79, 0x1a, 0xf4, 0x2a, 0x24, 0xf9, + 0x7f, 0x01, 0xb2, 0xbd, 0xe9, 0x24, 0x9f, 0x26, 0x56, 0x8e, 0xae, 0x1f, 0x71, 0x7d, 0x94, 0xd4, + 0xa1, 0xea, 0xfa, 0x5f, 0x62, 0x41, 0x55, 0xca, 0x35, 0x13, 0x7a, 0xb3, 0x7b, 0x74, 0x7b, 0x9f, + 0x17, 0xee, 0xee, 0xf3, 0xc2, 0xeb, 0xfb, 0xbc, 0xf0, 0xf7, 0x43, 0x3e, 0x75, 0xf7, 0x90, 0x4f, + 0xbd, 0x78, 0xc8, 0xa7, 0x7e, 0xa8, 0xe8, 0x86, 0x77, 0xd1, 0xae, 0xc9, 0x75, 0xbb, 0xe9, 0x93, + 0x6e, 0x5a, 0xd4, 0xfb, 0xd5, 0x6e, 0xfd, 0xdc, 0x2b, 0x72, 0xd5, 0x2b, 0xe3, 0x75, 0x1c, 0xea, + 0xd6, 0x32, 0xec, 0x63, 0xef, 0xf3, 0xb7, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0b, 0xc0, 0xf9, 0xbc, + 0xdb, 0x0a, 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 { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Queries a Rollapp by index. + Rollapp(ctx context.Context, in *QueryGetRollappRequest, opts ...grpc.CallOption) (*QueryGetRollappResponse, error) + // Queries a Rollapp by index. + RollappByEIP155(ctx context.Context, in *QueryGetRollappByEIP155Request, opts ...grpc.CallOption) (*QueryGetRollappResponse, error) + // Queries a list of Rollapp items. + RollappAll(ctx context.Context, in *QueryAllRollappRequest, opts ...grpc.CallOption) (*QueryAllRollappResponse, error) + // Queries a LatestHeight by rollapp-id. + LatestHeight(ctx context.Context, in *QueryGetLatestHeightRequest, opts ...grpc.CallOption) (*QueryGetLatestHeightResponse, error) + // Queries a LatestStateIndex by rollapp-id. + LatestStateIndex(ctx context.Context, in *QueryGetLatestStateIndexRequest, opts ...grpc.CallOption) (*QueryGetLatestStateIndexResponse, error) + // Queries a StateInfo by index. + StateInfo(ctx context.Context, in *QueryGetStateInfoRequest, opts ...grpc.CallOption) (*QueryGetStateInfoResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Rollapp(ctx context.Context, in *QueryGetRollappRequest, opts ...grpc.CallOption) (*QueryGetRollappResponse, error) { + out := new(QueryGetRollappResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/Rollapp", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RollappByEIP155(ctx context.Context, in *QueryGetRollappByEIP155Request, opts ...grpc.CallOption) (*QueryGetRollappResponse, error) { + out := new(QueryGetRollappResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/RollappByEIP155", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RollappAll(ctx context.Context, in *QueryAllRollappRequest, opts ...grpc.CallOption) (*QueryAllRollappResponse, error) { + out := new(QueryAllRollappResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/RollappAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LatestHeight(ctx context.Context, in *QueryGetLatestHeightRequest, opts ...grpc.CallOption) (*QueryGetLatestHeightResponse, error) { + out := new(QueryGetLatestHeightResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/LatestHeight", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LatestStateIndex(ctx context.Context, in *QueryGetLatestStateIndexRequest, opts ...grpc.CallOption) (*QueryGetLatestStateIndexResponse, error) { + out := new(QueryGetLatestStateIndexResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/LatestStateIndex", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) StateInfo(ctx context.Context, in *QueryGetStateInfoRequest, opts ...grpc.CallOption) (*QueryGetStateInfoResponse, error) { + out := new(QueryGetStateInfoResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/StateInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Queries a Rollapp by index. + Rollapp(context.Context, *QueryGetRollappRequest) (*QueryGetRollappResponse, error) + // Queries a Rollapp by index. + RollappByEIP155(context.Context, *QueryGetRollappByEIP155Request) (*QueryGetRollappResponse, error) + // Queries a list of Rollapp items. + RollappAll(context.Context, *QueryAllRollappRequest) (*QueryAllRollappResponse, error) + // Queries a LatestHeight by rollapp-id. + LatestHeight(context.Context, *QueryGetLatestHeightRequest) (*QueryGetLatestHeightResponse, error) + // Queries a LatestStateIndex by rollapp-id. + LatestStateIndex(context.Context, *QueryGetLatestStateIndexRequest) (*QueryGetLatestStateIndexResponse, error) + // Queries a StateInfo by index. + StateInfo(context.Context, *QueryGetStateInfoRequest) (*QueryGetStateInfoResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Rollapp(ctx context.Context, req *QueryGetRollappRequest) (*QueryGetRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Rollapp not implemented") +} +func (*UnimplementedQueryServer) RollappByEIP155(ctx context.Context, req *QueryGetRollappByEIP155Request) (*QueryGetRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RollappByEIP155 not implemented") +} +func (*UnimplementedQueryServer) RollappAll(ctx context.Context, req *QueryAllRollappRequest) (*QueryAllRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RollappAll not implemented") +} +func (*UnimplementedQueryServer) LatestHeight(ctx context.Context, req *QueryGetLatestHeightRequest) (*QueryGetLatestHeightResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LatestHeight not implemented") +} +func (*UnimplementedQueryServer) LatestStateIndex(ctx context.Context, req *QueryGetLatestStateIndexRequest) (*QueryGetLatestStateIndexResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LatestStateIndex not implemented") +} +func (*UnimplementedQueryServer) StateInfo(ctx context.Context, req *QueryGetStateInfoRequest) (*QueryGetStateInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StateInfo not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Rollapp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetRollappRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Rollapp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/Rollapp", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Rollapp(ctx, req.(*QueryGetRollappRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RollappByEIP155_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetRollappByEIP155Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RollappByEIP155(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/RollappByEIP155", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RollappByEIP155(ctx, req.(*QueryGetRollappByEIP155Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RollappAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllRollappRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RollappAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/RollappAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RollappAll(ctx, req.(*QueryAllRollappRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_LatestHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetLatestHeightRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LatestHeight(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/LatestHeight", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LatestHeight(ctx, req.(*QueryGetLatestHeightRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_LatestStateIndex_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetLatestStateIndexRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LatestStateIndex(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/LatestStateIndex", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LatestStateIndex(ctx, req.(*QueryGetLatestStateIndexRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_StateInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetStateInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).StateInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/StateInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).StateInfo(ctx, req.(*QueryGetStateInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "nucleic.rollapp.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Rollapp", + Handler: _Query_Rollapp_Handler, + }, + { + MethodName: "RollappByEIP155", + Handler: _Query_RollappByEIP155_Handler, + }, + { + MethodName: "RollappAll", + Handler: _Query_RollappAll_Handler, + }, + { + MethodName: "LatestHeight", + Handler: _Query_LatestHeight_Handler, + }, + { + MethodName: "LatestStateIndex", + Handler: _Query_LatestStateIndex_Handler, + }, + { + MethodName: "StateInfo", + Handler: _Query_StateInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "nucleic/rollapp/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGetRollappRequest) 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 *QueryGetRollappRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRollappRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetRollappByEIP155Request) 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 *QueryGetRollappByEIP155Request) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRollappByEIP155Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Eip155 != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Eip155)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLatestHeightRequest) 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 *QueryGetLatestHeightRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLatestHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Finalized { + i-- + if m.Finalized { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLatestHeightResponse) 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 *QueryGetLatestHeightResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLatestHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLatestStateIndexRequest) 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 *QueryGetLatestStateIndexRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLatestStateIndexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Finalized { + i-- + if m.Finalized { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLatestStateIndexResponse) 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 *QueryGetLatestStateIndexResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLatestStateIndexResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.StateIndex.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 *QueryGetRollappResponse) 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 *QueryGetRollappResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRollappResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LatestFinalizedHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.LatestFinalizedHeight)) + i-- + dAtA[i] = 0x28 + } + if m.LatestHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.LatestHeight)) + i-- + dAtA[i] = 0x20 + } + if m.LatestFinalizedStateIndex != nil { + { + size, err := m.LatestFinalizedStateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.LatestStateIndex != nil { + { + size, err := m.LatestStateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Rollapp.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 *QueryAllRollappRequest) 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 *QueryAllRollappRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRollappRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.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 *QueryAllRollappResponse) 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 *QueryAllRollappResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRollappResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Rollapp) > 0 { + for iNdEx := len(m.Rollapp) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rollapp[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 (m *QueryGetStateInfoRequest) 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 *QueryGetStateInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetStateInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Finalized { + i-- + if m.Finalized { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } + if m.Index != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetStateInfoResponse) 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 *QueryGetStateInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetStateInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.StateInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetRollappRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetRollappByEIP155Request) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Eip155 != 0 { + n += 1 + sovQuery(uint64(m.Eip155)) + } + return n +} + +func (m *QueryGetLatestHeightRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Finalized { + n += 2 + } + return n +} + +func (m *QueryGetLatestHeightResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryGetLatestStateIndexRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Finalized { + n += 2 + } + return n +} + +func (m *QueryGetLatestStateIndexResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateIndex.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetRollappResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Rollapp.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.LatestStateIndex != nil { + l = m.LatestStateIndex.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.LatestFinalizedStateIndex != nil { + l = m.LatestFinalizedStateIndex.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.LatestHeight != 0 { + n += 1 + sovQuery(uint64(m.LatestHeight)) + } + if m.LatestFinalizedHeight != 0 { + n += 1 + sovQuery(uint64(m.LatestFinalizedHeight)) + } + return n +} + +func (m *QueryAllRollappRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllRollappResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Rollapp) > 0 { + for _, e := range m.Rollapp { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetStateInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Index != 0 { + n += 1 + sovQuery(uint64(m.Index)) + } + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + if m.Finalized { + n += 2 + } + return n +} + +func (m *QueryGetStateInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetRollappRequest) 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: QueryGetRollappRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRollappRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", 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.RollappId = 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 *QueryGetRollappByEIP155Request) 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: QueryGetRollappByEIP155Request: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRollappByEIP155Request: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Eip155", wireType) + } + m.Eip155 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Eip155 |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *QueryGetLatestHeightRequest) 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: QueryGetLatestHeightRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLatestHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", 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.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Finalized", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Finalized = bool(v != 0) + 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 *QueryGetLatestHeightResponse) 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: QueryGetLatestHeightResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLatestHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *QueryGetLatestStateIndexRequest) 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: QueryGetLatestStateIndexRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLatestStateIndexRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", 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.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Finalized", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Finalized = bool(v != 0) + 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 *QueryGetLatestStateIndexResponse) 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: QueryGetLatestStateIndexResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLatestStateIndexResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateIndex", 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.StateIndex.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 *QueryGetRollappResponse) 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: QueryGetRollappResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRollappResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rollapp", 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.Rollapp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestStateIndex", 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 m.LatestStateIndex == nil { + m.LatestStateIndex = &StateInfoIndex{} + } + if err := m.LatestStateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFinalizedStateIndex", 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 m.LatestFinalizedStateIndex == nil { + m.LatestFinalizedStateIndex = &StateInfoIndex{} + } + if err := m.LatestFinalizedStateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestHeight", wireType) + } + m.LatestHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFinalizedHeight", wireType) + } + m.LatestFinalizedHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestFinalizedHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *QueryAllRollappRequest) 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: QueryAllRollappRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllRollappRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.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 *QueryAllRollappResponse) 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: QueryAllRollappResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllRollappResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rollapp", 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.Rollapp = append(m.Rollapp, RollappSummary{}) + if err := m.Rollapp[len(m.Rollapp)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.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 *QueryGetStateInfoRequest) 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: QueryGetStateInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetStateInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", 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.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Finalized", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Finalized = bool(v != 0) + 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 *QueryGetStateInfoResponse) 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: QueryGetStateInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetStateInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfo", 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.StateInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollapp/types/query.pb.gw.go b/x/rollapp/types/query.pb.gw.go new file mode 100644 index 00000000..f30646eb --- /dev/null +++ b/x/rollapp/types/query.pb.gw.go @@ -0,0 +1,817 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: nucleic/rollapp/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Rollapp_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRollappRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + msg, err := client.Rollapp(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Rollapp_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRollappRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + msg, err := server.Rollapp(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_RollappByEIP155_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRollappByEIP155Request + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["eip155"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "eip155") + } + + protoReq.Eip155, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "eip155", err) + } + + msg, err := client.RollappByEIP155(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RollappByEIP155_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRollappByEIP155Request + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["eip155"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "eip155") + } + + protoReq.Eip155, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "eip155", err) + } + + msg, err := server.RollappByEIP155(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_RollappAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_RollappAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRollappRequest + 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_Query_RollappAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RollappAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RollappAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRollappRequest + 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_Query_RollappAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RollappAll(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_LatestHeight_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollappId": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_LatestHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestHeightRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestHeight_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.LatestHeight(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LatestHeight_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestHeightRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestHeight_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.LatestHeight(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_LatestStateIndex_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollappId": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_LatestStateIndex_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestStateIndexRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestStateIndex_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.LatestStateIndex(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LatestStateIndex_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestStateIndexRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestStateIndex_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.LatestStateIndex(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_StateInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollappId": 0, "index": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + +func request_Query_StateInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetStateInfoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + val, ok = pathParams["index"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") + } + + protoReq.Index, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_StateInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.StateInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_StateInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetStateInfoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + val, ok = pathParams["index"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") + } + + protoReq.Index, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_StateInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.StateInfo(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Rollapp_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_Rollapp_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_Rollapp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RollappByEIP155_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_RollappByEIP155_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_RollappByEIP155_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RollappAll_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_RollappAll_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_RollappAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestHeight_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_LatestHeight_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_LatestHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestStateIndex_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_LatestStateIndex_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_LatestStateIndex_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StateInfo_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_StateInfo_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_StateInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Rollapp_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_Rollapp_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_Rollapp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RollappByEIP155_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_RollappByEIP155_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_RollappByEIP155_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RollappAll_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_RollappAll_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_RollappAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestHeight_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_LatestHeight_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_LatestHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestStateIndex_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_LatestStateIndex_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_LatestStateIndex_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StateInfo_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_StateInfo_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_StateInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nucleic", "rollapp", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Rollapp_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"nucleic", "rollapp", "rollappId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RollappByEIP155_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 2}, []string{"nucleic", "rollapp", "eip155"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RollappAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1}, []string{"nucleic", "rollapp"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_LatestHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"nucleic", "rollapp", "latest_height", "rollappId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_LatestStateIndex_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"nucleic", "rollapp", "latest_state_index", "rollappId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_StateInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"nucleic", "rollapp", "state_info", "rollappId", "index"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Rollapp_0 = runtime.ForwardResponseMessage + + forward_Query_RollappByEIP155_0 = runtime.ForwardResponseMessage + + forward_Query_RollappAll_0 = runtime.ForwardResponseMessage + + forward_Query_LatestHeight_0 = runtime.ForwardResponseMessage + + forward_Query_LatestStateIndex_0 = runtime.ForwardResponseMessage + + forward_Query_StateInfo_0 = runtime.ForwardResponseMessage +) diff --git a/x/rollapp/types/rollapp.go b/x/rollapp/types/rollapp.go new file mode 100644 index 00000000..86b7858a --- /dev/null +++ b/x/rollapp/types/rollapp.go @@ -0,0 +1,81 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const MaxAllowedSequencers = 100 + +func NewRollapp(creator, rollappId string, maxSequencers uint64, permissionedAddresses []string, + metadatas []*TokenMetadata, genesisAccounts RollappGenesisState, +) Rollapp { + return Rollapp{ + RollappId: rollappId, + Creator: creator, + MaxSequencers: maxSequencers, + PermissionedAddresses: permissionedAddresses, + GenesisState: genesisAccounts, + TokenMetadata: metadatas, + } +} + +func (r Rollapp) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(r.Creator) + if err != nil { + return errorsmod.Wrap(err, ErrInvalidCreatorAddress.Error()) + } + + // validate rollappId + _, err = NewChainID(r.RollappId) + if err != nil { + return err + } + + if r.MaxSequencers > MaxAllowedSequencers { + return errorsmod.Wrapf(ErrInvalidMaxSequencers, "max sequencers: %d, max sequencers allowed: %d", r.GetMaxSequencers(), MaxAllowedSequencers) + } + if uint64(len(r.PermissionedAddresses)) > r.GetMaxSequencers() { + return errorsmod.Wrapf(ErrTooManyPermissionedAddresses, "permissioned addresses: %d, max sequencers: %d", len(r.PermissionedAddresses), r.GetMaxSequencers()) + } + + // verifies that there's no duplicate address in PermissionedAddresses + // and addresses are in Bech32 format + permissionedAddresses := r.GetPermissionedAddresses() + if len(permissionedAddresses) > 0 { + duplicateAddresses := make(map[string]bool) + for _, item := range permissionedAddresses { + // check if the item/element exist in the duplicateAddresses map + _, exist := duplicateAddresses[item] + if exist { + return errorsmod.Wrapf(ErrPermissionedAddressesDuplicate, "address: %s", item) + } + // check Bech32 format + if _, err := sdk.AccAddressFromBech32(item); err != nil { + return errorsmod.Wrapf(ErrInvalidPermissionedAddress, "%s", err) + } + // mark as exist + duplicateAddresses[item] = true + } + } + + // verifies that token metadata, if any, must be valid + if len(r.TokenMetadata) > 0 { + for _, metadata := range r.TokenMetadata { + if err := metadata.Validate(); err != nil { + return errorsmod.Wrapf(ErrInvalidTokenMetadata, "%s: %v", metadata.Base, err) + } + } + } + + // genesisAccounts address validation + for _, acc := range r.GenesisState.GenesisAccounts { + _, err := sdk.AccAddressFromBech32(acc.Address) + if err != nil { + return errorsmod.Wrapf(err, "invalid genesis account address (%s)", acc.Address) + } + } + + return nil +} diff --git a/x/rollup/types/rollup.pb.go b/x/rollapp/types/rollapp.pb.go similarity index 62% rename from x/rollup/types/rollup.pb.go rename to x/rollapp/types/rollapp.pb.go index ee2930cc..4e3e342a 100644 --- a/x/rollup/types/rollup.pb.go +++ b/x/rollapp/types/rollapp.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nucleic/rollup/rollup.proto +// source: nucleic/rollapp/rollapp.proto package types @@ -24,7 +24,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// GenesisAccount is a struct for the genesis account for the Rollup +// GenesisAccount is a struct for the genesis account for the rollapp type GenesisAccount struct { // amount of coins to be sent to the genesis address Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` @@ -36,7 +36,7 @@ func (m *GenesisAccount) Reset() { *m = GenesisAccount{} } func (m *GenesisAccount) String() string { return proto.CompactTextString(m) } func (*GenesisAccount) ProtoMessage() {} func (*GenesisAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_ca266ab929c281b5, []int{0} + return fileDescriptor_aecaa292d97582fe, []int{0} } func (m *GenesisAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -79,26 +79,26 @@ func (m *GenesisAccount) GetAddress() string { return "" } -// RollupGenesisState is a partial repr of the state the hub can expect the Rollup to be in upon genesis -type RollupGenesisState struct { +// RollappGenesisState is a partial repr of the state the hub can expect the rollapp to be in upon genesis +type RollappGenesisState struct { // genesis_accounts is a list of token allocations GenesisAccounts []*GenesisAccount `protobuf:"bytes,1,rep,name=genesis_accounts,json=genesisAccounts,proto3" json:"genesis_accounts,omitempty"` // is_genesis_event is a boolean that indicates if the genesis event has occured IsGenesisEvent bool `protobuf:"varint,2,opt,name=is_genesis_event,json=isGenesisEvent,proto3" json:"is_genesis_event,omitempty"` } -func (m *RollupGenesisState) Reset() { *m = RollupGenesisState{} } -func (m *RollupGenesisState) String() string { return proto.CompactTextString(m) } -func (*RollupGenesisState) ProtoMessage() {} -func (*RollupGenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_ca266ab929c281b5, []int{1} +func (m *RollappGenesisState) Reset() { *m = RollappGenesisState{} } +func (m *RollappGenesisState) String() string { return proto.CompactTextString(m) } +func (*RollappGenesisState) ProtoMessage() {} +func (*RollappGenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_aecaa292d97582fe, []int{1} } -func (m *RollupGenesisState) XXX_Unmarshal(b []byte) error { +func (m *RollappGenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *RollupGenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *RollappGenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_RollupGenesisState.Marshal(b, m, deterministic) + return xxx_messageInfo_RollappGenesisState.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -108,70 +108,70 @@ func (m *RollupGenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *RollupGenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_RollupGenesisState.Merge(m, src) +func (m *RollappGenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_RollappGenesisState.Merge(m, src) } -func (m *RollupGenesisState) XXX_Size() int { +func (m *RollappGenesisState) XXX_Size() int { return m.Size() } -func (m *RollupGenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_RollupGenesisState.DiscardUnknown(m) +func (m *RollappGenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_RollappGenesisState.DiscardUnknown(m) } -var xxx_messageInfo_RollupGenesisState proto.InternalMessageInfo +var xxx_messageInfo_RollappGenesisState proto.InternalMessageInfo -func (m *RollupGenesisState) GetGenesisAccounts() []*GenesisAccount { +func (m *RollappGenesisState) GetGenesisAccounts() []*GenesisAccount { if m != nil { return m.GenesisAccounts } return nil } -func (m *RollupGenesisState) GetIsGenesisEvent() bool { +func (m *RollappGenesisState) GetIsGenesisEvent() bool { if m != nil { return m.IsGenesisEvent } return false } -// Rollup defines a Rollup object. First the Rollup is created and then -// sequencers can be created and attached. The Rollup is identified by RollupId -type Rollup struct { - // The unique identifier of the Rollup chain. - // The RollupId follows the same standard as cosmos chain_id. - RollupId string `protobuf:"bytes,1,opt,name=rollup_id,json=rollupId,proto3" json:"rollup_id,omitempty"` - // creator is the bech32-encoded address of the Rollup creator. +// Rollapp defines a rollapp object. First the RollApp is created and then +// sequencers can be created and attached. The RollApp is identified by rollappId +type Rollapp struct { + // The unique identifier of the rollapp chain. + // The rollappId follows the same standard as cosmos chain_id. + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + // creator is the bech32-encoded address of the rollapp creator. Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` // version is the software and configuration version. // starts from 1 and increases by one on every MsgUpdateState Version uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` // maxSequencers is the maximum number of sequencers. MaxSequencers uint64 `protobuf:"varint,4,opt,name=maxSequencers,proto3" json:"maxSequencers,omitempty"` - // permissionedAddresses is a bech32-encoded address list of the sequencers that are allowed to serve this RollupId. - // In the case of an empty list, the Rollup is considered permissionless. + // permissionedAddresses is a bech32-encoded address list of the sequencers that are allowed to serve this rollappId. + // In the case of an empty list, the rollapp is considered permissionless. PermissionedAddresses []string `protobuf:"bytes,5,rep,name=permissionedAddresses,proto3" json:"permissionedAddresses,omitempty"` - // tokenMetadata is a list of TokenMetadata that are registered on this Rollup + // tokenMetadata is a list of TokenMetadata that are registered on this rollapp TokenMetadata []*TokenMetadata `protobuf:"bytes,6,rep,name=tokenMetadata,proto3" json:"tokenMetadata,omitempty"` - // genesis_state is a partial repr of the state the hub can expect the Rollup to be in upon genesis - GenesisState RollupGenesisState `protobuf:"bytes,7,opt,name=genesis_state,json=genesisState,proto3" json:"genesis_state"` - // channel_id will be set to the canonical IBC channel of the Rollup. + // genesis_state is a partial repr of the state the hub can expect the rollapp to be in upon genesis + GenesisState RollappGenesisState `protobuf:"bytes,7,opt,name=genesis_state,json=genesisState,proto3" json:"genesis_state"` + // channel_id will be set to the canonical IBC channel of the rollapp. ChannelId string `protobuf:"bytes,8,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` - // frozen is a boolean that indicates if the Rollup is frozen. + // frozen is a boolean that indicates if the rollapp is frozen. Frozen bool `protobuf:"varint,9,opt,name=frozen,proto3" json:"frozen,omitempty"` } -func (m *Rollup) Reset() { *m = Rollup{} } -func (m *Rollup) String() string { return proto.CompactTextString(m) } -func (*Rollup) ProtoMessage() {} -func (*Rollup) Descriptor() ([]byte, []int) { - return fileDescriptor_ca266ab929c281b5, []int{2} +func (m *Rollapp) Reset() { *m = Rollapp{} } +func (m *Rollapp) String() string { return proto.CompactTextString(m) } +func (*Rollapp) ProtoMessage() {} +func (*Rollapp) Descriptor() ([]byte, []int) { + return fileDescriptor_aecaa292d97582fe, []int{2} } -func (m *Rollup) XXX_Unmarshal(b []byte) error { +func (m *Rollapp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Rollup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Rollapp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Rollup.Marshal(b, m, deterministic) + return xxx_messageInfo_Rollapp.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -181,104 +181,104 @@ func (m *Rollup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Rollup) XXX_Merge(src proto.Message) { - xxx_messageInfo_Rollup.Merge(m, src) +func (m *Rollapp) XXX_Merge(src proto.Message) { + xxx_messageInfo_Rollapp.Merge(m, src) } -func (m *Rollup) XXX_Size() int { +func (m *Rollapp) XXX_Size() int { return m.Size() } -func (m *Rollup) XXX_DiscardUnknown() { - xxx_messageInfo_Rollup.DiscardUnknown(m) +func (m *Rollapp) XXX_DiscardUnknown() { + xxx_messageInfo_Rollapp.DiscardUnknown(m) } -var xxx_messageInfo_Rollup proto.InternalMessageInfo +var xxx_messageInfo_Rollapp proto.InternalMessageInfo -func (m *Rollup) GetRollupId() string { +func (m *Rollapp) GetRollappId() string { if m != nil { - return m.RollupId + return m.RollappId } return "" } -func (m *Rollup) GetCreator() string { +func (m *Rollapp) GetCreator() string { if m != nil { return m.Creator } return "" } -func (m *Rollup) GetVersion() uint64 { +func (m *Rollapp) GetVersion() uint64 { if m != nil { return m.Version } return 0 } -func (m *Rollup) GetMaxSequencers() uint64 { +func (m *Rollapp) GetMaxSequencers() uint64 { if m != nil { return m.MaxSequencers } return 0 } -func (m *Rollup) GetPermissionedAddresses() []string { +func (m *Rollapp) GetPermissionedAddresses() []string { if m != nil { return m.PermissionedAddresses } return nil } -func (m *Rollup) GetTokenMetadata() []*TokenMetadata { +func (m *Rollapp) GetTokenMetadata() []*TokenMetadata { if m != nil { return m.TokenMetadata } return nil } -func (m *Rollup) GetGenesisState() RollupGenesisState { +func (m *Rollapp) GetGenesisState() RollappGenesisState { if m != nil { return m.GenesisState } - return RollupGenesisState{} + return RollappGenesisState{} } -func (m *Rollup) GetChannelId() string { +func (m *Rollapp) GetChannelId() string { if m != nil { return m.ChannelId } return "" } -func (m *Rollup) GetFrozen() bool { +func (m *Rollapp) GetFrozen() bool { if m != nil { return m.Frozen } return false } -// Rollup summary is a compact representation of Rollup -type RollupSummary struct { - // The unique identifier of the Rollup chain. - // The RollupId follows the same standard as cosmos chain_id. - RollupId string `protobuf:"bytes,1,opt,name=rollup_id,json=rollupId,proto3" json:"rollup_id,omitempty"` - // Defines the index of the last Rollup UpdateState. +// Rollapp summary is a compact representation of Rollapp +type RollappSummary struct { + // The unique identifier of the rollapp chain. + // The rollappId follows the same standard as cosmos chain_id. + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + // Defines the index of the last rollapp UpdateState. LatestStateIndex *StateInfoIndex `protobuf:"bytes,2,opt,name=latestStateIndex,proto3" json:"latestStateIndex,omitempty"` - // Defines the index of the last Rollup UpdateState that was finalized. + // Defines the index of the last rollapp UpdateState that was finalized. LatestFinalizedStateIndex *StateInfoIndex `protobuf:"bytes,3,opt,name=latestFinalizedStateIndex,proto3" json:"latestFinalizedStateIndex,omitempty"` } -func (m *RollupSummary) Reset() { *m = RollupSummary{} } -func (m *RollupSummary) String() string { return proto.CompactTextString(m) } -func (*RollupSummary) ProtoMessage() {} -func (*RollupSummary) Descriptor() ([]byte, []int) { - return fileDescriptor_ca266ab929c281b5, []int{3} +func (m *RollappSummary) Reset() { *m = RollappSummary{} } +func (m *RollappSummary) String() string { return proto.CompactTextString(m) } +func (*RollappSummary) ProtoMessage() {} +func (*RollappSummary) Descriptor() ([]byte, []int) { + return fileDescriptor_aecaa292d97582fe, []int{3} } -func (m *RollupSummary) XXX_Unmarshal(b []byte) error { +func (m *RollappSummary) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *RollupSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *RollappSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_RollupSummary.Marshal(b, m, deterministic) + return xxx_messageInfo_RollappSummary.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -288,33 +288,33 @@ func (m *RollupSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *RollupSummary) XXX_Merge(src proto.Message) { - xxx_messageInfo_RollupSummary.Merge(m, src) +func (m *RollappSummary) XXX_Merge(src proto.Message) { + xxx_messageInfo_RollappSummary.Merge(m, src) } -func (m *RollupSummary) XXX_Size() int { +func (m *RollappSummary) XXX_Size() int { return m.Size() } -func (m *RollupSummary) XXX_DiscardUnknown() { - xxx_messageInfo_RollupSummary.DiscardUnknown(m) +func (m *RollappSummary) XXX_DiscardUnknown() { + xxx_messageInfo_RollappSummary.DiscardUnknown(m) } -var xxx_messageInfo_RollupSummary proto.InternalMessageInfo +var xxx_messageInfo_RollappSummary proto.InternalMessageInfo -func (m *RollupSummary) GetRollupId() string { +func (m *RollappSummary) GetRollappId() string { if m != nil { - return m.RollupId + return m.RollappId } return "" } -func (m *RollupSummary) GetLatestStateIndex() *StateInfoIndex { +func (m *RollappSummary) GetLatestStateIndex() *StateInfoIndex { if m != nil { return m.LatestStateIndex } return nil } -func (m *RollupSummary) GetLatestFinalizedStateIndex() *StateInfoIndex { +func (m *RollappSummary) GetLatestFinalizedStateIndex() *StateInfoIndex { if m != nil { return m.LatestFinalizedStateIndex } @@ -322,51 +322,51 @@ func (m *RollupSummary) GetLatestFinalizedStateIndex() *StateInfoIndex { } func init() { - proto.RegisterType((*GenesisAccount)(nil), "nucleic.rollup.GenesisAccount") - proto.RegisterType((*RollupGenesisState)(nil), "nucleic.rollup.RollupGenesisState") - proto.RegisterType((*Rollup)(nil), "nucleic.rollup.Rollup") - proto.RegisterType((*RollupSummary)(nil), "nucleic.rollup.RollupSummary") + proto.RegisterType((*GenesisAccount)(nil), "nucleic.rollapp.GenesisAccount") + proto.RegisterType((*RollappGenesisState)(nil), "nucleic.rollapp.RollappGenesisState") + proto.RegisterType((*Rollapp)(nil), "nucleic.rollapp.Rollapp") + proto.RegisterType((*RollappSummary)(nil), "nucleic.rollapp.RollappSummary") } -func init() { proto.RegisterFile("nucleic/rollup/rollup.proto", fileDescriptor_ca266ab929c281b5) } +func init() { proto.RegisterFile("nucleic/rollapp/rollapp.proto", fileDescriptor_aecaa292d97582fe) } -var fileDescriptor_ca266ab929c281b5 = []byte{ - // 556 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0x6e, 0xe8, 0xe8, 0x16, 0x8f, 0x96, 0xca, 0x02, 0x94, 0x76, 0x5a, 0xa8, 0x2a, 0x0e, 0xb9, - 0x90, 0xa8, 0x03, 0x89, 0xf3, 0x36, 0x01, 0x2a, 0x68, 0x97, 0x94, 0x13, 0x42, 0xaa, 0xdc, 0xe4, - 0x2d, 0xb3, 0x9a, 0xd8, 0x25, 0x76, 0x4a, 0xb7, 0x13, 0x57, 0x6e, 0xfc, 0xac, 0x1d, 0x77, 0x42, - 0x9c, 0x10, 0x6a, 0xff, 0x08, 0x8a, 0xed, 0x48, 0x6d, 0x37, 0x10, 0xa7, 0xe4, 0xbd, 0xef, 0xbd, - 0xf7, 0x3d, 0x7f, 0x9f, 0x8d, 0x0e, 0x58, 0x11, 0xa5, 0x40, 0xa3, 0x20, 0xe7, 0x69, 0x5a, 0xcc, - 0xcc, 0xc7, 0x9f, 0xe5, 0x5c, 0x72, 0xdc, 0x32, 0xa0, 0xaf, 0xb3, 0xdd, 0x47, 0x09, 0x4f, 0xb8, - 0x82, 0x82, 0xf2, 0x4f, 0x57, 0x75, 0xdd, 0x88, 0x8b, 0x8c, 0x8b, 0x60, 0x42, 0x04, 0x04, 0xf3, - 0xc1, 0x04, 0x24, 0x19, 0x04, 0x11, 0xa7, 0xcc, 0xe0, 0xdd, 0x2d, 0x0a, 0x21, 0x89, 0x04, 0x83, - 0x75, 0xb6, 0xb0, 0x09, 0x61, 0x53, 0x0d, 0xf5, 0x23, 0xd4, 0x7a, 0x0b, 0x0c, 0x04, 0x15, 0xc7, - 0x51, 0xc4, 0x0b, 0x26, 0xf1, 0x2b, 0xd4, 0x20, 0x59, 0xf9, 0xe7, 0x58, 0x3d, 0xcb, 0xdb, 0x3f, - 0xea, 0xf8, 0x9a, 0xd9, 0x2f, 0x99, 0x7d, 0xc3, 0xec, 0x9f, 0x72, 0xca, 0x4e, 0x76, 0xae, 0x7f, - 0x3d, 0xad, 0x85, 0xa6, 0x1c, 0x3b, 0x68, 0x97, 0xc4, 0x71, 0x0e, 0x42, 0x38, 0xf7, 0x7a, 0x96, - 0x67, 0x87, 0x55, 0xd8, 0xff, 0x66, 0x21, 0x1c, 0x2a, 0x6a, 0xc3, 0x35, 0x2a, 0x97, 0xc3, 0x43, - 0xd4, 0x4e, 0x74, 0x3c, 0x26, 0x9a, 0x5c, 0x38, 0x56, 0xaf, 0xee, 0xed, 0x1f, 0xb9, 0xfe, 0xa6, - 0x26, 0xfe, 0xe6, 0x8e, 0xe1, 0xc3, 0x64, 0x23, 0x16, 0xd8, 0x43, 0x6d, 0x2a, 0xc6, 0xd5, 0x34, - 0x98, 0x03, 0x93, 0x6a, 0x89, 0xbd, 0xb0, 0x45, 0x85, 0x69, 0x7e, 0x5d, 0x66, 0xfb, 0x5f, 0xeb, - 0xa8, 0xa1, 0x77, 0xc1, 0x07, 0xc8, 0xd6, 0xe3, 0xc7, 0x34, 0x56, 0x87, 0xb5, 0xc3, 0x3d, 0x9d, - 0x18, 0xc6, 0xe5, 0x69, 0xa2, 0x1c, 0x88, 0xe4, 0x79, 0x75, 0x1a, 0x13, 0x96, 0xc8, 0x1c, 0x72, - 0x41, 0x39, 0x73, 0xea, 0x3d, 0xcb, 0xdb, 0x09, 0xab, 0x10, 0x3f, 0x43, 0xcd, 0x8c, 0x2c, 0x46, - 0xf0, 0xb9, 0x00, 0x16, 0x41, 0x2e, 0x9c, 0x1d, 0x85, 0x6f, 0x26, 0xf1, 0x4b, 0xf4, 0x78, 0x06, - 0x79, 0x46, 0x45, 0xd9, 0x03, 0xf1, 0xb1, 0x16, 0x09, 0x84, 0x73, 0xbf, 0x57, 0xf7, 0xec, 0xf0, - 0x6e, 0x10, 0x9f, 0xa2, 0xa6, 0xe4, 0x53, 0x60, 0x67, 0x20, 0x49, 0x4c, 0x24, 0x71, 0x1a, 0x4a, - 0xa9, 0xc3, 0x6d, 0xa5, 0x3e, 0xac, 0x17, 0x85, 0x9b, 0x3d, 0xf8, 0x0c, 0x35, 0x2b, 0x8d, 0xd4, - 0xfd, 0x70, 0x76, 0x95, 0xc5, 0xfd, 0xed, 0x21, 0xb7, 0xcd, 0x32, 0x5e, 0x3f, 0x48, 0xd6, 0x0d, - 0x3c, 0x44, 0x28, 0xba, 0x20, 0x8c, 0x41, 0x5a, 0x2a, 0xb8, 0xa7, 0x64, 0xb2, 0x4d, 0x66, 0x18, - 0xe3, 0x27, 0xa8, 0x71, 0x9e, 0xf3, 0x2b, 0x60, 0x8e, 0xad, 0xac, 0x30, 0x51, 0xff, 0x87, 0x85, - 0x9a, 0x9a, 0x61, 0x54, 0x64, 0x19, 0xc9, 0x2f, 0xff, 0xed, 0xc4, 0x3b, 0xd4, 0x4e, 0x89, 0x04, - 0x21, 0x15, 0xe9, 0x90, 0xc5, 0xb0, 0x50, 0x96, 0xdc, 0x71, 0x4d, 0x4c, 0xc5, 0x39, 0x57, 0x55, - 0xe1, 0xad, 0x3e, 0xfc, 0x09, 0x75, 0x74, 0xee, 0x0d, 0x65, 0x24, 0xa5, 0x57, 0x10, 0xaf, 0x0d, - 0xad, 0xff, 0xd7, 0xd0, 0xbf, 0x0f, 0x38, 0x79, 0x7f, 0xbd, 0x74, 0xad, 0x9b, 0xa5, 0x6b, 0xfd, - 0x5e, 0xba, 0xd6, 0xf7, 0x95, 0x5b, 0xbb, 0x59, 0xb9, 0xb5, 0x9f, 0x2b, 0xb7, 0xf6, 0x71, 0x90, - 0x50, 0x79, 0x51, 0x4c, 0xfc, 0x88, 0x67, 0x81, 0x19, 0xff, 0x9c, 0x81, 0xfc, 0xc2, 0xf3, 0x69, - 0x15, 0x07, 0x8b, 0xea, 0x79, 0xca, 0xcb, 0x19, 0x88, 0x49, 0x43, 0x3d, 0xd0, 0x17, 0x7f, 0x02, - 0x00, 0x00, 0xff, 0xff, 0x76, 0x9b, 0xa9, 0xd8, 0x3c, 0x04, 0x00, 0x00, +var fileDescriptor_aecaa292d97582fe = []byte{ + // 560 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x49, 0x6f, 0xd3, 0x40, + 0x18, 0x8d, 0x49, 0x49, 0x9a, 0x29, 0x49, 0xa3, 0x61, 0x91, 0x1b, 0x51, 0xd7, 0x8a, 0x7a, 0xf0, + 0x05, 0x5b, 0x0d, 0x48, 0x9c, 0x5b, 0x36, 0x85, 0x45, 0x48, 0x0e, 0x27, 0x24, 0x14, 0x4d, 0xec, + 0x2f, 0xee, 0x28, 0xf6, 0x4c, 0xf0, 0x4c, 0x42, 0xda, 0x3b, 0x27, 0x2e, 0xfc, 0xac, 0x1e, 0x7b, + 0x44, 0x1c, 0x10, 0x4a, 0xfe, 0x08, 0xf2, 0x78, 0x0c, 0xd9, 0x10, 0x9c, 0xec, 0x6f, 0x7b, 0xef, + 0xcd, 0xf7, 0x66, 0xd0, 0x21, 0x9b, 0x04, 0x31, 0xd0, 0xc0, 0x4b, 0x79, 0x1c, 0x93, 0xf1, 0xb8, + 0xf8, 0xba, 0xe3, 0x94, 0x4b, 0x8e, 0xf7, 0x75, 0xd9, 0xd5, 0xe9, 0xd6, 0x9d, 0x88, 0x47, 0x5c, + 0xd5, 0xbc, 0xec, 0x2f, 0x6f, 0x6b, 0x59, 0x01, 0x17, 0x09, 0x17, 0xde, 0x80, 0x08, 0xf0, 0xa6, + 0x27, 0x03, 0x90, 0xe4, 0xc4, 0x0b, 0x38, 0x65, 0xba, 0x6e, 0xaf, 0xb3, 0x08, 0x49, 0x24, 0xf4, + 0x29, 0x1b, 0x16, 0x08, 0xad, 0xf5, 0x8e, 0x01, 0x61, 0xa3, 0xbc, 0xd6, 0x0e, 0x50, 0xe3, 0x05, + 0x30, 0x10, 0x54, 0x9c, 0x06, 0x01, 0x9f, 0x30, 0x89, 0x1f, 0xa3, 0x0a, 0x49, 0xb2, 0x3f, 0xd3, + 0xb0, 0x0d, 0x67, 0xaf, 0x73, 0xe0, 0xe6, 0x02, 0xdc, 0x4c, 0x80, 0xab, 0x05, 0xb8, 0x4f, 0x38, + 0x65, 0x67, 0x3b, 0x57, 0x3f, 0x8e, 0x4a, 0xbe, 0x6e, 0xc7, 0x26, 0xaa, 0x92, 0x30, 0x4c, 0x41, + 0x08, 0xf3, 0x86, 0x6d, 0x38, 0x35, 0xbf, 0x08, 0xdb, 0x5f, 0x0c, 0x74, 0xdb, 0xcf, 0xb9, 0x35, + 0x59, 0x2f, 0xd3, 0x88, 0x5f, 0xa2, 0x66, 0x94, 0xc7, 0x7d, 0x92, 0xb3, 0x0b, 0xd3, 0xb0, 0xcb, + 0xce, 0x5e, 0xe7, 0xc8, 0x5d, 0x5b, 0x8e, 0xbb, 0xaa, 0xd2, 0xdf, 0x8f, 0x56, 0x62, 0x81, 0x1d, + 0xd4, 0xa4, 0xa2, 0x5f, 0xc0, 0xc1, 0x14, 0x98, 0x54, 0x32, 0x76, 0xfd, 0x06, 0x15, 0x7a, 0xf8, + 0x59, 0x96, 0x6d, 0x7f, 0x2e, 0xa3, 0xaa, 0x56, 0x83, 0xef, 0xa3, 0x9a, 0x26, 0xe8, 0x86, 0xea, + 0xbc, 0x35, 0xff, 0x4f, 0x22, 0x3b, 0x51, 0x90, 0x02, 0x91, 0x3c, 0x2d, 0x4e, 0xa4, 0xc3, 0xac, + 0x32, 0x85, 0x54, 0x50, 0xce, 0xcc, 0xb2, 0x6d, 0x38, 0x3b, 0x7e, 0x11, 0xe2, 0x63, 0x54, 0x4f, + 0xc8, 0xac, 0x07, 0x1f, 0x27, 0xc0, 0x02, 0x48, 0x85, 0xb9, 0xa3, 0xea, 0xab, 0x49, 0xfc, 0x08, + 0xdd, 0x1d, 0x43, 0x9a, 0x50, 0x91, 0xcd, 0x40, 0x78, 0x9a, 0x2f, 0x0a, 0x84, 0x79, 0xd3, 0x2e, + 0x3b, 0x35, 0x7f, 0x7b, 0x11, 0x3f, 0x45, 0x75, 0xc9, 0x47, 0xc0, 0xde, 0x80, 0x24, 0x21, 0x91, + 0xc4, 0xac, 0xa8, 0x65, 0x59, 0x1b, 0xcb, 0x7a, 0xb7, 0xdc, 0xe5, 0xaf, 0x0e, 0xe1, 0xb7, 0xa8, + 0x5e, 0xac, 0x49, 0x5d, 0x15, 0xb3, 0xaa, 0x7c, 0x3e, 0xde, 0x40, 0xd9, 0x62, 0x99, 0xb6, 0xfc, + 0x56, 0xb4, 0x6c, 0xe3, 0x21, 0x42, 0xc1, 0x39, 0x61, 0x0c, 0xe2, 0x3e, 0x0d, 0xcd, 0xdd, 0x7c, + 0x8b, 0x3a, 0xd3, 0x0d, 0xf1, 0x3d, 0x54, 0x19, 0xa6, 0xfc, 0x12, 0x98, 0x59, 0x53, 0x7e, 0xe8, + 0xa8, 0xfd, 0xdd, 0x40, 0x0d, 0x4d, 0xd1, 0x9b, 0x24, 0x09, 0x49, 0x2f, 0xfe, 0x61, 0xc7, 0x2b, + 0xd4, 0x8c, 0x89, 0x04, 0x21, 0x15, 0x6d, 0x97, 0x85, 0x30, 0x53, 0xbe, 0x6c, 0xbb, 0x2e, 0xba, + 0x65, 0xc8, 0x55, 0x9b, 0xbf, 0x31, 0x88, 0x3f, 0xa0, 0x83, 0x3c, 0xf7, 0x9c, 0x32, 0x12, 0xd3, + 0x4b, 0x08, 0x97, 0x50, 0xcb, 0xff, 0x87, 0xfa, 0x77, 0x84, 0xb3, 0xd7, 0x57, 0x73, 0xcb, 0xb8, + 0x9e, 0x5b, 0xc6, 0xcf, 0xb9, 0x65, 0x7c, 0x5d, 0x58, 0xa5, 0xeb, 0x85, 0x55, 0xfa, 0xb6, 0xb0, + 0x4a, 0xef, 0x3b, 0x11, 0x95, 0xe7, 0x93, 0x81, 0x1b, 0xf0, 0xc4, 0xd3, 0xf8, 0x0f, 0x18, 0xc8, + 0x4f, 0x3c, 0x1d, 0x15, 0xb1, 0x37, 0xfb, 0xfd, 0x54, 0xe5, 0xc5, 0x18, 0xc4, 0xa0, 0xa2, 0x1e, + 0xeb, 0xc3, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb0, 0xdb, 0x41, 0x1c, 0x52, 0x04, 0x00, 0x00, } func (m *GenesisAccount) Marshal() (dAtA []byte, err error) { @@ -392,7 +392,7 @@ func (m *GenesisAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { if len(m.Address) > 0 { i -= len(m.Address) copy(dAtA[i:], m.Address) - i = encodeVarintRollup(dAtA, i, uint64(len(m.Address))) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.Address))) i-- dAtA[i] = 0x12 } @@ -402,14 +402,14 @@ func (m *GenesisAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRollup(dAtA, i, uint64(size)) + i = encodeVarintRollapp(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *RollupGenesisState) Marshal() (dAtA []byte, err error) { +func (m *RollappGenesisState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -419,12 +419,12 @@ func (m *RollupGenesisState) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RollupGenesisState) MarshalTo(dAtA []byte) (int, error) { +func (m *RollappGenesisState) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *RollupGenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RollappGenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -447,7 +447,7 @@ func (m *RollupGenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRollup(dAtA, i, uint64(size)) + i = encodeVarintRollapp(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -456,7 +456,7 @@ func (m *RollupGenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Rollup) Marshal() (dAtA []byte, err error) { +func (m *Rollapp) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -466,12 +466,12 @@ func (m *Rollup) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Rollup) MarshalTo(dAtA []byte) (int, error) { +func (m *Rollapp) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Rollup) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Rollapp) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -489,7 +489,7 @@ func (m *Rollup) MarshalToSizedBuffer(dAtA []byte) (int, error) { if len(m.ChannelId) > 0 { i -= len(m.ChannelId) copy(dAtA[i:], m.ChannelId) - i = encodeVarintRollup(dAtA, i, uint64(len(m.ChannelId))) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.ChannelId))) i-- dAtA[i] = 0x42 } @@ -499,7 +499,7 @@ func (m *Rollup) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRollup(dAtA, i, uint64(size)) + i = encodeVarintRollapp(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x3a @@ -511,7 +511,7 @@ func (m *Rollup) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRollup(dAtA, i, uint64(size)) + i = encodeVarintRollapp(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x32 @@ -521,39 +521,39 @@ func (m *Rollup) MarshalToSizedBuffer(dAtA []byte) (int, error) { for iNdEx := len(m.PermissionedAddresses) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.PermissionedAddresses[iNdEx]) copy(dAtA[i:], m.PermissionedAddresses[iNdEx]) - i = encodeVarintRollup(dAtA, i, uint64(len(m.PermissionedAddresses[iNdEx]))) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.PermissionedAddresses[iNdEx]))) i-- dAtA[i] = 0x2a } } if m.MaxSequencers != 0 { - i = encodeVarintRollup(dAtA, i, uint64(m.MaxSequencers)) + i = encodeVarintRollapp(dAtA, i, uint64(m.MaxSequencers)) i-- dAtA[i] = 0x20 } if m.Version != 0 { - i = encodeVarintRollup(dAtA, i, uint64(m.Version)) + i = encodeVarintRollapp(dAtA, i, uint64(m.Version)) i-- dAtA[i] = 0x18 } if len(m.Creator) > 0 { i -= len(m.Creator) copy(dAtA[i:], m.Creator) - i = encodeVarintRollup(dAtA, i, uint64(len(m.Creator))) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.Creator))) i-- dAtA[i] = 0x12 } - if len(m.RollupId) > 0 { - i -= len(m.RollupId) - copy(dAtA[i:], m.RollupId) - i = encodeVarintRollup(dAtA, i, uint64(len(m.RollupId))) + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.RollappId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *RollupSummary) Marshal() (dAtA []byte, err error) { +func (m *RollappSummary) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -563,12 +563,12 @@ func (m *RollupSummary) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RollupSummary) MarshalTo(dAtA []byte) (int, error) { +func (m *RollappSummary) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *RollupSummary) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RollappSummary) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -580,7 +580,7 @@ func (m *RollupSummary) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRollup(dAtA, i, uint64(size)) + i = encodeVarintRollapp(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a @@ -592,23 +592,23 @@ func (m *RollupSummary) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintRollup(dAtA, i, uint64(size)) + i = encodeVarintRollapp(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } - if len(m.RollupId) > 0 { - i -= len(m.RollupId) - copy(dAtA[i:], m.RollupId) - i = encodeVarintRollup(dAtA, i, uint64(len(m.RollupId))) + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.RollappId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func encodeVarintRollup(dAtA []byte, offset int, v uint64) int { - offset -= sovRollup(v) +func encodeVarintRollapp(dAtA []byte, offset int, v uint64) int { + offset -= sovRollapp(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -625,15 +625,15 @@ func (m *GenesisAccount) Size() (n int) { var l int _ = l l = m.Amount.Size() - n += 1 + l + sovRollup(uint64(l)) + n += 1 + l + sovRollapp(uint64(l)) l = len(m.Address) if l > 0 { - n += 1 + l + sovRollup(uint64(l)) + n += 1 + l + sovRollapp(uint64(l)) } return n } -func (m *RollupGenesisState) Size() (n int) { +func (m *RollappGenesisState) Size() (n int) { if m == nil { return 0 } @@ -642,7 +642,7 @@ func (m *RollupGenesisState) Size() (n int) { if len(m.GenesisAccounts) > 0 { for _, e := range m.GenesisAccounts { l = e.Size() - n += 1 + l + sovRollup(uint64(l)) + n += 1 + l + sovRollapp(uint64(l)) } } if m.IsGenesisEvent { @@ -651,43 +651,43 @@ func (m *RollupGenesisState) Size() (n int) { return n } -func (m *Rollup) Size() (n int) { +func (m *Rollapp) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.RollupId) + l = len(m.RollappId) if l > 0 { - n += 1 + l + sovRollup(uint64(l)) + n += 1 + l + sovRollapp(uint64(l)) } l = len(m.Creator) if l > 0 { - n += 1 + l + sovRollup(uint64(l)) + n += 1 + l + sovRollapp(uint64(l)) } if m.Version != 0 { - n += 1 + sovRollup(uint64(m.Version)) + n += 1 + sovRollapp(uint64(m.Version)) } if m.MaxSequencers != 0 { - n += 1 + sovRollup(uint64(m.MaxSequencers)) + n += 1 + sovRollapp(uint64(m.MaxSequencers)) } if len(m.PermissionedAddresses) > 0 { for _, s := range m.PermissionedAddresses { l = len(s) - n += 1 + l + sovRollup(uint64(l)) + n += 1 + l + sovRollapp(uint64(l)) } } if len(m.TokenMetadata) > 0 { for _, e := range m.TokenMetadata { l = e.Size() - n += 1 + l + sovRollup(uint64(l)) + n += 1 + l + sovRollapp(uint64(l)) } } l = m.GenesisState.Size() - n += 1 + l + sovRollup(uint64(l)) + n += 1 + l + sovRollapp(uint64(l)) l = len(m.ChannelId) if l > 0 { - n += 1 + l + sovRollup(uint64(l)) + n += 1 + l + sovRollapp(uint64(l)) } if m.Frozen { n += 2 @@ -695,32 +695,32 @@ func (m *Rollup) Size() (n int) { return n } -func (m *RollupSummary) Size() (n int) { +func (m *RollappSummary) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.RollupId) + l = len(m.RollappId) if l > 0 { - n += 1 + l + sovRollup(uint64(l)) + n += 1 + l + sovRollapp(uint64(l)) } if m.LatestStateIndex != nil { l = m.LatestStateIndex.Size() - n += 1 + l + sovRollup(uint64(l)) + n += 1 + l + sovRollapp(uint64(l)) } if m.LatestFinalizedStateIndex != nil { l = m.LatestFinalizedStateIndex.Size() - n += 1 + l + sovRollup(uint64(l)) + n += 1 + l + sovRollapp(uint64(l)) } return n } -func sovRollup(x uint64) (n int) { +func sovRollapp(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } -func sozRollup(x uint64) (n int) { - return sovRollup(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozRollapp(x uint64) (n int) { + return sovRollapp(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *GenesisAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -730,7 +730,7 @@ func (m *GenesisAccount) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -758,7 +758,7 @@ func (m *GenesisAccount) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -771,11 +771,11 @@ func (m *GenesisAccount) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if postIndex > l { return io.ErrUnexpectedEOF @@ -791,7 +791,7 @@ func (m *GenesisAccount) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -805,11 +805,11 @@ func (m *GenesisAccount) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if postIndex > l { return io.ErrUnexpectedEOF @@ -818,12 +818,12 @@ func (m *GenesisAccount) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipRollup(dAtA[iNdEx:]) + skippy, err := skipRollapp(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -837,7 +837,7 @@ func (m *GenesisAccount) Unmarshal(dAtA []byte) error { } return nil } -func (m *RollupGenesisState) Unmarshal(dAtA []byte) error { +func (m *RollappGenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -845,7 +845,7 @@ func (m *RollupGenesisState) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -860,10 +860,10 @@ func (m *RollupGenesisState) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RollupGenesisState: wiretype end group for non-group") + return fmt.Errorf("proto: RollappGenesisState: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RollupGenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RollappGenesisState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -873,7 +873,7 @@ func (m *RollupGenesisState) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -886,11 +886,11 @@ func (m *RollupGenesisState) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if postIndex > l { return io.ErrUnexpectedEOF @@ -907,7 +907,7 @@ func (m *RollupGenesisState) Unmarshal(dAtA []byte) error { var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -922,12 +922,12 @@ func (m *RollupGenesisState) Unmarshal(dAtA []byte) error { m.IsGenesisEvent = bool(v != 0) default: iNdEx = preIndex - skippy, err := skipRollup(dAtA[iNdEx:]) + skippy, err := skipRollapp(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -941,7 +941,7 @@ func (m *RollupGenesisState) Unmarshal(dAtA []byte) error { } return nil } -func (m *Rollup) Unmarshal(dAtA []byte) error { +func (m *Rollapp) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -949,7 +949,7 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -964,20 +964,20 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Rollup: wiretype end group for non-group") + return fmt.Errorf("proto: Rollapp: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Rollup: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Rollapp: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RollupId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -991,16 +991,16 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if postIndex > l { return io.ErrUnexpectedEOF } - m.RollupId = string(dAtA[iNdEx:postIndex]) + m.RollappId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1009,7 +1009,7 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1023,11 +1023,11 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if postIndex > l { return io.ErrUnexpectedEOF @@ -1041,7 +1041,7 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { m.Version = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1060,7 +1060,7 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { m.MaxSequencers = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1079,7 +1079,7 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1093,11 +1093,11 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if postIndex > l { return io.ErrUnexpectedEOF @@ -1111,7 +1111,7 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1124,11 +1124,11 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if postIndex > l { return io.ErrUnexpectedEOF @@ -1145,7 +1145,7 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1158,11 +1158,11 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if postIndex > l { return io.ErrUnexpectedEOF @@ -1178,7 +1178,7 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1192,11 +1192,11 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if postIndex > l { return io.ErrUnexpectedEOF @@ -1210,7 +1210,7 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1225,12 +1225,12 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { m.Frozen = bool(v != 0) default: iNdEx = preIndex - skippy, err := skipRollup(dAtA[iNdEx:]) + skippy, err := skipRollapp(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1244,7 +1244,7 @@ func (m *Rollup) Unmarshal(dAtA []byte) error { } return nil } -func (m *RollupSummary) Unmarshal(dAtA []byte) error { +func (m *RollappSummary) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1252,7 +1252,7 @@ func (m *RollupSummary) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1267,20 +1267,20 @@ func (m *RollupSummary) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RollupSummary: wiretype end group for non-group") + return fmt.Errorf("proto: RollappSummary: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RollupSummary: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RollappSummary: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RollupId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1294,16 +1294,16 @@ func (m *RollupSummary) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if postIndex > l { return io.ErrUnexpectedEOF } - m.RollupId = string(dAtA[iNdEx:postIndex]) + m.RollappId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1312,7 +1312,7 @@ func (m *RollupSummary) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1325,11 +1325,11 @@ func (m *RollupSummary) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if postIndex > l { return io.ErrUnexpectedEOF @@ -1348,7 +1348,7 @@ func (m *RollupSummary) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowRollup + return ErrIntOverflowRollapp } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1361,11 +1361,11 @@ func (m *RollupSummary) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if postIndex > l { return io.ErrUnexpectedEOF @@ -1379,12 +1379,12 @@ func (m *RollupSummary) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipRollup(dAtA[iNdEx:]) + skippy, err := skipRollapp(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRollup + return ErrInvalidLengthRollapp } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1398,7 +1398,7 @@ func (m *RollupSummary) Unmarshal(dAtA []byte) error { } return nil } -func skipRollup(dAtA []byte) (n int, err error) { +func skipRollapp(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 @@ -1406,7 +1406,7 @@ func skipRollup(dAtA []byte) (n int, err error) { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowRollup + return 0, ErrIntOverflowRollapp } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1423,7 +1423,7 @@ func skipRollup(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowRollup + return 0, ErrIntOverflowRollapp } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1439,7 +1439,7 @@ func skipRollup(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowRollup + return 0, ErrIntOverflowRollapp } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1452,14 +1452,14 @@ func skipRollup(dAtA []byte) (n int, err error) { } } if length < 0 { - return 0, ErrInvalidLengthRollup + return 0, ErrInvalidLengthRollapp } iNdEx += length case 3: depth++ case 4: if depth == 0 { - return 0, ErrUnexpectedEndOfGroupRollup + return 0, ErrUnexpectedEndOfGroupRollapp } depth-- case 5: @@ -1468,7 +1468,7 @@ func skipRollup(dAtA []byte) (n int, err error) { return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { - return 0, ErrInvalidLengthRollup + return 0, ErrInvalidLengthRollapp } if depth == 0 { return iNdEx, nil @@ -1478,7 +1478,7 @@ func skipRollup(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthRollup = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRollup = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupRollup = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthRollapp = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRollapp = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRollapp = fmt.Errorf("proto: unexpected end of group") ) diff --git a/x/rollapp/types/state_info.go b/x/rollapp/types/state_info.go new file mode 100644 index 00000000..369399a1 --- /dev/null +++ b/x/rollapp/types/state_info.go @@ -0,0 +1,47 @@ +package types + +import ( + "strconv" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func NewStateInfo(rollappId string, newIndex uint64, creator string, startHeight, numBlocks uint64, daPath string, version, height uint64, BDs BlockDescriptors) *StateInfo { + stateInfoIndex := StateInfoIndex{RollappId: rollappId, Index: newIndex} + status := Status_PENDING + return &StateInfo{ + StateInfoIndex: stateInfoIndex, + Sequencer: creator, + StartHeight: startHeight, + NumBlocks: numBlocks, + DAPath: daPath, + Version: version, + CreationHeight: height, + Status: status, + BDs: BDs, + } +} + +func (s *StateInfo) Finalize() { + s.Status = Status_FINALIZED +} + +func (s *StateInfo) GetIndex() StateInfoIndex { + return s.StateInfoIndex +} + +func (s *StateInfo) GetLatestHeight() uint64 { + return s.StartHeight + s.NumBlocks - 1 +} + +func (s *StateInfo) GetEvents() []sdk.Attribute { + eventAttributes := []sdk.Attribute{ + sdk.NewAttribute(AttributeKeyRollappId, s.StateInfoIndex.RollappId), + sdk.NewAttribute(AttributeKeyStateInfoIndex, strconv.FormatUint(s.StateInfoIndex.Index, 10)), + sdk.NewAttribute(AttributeKeyStartHeight, strconv.FormatUint(s.StartHeight, 10)), + sdk.NewAttribute(AttributeKeyNumBlocks, strconv.FormatUint(s.NumBlocks, 10)), + sdk.NewAttribute(AttributeKeyDAPath, s.DAPath), + sdk.NewAttribute(AttributeKeyStatus, s.Status.String()), + } + return eventAttributes +} diff --git a/x/rollapp/types/state_info.pb.go b/x/rollapp/types/state_info.pb.go new file mode 100644 index 00000000..7ad81e88 --- /dev/null +++ b/x/rollapp/types/state_info.pb.go @@ -0,0 +1,1392 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/state_info.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 + +type Status int32 + +const ( + Status_PENDING Status = 0 + Status_FINALIZED Status = 1 + Status_REVERTED Status = 3 +) + +var Status_name = map[int32]string{ + 0: "PENDING", + 1: "FINALIZED", + 3: "REVERTED", +} + +var Status_value = map[string]int32{ + "PENDING": 0, + "FINALIZED": 1, + "REVERTED": 3, +} + +func (x Status) String() string { + return proto.EnumName(Status_name, int32(x)) +} + +func (Status) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_759345ac0f400d2c, []int{0} +} + +// StateInfoIndex is the data used for indexing and retrieving a StateInfo +// it updated and saved with every UpdateState in StateInfo. +// We use the this structure also for: +// 1. LatestStateInfoIndex which defines the rollapps' current (latest) index of the last UpdateState +// 2. LatestFinalizedStateIndex which defines the rollapps' current (latest) index of the latest StateInfo that was finalized +type StateInfoIndex struct { + // rollappId is the rollapp that the sequencer belongs to and asking to update + // it used to identify the what rollapp a StateInfo belongs + // The rollappId follows the same standard as cosmos chain_id + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + // index is a sequential increasing number, updating on each + // state update used for indexing to a specific state info, the first index is 1 + Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` +} + +func (m *StateInfoIndex) Reset() { *m = StateInfoIndex{} } +func (m *StateInfoIndex) String() string { return proto.CompactTextString(m) } +func (*StateInfoIndex) ProtoMessage() {} +func (*StateInfoIndex) Descriptor() ([]byte, []int) { + return fileDescriptor_759345ac0f400d2c, []int{0} +} +func (m *StateInfoIndex) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateInfoIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateInfoIndex.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 *StateInfoIndex) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateInfoIndex.Merge(m, src) +} +func (m *StateInfoIndex) XXX_Size() int { + return m.Size() +} +func (m *StateInfoIndex) XXX_DiscardUnknown() { + xxx_messageInfo_StateInfoIndex.DiscardUnknown(m) +} + +var xxx_messageInfo_StateInfoIndex proto.InternalMessageInfo + +func (m *StateInfoIndex) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *StateInfoIndex) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +// StateInfo defines a rollapps' state. +type StateInfo struct { + // stateInfoIndex defines what rollapp the state belongs to + // and in which index it can be referenced + StateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=stateInfoIndex,proto3" json:"stateInfoIndex"` + // sequencer is the bech32-encoded address of the sequencer sent the update + Sequencer string `protobuf:"bytes,2,opt,name=sequencer,proto3" json:"sequencer,omitempty"` + // startHeight is the block height of the first block in the batch + StartHeight uint64 `protobuf:"varint,3,opt,name=startHeight,proto3" json:"startHeight,omitempty"` + // numBlocks is the number of blocks included in this batch update + NumBlocks uint64 `protobuf:"varint,4,opt,name=numBlocks,proto3" json:"numBlocks,omitempty"` + // DAPath is the description of the location on the DA layer + DAPath string `protobuf:"bytes,5,opt,name=DAPath,proto3" json:"DAPath,omitempty"` + // version is the version of the rollapp + Version uint64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"` + // creationHeight is the height at which the UpdateState took place + CreationHeight uint64 `protobuf:"varint,7,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` + // status is the status of the state update + Status Status `protobuf:"varint,8,opt,name=status,proto3,enum=nucleic.rollapp.Status" json:"status,omitempty"` + // BDs is a list of block description objects (one per block) + // the list must be ordered by height, starting from startHeight to startHeight+numBlocks-1 + BDs BlockDescriptors `protobuf:"bytes,9,opt,name=BDs,proto3" json:"BDs"` +} + +func (m *StateInfo) Reset() { *m = StateInfo{} } +func (m *StateInfo) String() string { return proto.CompactTextString(m) } +func (*StateInfo) ProtoMessage() {} +func (*StateInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_759345ac0f400d2c, []int{1} +} +func (m *StateInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateInfo.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 *StateInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateInfo.Merge(m, src) +} +func (m *StateInfo) XXX_Size() int { + return m.Size() +} +func (m *StateInfo) XXX_DiscardUnknown() { + xxx_messageInfo_StateInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_StateInfo proto.InternalMessageInfo + +func (m *StateInfo) GetStateInfoIndex() StateInfoIndex { + if m != nil { + return m.StateInfoIndex + } + return StateInfoIndex{} +} + +func (m *StateInfo) GetSequencer() string { + if m != nil { + return m.Sequencer + } + return "" +} + +func (m *StateInfo) GetStartHeight() uint64 { + if m != nil { + return m.StartHeight + } + return 0 +} + +func (m *StateInfo) GetNumBlocks() uint64 { + if m != nil { + return m.NumBlocks + } + return 0 +} + +func (m *StateInfo) GetDAPath() string { + if m != nil { + return m.DAPath + } + return "" +} + +func (m *StateInfo) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *StateInfo) GetCreationHeight() uint64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +func (m *StateInfo) GetStatus() Status { + if m != nil { + return m.Status + } + return Status_PENDING +} + +func (m *StateInfo) GetBDs() BlockDescriptors { + if m != nil { + return m.BDs + } + return BlockDescriptors{} +} + +// StateInfoSummary is a compact representation of StateInfo +type StateInfoSummary struct { + // stateInfoIndex defines what rollapp the state belongs to + // and in which index it can be referenced + StateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=stateInfoIndex,proto3" json:"stateInfoIndex"` + // status is the status of the state update + Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=nucleic.rollapp.Status" json:"status,omitempty"` + // creationHeight is the height at which the UpdateState took place + CreationHeight uint64 `protobuf:"varint,3,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` +} + +func (m *StateInfoSummary) Reset() { *m = StateInfoSummary{} } +func (m *StateInfoSummary) String() string { return proto.CompactTextString(m) } +func (*StateInfoSummary) ProtoMessage() {} +func (*StateInfoSummary) Descriptor() ([]byte, []int) { + return fileDescriptor_759345ac0f400d2c, []int{2} +} +func (m *StateInfoSummary) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateInfoSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateInfoSummary.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 *StateInfoSummary) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateInfoSummary.Merge(m, src) +} +func (m *StateInfoSummary) XXX_Size() int { + return m.Size() +} +func (m *StateInfoSummary) XXX_DiscardUnknown() { + xxx_messageInfo_StateInfoSummary.DiscardUnknown(m) +} + +var xxx_messageInfo_StateInfoSummary proto.InternalMessageInfo + +func (m *StateInfoSummary) GetStateInfoIndex() StateInfoIndex { + if m != nil { + return m.StateInfoIndex + } + return StateInfoIndex{} +} + +func (m *StateInfoSummary) GetStatus() Status { + if m != nil { + return m.Status + } + return Status_PENDING +} + +func (m *StateInfoSummary) GetCreationHeight() uint64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +// BlockHeightToFinalizationQueue defines a map from block height to list of states to finalized +type BlockHeightToFinalizationQueue struct { + // creationHeight is the block height that the state should be finalized + CreationHeight uint64 `protobuf:"varint,1,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` + // finalizationQueue is a list of states that are waiting to be finalized + // when the block height becomes creationHeight + FinalizationQueue []StateInfoIndex `protobuf:"bytes,2,rep,name=finalizationQueue,proto3" json:"finalizationQueue"` +} + +func (m *BlockHeightToFinalizationQueue) Reset() { *m = BlockHeightToFinalizationQueue{} } +func (m *BlockHeightToFinalizationQueue) String() string { return proto.CompactTextString(m) } +func (*BlockHeightToFinalizationQueue) ProtoMessage() {} +func (*BlockHeightToFinalizationQueue) Descriptor() ([]byte, []int) { + return fileDescriptor_759345ac0f400d2c, []int{3} +} +func (m *BlockHeightToFinalizationQueue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockHeightToFinalizationQueue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockHeightToFinalizationQueue.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 *BlockHeightToFinalizationQueue) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockHeightToFinalizationQueue.Merge(m, src) +} +func (m *BlockHeightToFinalizationQueue) XXX_Size() int { + return m.Size() +} +func (m *BlockHeightToFinalizationQueue) XXX_DiscardUnknown() { + xxx_messageInfo_BlockHeightToFinalizationQueue.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockHeightToFinalizationQueue proto.InternalMessageInfo + +func (m *BlockHeightToFinalizationQueue) GetCreationHeight() uint64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +func (m *BlockHeightToFinalizationQueue) GetFinalizationQueue() []StateInfoIndex { + if m != nil { + return m.FinalizationQueue + } + return nil +} + +func init() { + proto.RegisterEnum("nucleic.rollapp.Status", Status_name, Status_value) + proto.RegisterType((*StateInfoIndex)(nil), "nucleic.rollapp.StateInfoIndex") + proto.RegisterType((*StateInfo)(nil), "nucleic.rollapp.StateInfo") + proto.RegisterType((*StateInfoSummary)(nil), "nucleic.rollapp.StateInfoSummary") + proto.RegisterType((*BlockHeightToFinalizationQueue)(nil), "nucleic.rollapp.BlockHeightToFinalizationQueue") +} + +func init() { proto.RegisterFile("nucleic/rollapp/state_info.proto", fileDescriptor_759345ac0f400d2c) } + +var fileDescriptor_759345ac0f400d2c = []byte{ + // 512 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x41, 0x6f, 0xd3, 0x3c, + 0x18, 0xae, 0xdb, 0xae, 0x5d, 0xdc, 0xef, 0x2b, 0xc5, 0x9a, 0xc0, 0x9a, 0x50, 0x16, 0x7a, 0x98, + 0x2a, 0x24, 0x1a, 0xa9, 0x9c, 0x38, 0xae, 0x4a, 0x06, 0x91, 0x46, 0x35, 0xd2, 0x89, 0xc3, 0x2e, + 0x53, 0x9a, 0xba, 0xad, 0xb5, 0xd4, 0x0e, 0xb6, 0x03, 0x1b, 0xbf, 0x82, 0x3f, 0xc0, 0x1f, 0xe1, + 0x17, 0xec, 0xb8, 0x23, 0x27, 0x84, 0xda, 0xff, 0x81, 0x50, 0x9c, 0xac, 0x65, 0x69, 0x0f, 0x3b, + 0x70, 0xf3, 0xfb, 0xfa, 0x79, 0x9e, 0xf7, 0x7d, 0x1e, 0xcb, 0xd0, 0x62, 0x49, 0x18, 0x11, 0x1a, + 0xda, 0x82, 0x47, 0x51, 0x10, 0xc7, 0xb6, 0x54, 0x81, 0x22, 0x17, 0x94, 0x4d, 0x78, 0x37, 0x16, + 0x5c, 0x71, 0xf4, 0x28, 0x47, 0x74, 0x73, 0xc4, 0xfe, 0xde, 0x94, 0x4f, 0xb9, 0xbe, 0xb3, 0xd3, + 0x53, 0x06, 0xdb, 0x3f, 0x2c, 0x0a, 0x8d, 0x22, 0x1e, 0x5e, 0x5e, 0x8c, 0x89, 0x0c, 0x05, 0x8d, + 0x15, 0x17, 0x19, 0xae, 0xed, 0xc0, 0xe6, 0x30, 0x1d, 0xe1, 0xb1, 0x09, 0xf7, 0xd8, 0x98, 0x5c, + 0xa1, 0x67, 0xd0, 0xc8, 0x39, 0xde, 0x18, 0x03, 0x0b, 0x74, 0x0c, 0x7f, 0xdd, 0x40, 0x7b, 0x70, + 0x87, 0xa6, 0x30, 0x5c, 0xb6, 0x40, 0xa7, 0xea, 0x67, 0x45, 0xfb, 0x77, 0x19, 0x1a, 0x2b, 0x19, + 0xf4, 0x0e, 0x36, 0xe5, 0x3d, 0x4d, 0x2d, 0xd3, 0xe8, 0x1d, 0x74, 0x0b, 0xbb, 0x77, 0xef, 0x8f, + 0xee, 0x57, 0x6f, 0x7e, 0x1e, 0x94, 0xfc, 0x02, 0x39, 0x5d, 0x48, 0x92, 0x8f, 0x09, 0x61, 0x21, + 0x11, 0x7a, 0xac, 0xe1, 0xaf, 0x1b, 0xc8, 0x82, 0x0d, 0xa9, 0x02, 0xa1, 0xde, 0x12, 0x3a, 0x9d, + 0x29, 0x5c, 0xd1, 0x6b, 0xfd, 0xdd, 0x4a, 0xf9, 0x2c, 0x99, 0xf7, 0x53, 0xff, 0x12, 0x57, 0xf5, + 0xfd, 0xba, 0x81, 0x9e, 0xc0, 0x9a, 0x73, 0x74, 0x1a, 0xa8, 0x19, 0xde, 0xd1, 0xd2, 0x79, 0x85, + 0x30, 0xac, 0x7f, 0x22, 0x42, 0x52, 0xce, 0x70, 0x4d, 0x73, 0xee, 0x4a, 0x74, 0x08, 0x9b, 0xa1, + 0x20, 0x81, 0xa2, 0x9c, 0xe5, 0x43, 0xeb, 0x1a, 0x50, 0xe8, 0x22, 0x1b, 0xd6, 0x52, 0x27, 0x89, + 0xc4, 0xbb, 0x16, 0xe8, 0x34, 0x7b, 0x4f, 0xb7, 0xda, 0x4f, 0xa4, 0x9f, 0xc3, 0xd0, 0x6b, 0x58, + 0xe9, 0x3b, 0x12, 0x1b, 0x3a, 0xac, 0xe7, 0x1b, 0x68, 0xbd, 0xb0, 0xb3, 0x7a, 0x40, 0x99, 0xc7, + 0x95, 0x72, 0xda, 0xdf, 0x01, 0x6c, 0xad, 0xc2, 0x1c, 0x26, 0xf3, 0x79, 0x20, 0xae, 0xff, 0xf5, + 0x3b, 0xac, 0xfd, 0x94, 0x1f, 0xe6, 0x67, 0x33, 0xa8, 0xca, 0xb6, 0xa0, 0xda, 0xdf, 0x00, 0x34, + 0xb5, 0xb9, 0xac, 0x3e, 0xe3, 0xc7, 0x94, 0x05, 0x11, 0xfd, 0xa2, 0x31, 0xef, 0x13, 0x92, 0x90, + 0x2d, 0x52, 0x60, 0x6b, 0xe6, 0x43, 0xf8, 0x78, 0x52, 0x24, 0xe3, 0xb2, 0x55, 0x79, 0xb8, 0xeb, + 0x4d, 0xfe, 0x8b, 0x1e, 0xac, 0x65, 0xce, 0x50, 0x03, 0xd6, 0x4f, 0xdd, 0x81, 0xe3, 0x0d, 0xde, + 0xb4, 0x4a, 0xe8, 0x7f, 0x68, 0x1c, 0x7b, 0x83, 0xa3, 0x13, 0xef, 0xdc, 0x75, 0x5a, 0x00, 0xfd, + 0x07, 0x77, 0x7d, 0xf7, 0x83, 0xeb, 0x9f, 0xb9, 0x4e, 0xab, 0xd2, 0x3f, 0xb9, 0x59, 0x98, 0xe0, + 0x76, 0x61, 0x82, 0x5f, 0x0b, 0x13, 0x7c, 0x5d, 0x9a, 0xa5, 0xdb, 0xa5, 0x59, 0xfa, 0xb1, 0x34, + 0x4b, 0xe7, 0xbd, 0x29, 0x55, 0xb3, 0x64, 0xd4, 0x0d, 0xf9, 0xdc, 0xce, 0x37, 0x7a, 0xc9, 0x88, + 0xfa, 0xcc, 0xc5, 0xe5, 0x5d, 0x6d, 0x5f, 0xad, 0xbe, 0xad, 0xba, 0x8e, 0x89, 0x1c, 0xd5, 0xf4, + 0x67, 0x7d, 0xf5, 0x27, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xda, 0x50, 0x32, 0x1f, 0x04, 0x00, 0x00, +} + +func (m *StateInfoIndex) 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 *StateInfoIndex) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateInfoIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Index != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintStateInfo(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StateInfo) 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 *StateInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BDs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + if m.Status != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x40 + } + if m.CreationHeight != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x38 + } + if m.Version != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x30 + } + if len(m.DAPath) > 0 { + i -= len(m.DAPath) + copy(dAtA[i:], m.DAPath) + i = encodeVarintStateInfo(dAtA, i, uint64(len(m.DAPath))) + i-- + dAtA[i] = 0x2a + } + if m.NumBlocks != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.NumBlocks)) + i-- + dAtA[i] = 0x20 + } + if m.StartHeight != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.Sequencer) > 0 { + i -= len(m.Sequencer) + copy(dAtA[i:], m.Sequencer) + i = encodeVarintStateInfo(dAtA, i, uint64(len(m.Sequencer))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.StateInfoIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StateInfoSummary) 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 *StateInfoSummary) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateInfoSummary) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationHeight != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x18 + } + if m.Status != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.StateInfoIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *BlockHeightToFinalizationQueue) 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 *BlockHeightToFinalizationQueue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockHeightToFinalizationQueue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FinalizationQueue) > 0 { + for iNdEx := len(m.FinalizationQueue) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FinalizationQueue[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.CreationHeight != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintStateInfo(dAtA []byte, offset int, v uint64) int { + offset -= sovStateInfo(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StateInfoIndex) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovStateInfo(uint64(l)) + } + if m.Index != 0 { + n += 1 + sovStateInfo(uint64(m.Index)) + } + return n +} + +func (m *StateInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateInfoIndex.Size() + n += 1 + l + sovStateInfo(uint64(l)) + l = len(m.Sequencer) + if l > 0 { + n += 1 + l + sovStateInfo(uint64(l)) + } + if m.StartHeight != 0 { + n += 1 + sovStateInfo(uint64(m.StartHeight)) + } + if m.NumBlocks != 0 { + n += 1 + sovStateInfo(uint64(m.NumBlocks)) + } + l = len(m.DAPath) + if l > 0 { + n += 1 + l + sovStateInfo(uint64(l)) + } + if m.Version != 0 { + n += 1 + sovStateInfo(uint64(m.Version)) + } + if m.CreationHeight != 0 { + n += 1 + sovStateInfo(uint64(m.CreationHeight)) + } + if m.Status != 0 { + n += 1 + sovStateInfo(uint64(m.Status)) + } + l = m.BDs.Size() + n += 1 + l + sovStateInfo(uint64(l)) + return n +} + +func (m *StateInfoSummary) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateInfoIndex.Size() + n += 1 + l + sovStateInfo(uint64(l)) + if m.Status != 0 { + n += 1 + sovStateInfo(uint64(m.Status)) + } + if m.CreationHeight != 0 { + n += 1 + sovStateInfo(uint64(m.CreationHeight)) + } + return n +} + +func (m *BlockHeightToFinalizationQueue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CreationHeight != 0 { + n += 1 + sovStateInfo(uint64(m.CreationHeight)) + } + if len(m.FinalizationQueue) > 0 { + for _, e := range m.FinalizationQueue { + l = e.Size() + n += 1 + l + sovStateInfo(uint64(l)) + } + } + return n +} + +func sovStateInfo(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStateInfo(x uint64) (n int) { + return sovStateInfo(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StateInfoIndex) 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 ErrIntOverflowStateInfo + } + 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: StateInfoIndex: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateInfoIndex: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + 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 ErrInvalidLengthStateInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStateInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStateInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StateInfo) 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 ErrIntOverflowStateInfo + } + 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: StateInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfoIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StateInfoIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + 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 ErrInvalidLengthStateInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sequencer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) + } + m.StartHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumBlocks", wireType) + } + m.NumBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DAPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + 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 ErrInvalidLengthStateInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DAPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= Status(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BDs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BDs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStateInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStateInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StateInfoSummary) 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 ErrIntOverflowStateInfo + } + 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: StateInfoSummary: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateInfoSummary: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfoIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StateInfoIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= Status(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStateInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStateInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlockHeightToFinalizationQueue) 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 ErrIntOverflowStateInfo + } + 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: BlockHeightToFinalizationQueue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockHeightToFinalizationQueue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalizationQueue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FinalizationQueue = append(m.FinalizationQueue, StateInfoIndex{}) + if err := m.FinalizationQueue[len(m.FinalizationQueue)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStateInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStateInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStateInfo(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, ErrIntOverflowStateInfo + } + 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, ErrIntOverflowStateInfo + } + 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, ErrIntOverflowStateInfo + } + 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, ErrInvalidLengthStateInfo + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStateInfo + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStateInfo + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStateInfo = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStateInfo = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStateInfo = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollapp/types/token_metadata.go b/x/rollapp/types/token_metadata.go new file mode 100644 index 00000000..9df221d2 --- /dev/null +++ b/x/rollapp/types/token_metadata.go @@ -0,0 +1,42 @@ +package types + +import ( + "errors" + + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +// Validate performs a basic validation of the coin metadata fields. +// Inherits from x/bank metadata and following same spec of x/bank/types/metadata.go +func (m *TokenMetadata) Validate() error { + if m == nil { + return errors.New("token metadata cannot be nil") + } + + bankMetadata := m.ConvertToBankMetadata() + return bankMetadata.Validate() +} + +// ConvertToBankMetadata converts TokenMetadata to Metadata of x/bank/types +func (m *TokenMetadata) ConvertToBankMetadata() banktypes.Metadata { + var denomUnits []*banktypes.DenomUnit + + for _, denomUnit := range m.DenomUnits { + denomUnits = append(denomUnits, &banktypes.DenomUnit{ + Denom: denomUnit.Denom, + Exponent: denomUnit.Exponent, + Aliases: denomUnit.Aliases, + }) + } + + return banktypes.Metadata{ + Description: m.Description, + DenomUnits: denomUnits, + Base: m.Base, + Display: m.Display, + Name: m.Name, + Symbol: m.Symbol, + URI: m.URI, + URIHash: m.URIHash, + } +} diff --git a/x/rollapp/types/tx.pb.go b/x/rollapp/types/tx.pb.go new file mode 100644 index 00000000..6eec9158 --- /dev/null +++ b/x/rollapp/types/tx.pb.go @@ -0,0 +1,1849 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "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 + +// MsgCreateRollapp creates a new rollapp chain on the hub. +type MsgCreateRollapp struct { + // creator is the bech32-encoded address of the rollapp creator + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // rollappId is the unique identifier of the rollapp chain. + // The rollappId follows the same standard as cosmos chain_id + RollappId string `protobuf:"bytes,2,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + // maxSequencers is the maximum number of sequencers + MaxSequencers uint64 `protobuf:"varint,6,opt,name=maxSequencers,proto3" json:"maxSequencers,omitempty"` + // permissionedAddresses is a bech32-encoded address list of the + // sequencers that are allowed to serve this rollappId. + // In the case of an empty list, the rollapp is considered permissionless + PermissionedAddresses []string `protobuf:"bytes,7,rep,name=permissionedAddresses,proto3" json:"permissionedAddresses,omitempty"` + // metadata provides the client information for all the registered tokens. + Metadatas []TokenMetadata `protobuf:"bytes,8,rep,name=metadatas,proto3" json:"metadatas"` + // genesis_accounts for the rollapp on the hub + GenesisAccounts []GenesisAccount `protobuf:"bytes,9,rep,name=genesis_accounts,json=genesisAccounts,proto3" json:"genesis_accounts"` +} + +func (m *MsgCreateRollapp) Reset() { *m = MsgCreateRollapp{} } +func (m *MsgCreateRollapp) String() string { return proto.CompactTextString(m) } +func (*MsgCreateRollapp) ProtoMessage() {} +func (*MsgCreateRollapp) Descriptor() ([]byte, []int) { + return fileDescriptor_eb8b6554f760aaec, []int{0} +} +func (m *MsgCreateRollapp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateRollapp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateRollapp.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 *MsgCreateRollapp) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateRollapp.Merge(m, src) +} +func (m *MsgCreateRollapp) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateRollapp) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateRollapp.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateRollapp proto.InternalMessageInfo + +func (m *MsgCreateRollapp) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgCreateRollapp) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *MsgCreateRollapp) GetMaxSequencers() uint64 { + if m != nil { + return m.MaxSequencers + } + return 0 +} + +func (m *MsgCreateRollapp) GetPermissionedAddresses() []string { + if m != nil { + return m.PermissionedAddresses + } + return nil +} + +func (m *MsgCreateRollapp) GetMetadatas() []TokenMetadata { + if m != nil { + return m.Metadatas + } + return nil +} + +func (m *MsgCreateRollapp) GetGenesisAccounts() []GenesisAccount { + if m != nil { + return m.GenesisAccounts + } + return nil +} + +type MsgCreateRollappResponse struct { +} + +func (m *MsgCreateRollappResponse) Reset() { *m = MsgCreateRollappResponse{} } +func (m *MsgCreateRollappResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateRollappResponse) ProtoMessage() {} +func (*MsgCreateRollappResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_eb8b6554f760aaec, []int{1} +} +func (m *MsgCreateRollappResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateRollappResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateRollappResponse.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 *MsgCreateRollappResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateRollappResponse.Merge(m, src) +} +func (m *MsgCreateRollappResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateRollappResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateRollappResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateRollappResponse proto.InternalMessageInfo + +// MsgUpdateState updates a rollapp state with a block batch. +// a block batch is a list of ordered blocks (by height) +type MsgUpdateState struct { + // creator is the bech32-encoded address of the sequencer sending the update + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // rollappId is the rollapp that the sequencer belongs to and asking to update + // The rollappId follows the same standard as cosmos chain_id + RollappId string `protobuf:"bytes,2,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + // startHeight is the block height of the first block in the batch + StartHeight uint64 `protobuf:"varint,3,opt,name=startHeight,proto3" json:"startHeight,omitempty"` + // numBlocks is the number of blocks included in this batch update + NumBlocks uint64 `protobuf:"varint,4,opt,name=numBlocks,proto3" json:"numBlocks,omitempty"` + // DAPath is the description of the location on the DA layer + DAPath string `protobuf:"bytes,5,opt,name=DAPath,proto3" json:"DAPath,omitempty"` + // version is the version of the rollapp + Version uint64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"` + // BDs is a list of block description objects (one per block) + // the list must be ordered by height, starting from startHeight to startHeight+numBlocks-1 + BDs BlockDescriptors `protobuf:"bytes,7,opt,name=BDs,proto3" json:"BDs"` +} + +func (m *MsgUpdateState) Reset() { *m = MsgUpdateState{} } +func (m *MsgUpdateState) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateState) ProtoMessage() {} +func (*MsgUpdateState) Descriptor() ([]byte, []int) { + return fileDescriptor_eb8b6554f760aaec, []int{2} +} +func (m *MsgUpdateState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateState.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 *MsgUpdateState) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateState.Merge(m, src) +} +func (m *MsgUpdateState) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateState) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateState.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateState proto.InternalMessageInfo + +func (m *MsgUpdateState) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateState) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *MsgUpdateState) GetStartHeight() uint64 { + if m != nil { + return m.StartHeight + } + return 0 +} + +func (m *MsgUpdateState) GetNumBlocks() uint64 { + if m != nil { + return m.NumBlocks + } + return 0 +} + +func (m *MsgUpdateState) GetDAPath() string { + if m != nil { + return m.DAPath + } + return "" +} + +func (m *MsgUpdateState) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *MsgUpdateState) GetBDs() BlockDescriptors { + if m != nil { + return m.BDs + } + return BlockDescriptors{} +} + +type MsgUpdateStateResponse struct { +} + +func (m *MsgUpdateStateResponse) Reset() { *m = MsgUpdateStateResponse{} } +func (m *MsgUpdateStateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateStateResponse) ProtoMessage() {} +func (*MsgUpdateStateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_eb8b6554f760aaec, []int{3} +} +func (m *MsgUpdateStateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateStateResponse.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 *MsgUpdateStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateStateResponse.Merge(m, src) +} +func (m *MsgUpdateStateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateStateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateStateResponse proto.InternalMessageInfo + +// MsgRollappGenesisEvent is the message type for triggering the genesis event of the rollapp +type MsgRollappGenesisEvent struct { + // address is the bech32-encoded address of the sender + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // channel_id is the rollapp channel id on the hub + ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // rollapp_id is the rollapp id we want to mint tokens on the hub. + // Used for validation against channel_id to reduce error surface. + RollappId string `protobuf:"bytes,3,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` +} + +func (m *MsgRollappGenesisEvent) Reset() { *m = MsgRollappGenesisEvent{} } +func (m *MsgRollappGenesisEvent) String() string { return proto.CompactTextString(m) } +func (*MsgRollappGenesisEvent) ProtoMessage() {} +func (*MsgRollappGenesisEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_eb8b6554f760aaec, []int{4} +} +func (m *MsgRollappGenesisEvent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRollappGenesisEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRollappGenesisEvent.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 *MsgRollappGenesisEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRollappGenesisEvent.Merge(m, src) +} +func (m *MsgRollappGenesisEvent) XXX_Size() int { + return m.Size() +} +func (m *MsgRollappGenesisEvent) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRollappGenesisEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRollappGenesisEvent proto.InternalMessageInfo + +func (m *MsgRollappGenesisEvent) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *MsgRollappGenesisEvent) GetChannelId() string { + if m != nil { + return m.ChannelId + } + return "" +} + +func (m *MsgRollappGenesisEvent) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +type MsgRollappGenesisEventResponse struct { +} + +func (m *MsgRollappGenesisEventResponse) Reset() { *m = MsgRollappGenesisEventResponse{} } +func (m *MsgRollappGenesisEventResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRollappGenesisEventResponse) ProtoMessage() {} +func (*MsgRollappGenesisEventResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_eb8b6554f760aaec, []int{5} +} +func (m *MsgRollappGenesisEventResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRollappGenesisEventResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRollappGenesisEventResponse.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 *MsgRollappGenesisEventResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRollappGenesisEventResponse.Merge(m, src) +} +func (m *MsgRollappGenesisEventResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRollappGenesisEventResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRollappGenesisEventResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRollappGenesisEventResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateRollapp)(nil), "nucleic.rollapp.MsgCreateRollapp") + proto.RegisterType((*MsgCreateRollappResponse)(nil), "nucleic.rollapp.MsgCreateRollappResponse") + proto.RegisterType((*MsgUpdateState)(nil), "nucleic.rollapp.MsgUpdateState") + proto.RegisterType((*MsgUpdateStateResponse)(nil), "nucleic.rollapp.MsgUpdateStateResponse") + proto.RegisterType((*MsgRollappGenesisEvent)(nil), "nucleic.rollapp.MsgRollappGenesisEvent") + proto.RegisterType((*MsgRollappGenesisEventResponse)(nil), "nucleic.rollapp.MsgRollappGenesisEventResponse") +} + +func init() { proto.RegisterFile("nucleic/rollapp/tx.proto", fileDescriptor_eb8b6554f760aaec) } + +var fileDescriptor_eb8b6554f760aaec = []byte{ + // 587 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xdf, 0x6e, 0xd3, 0x30, + 0x14, 0xc6, 0x9b, 0x65, 0x6c, 0xd4, 0xd5, 0xd8, 0x64, 0x60, 0xb2, 0x22, 0x96, 0x86, 0x0a, 0x41, + 0xb9, 0xa0, 0x91, 0x0a, 0x37, 0x5c, 0xb6, 0x14, 0xc1, 0x24, 0x2a, 0x4d, 0xd9, 0x10, 0x12, 0x12, + 0xaa, 0xdc, 0xe4, 0x28, 0x8d, 0xda, 0xda, 0xc1, 0x76, 0x47, 0x79, 0x0b, 0x9e, 0x84, 0x27, 0xe0, + 0x01, 0x76, 0xb9, 0x4b, 0xae, 0x10, 0x6a, 0x9f, 0x81, 0x7b, 0x94, 0xc4, 0xe9, 0x9f, 0xb4, 0xd2, + 0x10, 0x57, 0xed, 0x39, 0xdf, 0x77, 0x3e, 0x3b, 0x3f, 0x3b, 0x41, 0x84, 0x4d, 0xfc, 0x11, 0x44, + 0xbe, 0x2b, 0xf8, 0x68, 0x44, 0xe3, 0xd8, 0x55, 0xd3, 0x46, 0x2c, 0xb8, 0xe2, 0xf8, 0x50, 0x2b, + 0x0d, 0xad, 0x58, 0xf7, 0x42, 0x1e, 0xf2, 0x54, 0x73, 0x93, 0x7f, 0x99, 0xcd, 0x7a, 0x5c, 0x0c, + 0xe8, 0x8f, 0xb8, 0x3f, 0xec, 0x05, 0x20, 0x7d, 0x11, 0xc5, 0x8a, 0x0b, 0xed, 0xb3, 0x36, 0x7c, + 0x94, 0x0d, 0xb5, 0x76, 0x52, 0xd4, 0xf4, 0x6f, 0x26, 0xd7, 0x7e, 0xec, 0xa0, 0xa3, 0xae, 0x0c, + 0x5f, 0x09, 0xa0, 0x0a, 0xbc, 0x4c, 0xc2, 0x04, 0xed, 0xfb, 0x49, 0x83, 0x0b, 0x62, 0x38, 0x46, + 0xbd, 0xec, 0xe5, 0x25, 0x7e, 0x80, 0xca, 0x7a, 0xfe, 0x34, 0x20, 0x3b, 0xa9, 0xb6, 0x6c, 0xe0, + 0x47, 0xe8, 0x60, 0x4c, 0xa7, 0xe7, 0xf0, 0x79, 0x02, 0xcc, 0x07, 0x21, 0xc9, 0x9e, 0x63, 0xd4, + 0x77, 0xbd, 0xf5, 0x26, 0x7e, 0x81, 0xee, 0xc7, 0x20, 0xc6, 0x91, 0x94, 0x11, 0x67, 0x10, 0xb4, + 0x82, 0x40, 0x80, 0x94, 0x20, 0xc9, 0xbe, 0x63, 0xd6, 0xcb, 0xde, 0x76, 0x11, 0xb7, 0x51, 0x79, + 0x0c, 0x8a, 0x06, 0x54, 0x51, 0x49, 0x6e, 0x3b, 0x66, 0xbd, 0xd2, 0xb4, 0x1b, 0x05, 0x8c, 0x8d, + 0x0b, 0x3e, 0x04, 0xd6, 0xd5, 0xb6, 0xf6, 0xee, 0xd5, 0xaf, 0x6a, 0xc9, 0x5b, 0x8e, 0xe1, 0x33, + 0x74, 0x14, 0x02, 0x03, 0x19, 0xc9, 0x1e, 0xf5, 0x7d, 0x3e, 0x61, 0x4a, 0x92, 0x72, 0x1a, 0x55, + 0xdd, 0x88, 0x7a, 0x93, 0x19, 0x5b, 0x99, 0x4f, 0x67, 0x1d, 0x86, 0x6b, 0x5d, 0x59, 0xb3, 0x10, + 0x29, 0xd2, 0xf3, 0x40, 0xc6, 0x9c, 0x49, 0xa8, 0xfd, 0x31, 0xd0, 0x9d, 0xae, 0x0c, 0xdf, 0xc7, + 0x01, 0x55, 0x70, 0xae, 0xa8, 0x82, 0xff, 0x06, 0xeb, 0xa0, 0x8a, 0x54, 0x54, 0xa8, 0xb7, 0x10, + 0x85, 0x03, 0x45, 0xcc, 0x14, 0xeb, 0x6a, 0x2b, 0x99, 0x67, 0x93, 0x71, 0x3b, 0xb9, 0x1f, 0x92, + 0xec, 0xa6, 0xfa, 0xb2, 0x81, 0x8f, 0xd1, 0x5e, 0xa7, 0x75, 0x46, 0xd5, 0x80, 0xdc, 0x4a, 0xa3, + 0x75, 0x95, 0xec, 0xe7, 0x12, 0x44, 0x82, 0x5a, 0x1f, 0x55, 0x5e, 0xe2, 0x97, 0xc8, 0x6c, 0x77, + 0x92, 0x23, 0x31, 0xea, 0x95, 0xe6, 0xc3, 0x0d, 0x3a, 0x69, 0x6e, 0x67, 0x71, 0x0f, 0xa5, 0xe6, + 0x93, 0xcc, 0xd4, 0x08, 0x3a, 0x5e, 0x7f, 0xec, 0x05, 0x91, 0x38, 0x55, 0x34, 0x27, 0x0d, 0xf8, + 0xf5, 0x25, 0x30, 0x95, 0x6c, 0x84, 0x66, 0x47, 0x9d, 0x83, 0xd1, 0x25, 0x3e, 0x41, 0xc8, 0x1f, + 0x50, 0xc6, 0x60, 0xd4, 0x8b, 0x16, 0x64, 0x74, 0xe7, 0x34, 0x48, 0x64, 0xbd, 0xa7, 0x44, 0x36, + 0x0b, 0xe0, 0x6a, 0x0e, 0xb2, 0xb7, 0xaf, 0x98, 0xef, 0xa9, 0xf9, 0x7d, 0x07, 0x99, 0x5d, 0x19, + 0xe2, 0x4f, 0xe8, 0x60, 0xfd, 0x25, 0xd8, 0x7c, 0xe8, 0xe2, 0x49, 0x5b, 0x4f, 0x6f, 0xb4, 0xe4, + 0xcb, 0xe0, 0x0f, 0xa8, 0xb2, 0x7a, 0x11, 0xaa, 0xdb, 0x26, 0x57, 0x0c, 0xd6, 0x93, 0x1b, 0x0c, + 0x8b, 0x60, 0x8e, 0xee, 0x5e, 0x88, 0x28, 0x0c, 0x41, 0xac, 0x01, 0xdd, 0x3a, 0xbf, 0x85, 0x83, + 0xe5, 0xfe, 0xa3, 0x31, 0x5f, 0xb0, 0xfd, 0xee, 0x6a, 0x66, 0x1b, 0xd7, 0x33, 0xdb, 0xf8, 0x3d, + 0xb3, 0x8d, 0x6f, 0x73, 0xbb, 0x74, 0x3d, 0xb7, 0x4b, 0x3f, 0xe7, 0x76, 0xe9, 0x63, 0x33, 0x8c, + 0xd4, 0x60, 0xd2, 0x6f, 0xf8, 0x7c, 0xec, 0xea, 0xd0, 0x67, 0x0c, 0xd4, 0x17, 0x2e, 0x86, 0x79, + 0xed, 0x4e, 0x97, 0x1f, 0xc3, 0xaf, 0x31, 0xc8, 0xfe, 0x5e, 0xfa, 0x19, 0x7a, 0xfe, 0x37, 0x00, + 0x00, 0xff, 0xff, 0xa9, 0x66, 0x3c, 0x6b, 0x2c, 0x05, 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 { + CreateRollapp(ctx context.Context, in *MsgCreateRollapp, opts ...grpc.CallOption) (*MsgCreateRollappResponse, error) + UpdateState(ctx context.Context, in *MsgUpdateState, opts ...grpc.CallOption) (*MsgUpdateStateResponse, error) + TriggerGenesisEvent(ctx context.Context, in *MsgRollappGenesisEvent, opts ...grpc.CallOption) (*MsgRollappGenesisEventResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateRollapp(ctx context.Context, in *MsgCreateRollapp, opts ...grpc.CallOption) (*MsgCreateRollappResponse, error) { + out := new(MsgCreateRollappResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Msg/CreateRollapp", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateState(ctx context.Context, in *MsgUpdateState, opts ...grpc.CallOption) (*MsgUpdateStateResponse, error) { + out := new(MsgUpdateStateResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Msg/UpdateState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) TriggerGenesisEvent(ctx context.Context, in *MsgRollappGenesisEvent, opts ...grpc.CallOption) (*MsgRollappGenesisEventResponse, error) { + out := new(MsgRollappGenesisEventResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Msg/TriggerGenesisEvent", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + CreateRollapp(context.Context, *MsgCreateRollapp) (*MsgCreateRollappResponse, error) + UpdateState(context.Context, *MsgUpdateState) (*MsgUpdateStateResponse, error) + TriggerGenesisEvent(context.Context, *MsgRollappGenesisEvent) (*MsgRollappGenesisEventResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateRollapp(ctx context.Context, req *MsgCreateRollapp) (*MsgCreateRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateRollapp not implemented") +} +func (*UnimplementedMsgServer) UpdateState(ctx context.Context, req *MsgUpdateState) (*MsgUpdateStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateState not implemented") +} +func (*UnimplementedMsgServer) TriggerGenesisEvent(ctx context.Context, req *MsgRollappGenesisEvent) (*MsgRollappGenesisEventResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TriggerGenesisEvent not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateRollapp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateRollapp) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateRollapp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Msg/CreateRollapp", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateRollapp(ctx, req.(*MsgCreateRollapp)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateState) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Msg/UpdateState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateState(ctx, req.(*MsgUpdateState)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_TriggerGenesisEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRollappGenesisEvent) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).TriggerGenesisEvent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Msg/TriggerGenesisEvent", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).TriggerGenesisEvent(ctx, req.(*MsgRollappGenesisEvent)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "nucleic.rollapp.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateRollapp", + Handler: _Msg_CreateRollapp_Handler, + }, + { + MethodName: "UpdateState", + Handler: _Msg_UpdateState_Handler, + }, + { + MethodName: "TriggerGenesisEvent", + Handler: _Msg_TriggerGenesisEvent_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "nucleic/rollapp/tx.proto", +} + +func (m *MsgCreateRollapp) 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 *MsgCreateRollapp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateRollapp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.GenesisAccounts) > 0 { + for iNdEx := len(m.GenesisAccounts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GenesisAccounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } + if len(m.Metadatas) > 0 { + for iNdEx := len(m.Metadatas) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Metadatas[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if len(m.PermissionedAddresses) > 0 { + for iNdEx := len(m.PermissionedAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PermissionedAddresses[iNdEx]) + copy(dAtA[i:], m.PermissionedAddresses[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.PermissionedAddresses[iNdEx]))) + i-- + dAtA[i] = 0x3a + } + } + if m.MaxSequencers != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.MaxSequencers)) + i-- + dAtA[i] = 0x30 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateRollappResponse) 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 *MsgCreateRollappResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateRollappResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateState) 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 *MsgUpdateState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BDs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if m.Version != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x30 + } + if len(m.DAPath) > 0 { + i -= len(m.DAPath) + copy(dAtA[i:], m.DAPath) + i = encodeVarintTx(dAtA, i, uint64(len(m.DAPath))) + i-- + dAtA[i] = 0x2a + } + if m.NumBlocks != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.NumBlocks)) + i-- + dAtA[i] = 0x20 + } + if m.StartHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateStateResponse) 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 *MsgUpdateStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRollappGenesisEvent) 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 *MsgRollappGenesisEvent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRollappGenesisEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRollappGenesisEventResponse) 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 *MsgRollappGenesisEventResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRollappGenesisEventResponse) 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 *MsgCreateRollapp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.MaxSequencers != 0 { + n += 1 + sovTx(uint64(m.MaxSequencers)) + } + if len(m.PermissionedAddresses) > 0 { + for _, s := range m.PermissionedAddresses { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.Metadatas) > 0 { + for _, e := range m.Metadatas { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.GenesisAccounts) > 0 { + for _, e := range m.GenesisAccounts { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgCreateRollappResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.StartHeight != 0 { + n += 1 + sovTx(uint64(m.StartHeight)) + } + if m.NumBlocks != 0 { + n += 1 + sovTx(uint64(m.NumBlocks)) + } + l = len(m.DAPath) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Version != 0 { + n += 1 + sovTx(uint64(m.Version)) + } + l = m.BDs.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateStateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRollappGenesisEvent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRollappGenesisEventResponse) 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 *MsgCreateRollapp) 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: MsgCreateRollapp: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateRollapp: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", 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.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSequencers", wireType) + } + m.MaxSequencers = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSequencers |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PermissionedAddresses", 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.PermissionedAddresses = append(m.PermissionedAddresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadatas", 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 + } + m.Metadatas = append(m.Metadatas, TokenMetadata{}) + if err := m.Metadatas[len(m.Metadatas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisAccounts", 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 + } + m.GenesisAccounts = append(m.GenesisAccounts, GenesisAccount{}) + if err := m.GenesisAccounts[len(m.GenesisAccounts)-1].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 *MsgCreateRollappResponse) 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: MsgCreateRollappResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateRollappResponse: 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 (m *MsgUpdateState) 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: MsgUpdateState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", 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.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) + } + m.StartHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumBlocks", wireType) + } + m.NumBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DAPath", 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.DAPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BDs", 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.BDs.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 *MsgUpdateStateResponse) 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: MsgUpdateStateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateStateResponse: 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 (m *MsgRollappGenesisEvent) 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: MsgRollappGenesisEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRollappGenesisEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", 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.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", 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.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRollappGenesisEventResponse) 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: MsgRollappGenesisEventResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRollappGenesisEventResponse: 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") +) diff --git a/x/rollup/client/cli/query.go b/x/rollup/client/cli/query.go deleted file mode 100644 index 7f1e458c..00000000 --- a/x/rollup/client/cli/query.go +++ /dev/null @@ -1 +0,0 @@ -package cli diff --git a/x/rollup/client/cli/tx.go b/x/rollup/client/cli/tx.go deleted file mode 100644 index 7f1e458c..00000000 --- a/x/rollup/client/cli/tx.go +++ /dev/null @@ -1 +0,0 @@ -package cli diff --git a/x/rollup/keeper/keeper.go b/x/rollup/keeper/keeper.go deleted file mode 100644 index d823e764..00000000 --- a/x/rollup/keeper/keeper.go +++ /dev/null @@ -1,50 +0,0 @@ -package keeper - -import ( - "fmt" - - "cosmossdk.io/core/store" - "cosmossdk.io/log" - "cosmossdk.io/x/circuit/types" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type Keeper struct { - cdc codec.BinaryCodec - storeService store.KVStoreService - logger log.Logger - - // the address capable of executing a MsgUpdateParams message. Typically, this - // should be the x/gov module account. - authority string -} - -func NewKeeper( - cdc codec.BinaryCodec, - storeService store.KVStoreService, - logger log.Logger, - authority string, -) Keeper { - if _, err := sdk.AccAddressFromBech32(authority); err != nil { - panic(fmt.Sprintf("invalid authority address: %s", authority)) - } - - return Keeper{ - cdc: cdc, - storeService: storeService, - authority: authority, - logger: logger, - } -} - -// GetAuthority returns the module's authority. -func (k Keeper) GetAuthority() string { - return k.authority -} - -// Logger returns a module-specific logger. -func (k Keeper) Logger() log.Logger { - return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/x/rollup/keeper/params.go b/x/rollup/keeper/params.go deleted file mode 100644 index 5642c03d..00000000 --- a/x/rollup/keeper/params.go +++ /dev/null @@ -1,33 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/eve-network/eve/x/rollup/types" - - "github.com/cosmos/cosmos-sdk/runtime" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx context.Context) (params types.Params) { - store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz := store.Get(types.ParamsKey) - if bz == nil { - return params - } - - k.cdc.MustUnmarshal(bz, ¶ms) - return params -} - -// SetParams set the params -func (k Keeper) SetParams(ctx context.Context, params types.Params) error { - store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz, err := k.cdc.Marshal(¶ms) - if err != nil { - return err - } - store.Set(types.ParamsKey, bz) - - return nil -} diff --git a/x/rollup/keeper/rollup.go b/x/rollup/keeper/rollup.go deleted file mode 100644 index 5dd43cfb..00000000 --- a/x/rollup/keeper/rollup.go +++ /dev/null @@ -1,56 +0,0 @@ -package keeper - -import ( - "github.com/eve-network/eve/x/rollup/types" - - "cosmossdk.io/store/prefix" - - "github.com/cosmos/cosmos-sdk/runtime" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (k Keeper) SetRollup(ctx sdk.Context, rollup types.Rollup) error { - store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz, err := k.cdc.Marshal(&rollup) - if err != nil { - return err - } - store.Set(types.RollupKey(rollup.RollupId), bz) - return nil -} - -func (k Keeper) GetRollup(ctx sdk.Context, rollupId string) (types.Rollup, bool) { - store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - b := store.Get(types.RollupKey(rollupId)) - if b == nil { - return types.Rollup{}, false - } - - var val types.Rollup - err := k.cdc.Unmarshal(b, &val) - if err != nil { - return types.Rollup{}, false - } - return val, true -} - -func (k Keeper) RemoveRollup(ctx sdk.Context, rollupId string) { - store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - store.Delete(types.RollupKey(rollupId)) -} - -func (k Keeper) GetAllRollups(ctx sdk.Context) []types.Rollup { - prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), []byte(types.RollupKeyPrefix)) - iter := prefixStore.Iterator(nil, nil) - defer iter.Close() - - var list []types.Rollup - - for ; iter.Valid(); iter.Next() { - var val types.Rollup - k.cdc.MustUnmarshal(iter.Value(), &val) - list = append(list, val) - } - - return list -} diff --git a/x/rollup/types/genesis.pb.go b/x/rollup/types/genesis.pb.go deleted file mode 100644 index efb4fb44..00000000 --- a/x/rollup/types/genesis.pb.go +++ /dev/null @@ -1,321 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nucleic/rollup/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 rollup module's genesis state. -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -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_093adc730a34492c, []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) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "nucleic.rollup.GenesisState") -} - -func init() { proto.RegisterFile("nucleic/rollup/genesis.proto", fileDescriptor_093adc730a34492c) } - -var fileDescriptor_093adc730a34492c = []byte{ - // 194 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc9, 0x2b, 0x4d, 0xce, - 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x29, 0x2d, 0xd0, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, - 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0xea, 0x41, 0x64, 0xa5, - 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x94, 0x34, 0x9a, 0x19, - 0x05, 0x89, 0x45, 0x89, 0xb9, 0x50, 0x23, 0x94, 0x5c, 0xb8, 0x78, 0xdc, 0x21, 0x66, 0x06, 0x97, - 0x24, 0x96, 0xa4, 0x0a, 0x99, 0x70, 0xb1, 0x41, 0xe4, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, - 0xc4, 0xf4, 0x50, 0xed, 0xd0, 0x0b, 0x00, 0xcb, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, - 0x55, 0xeb, 0xe4, 0x7d, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, - 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x86, 0xe9, - 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, 0x93, 0x74, 0xf3, 0x52, 0x4b, - 0xca, 0xf3, 0x8b, 0xb2, 0x61, 0x7c, 0xfd, 0x0a, 0x98, 0xcb, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, - 0xd8, 0xc0, 0x2e, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x0b, 0xbd, 0xe6, 0x9d, 0xfc, 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 - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -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 - l = m.Params.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 Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - 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") -) diff --git a/x/rollup/types/params.go b/x/rollup/types/params.go deleted file mode 100644 index 4f3215e3..00000000 --- a/x/rollup/types/params.go +++ /dev/null @@ -1,32 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} diff --git a/x/rollup/types/params.pb.go b/x/rollup/types/params.pb.go deleted file mode 100644 index f22c6056..00000000 --- a/x/rollup/types/params.pb.go +++ /dev/null @@ -1,263 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nucleic/rollup/params.proto - -package types - -import ( - fmt "fmt" - 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 - -// Params defines the parameters for the module. -type Params struct { -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_e4f8f0f26e946001, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Params)(nil), "nucleic.rollup.Params") -} - -func init() { proto.RegisterFile("nucleic/rollup/params.proto", fileDescriptor_e4f8f0f26e946001) } - -var fileDescriptor_e4f8f0f26e946001 = []byte{ - // 133 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xce, 0x2b, 0x4d, 0xce, - 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x29, 0x2d, 0xd0, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, - 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xea, 0x41, 0x24, 0x95, 0x38, - 0xb8, 0xd8, 0x02, 0xc0, 0xf2, 0x4e, 0xde, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, - 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, - 0x10, 0x65, 0x98, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xd5, 0xae, - 0x9b, 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0x0d, 0xe3, 0xeb, 0x57, 0xc0, 0x6c, 0x2b, 0xa9, 0x2c, - 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xdb, 0x66, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x03, 0x57, 0x09, - 0x11, 0x8c, 0x00, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/rollup/types/query.pb.go b/x/rollup/types/query.pb.go deleted file mode 100644 index 0ac3ee89..00000000 --- a/x/rollup/types/query.pb.go +++ /dev/null @@ -1,1079 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nucleic/rollup/query.proto - -package types - -import ( - context "context" - fmt "fmt" - 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 - -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_4ffe00ca994f2cf8, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -type QueryParamsResponse struct { -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4ffe00ca994f2cf8, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -type QueryRollupRequest struct { - RollupId string `protobuf:"bytes,1,opt,name=rollup_id,json=rollupId,proto3" json:"rollup_id,omitempty"` -} - -func (m *QueryRollupRequest) Reset() { *m = QueryRollupRequest{} } -func (m *QueryRollupRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRollupRequest) ProtoMessage() {} -func (*QueryRollupRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_4ffe00ca994f2cf8, []int{2} -} -func (m *QueryRollupRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRollupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRollupRequest.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 *QueryRollupRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRollupRequest.Merge(m, src) -} -func (m *QueryRollupRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRollupRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRollupRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRollupRequest proto.InternalMessageInfo - -func (m *QueryRollupRequest) GetRollupId() string { - if m != nil { - return m.RollupId - } - return "" -} - -type QueryRollupResponse struct { -} - -func (m *QueryRollupResponse) Reset() { *m = QueryRollupResponse{} } -func (m *QueryRollupResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRollupResponse) ProtoMessage() {} -func (*QueryRollupResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4ffe00ca994f2cf8, []int{3} -} -func (m *QueryRollupResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRollupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRollupResponse.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 *QueryRollupResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRollupResponse.Merge(m, src) -} -func (m *QueryRollupResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRollupResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRollupResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRollupResponse proto.InternalMessageInfo - -type QueryAllRollupRequest struct { -} - -func (m *QueryAllRollupRequest) Reset() { *m = QueryAllRollupRequest{} } -func (m *QueryAllRollupRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllRollupRequest) ProtoMessage() {} -func (*QueryAllRollupRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_4ffe00ca994f2cf8, []int{4} -} -func (m *QueryAllRollupRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllRollupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllRollupRequest.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 *QueryAllRollupRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllRollupRequest.Merge(m, src) -} -func (m *QueryAllRollupRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllRollupRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllRollupRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllRollupRequest proto.InternalMessageInfo - -type QueryAllRollupResponse struct { -} - -func (m *QueryAllRollupResponse) Reset() { *m = QueryAllRollupResponse{} } -func (m *QueryAllRollupResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllRollupResponse) ProtoMessage() {} -func (*QueryAllRollupResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4ffe00ca994f2cf8, []int{5} -} -func (m *QueryAllRollupResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllRollupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllRollupResponse.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 *QueryAllRollupResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllRollupResponse.Merge(m, src) -} -func (m *QueryAllRollupResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAllRollupResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllRollupResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllRollupResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "nucleic.rollup.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "nucleic.rollup.QueryParamsResponse") - proto.RegisterType((*QueryRollupRequest)(nil), "nucleic.rollup.QueryRollupRequest") - proto.RegisterType((*QueryRollupResponse)(nil), "nucleic.rollup.QueryRollupResponse") - proto.RegisterType((*QueryAllRollupRequest)(nil), "nucleic.rollup.QueryAllRollupRequest") - proto.RegisterType((*QueryAllRollupResponse)(nil), "nucleic.rollup.QueryAllRollupResponse") -} - -func init() { proto.RegisterFile("nucleic/rollup/query.proto", fileDescriptor_4ffe00ca994f2cf8) } - -var fileDescriptor_4ffe00ca994f2cf8 = []byte{ - // 344 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xca, 0x2b, 0x4d, 0xce, - 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x29, 0x2d, 0xd0, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, - 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0xe9, 0x41, 0xe4, 0xa4, 0x64, 0xd2, - 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, - 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xaa, 0x95, 0x44, 0xb8, 0x84, 0x02, 0x41, 0x9a, 0x03, 0x12, - 0x8b, 0x12, 0x73, 0x8b, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x94, 0x44, 0xb9, 0x84, 0x51, - 0x44, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x95, 0x0c, 0xa1, 0x8a, 0x83, 0xc0, 0x26, 0x43, 0x15, - 0x0b, 0x49, 0x73, 0x71, 0x42, 0xac, 0x8a, 0xcf, 0x4c, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, - 0xe2, 0x80, 0x08, 0x78, 0xa6, 0xc0, 0x4d, 0x82, 0x69, 0x81, 0x9a, 0x24, 0xce, 0x25, 0x0a, 0x16, - 0x76, 0xcc, 0xc9, 0x41, 0x31, 0x4c, 0x49, 0x82, 0x4b, 0x0c, 0x5d, 0x02, 0xa2, 0xc5, 0x68, 0x3a, - 0x33, 0x17, 0x2b, 0x58, 0x4a, 0xa8, 0x81, 0x91, 0x8b, 0x0d, 0xe2, 0x32, 0x21, 0x25, 0x3d, 0x54, - 0xdf, 0xea, 0x61, 0x7a, 0x46, 0x4a, 0x19, 0xaf, 0x1a, 0xa8, 0x83, 0x74, 0x9b, 0x2e, 0x3f, 0x99, - 0xcc, 0xa4, 0x2e, 0xa4, 0xaa, 0x0f, 0x55, 0x9c, 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0xad, 0x8f, - 0x16, 0xd2, 0x05, 0x10, 0x7b, 0x5b, 0x19, 0xb9, 0xd8, 0x20, 0xee, 0xc3, 0xe1, 0x04, 0x14, 0x5f, - 0xe1, 0x70, 0x02, 0x5a, 0x98, 0x18, 0x81, 0x9d, 0xa0, 0x23, 0xa4, 0x45, 0xc0, 0x09, 0xd5, 0xf0, - 0xd0, 0xae, 0x15, 0x6a, 0x62, 0xe4, 0xe2, 0x84, 0x07, 0x95, 0x90, 0x2a, 0x56, 0x6b, 0xd0, 0xc3, - 0x58, 0x4a, 0x8d, 0x90, 0x32, 0xa8, 0x83, 0xd4, 0xc0, 0x0e, 0x52, 0x10, 0x92, 0xc3, 0xef, 0x20, - 0x27, 0xef, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, - 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4c, 0xcf, 0x2c, - 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0x85, 0x69, 0xd2, 0x45, 0x37, 0xa4, 0x02, 0xe6, 0xaf, - 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0xba, 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, - 0xc4, 0x42, 0x53, 0xc0, 0xe3, 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 { - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - Rollup(ctx context.Context, in *QueryRollupRequest, opts ...grpc.CallOption) (*QueryRollupResponse, error) - AllRollup(ctx context.Context, in *QueryAllRollupRequest, opts ...grpc.CallOption) (*QueryAllRollupResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/nucleic.rollup.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Rollup(ctx context.Context, in *QueryRollupRequest, opts ...grpc.CallOption) (*QueryRollupResponse, error) { - out := new(QueryRollupResponse) - err := c.cc.Invoke(ctx, "/nucleic.rollup.Query/Rollup", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AllRollup(ctx context.Context, in *QueryAllRollupRequest, opts ...grpc.CallOption) (*QueryAllRollupResponse, error) { - out := new(QueryAllRollupResponse) - err := c.cc.Invoke(ctx, "/nucleic.rollup.Query/AllRollup", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - Rollup(context.Context, *QueryRollupRequest) (*QueryRollupResponse, error) - AllRollup(context.Context, *QueryAllRollupRequest) (*QueryAllRollupResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) Rollup(ctx context.Context, req *QueryRollupRequest) (*QueryRollupResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Rollup not implemented") -} -func (*UnimplementedQueryServer) AllRollup(ctx context.Context, req *QueryAllRollupRequest) (*QueryAllRollupResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AllRollup not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/nucleic.rollup.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Rollup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRollupRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Rollup(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/nucleic.rollup.Query/Rollup", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Rollup(ctx, req.(*QueryRollupRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AllRollup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllRollupRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AllRollup(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/nucleic.rollup.Query/AllRollup", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AllRollup(ctx, req.(*QueryAllRollupRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "nucleic.rollup.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "Rollup", - Handler: _Query_Rollup_Handler, - }, - { - MethodName: "AllRollup", - Handler: _Query_AllRollup_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "nucleic/rollup/query.proto", -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryRollupRequest) 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 *QueryRollupRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRollupRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RollupId) > 0 { - i -= len(m.RollupId) - copy(dAtA[i:], m.RollupId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.RollupId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryRollupResponse) 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 *QueryRollupResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRollupResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryAllRollupRequest) 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 *QueryAllRollupRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllRollupRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryAllRollupResponse) 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 *QueryAllRollupResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllRollupResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryRollupRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RollupId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRollupResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryAllRollupRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryAllRollupResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - 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 *QueryRollupRequest) 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: QueryRollupRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRollupRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RollupId", 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.RollupId = 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 *QueryRollupResponse) 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: QueryRollupResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRollupResponse: 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 *QueryAllRollupRequest) 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: QueryAllRollupRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllRollupRequest: 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 *QueryAllRollupResponse) 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: QueryAllRollupResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllRollupResponse: 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 skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/rollup/types/query.pb.gw.go b/x/rollup/types/query.pb.gw.go deleted file mode 100644 index f678a2cc..00000000 --- a/x/rollup/types/query.pb.gw.go +++ /dev/null @@ -1,319 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: nucleic/rollup/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Rollup_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRollupRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["rollup_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollup_id") - } - - protoReq.RollupId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollup_id", err) - } - - msg, err := client.Rollup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Rollup_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRollupRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["rollup_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollup_id") - } - - protoReq.RollupId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollup_id", err) - } - - msg, err := server.Rollup(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_AllRollup_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllRollupRequest - var metadata runtime.ServerMetadata - - msg, err := client.AllRollup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AllRollup_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllRollupRequest - var metadata runtime.ServerMetadata - - msg, err := server.AllRollup(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Rollup_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_Rollup_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_Rollup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AllRollup_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_AllRollup_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_AllRollup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Rollup_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_Rollup_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_Rollup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AllRollup_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_AllRollup_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_AllRollup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"nucleicnetwork", "nucleic", "rollup", "params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Rollup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"nucleicnetwork", "nucleic", "rollup", "rollup_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_AllRollup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nucleicnetwork", "nucleic", "rollup"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_Rollup_0 = runtime.ForwardResponseMessage - - forward_Query_AllRollup_0 = runtime.ForwardResponseMessage -) diff --git a/x/rollup/types/rollup_keys.go b/x/rollup/types/rollup_keys.go deleted file mode 100644 index 6dfafe37..00000000 --- a/x/rollup/types/rollup_keys.go +++ /dev/null @@ -1,34 +0,0 @@ -package types - -import "encoding/binary" - -var _ binary.ByteOrder - -const ( - // RollupKeyPrefix is the prefix to retrieve all Rollup - RollupKeyPrefix = "Rollup/value/" - RollupByEIP155KeyPrefix = "RollupByEIP155/value/" -) - -// RollupKey returns the store key to retrieve a Rollup from the index fields -func RollupKey(rollupId string) []byte { - var key []byte - - rollupIdBytes := []byte(rollupId) - key = append(key, rollupIdBytes...) - key = append(key, []byte("/")...) - - return key -} - -// RollupByEIP155Key returns the store key to retrieve a Rollup from the index fields -func RollupByEIP155Key(eip155 uint64) []byte { - var key []byte - - eip155Bytes := make([]byte, 8) - binary.LittleEndian.PutUint64(eip155Bytes, eip155) - key = append(key, eip155Bytes...) - key = append(key, []byte("/")...) - - return key -} diff --git a/x/rollup/types/state.pb.go b/x/rollup/types/state.pb.go deleted file mode 100644 index e0233739..00000000 --- a/x/rollup/types/state.pb.go +++ /dev/null @@ -1,920 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nucleic/rollup/state.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 - -type StateStatus int32 - -const ( - StateStatus_PENDING StateStatus = 0 - StateStatus_FINALIZED StateStatus = 1 - StateStatus_REVERTED StateStatus = 3 -) - -var StateStatus_name = map[int32]string{ - 0: "PENDING", - 1: "FINALIZED", - 3: "REVERTED", -} - -var StateStatus_value = map[string]int32{ - "PENDING": 0, - "FINALIZED": 1, - "REVERTED": 3, -} - -func (x StateStatus) String() string { - return proto.EnumName(StateStatus_name, int32(x)) -} - -func (StateStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_486e5873fc407807, []int{0} -} - -// StateInfoIndex is the data used for indexing and retrieving a StateInfo -// it updated and saved with every UpdateState in StateInfo. -// We use the this structure also for: -// 1. LatestStateInfoIndex which defines the rollups' current (latest) index of the last UpdateState -// 2. LatestFinalizedStateIndex which defines the rollups' current (latest) index of the latest StateInfo that was finalized -type StateInfoIndex struct { - // rollupId is the rollup that the sequencer belongs to and asking to update - // it used to identify the what rollup a StateInfo belongs - // The rollupId follows the same standard as cosmos chain_id - RollupId string `protobuf:"bytes,1,opt,name=rollupId,proto3" json:"rollupId,omitempty"` - // index is a sequential increasing number, updating on each - // state update used for indexing to a specific state info, the first index is 1 - Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` -} - -func (m *StateInfoIndex) Reset() { *m = StateInfoIndex{} } -func (m *StateInfoIndex) String() string { return proto.CompactTextString(m) } -func (*StateInfoIndex) ProtoMessage() {} -func (*StateInfoIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_486e5873fc407807, []int{0} -} -func (m *StateInfoIndex) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StateInfoIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StateInfoIndex.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 *StateInfoIndex) XXX_Merge(src proto.Message) { - xxx_messageInfo_StateInfoIndex.Merge(m, src) -} -func (m *StateInfoIndex) XXX_Size() int { - return m.Size() -} -func (m *StateInfoIndex) XXX_DiscardUnknown() { - xxx_messageInfo_StateInfoIndex.DiscardUnknown(m) -} - -var xxx_messageInfo_StateInfoIndex proto.InternalMessageInfo - -func (m *StateInfoIndex) GetRollupId() string { - if m != nil { - return m.RollupId - } - return "" -} - -func (m *StateInfoIndex) GetIndex() uint64 { - if m != nil { - return m.Index - } - return 0 -} - -// StateInfo defines a state of the rollup. -type StateInfo struct { - // stateInfoIndex defines what rollup the state belongs to - // and in which index it can be referenced - StateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=stateInfoIndex,proto3" json:"stateInfoIndex"` - // sequencer is the bech32-encoded address of the sequencer sent the update - Sequencer string `protobuf:"bytes,2,opt,name=sequencer,proto3" json:"sequencer,omitempty"` - // startHeight is the block height of the first block in the batch - StartHeight uint64 `protobuf:"varint,3,opt,name=startHeight,proto3" json:"startHeight,omitempty"` - // numBlocks is the number of blocks included in this batch update - NumBlocks uint64 `protobuf:"varint,4,opt,name=numBlocks,proto3" json:"numBlocks,omitempty"` - // DAPath is the description of the location on the DA layer - DAPath string `protobuf:"bytes,5,opt,name=DAPath,proto3" json:"DAPath,omitempty"` - // version is the version of the rollup - Version uint64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"` - // creationHeight is the height at which the UpdateState took place - CreationHeight uint64 `protobuf:"varint,7,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` - // status is the status of the state update - Status StateStatus `protobuf:"varint,8,opt,name=status,proto3,enum=nucleic.rollup.StateStatus" json:"status,omitempty"` - // BDs is a list of block description objects (one per block) - // the list must be ordered by height, starting from startHeight to startHeight+numBlocks-1 - BDs BlockDescriptors `protobuf:"bytes,9,opt,name=BDs,proto3" json:"BDs"` -} - -func (m *StateInfo) Reset() { *m = StateInfo{} } -func (m *StateInfo) String() string { return proto.CompactTextString(m) } -func (*StateInfo) ProtoMessage() {} -func (*StateInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_486e5873fc407807, []int{1} -} -func (m *StateInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StateInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StateInfo.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 *StateInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_StateInfo.Merge(m, src) -} -func (m *StateInfo) XXX_Size() int { - return m.Size() -} -func (m *StateInfo) XXX_DiscardUnknown() { - xxx_messageInfo_StateInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_StateInfo proto.InternalMessageInfo - -func (m *StateInfo) GetStateInfoIndex() StateInfoIndex { - if m != nil { - return m.StateInfoIndex - } - return StateInfoIndex{} -} - -func (m *StateInfo) GetSequencer() string { - if m != nil { - return m.Sequencer - } - return "" -} - -func (m *StateInfo) GetStartHeight() uint64 { - if m != nil { - return m.StartHeight - } - return 0 -} - -func (m *StateInfo) GetNumBlocks() uint64 { - if m != nil { - return m.NumBlocks - } - return 0 -} - -func (m *StateInfo) GetDAPath() string { - if m != nil { - return m.DAPath - } - return "" -} - -func (m *StateInfo) GetVersion() uint64 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *StateInfo) GetCreationHeight() uint64 { - if m != nil { - return m.CreationHeight - } - return 0 -} - -func (m *StateInfo) GetStatus() StateStatus { - if m != nil { - return m.Status - } - return StateStatus_PENDING -} - -func (m *StateInfo) GetBDs() BlockDescriptors { - if m != nil { - return m.BDs - } - return BlockDescriptors{} -} - -func init() { - proto.RegisterEnum("nucleic.rollup.StateStatus", StateStatus_name, StateStatus_value) - proto.RegisterType((*StateInfoIndex)(nil), "nucleic.rollup.StateInfoIndex") - proto.RegisterType((*StateInfo)(nil), "nucleic.rollup.StateInfo") -} - -func init() { proto.RegisterFile("nucleic/rollup/state.proto", fileDescriptor_486e5873fc407807) } - -var fileDescriptor_486e5873fc407807 = []byte{ - // 428 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x4f, 0x6f, 0xd3, 0x30, - 0x14, 0x8f, 0x69, 0xd7, 0x36, 0xaf, 0x10, 0x55, 0xd6, 0x84, 0xac, 0x82, 0x42, 0xb4, 0x03, 0xaa, - 0x90, 0x48, 0xc4, 0x76, 0x80, 0xeb, 0xa2, 0x04, 0x88, 0x98, 0xaa, 0x29, 0x43, 0x1c, 0x76, 0x4b, - 0x33, 0x93, 0x46, 0xcb, 0xec, 0x60, 0x3b, 0x30, 0x6e, 0x7c, 0x04, 0x3e, 0xd6, 0x8e, 0x3b, 0x72, - 0x42, 0xa8, 0xfd, 0x22, 0x28, 0x4e, 0xba, 0xb5, 0xd1, 0x6e, 0xfe, 0xbd, 0xdf, 0x9f, 0xf7, 0x9e, - 0xf5, 0x60, 0xca, 0xaa, 0xb4, 0xa0, 0x79, 0xea, 0x09, 0x5e, 0x14, 0x55, 0xe9, 0x49, 0x95, 0x28, - 0xea, 0x96, 0x82, 0x2b, 0x8e, 0xad, 0x96, 0x73, 0x1b, 0x6e, 0xba, 0x9f, 0xf1, 0x8c, 0x6b, 0xca, - 0xab, 0x5f, 0x8d, 0x6a, 0xda, 0x4d, 0x58, 0x14, 0x3c, 0xbd, 0x6c, 0xb8, 0x03, 0x1f, 0xac, 0xb3, - 0x3a, 0x30, 0x62, 0x5f, 0x79, 0xc4, 0x2e, 0xe8, 0x35, 0x9e, 0xc2, 0xa8, 0xd1, 0x45, 0x17, 0x04, - 0x39, 0x68, 0x66, 0xc6, 0x77, 0x18, 0xef, 0xc3, 0x5e, 0x5e, 0x8b, 0xc8, 0x23, 0x07, 0xcd, 0xfa, - 0x71, 0x03, 0x0e, 0x7e, 0xf5, 0xc0, 0xbc, 0x0b, 0xc1, 0x27, 0x60, 0xc9, 0x9d, 0x44, 0x9d, 0x32, - 0x3e, 0xb4, 0xdd, 0xdd, 0x61, 0xdd, 0xdd, 0xbe, 0x7e, 0xff, 0xe6, 0xef, 0x0b, 0x23, 0xee, 0x78, - 0xf1, 0x73, 0x30, 0x25, 0xfd, 0x56, 0x51, 0x96, 0x52, 0xa1, 0xbb, 0x9a, 0xf1, 0x7d, 0x01, 0x3b, - 0x30, 0x96, 0x2a, 0x11, 0xea, 0x23, 0xcd, 0xb3, 0xa5, 0x22, 0x3d, 0x3d, 0xd5, 0x76, 0xa9, 0xf6, - 0xb3, 0xea, 0xca, 0xaf, 0x37, 0x96, 0xa4, 0xaf, 0xf9, 0xfb, 0x02, 0x7e, 0x0a, 0x83, 0xe0, 0xf8, - 0x34, 0x51, 0x4b, 0xb2, 0xa7, 0xa3, 0x5b, 0x84, 0x09, 0x0c, 0xbf, 0x53, 0x21, 0x73, 0xce, 0xc8, - 0x40, 0x7b, 0x36, 0x10, 0xbf, 0x04, 0x2b, 0x15, 0x34, 0x51, 0x39, 0x67, 0x6d, 0xd3, 0xa1, 0x16, - 0x74, 0xaa, 0xf8, 0x08, 0x06, 0xf5, 0x26, 0x95, 0x24, 0x23, 0x07, 0xcd, 0xac, 0xc3, 0x67, 0x0f, - 0x6e, 0x7f, 0xa6, 0x25, 0x71, 0x2b, 0xc5, 0xef, 0xa0, 0xe7, 0x07, 0x92, 0x98, 0xfa, 0xbf, 0x9c, - 0xae, 0x43, 0xcf, 0x1c, 0x50, 0x99, 0x8a, 0xbc, 0x54, 0x5c, 0xc8, 0xf6, 0xc7, 0x6a, 0xcb, 0xab, - 0xb7, 0x30, 0xde, 0x0a, 0xc4, 0x63, 0x18, 0x9e, 0x86, 0xf3, 0x20, 0x9a, 0x7f, 0x98, 0x18, 0xf8, - 0x09, 0x98, 0xef, 0xa3, 0xf9, 0xf1, 0x49, 0x74, 0x1e, 0x06, 0x13, 0x84, 0x1f, 0xc3, 0x28, 0x0e, - 0xbf, 0x84, 0xf1, 0xe7, 0x30, 0x98, 0xf4, 0xfc, 0x4f, 0x37, 0x2b, 0x1b, 0xdd, 0xae, 0x6c, 0xf4, - 0x6f, 0x65, 0xa3, 0xdf, 0x6b, 0xdb, 0xb8, 0x5d, 0xdb, 0xc6, 0x9f, 0xb5, 0x6d, 0x9c, 0xbf, 0xc9, - 0x72, 0xb5, 0xac, 0x16, 0x6e, 0xca, 0xaf, 0xbc, 0x76, 0x92, 0xd7, 0x8c, 0xaa, 0x1f, 0x5c, 0x5c, - 0x6e, 0xb0, 0x77, 0xbd, 0x39, 0x29, 0xf5, 0xb3, 0xa4, 0x72, 0x31, 0xd0, 0x37, 0x75, 0xf4, 0x3f, - 0x00, 0x00, 0xff, 0xff, 0xe1, 0x1e, 0x4b, 0xa4, 0xb3, 0x02, 0x00, 0x00, -} - -func (m *StateInfoIndex) 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 *StateInfoIndex) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StateInfoIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Index != 0 { - i = encodeVarintState(dAtA, i, uint64(m.Index)) - i-- - dAtA[i] = 0x10 - } - if len(m.RollupId) > 0 { - i -= len(m.RollupId) - copy(dAtA[i:], m.RollupId) - i = encodeVarintState(dAtA, i, uint64(len(m.RollupId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *StateInfo) 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 *StateInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StateInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.BDs.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintState(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - if m.Status != 0 { - i = encodeVarintState(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x40 - } - if m.CreationHeight != 0 { - i = encodeVarintState(dAtA, i, uint64(m.CreationHeight)) - i-- - dAtA[i] = 0x38 - } - if m.Version != 0 { - i = encodeVarintState(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x30 - } - if len(m.DAPath) > 0 { - i -= len(m.DAPath) - copy(dAtA[i:], m.DAPath) - i = encodeVarintState(dAtA, i, uint64(len(m.DAPath))) - i-- - dAtA[i] = 0x2a - } - if m.NumBlocks != 0 { - i = encodeVarintState(dAtA, i, uint64(m.NumBlocks)) - i-- - dAtA[i] = 0x20 - } - if m.StartHeight != 0 { - i = encodeVarintState(dAtA, i, uint64(m.StartHeight)) - i-- - dAtA[i] = 0x18 - } - if len(m.Sequencer) > 0 { - i -= len(m.Sequencer) - copy(dAtA[i:], m.Sequencer) - i = encodeVarintState(dAtA, i, uint64(len(m.Sequencer))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.StateInfoIndex.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintState(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintState(dAtA []byte, offset int, v uint64) int { - offset -= sovState(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *StateInfoIndex) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RollupId) - if l > 0 { - n += 1 + l + sovState(uint64(l)) - } - if m.Index != 0 { - n += 1 + sovState(uint64(m.Index)) - } - return n -} - -func (m *StateInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.StateInfoIndex.Size() - n += 1 + l + sovState(uint64(l)) - l = len(m.Sequencer) - if l > 0 { - n += 1 + l + sovState(uint64(l)) - } - if m.StartHeight != 0 { - n += 1 + sovState(uint64(m.StartHeight)) - } - if m.NumBlocks != 0 { - n += 1 + sovState(uint64(m.NumBlocks)) - } - l = len(m.DAPath) - if l > 0 { - n += 1 + l + sovState(uint64(l)) - } - if m.Version != 0 { - n += 1 + sovState(uint64(m.Version)) - } - if m.CreationHeight != 0 { - n += 1 + sovState(uint64(m.CreationHeight)) - } - if m.Status != 0 { - n += 1 + sovState(uint64(m.Status)) - } - l = m.BDs.Size() - n += 1 + l + sovState(uint64(l)) - return n -} - -func sovState(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozState(x uint64) (n int) { - return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *StateInfoIndex) 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 ErrIntOverflowState - } - 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: StateInfoIndex: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StateInfoIndex: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RollupId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - 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 ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RollupId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipState(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthState - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StateInfo) 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 ErrIntOverflowState - } - 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: StateInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StateInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StateInfoIndex", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthState - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.StateInfoIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequencer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - 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 ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sequencer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) - } - m.StartHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumBlocks", wireType) - } - m.NumBlocks = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NumBlocks |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DAPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - 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 ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DAPath = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) - } - m.CreationHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CreationHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= StateStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BDs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthState - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.BDs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipState(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthState - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipState(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, ErrIntOverflowState - } - 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, ErrIntOverflowState - } - 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, ErrIntOverflowState - } - 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, ErrInvalidLengthState - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupState - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthState - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthState = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowState = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupState = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/rollup/types/tx.pb.go b/x/rollup/types/tx.pb.go deleted file mode 100644 index 5f8a2b75..00000000 --- a/x/rollup/types/tx.pb.go +++ /dev/null @@ -1,851 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nucleic/rollup/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - 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 - -// MsgCreateRollup creates a rollup app on the share sequencer chain -type MsgCreateRollup struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - RollupId string `protobuf:"bytes,2,opt,name=rollup_id,json=rollupId,proto3" json:"rollup_id,omitempty"` -} - -func (m *MsgCreateRollup) Reset() { *m = MsgCreateRollup{} } -func (m *MsgCreateRollup) String() string { return proto.CompactTextString(m) } -func (*MsgCreateRollup) ProtoMessage() {} -func (*MsgCreateRollup) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a6b771ffd57ed2, []int{0} -} -func (m *MsgCreateRollup) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateRollup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateRollup.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 *MsgCreateRollup) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateRollup.Merge(m, src) -} -func (m *MsgCreateRollup) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateRollup) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateRollup.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateRollup proto.InternalMessageInfo - -func (m *MsgCreateRollup) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -func (m *MsgCreateRollup) GetRollupId() string { - if m != nil { - return m.RollupId - } - return "" -} - -type MsgCreateRollupResponse struct { -} - -func (m *MsgCreateRollupResponse) Reset() { *m = MsgCreateRollupResponse{} } -func (m *MsgCreateRollupResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateRollupResponse) ProtoMessage() {} -func (*MsgCreateRollupResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a6b771ffd57ed2, []int{1} -} -func (m *MsgCreateRollupResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateRollupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateRollupResponse.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 *MsgCreateRollupResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateRollupResponse.Merge(m, src) -} -func (m *MsgCreateRollupResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateRollupResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateRollupResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateRollupResponse proto.InternalMessageInfo - -type MsgUpdateState struct { -} - -func (m *MsgUpdateState) Reset() { *m = MsgUpdateState{} } -func (m *MsgUpdateState) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateState) ProtoMessage() {} -func (*MsgUpdateState) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a6b771ffd57ed2, []int{2} -} -func (m *MsgUpdateState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateState.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 *MsgUpdateState) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateState.Merge(m, src) -} -func (m *MsgUpdateState) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateState) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateState.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateState proto.InternalMessageInfo - -type MsgUpdateStateResponse struct { -} - -func (m *MsgUpdateStateResponse) Reset() { *m = MsgUpdateStateResponse{} } -func (m *MsgUpdateStateResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateStateResponse) ProtoMessage() {} -func (*MsgUpdateStateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3a6b771ffd57ed2, []int{3} -} -func (m *MsgUpdateStateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateStateResponse.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 *MsgUpdateStateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateStateResponse.Merge(m, src) -} -func (m *MsgUpdateStateResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateStateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateStateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateStateResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgCreateRollup)(nil), "nucleic.rollup.MsgCreateRollup") - proto.RegisterType((*MsgCreateRollupResponse)(nil), "nucleic.rollup.MsgCreateRollupResponse") - proto.RegisterType((*MsgUpdateState)(nil), "nucleic.rollup.MsgUpdateState") - proto.RegisterType((*MsgUpdateStateResponse)(nil), "nucleic.rollup.MsgUpdateStateResponse") -} - -func init() { proto.RegisterFile("nucleic/rollup/tx.proto", fileDescriptor_b3a6b771ffd57ed2) } - -var fileDescriptor_b3a6b771ffd57ed2 = []byte{ - // 261 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x2b, 0x4d, 0xce, - 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x29, 0x2d, 0xd0, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xe8, 0x41, 0x24, 0x94, 0x3c, 0xb8, 0xf8, 0x7d, 0x8b, - 0xd3, 0x9d, 0x8b, 0x52, 0x13, 0x4b, 0x52, 0x83, 0xc0, 0x42, 0x42, 0x12, 0x5c, 0xec, 0xc9, 0x20, - 0x7e, 0x7e, 0x91, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x8c, 0x2b, 0x24, 0xcd, 0xc5, 0x09, - 0xd1, 0x16, 0x9f, 0x99, 0x22, 0xc1, 0x04, 0x96, 0xe3, 0x80, 0x08, 0x78, 0xa6, 0x28, 0x49, 0x72, - 0x89, 0xa3, 0x99, 0x14, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0xaa, 0x24, 0xc0, 0xc5, 0xe7, - 0x5b, 0x9c, 0x1e, 0x5a, 0x90, 0x92, 0x58, 0x92, 0x1a, 0x5c, 0x92, 0x58, 0x92, 0xaa, 0x24, 0xc1, - 0x25, 0x86, 0x2a, 0x02, 0x53, 0x6b, 0xb4, 0x8d, 0x91, 0x8b, 0xd9, 0xb7, 0x38, 0x5d, 0x28, 0x82, - 0x8b, 0x07, 0xc5, 0x55, 0xf2, 0x7a, 0xa8, 0x2e, 0xd7, 0x43, 0xb3, 0x4c, 0x4a, 0x9d, 0x80, 0x02, - 0x98, 0x0d, 0x42, 0xa1, 0x5c, 0xdc, 0x48, 0x16, 0x0b, 0xc9, 0x61, 0xd1, 0x87, 0x24, 0x2f, 0xa5, - 0x86, 0x5f, 0x1e, 0x66, 0xac, 0x93, 0xf7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, - 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, - 0x44, 0x19, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0xcd, 0xd2, - 0xcd, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0x86, 0xf1, 0xf5, 0x2b, 0xe0, 0x31, 0x55, 0x59, 0x90, - 0x5a, 0x9c, 0xc4, 0x06, 0x8e, 0x2d, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xac, 0xb0, - 0xb0, 0xc8, 0x01, 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 { - CreateRollup(ctx context.Context, in *MsgCreateRollup, opts ...grpc.CallOption) (*MsgCreateRollupResponse, error) - UpdateState(ctx context.Context, in *MsgUpdateState, opts ...grpc.CallOption) (*MsgUpdateStateResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) CreateRollup(ctx context.Context, in *MsgCreateRollup, opts ...grpc.CallOption) (*MsgCreateRollupResponse, error) { - out := new(MsgCreateRollupResponse) - err := c.cc.Invoke(ctx, "/nucleic.rollup.Msg/CreateRollup", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateState(ctx context.Context, in *MsgUpdateState, opts ...grpc.CallOption) (*MsgUpdateStateResponse, error) { - out := new(MsgUpdateStateResponse) - err := c.cc.Invoke(ctx, "/nucleic.rollup.Msg/UpdateState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - CreateRollup(context.Context, *MsgCreateRollup) (*MsgCreateRollupResponse, error) - UpdateState(context.Context, *MsgUpdateState) (*MsgUpdateStateResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) CreateRollup(ctx context.Context, req *MsgCreateRollup) (*MsgCreateRollupResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateRollup not implemented") -} -func (*UnimplementedMsgServer) UpdateState(ctx context.Context, req *MsgUpdateState) (*MsgUpdateStateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateState not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_CreateRollup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateRollup) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateRollup(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/nucleic.rollup.Msg/CreateRollup", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateRollup(ctx, req.(*MsgCreateRollup)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UpdateState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateState) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/nucleic.rollup.Msg/UpdateState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateState(ctx, req.(*MsgUpdateState)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "nucleic.rollup.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateRollup", - Handler: _Msg_CreateRollup_Handler, - }, - { - MethodName: "UpdateState", - Handler: _Msg_UpdateState_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "nucleic/rollup/tx.proto", -} - -func (m *MsgCreateRollup) 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 *MsgCreateRollup) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateRollup) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RollupId) > 0 { - i -= len(m.RollupId) - copy(dAtA[i:], m.RollupId) - i = encodeVarintTx(dAtA, i, uint64(len(m.RollupId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreateRollupResponse) 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 *MsgCreateRollupResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateRollupResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUpdateState) 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 *MsgUpdateState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUpdateStateResponse) 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 *MsgUpdateStateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateStateResponse) 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 *MsgCreateRollup) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.RollupId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgCreateRollupResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUpdateState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUpdateStateResponse) 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 *MsgCreateRollup) 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: MsgCreateRollup: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateRollup: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RollupId", 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.RollupId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreateRollupResponse) 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: MsgCreateRollupResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateRollupResponse: 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 (m *MsgUpdateState) 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: MsgUpdateState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateState: 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 (m *MsgUpdateStateResponse) 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: MsgUpdateStateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateStateResponse: 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") -) From 57287371ae9d716f35729fadce52dd4abfe93543 Mon Sep 17 00:00:00 2001 From: tnv1 Date: Tue, 30 Apr 2024 00:44:04 +0700 Subject: [PATCH 06/12] Add readme for rollapp module --- x/rollapp/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 x/rollapp/README.md diff --git a/x/rollapp/README.md b/x/rollapp/README.md new file mode 100644 index 00000000..fdc96ea2 --- /dev/null +++ b/x/rollapp/README.md @@ -0,0 +1,26 @@ +# Rollapp + +## Abstract + +RollApps are standardized blockchains that are easy to bootstrap and provide a seamless user experience. RollApps come with pre-defined modules that expediate the development process, incorporating features such as minting native tokens, onchain governance, out-of-the-box bridging and much more. + +## Contents + +1. **[Concepts](#concepts)** +2. **[State](#state)** +3. **[Events](#events)** +4. **[Keepers](#keepers)** +5. **[Hooks](#hooks)** +6. **[Queries](#queries)** + +## Concepts + +## State + +## Events + +## Keepers + +## Hooks + +## Queries From 6df04ad3d04146f41e012391634fae41dc94f447 Mon Sep 17 00:00:00 2001 From: tnv1 Date: Tue, 30 Apr 2024 00:45:49 +0700 Subject: [PATCH 07/12] Fix name of client type --- x/rollapp/types/errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/rollapp/types/errors.go b/x/rollapp/types/errors.go index 2f7eb4bb..6b087962 100644 --- a/x/rollapp/types/errors.go +++ b/x/rollapp/types/errors.go @@ -21,7 +21,7 @@ var ( ErrMultiUpdateStateInBlock = errorsmod.Register(ModuleName, 1010, "only one state update can take place per block") ErrInvalidStateRoot = errorsmod.Register(ModuleName, 1011, "invalid blocks state root") ErrUnauthorizedRollappCreator = errorsmod.Register(ModuleName, 1013, "rollapp creator not registered in the whitelist") - ErrInvalidClientType = errorsmod.Register(ModuleName, 1014, "client type of the rollapp isn't dymint") + ErrInvalidClientType = errorsmod.Register(ModuleName, 1014, "client type of the rollapp isn't rollkit") ErrHeightStateNotFinalized = errorsmod.Register(ModuleName, 1015, "rollapp block on this height was not finalized yet") ErrInvalidAppHash = errorsmod.Register(ModuleName, 1016, "the app hash is different from the finalized state root") ErrStateNotExists = errorsmod.Register(ModuleName, 1017, "state of this height doesn't exist") From 4fd0059f447780211f2026db895ab930ca66e531 Mon Sep 17 00:00:00 2001 From: tnv1 Date: Tue, 30 Apr 2024 14:25:36 +0700 Subject: [PATCH 08/12] Change proto name to snake case --- proto/nucleic/rollapp/block_descriptor.proto | 6 +- proto/nucleic/rollapp/genesis.proto | 11 +- proto/nucleic/rollapp/query.proto | 29 ++-- proto/nucleic/rollapp/rollapp.proto | 30 ++-- proto/nucleic/rollapp/state_info.proto | 55 ++++--- x/rollapp/README.md | 42 ++++- x/rollapp/types/bank.pb.go | 7 +- x/rollapp/types/block_descriptor.pb.go | 50 +++--- x/rollapp/types/errors.go | 6 - x/rollapp/types/genesis.pb.go | 60 +++---- x/rollapp/types/params.pb.go | 4 +- x/rollapp/types/query.pb.go | 135 +++++++-------- x/rollapp/types/query.pb.gw.go | 62 +++---- x/rollapp/types/rollapp.pb.go | 114 +++++++------ x/rollapp/types/state_info.go | 8 +- x/rollapp/types/state_info.pb.go | 164 ++++++++++--------- x/rollapp/types/tx.pb.go | 6 +- 17 files changed, 425 insertions(+), 364 deletions(-) diff --git a/proto/nucleic/rollapp/block_descriptor.proto b/proto/nucleic/rollapp/block_descriptor.proto index d896b33e..10af505c 100644 --- a/proto/nucleic/rollapp/block_descriptor.proto +++ b/proto/nucleic/rollapp/block_descriptor.proto @@ -9,12 +9,12 @@ import "gogoproto/gogo.proto"; message BlockDescriptor { // height is the height of the block uint64 height = 1; - // stateRoot is a 32 byte array of the hash of the block (state root of the + // state_root is a 32 byte array of the hash of the block (state root of the // block) - bytes stateRoot = 2; + bytes state_root = 2; } // BlockDescriptors defines list of BlockDescriptor. message BlockDescriptors { - repeated BlockDescriptor BD = 1 [ (gogoproto.nullable) = false ]; + repeated BlockDescriptor bd = 1 [ (gogoproto.nullable) = false ]; } diff --git a/proto/nucleic/rollapp/genesis.proto b/proto/nucleic/rollapp/genesis.proto index f0ce655b..d356f087 100644 --- a/proto/nucleic/rollapp/genesis.proto +++ b/proto/nucleic/rollapp/genesis.proto @@ -11,12 +11,13 @@ import "nucleic/rollapp/state_info.proto"; // GenesisState defines the rollapp module's genesis state. message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; - repeated Rollapp rollappList = 2 [ (gogoproto.nullable) = false ]; - repeated StateInfo stateInfoList = 3 [ (gogoproto.nullable) = false ]; - repeated StateInfoIndex latestStateInfoIndexList = 4 + repeated Rollapp rollapp_list = 2 [ (gogoproto.nullable) = false ]; + repeated StateInfo state_info_list = 3 [ (gogoproto.nullable) = false ]; + repeated StateInfoIndex latest_state_info_index_list = 4 [ (gogoproto.nullable) = false ]; - repeated StateInfoIndex latestFinalizedStateIndexList = 5 + repeated StateInfoIndex latest_finalized_state_index_list = 5 [ (gogoproto.nullable) = false ]; - repeated BlockHeightToFinalizationQueue blockHeightToFinalizationQueueList = 6 + repeated BlockHeightToFinalizationQueue + block_height_to_finalization_queue_list = 6 [ (gogoproto.nullable) = false ]; } diff --git a/proto/nucleic/rollapp/query.proto b/proto/nucleic/rollapp/query.proto index e202b9e5..5c2d9a20 100644 --- a/proto/nucleic/rollapp/query.proto +++ b/proto/nucleic/rollapp/query.proto @@ -18,7 +18,7 @@ service Query { } // Queries a Rollapp by index. rpc Rollapp(QueryGetRollappRequest) returns (QueryGetRollappResponse) { - option (google.api.http).get = "/nucleic/rollapp/rollapp/{rollappId}"; + option (google.api.http).get = "/nucleic/rollapp/rollapp/{rollapp_id}"; } // Queries a Rollapp by index. @@ -35,20 +35,21 @@ service Query { // Queries a LatestHeight by rollapp-id. rpc LatestHeight(QueryGetLatestHeightRequest) returns (QueryGetLatestHeightResponse) { - option (google.api.http).get = "/nucleic/rollapp/latest_height/{rollappId}"; + option (google.api.http).get = + "/nucleic/rollapp/latest_height/{rollapp_id}"; } // Queries a LatestStateIndex by rollapp-id. rpc LatestStateIndex(QueryGetLatestStateIndexRequest) returns (QueryGetLatestStateIndexResponse) { option (google.api.http).get = - "/nucleic/rollapp/latest_state_index/{rollappId}"; + "/nucleic/rollapp/latest_state_index/{rollapp_id}"; } // Queries a StateInfo by index. rpc StateInfo(QueryGetStateInfoRequest) returns (QueryGetStateInfoResponse) { option (google.api.http).get = - "/nucleic/rollapp/state_info/{rollappId}/{index}"; + "/nucleic/rollapp/state_info/{rollapp_id}/{index}"; } } @@ -61,35 +62,35 @@ message QueryParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } -message QueryGetRollappRequest { string rollappId = 1; } +message QueryGetRollappRequest { string rollapp_id = 1; } message QueryGetRollappByEIP155Request { uint64 eip155 = 1; } message QueryGetLatestHeightRequest { - string rollappId = 1; + string rollapp_id = 1; bool finalized = 2; } message QueryGetLatestHeightResponse { uint64 height = 1; } message QueryGetLatestStateIndexRequest { - string rollappId = 1; + string rollapp_id = 1; bool finalized = 2; } message QueryGetLatestStateIndexResponse { - StateInfoIndex stateIndex = 1 [ (gogoproto.nullable) = false ]; + StateInfoIndex state_index = 1 [ (gogoproto.nullable) = false ]; } message QueryGetRollappResponse { Rollapp rollapp = 1 [ (gogoproto.nullable) = false ]; // Defines the index of the last rollapp UpdateState. - StateInfoIndex latestStateIndex = 2; + StateInfoIndex latest_state_index = 2; // Defines the index of the last rollapp UpdateState that was finalized. - StateInfoIndex latestFinalizedStateIndex = 3; + StateInfoIndex latest_finalized_state_index = 3; - uint64 latestHeight = 4; - uint64 latestFinalizedHeight = 5; + uint64 latest_height = 4; + uint64 latest_finalized_height = 5; } message QueryAllRollappRequest { @@ -102,12 +103,12 @@ message QueryAllRollappResponse { } message QueryGetStateInfoRequest { - string rollappId = 1; + string rollapp_id = 1; uint64 index = 2; uint64 height = 3; bool finalized = 4; } message QueryGetStateInfoResponse { - StateInfo stateInfo = 1 [ (gogoproto.nullable) = false ]; + StateInfo state_info = 1 [ (gogoproto.nullable) = false ]; } diff --git a/proto/nucleic/rollapp/rollapp.proto b/proto/nucleic/rollapp/rollapp.proto index 04e68097..c52249ba 100644 --- a/proto/nucleic/rollapp/rollapp.proto +++ b/proto/nucleic/rollapp/rollapp.proto @@ -28,25 +28,25 @@ message RollappGenesisState { // Rollapp defines a rollapp object. First the RollApp is created and then // sequencers can be created and attached. The RollApp is identified by -// rollappId +// rollapp_id message Rollapp { // The unique identifier of the rollapp chain. - // The rollappId follows the same standard as cosmos chain_id. - string rollappId = 1; + // The rollapp_id follows the same standard as cosmos chain_id. + string rollapp_id = 1; // creator is the bech32-encoded address of the rollapp creator. string creator = 2; // version is the software and configuration version. // starts from 1 and increases by one on every MsgUpdateState uint64 version = 3; - // maxSequencers is the maximum number of sequencers. - uint64 maxSequencers = 4; - // permissionedAddresses is a bech32-encoded address list of the sequencers - // that are allowed to serve this rollappId. In the case of an empty list, the - // rollapp is considered permissionless. - repeated string permissionedAddresses = 5; - // tokenMetadata is a list of TokenMetadata that are registered on this + // max_sequencers is the maximum number of sequencers. + uint64 max_sequencers = 4; + // permissioned_addresses is a bech32-encoded address list of the sequencers + // that are allowed to serve this rollapp_id. In the case of an empty list, + // the rollapp is considered permissionless. + repeated string permissioned_addresses = 5; + // token_metadata is a list of TokenMetadata that are registered on this // rollapp - repeated TokenMetadata tokenMetadata = 6; + repeated TokenMetadata token_metadata = 6; // genesis_state is a partial repr of the state the hub can expect the rollapp // to be in upon genesis RollappGenesisState genesis_state = 7 [ (gogoproto.nullable) = false ]; @@ -59,10 +59,10 @@ message Rollapp { // Rollapp summary is a compact representation of Rollapp message RollappSummary { // The unique identifier of the rollapp chain. - // The rollappId follows the same standard as cosmos chain_id. - string rollappId = 1; + // The rollapp_id follows the same standard as cosmos chain_id. + string rollapp_id = 1; // Defines the index of the last rollapp UpdateState. - StateInfoIndex latestStateIndex = 2; + StateInfoIndex latest_state_index = 2; // Defines the index of the last rollapp UpdateState that was finalized. - StateInfoIndex latestFinalizedStateIndex = 3; + StateInfoIndex latest_finalized_state_index = 3; } diff --git a/proto/nucleic/rollapp/state_info.proto b/proto/nucleic/rollapp/state_info.proto index 60d1f26e..9fe2c32a 100644 --- a/proto/nucleic/rollapp/state_info.proto +++ b/proto/nucleic/rollapp/state_info.proto @@ -14,10 +14,10 @@ import "nucleic/rollapp/block_descriptor.proto"; // 2. LatestFinalizedStateIndex which defines the rollapps' current (latest) // index of the latest StateInfo that was finalized message StateInfoIndex { - // rollappId is the rollapp that the sequencer belongs to and asking to update - // it used to identify the what rollapp a StateInfo belongs - // The rollappId follows the same standard as cosmos chain_id - string rollappId = 1; + // rollapp_id is the rollapp that the sequencer belongs to and asking to + // update it used to identify the what rollapp a StateInfo belongs The + // rollapp_id follows the same standard as cosmos chain_id + string rollapp_id = 1; // index is a sequential increasing number, updating on each // state update used for indexing to a specific state info, the first index is // 1 @@ -26,51 +26,52 @@ message StateInfoIndex { // StateInfo defines a rollapps' state. message StateInfo { - // stateInfoIndex defines what rollapp the state belongs to + // state_info_index defines what rollapp the state belongs to // and in which index it can be referenced - StateInfoIndex stateInfoIndex = 1 [ (gogoproto.nullable) = false ]; + StateInfoIndex state_info_index = 1 [ (gogoproto.nullable) = false ]; // sequencer is the bech32-encoded address of the sequencer sent the update string sequencer = 2; - // startHeight is the block height of the first block in the batch - uint64 startHeight = 3; - // numBlocks is the number of blocks included in this batch update - uint64 numBlocks = 4; - // DAPath is the description of the location on the DA layer - string DAPath = 5; + // start_height is the block height of the first block in the batch + uint64 start_height = 3; + // num_blocks is the number of blocks included in this batch update + uint64 num_blocks = 4; + // da_path is the description of the location on the DA layer + string da_path = 5; // version is the version of the rollapp uint64 version = 6; - // creationHeight is the height at which the UpdateState took place - uint64 creationHeight = 7; + // creation_height is the height at which the UpdateState took place + uint64 creation_height = 7; // status is the status of the state update Status status = 8; - // BDs is a list of block description objects (one per block) - // the list must be ordered by height, starting from startHeight to - // startHeight+numBlocks-1 - BlockDescriptors BDs = 9 [ (gogoproto.nullable) = false ]; + // bds is a list of block description objects (one per block) + // the list must be ordered by height, starting from start_height to + // start_height+num_blocks-1 + BlockDescriptors bds = 9 [ (gogoproto.nullable) = false ]; } // StateInfoSummary is a compact representation of StateInfo message StateInfoSummary { - // stateInfoIndex defines what rollapp the state belongs to + // state_info_index defines what rollapp the state belongs to // and in which index it can be referenced - StateInfoIndex stateInfoIndex = 1 [ (gogoproto.nullable) = false ]; + StateInfoIndex state_info_index = 1 [ (gogoproto.nullable) = false ]; // status is the status of the state update Status status = 2; - // creationHeight is the height at which the UpdateState took place - uint64 creationHeight = 3; + // creation_height is the height at which the UpdateState took place + uint64 creation_height = 3; } // BlockHeightToFinalizationQueue defines a map from block height to list of // states to finalized message BlockHeightToFinalizationQueue { - // creationHeight is the block height that the state should be finalized - uint64 creationHeight = 1; - // finalizationQueue is a list of states that are waiting to be finalized - // when the block height becomes creationHeight - repeated StateInfoIndex finalizationQueue = 2 + // creation_height is the block height that the state should be finalized + uint64 creation_height = 1; + // finalization_queue is a list of states that are waiting to be finalized + // when the block height becomes creation_height + repeated StateInfoIndex finalization_queue = 2 [ (gogoproto.nullable) = false ]; } +// Status of state enum Status { PENDING = 0; FINALIZED = 1; diff --git a/x/rollapp/README.md b/x/rollapp/README.md index fdc96ea2..9f650282 100644 --- a/x/rollapp/README.md +++ b/x/rollapp/README.md @@ -1,4 +1,4 @@ -# Rollapp +# x/rollapp ## Abstract @@ -15,8 +15,48 @@ RollApps are standardized blockchains that are easy to bootstrap and provide a s ## Concepts +This document specifies the rollapp module. + +This module allows rollapp register onto Nucleic chain. + +If a rollapp is registered on the Nucleic chain, sequencers should be able to nominate themselves for the rollapp by running a rollapp node. + +The Nucleic chain selects a sequencer for a block n blocks before. This is done through leader rotation based on restaked TIA signaled to each sequencer on that rollapp. + ## State +Each RollApp is identified by a `rollapp_id` folows the same standard as cosmos `chain_id`. + +Here is a struct of a RollApp: + +```protobuf +message Rollapp { + string rollappId = 1; + string creator = 2; + // version is the software and configuration version. + // starts from 1 and increases by one on every MsgUpdateState + uint64 version = 3; + // maxSequencers is the maximum number of sequencers. + uint64 maxSequencers = 4; + // permissionedAddresses is a bech32-encoded address list of the sequencers + // that are allowed to serve this rollappId. In the case of an empty list, the + // rollapp is considered permissionless. + repeated string permissionedAddresses = 5; + // tokenMetadata is a list of TokenMetadata that are registered on this + // rollapp + repeated TokenMetadata tokenMetadata = 6; + // genesis_state is a partial repr of the state the hub can expect the rollapp + // to be in upon genesis + RollappGenesisState genesis_state = 7 [ (gogoproto.nullable) = false ]; + // channel_id will be set to the canonical IBC channel of the rollapp. + string channel_id = 8; + // frozen is a boolean that indicates if the rollapp is frozen. + bool frozen = 9; +} +``` + + + ## Events ## Keepers diff --git a/x/rollapp/types/bank.pb.go b/x/rollapp/types/bank.pb.go index 87acfd4d..4ae58083 100644 --- a/x/rollapp/types/bank.pb.go +++ b/x/rollapp/types/bank.pb.go @@ -112,12 +112,13 @@ type TokenMetadata struct { // // Since: cosmos-sdk 0.43 Symbol string `protobuf:"bytes,6,opt,name=symbol,proto3" json:"symbol,omitempty"` - // URI to a document (on or off-chain) that contains additional information. Optional. + // URI to a document (on or off-chain) that contains additional information. + // Optional. // // Since: cosmos-sdk 0.46 URI string `protobuf:"bytes,7,opt,name=uri,proto3" json:"uri,omitempty"` - // URIHash is a sha256 hash of a document pointed by URI. It's used to verify that - // the document didn't change. Optional. + // URIHash is a sha256 hash of a document pointed by URI. It's used to verify + // that the document didn't change. Optional. // // Since: cosmos-sdk 0.46 URIHash string `protobuf:"bytes,8,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` diff --git a/x/rollapp/types/block_descriptor.pb.go b/x/rollapp/types/block_descriptor.pb.go index b32b4aed..a69a067b 100644 --- a/x/rollapp/types/block_descriptor.pb.go +++ b/x/rollapp/types/block_descriptor.pb.go @@ -27,8 +27,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type BlockDescriptor struct { // height is the height of the block Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - // stateRoot is a 32 byte array of the hash of the block (state root of the block) - StateRoot []byte `protobuf:"bytes,2,opt,name=stateRoot,proto3" json:"stateRoot,omitempty"` + // state_root is a 32 byte array of the hash of the block (state root of the + // block) + StateRoot []byte `protobuf:"bytes,2,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` } func (m *BlockDescriptor) Reset() { *m = BlockDescriptor{} } @@ -80,7 +81,7 @@ func (m *BlockDescriptor) GetStateRoot() []byte { // BlockDescriptors defines list of BlockDescriptor. type BlockDescriptors struct { - BD []BlockDescriptor `protobuf:"bytes,1,rep,name=BD,proto3" json:"BD"` + Bd []BlockDescriptor `protobuf:"bytes,1,rep,name=bd,proto3" json:"bd"` } func (m *BlockDescriptors) Reset() { *m = BlockDescriptors{} } @@ -116,9 +117,9 @@ func (m *BlockDescriptors) XXX_DiscardUnknown() { var xxx_messageInfo_BlockDescriptors proto.InternalMessageInfo -func (m *BlockDescriptors) GetBD() []BlockDescriptor { +func (m *BlockDescriptors) GetBd() []BlockDescriptor { if m != nil { - return m.BD + return m.Bd } return nil } @@ -133,22 +134,23 @@ func init() { } var fileDescriptor_fccbdab1f9ac4db2 = []byte{ - // 239 bytes of a gzipped FileDescriptorProto + // 245 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcb, 0x2b, 0x4d, 0xce, 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0x4f, 0xca, 0xc9, 0x4f, 0xce, 0x8e, 0x4f, 0x49, 0x2d, 0x4e, 0x2e, 0xca, 0x2c, 0x28, 0xc9, 0x2f, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x87, 0xaa, 0xd3, 0x83, 0xaa, 0x93, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, - 0xcb, 0xe9, 0x83, 0x58, 0x10, 0x65, 0x4a, 0xee, 0x5c, 0xfc, 0x4e, 0x20, 0x03, 0x5c, 0xe0, 0xfa, + 0xcb, 0xe9, 0x83, 0x58, 0x10, 0x65, 0x4a, 0x1e, 0x5c, 0xfc, 0x4e, 0x20, 0x03, 0x5c, 0xe0, 0xfa, 0x85, 0xc4, 0xb8, 0xd8, 0x32, 0x52, 0x33, 0xd3, 0x33, 0x4a, 0x24, 0x18, 0x15, 0x18, 0x35, 0x58, - 0x82, 0xa0, 0x3c, 0x21, 0x19, 0x2e, 0xce, 0xe2, 0x92, 0xc4, 0x92, 0xd4, 0xa0, 0xfc, 0xfc, 0x12, - 0x09, 0x26, 0x05, 0x46, 0x0d, 0x9e, 0x20, 0x84, 0x80, 0x92, 0x17, 0x97, 0x00, 0x9a, 0x41, 0xc5, - 0x42, 0x66, 0x5c, 0x4c, 0x4e, 0x2e, 0x12, 0x8c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0x0a, 0x7a, 0x68, - 0x0e, 0xd2, 0x43, 0x53, 0xee, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x93, 0x93, 0x8b, 0x93, - 0xcf, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, - 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x19, 0xa5, 0x67, 0x96, 0x64, - 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0xcd, 0xd3, 0xcd, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, - 0xca, 0x86, 0xf1, 0xf5, 0x2b, 0xe0, 0x41, 0x53, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, - 0xa9, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x04, 0xbd, 0xa4, 0xe6, 0x3a, 0x01, 0x00, 0x00, + 0x82, 0xa0, 0x3c, 0x21, 0x59, 0x2e, 0xae, 0xe2, 0x92, 0xc4, 0x92, 0xd4, 0xf8, 0xa2, 0xfc, 0xfc, + 0x12, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x9e, 0x20, 0x4e, 0xb0, 0x48, 0x50, 0x7e, 0x7e, 0x89, 0x92, + 0x17, 0x97, 0x00, 0x9a, 0x49, 0xc5, 0x42, 0x66, 0x5c, 0x4c, 0x49, 0x29, 0x12, 0x8c, 0x0a, 0xcc, + 0x1a, 0xdc, 0x46, 0x0a, 0x7a, 0x68, 0x2e, 0xd2, 0x43, 0x53, 0xee, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, + 0x43, 0x10, 0x53, 0x52, 0x8a, 0x93, 0xcf, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, + 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, + 0x44, 0x19, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0xcd, 0xd3, + 0xcd, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0x86, 0xf1, 0xf5, 0x2b, 0xe0, 0x61, 0x53, 0x52, 0x59, + 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0xaa, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x97, 0xc0, 0x31, + 0xb9, 0x3b, 0x01, 0x00, 0x00, } func (m *BlockDescriptor) Marshal() (dAtA []byte, err error) { @@ -206,10 +208,10 @@ func (m *BlockDescriptors) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.BD) > 0 { - for iNdEx := len(m.BD) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Bd) > 0 { + for iNdEx := len(m.Bd) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.BD[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Bd[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -256,8 +258,8 @@ func (m *BlockDescriptors) Size() (n int) { } var l int _ = l - if len(m.BD) > 0 { - for _, e := range m.BD { + if len(m.Bd) > 0 { + for _, e := range m.Bd { l = e.Size() n += 1 + l + sovBlockDescriptor(uint64(l)) } @@ -405,7 +407,7 @@ func (m *BlockDescriptors) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BD", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Bd", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -432,8 +434,8 @@ func (m *BlockDescriptors) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BD = append(m.BD, BlockDescriptor{}) - if err := m.BD[len(m.BD)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Bd = append(m.Bd, BlockDescriptor{}) + if err := m.Bd[len(m.Bd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/rollapp/types/errors.go b/x/rollapp/types/errors.go index 6b087962..efddab5b 100644 --- a/x/rollapp/types/errors.go +++ b/x/rollapp/types/errors.go @@ -48,10 +48,4 @@ var ( ErrLogic = errorsmod.Register(ModuleName, 1038, "internal logic error") ErrUnauthorized = errorsmod.Register(ModuleName, 1039, "unauthorized") ErrInvalidAddress = errorsmod.Register(ModuleName, 1040, "invalid address") - - /* ------------------------------ fraud related ----------------------------- */ - ErrDisputeAlreadyFinalized = errorsmod.Register(ModuleName, 2000, "disputed height already finalized") - ErrDisputeAlreadyReverted = errorsmod.Register(ModuleName, 2001, "disputed height already reverted") - ErrWrongClientId = errorsmod.Register(ModuleName, 2002, "client id does not match the rollapp") - ErrWrongProposerAddr = errorsmod.Register(ModuleName, 2003, "wrong proposer address") ) diff --git a/x/rollapp/types/genesis.pb.go b/x/rollapp/types/genesis.pb.go index f98860fc..0783d7b3 100644 --- a/x/rollapp/types/genesis.pb.go +++ b/x/rollapp/types/genesis.pb.go @@ -26,11 +26,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the rollapp module's genesis state. type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - RollappList []Rollapp `protobuf:"bytes,2,rep,name=rollappList,proto3" json:"rollappList"` - StateInfoList []StateInfo `protobuf:"bytes,3,rep,name=stateInfoList,proto3" json:"stateInfoList"` - LatestStateInfoIndexList []StateInfoIndex `protobuf:"bytes,4,rep,name=latestStateInfoIndexList,proto3" json:"latestStateInfoIndexList"` - LatestFinalizedStateIndexList []StateInfoIndex `protobuf:"bytes,5,rep,name=latestFinalizedStateIndexList,proto3" json:"latestFinalizedStateIndexList"` - BlockHeightToFinalizationQueueList []BlockHeightToFinalizationQueue `protobuf:"bytes,6,rep,name=blockHeightToFinalizationQueueList,proto3" json:"blockHeightToFinalizationQueueList"` + RollappList []Rollapp `protobuf:"bytes,2,rep,name=rollapp_list,json=rollappList,proto3" json:"rollapp_list"` + StateInfoList []StateInfo `protobuf:"bytes,3,rep,name=state_info_list,json=stateInfoList,proto3" json:"state_info_list"` + LatestStateInfoIndexList []StateInfoIndex `protobuf:"bytes,4,rep,name=latest_state_info_index_list,json=latestStateInfoIndexList,proto3" json:"latest_state_info_index_list"` + LatestFinalizedStateIndexList []StateInfoIndex `protobuf:"bytes,5,rep,name=latest_finalized_state_index_list,json=latestFinalizedStateIndexList,proto3" json:"latest_finalized_state_index_list"` + BlockHeightToFinalizationQueueList []BlockHeightToFinalizationQueue `protobuf:"bytes,6,rep,name=block_height_to_finalization_queue_list,json=blockHeightToFinalizationQueueList,proto3" json:"block_height_to_finalization_queue_list"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -115,30 +115,32 @@ func init() { func init() { proto.RegisterFile("nucleic/rollapp/genesis.proto", fileDescriptor_165a9e3e67ef0cbd) } var fileDescriptor_165a9e3e67ef0cbd = []byte{ - // 364 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x31, 0x4f, 0xf2, 0x40, - 0x18, 0xc7, 0xdb, 0x17, 0x5e, 0x86, 0x43, 0x63, 0x72, 0x31, 0xb1, 0x69, 0xa4, 0x10, 0x26, 0x16, - 0xdb, 0x04, 0xe3, 0x6e, 0x18, 0x50, 0x12, 0x06, 0x05, 0x27, 0x17, 0x73, 0x94, 0xa3, 0x5c, 0x28, - 0x77, 0x4d, 0xef, 0x1a, 0xd1, 0xdd, 0xdd, 0x6f, 0xe1, 0x57, 0x61, 0x64, 0x74, 0x32, 0x06, 0xbe, - 0x88, 0xe1, 0xfa, 0x40, 0xb4, 0x0d, 0x44, 0xa7, 0x6b, 0xf3, 0xff, 0x3f, 0xbf, 0xdf, 0x33, 0x3c, - 0xa8, 0xc2, 0x13, 0x3f, 0xa4, 0xcc, 0xf7, 0x62, 0x11, 0x86, 0x24, 0x8a, 0xbc, 0x80, 0x72, 0x2a, - 0x99, 0x74, 0xa3, 0x58, 0x28, 0x81, 0x8f, 0x20, 0x76, 0x21, 0xb6, 0x8f, 0x03, 0x11, 0x08, 0x9d, - 0x79, 0xeb, 0xaf, 0xb4, 0x66, 0x9f, 0x66, 0x29, 0x11, 0x89, 0xc9, 0x14, 0x20, 0x76, 0xce, 0x01, - 0x2f, 0xc4, 0xb5, 0x6c, 0x2c, 0x15, 0x51, 0xf4, 0x81, 0xf1, 0x11, 0xe0, 0xeb, 0x6f, 0x45, 0x74, - 0x70, 0x95, 0xee, 0xd5, 0x5f, 0x67, 0xf8, 0x02, 0x95, 0x52, 0x83, 0x65, 0xd6, 0xcc, 0x46, 0xb9, - 0x79, 0xe2, 0x66, 0xf6, 0x74, 0x6f, 0x74, 0xdc, 0x2a, 0xce, 0x3f, 0xaa, 0x46, 0x0f, 0xca, 0xf8, - 0x12, 0x95, 0x21, 0xef, 0x32, 0xa9, 0xac, 0x7f, 0xb5, 0x42, 0xa3, 0xdc, 0xb4, 0x72, 0xb3, 0xbd, - 0xf4, 0x85, 0xe1, 0xef, 0x23, 0xb8, 0x8d, 0x0e, 0xf5, 0x76, 0x1d, 0x3e, 0x12, 0x9a, 0x51, 0xd0, - 0x0c, 0x3b, 0xc7, 0xe8, 0x6f, 0x5a, 0x40, 0xf9, 0x39, 0x86, 0x09, 0xb2, 0x42, 0xa2, 0xa8, 0x54, - 0xdb, 0x5e, 0x87, 0x0f, 0xe9, 0x4c, 0x23, 0x8b, 0x1a, 0x59, 0xdd, 0x8d, 0xd4, 0x55, 0xe0, 0xee, - 0xc4, 0xe0, 0x09, 0xaa, 0xa4, 0x59, 0x9b, 0x71, 0x12, 0xb2, 0x67, 0x3a, 0x84, 0xd2, 0xc6, 0xf3, - 0xff, 0x2f, 0x9e, 0xfd, 0x2c, 0xfc, 0x62, 0xa2, 0xfa, 0x20, 0x14, 0xfe, 0xe4, 0x9a, 0xb2, 0x60, - 0xac, 0xee, 0x04, 0x14, 0x89, 0x62, 0x82, 0xdf, 0x26, 0x34, 0xa1, 0x5a, 0x59, 0xd2, 0x4a, 0x2f, - 0xa7, 0x6c, 0xed, 0x1d, 0x85, 0x15, 0x7e, 0x21, 0x68, 0x75, 0xe7, 0x4b, 0xc7, 0x5c, 0x2c, 0x1d, - 0xf3, 0x73, 0xe9, 0x98, 0xaf, 0x2b, 0xc7, 0x58, 0xac, 0x1c, 0xe3, 0x7d, 0xe5, 0x18, 0xf7, 0xcd, - 0x80, 0xa9, 0x71, 0x32, 0x70, 0x7d, 0x31, 0xf5, 0x40, 0x7f, 0xc6, 0xa9, 0x7a, 0x14, 0xf1, 0x64, - 0xf3, 0xef, 0xcd, 0xb6, 0x27, 0xa8, 0x9e, 0x22, 0x2a, 0x07, 0x25, 0x7d, 0x7e, 0xe7, 0x5f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0xdc, 0x93, 0xc5, 0xd7, 0x25, 0x03, 0x00, 0x00, + // 400 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xb1, 0x6e, 0xda, 0x40, + 0x18, 0xc7, 0xed, 0x42, 0x19, 0x0e, 0x2a, 0x24, 0xab, 0x52, 0x2d, 0x0b, 0x0c, 0x65, 0x29, 0x4b, + 0x6d, 0x89, 0xaa, 0x0f, 0x50, 0x06, 0x0a, 0x12, 0x43, 0x4b, 0x3b, 0x75, 0xb1, 0x6c, 0x73, 0x98, + 0x13, 0xe6, 0xce, 0xf5, 0x9d, 0x15, 0x92, 0x47, 0xc8, 0x94, 0xb7, 0xc9, 0x2b, 0x30, 0x32, 0x66, + 0x8a, 0x22, 0x78, 0x91, 0xc8, 0x77, 0x9f, 0x09, 0xc1, 0x4a, 0xa4, 0x4c, 0x67, 0xdf, 0xff, 0xfb, + 0x7e, 0xbf, 0xff, 0x70, 0xa8, 0x4d, 0xb3, 0x30, 0xc6, 0x24, 0x74, 0x53, 0x16, 0xc7, 0x7e, 0x92, + 0xb8, 0x11, 0xa6, 0x98, 0x13, 0xee, 0x24, 0x29, 0x13, 0xcc, 0x68, 0x42, 0xec, 0x40, 0x6c, 0x7d, + 0x8c, 0x58, 0xc4, 0x64, 0xe6, 0xe6, 0x5f, 0x6a, 0xcc, 0x6a, 0x9d, 0x53, 0x12, 0x3f, 0xf5, 0xd7, + 0x00, 0xb1, 0x4a, 0x0e, 0x38, 0x21, 0xee, 0x9e, 0xc7, 0x5c, 0xf8, 0x02, 0x7b, 0x84, 0x2e, 0x00, + 0xdf, 0xbb, 0xad, 0xa2, 0xc6, 0x4f, 0xd5, 0xeb, 0x4f, 0x9e, 0x19, 0xdf, 0x51, 0x4d, 0x19, 0x4c, + 0xbd, 0xab, 0xf7, 0xeb, 0x83, 0x4f, 0xce, 0x59, 0x4f, 0xe7, 0x97, 0x8c, 0x87, 0xd5, 0xed, 0x7d, + 0x47, 0x9b, 0xc1, 0xb0, 0xf1, 0x03, 0x35, 0x20, 0xf7, 0x62, 0xc2, 0x85, 0xf9, 0xae, 0x5b, 0xe9, + 0xd7, 0x07, 0x66, 0x69, 0x79, 0xa6, 0x4e, 0xd8, 0xae, 0xc3, 0xf5, 0x94, 0x70, 0x61, 0x8c, 0x51, + 0xf3, 0xa9, 0x9e, 0xa2, 0x54, 0x24, 0xc5, 0x2a, 0x51, 0x64, 0xd5, 0x09, 0x5d, 0x30, 0xe0, 0x7c, + 0xe0, 0xc5, 0x85, 0x24, 0x61, 0xd4, 0x8a, 0x7d, 0x81, 0xb9, 0xf0, 0x4e, 0x80, 0x84, 0xce, 0xf1, + 0x46, 0x61, 0xab, 0x12, 0xdb, 0x79, 0x19, 0x3b, 0xc9, 0x67, 0x81, 0x6d, 0x2a, 0xd4, 0xf3, 0x4c, + 0x6a, 0x18, 0xfa, 0x0c, 0x9a, 0x05, 0xa1, 0x7e, 0x4c, 0xae, 0xf0, 0xfc, 0x28, 0x3c, 0xba, 0xde, + 0xbf, 0xc5, 0xd5, 0x56, 0xbc, 0x51, 0x81, 0x83, 0xa1, 0x42, 0x78, 0xad, 0xa3, 0x2f, 0x41, 0xcc, + 0xc2, 0x95, 0xb7, 0xc4, 0x24, 0x5a, 0x0a, 0x4f, 0xb0, 0x42, 0xed, 0x0b, 0xc2, 0xa8, 0xf7, 0x3f, + 0xc3, 0x19, 0x56, 0xde, 0x9a, 0xf4, 0xba, 0x25, 0xef, 0x30, 0xdf, 0x1f, 0xcb, 0xf5, 0xbf, 0x6c, + 0x74, 0xb2, 0xfc, 0x3b, 0xdf, 0x85, 0x1e, 0xbd, 0xe0, 0xd5, 0xa9, 0xbc, 0xcc, 0x70, 0xba, 0xdd, + 0xdb, 0xfa, 0x6e, 0x6f, 0xeb, 0x0f, 0x7b, 0x5b, 0xbf, 0x39, 0xd8, 0xda, 0xee, 0x60, 0x6b, 0x77, + 0x07, 0x5b, 0xfb, 0x37, 0x88, 0x88, 0x58, 0x66, 0x81, 0x13, 0xb2, 0xb5, 0x0b, 0xfa, 0xaf, 0x14, + 0x8b, 0x0b, 0x96, 0xae, 0x8a, 0x7f, 0x77, 0x73, 0x7c, 0x92, 0xe2, 0x32, 0xc1, 0x3c, 0xa8, 0xc9, + 0xe7, 0xf8, 0xed, 0x31, 0x00, 0x00, 0xff, 0xff, 0x68, 0x84, 0x55, 0x48, 0x35, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/rollapp/types/params.pb.go b/x/rollapp/types/params.pb.go index dd91d06f..9a82518f 100644 --- a/x/rollapp/types/params.pb.go +++ b/x/rollapp/types/params.pb.go @@ -76,8 +76,8 @@ type Params struct { // during that period, any user could submit fraud proof DisputePeriodInBlocks uint64 `protobuf:"varint,1,opt,name=dispute_period_in_blocks,json=disputePeriodInBlocks,proto3" json:"dispute_period_in_blocks,omitempty" yaml:"dispute_period_in_blocks"` // deployer_whitelist is a list of the - // accounts that are allowed to create a rollapp and maximum number of rollapps. - // In the case of an empty list, there are no restrictions + // accounts that are allowed to create a rollapp and maximum number of + // rollapps. In the case of an empty list, there are no restrictions DeployerWhitelist []DeployerParams `protobuf:"bytes,2,rep,name=deployer_whitelist,json=deployerWhitelist,proto3" json:"deployer_whitelist" yaml:"deployer_whitelist"` RollappsEnabled bool `protobuf:"varint,3,opt,name=rollapps_enabled,json=rollappsEnabled,proto3" json:"rollapps_enabled,omitempty" yaml:"rollapps_enabled"` } diff --git a/x/rollapp/types/query.pb.go b/x/rollapp/types/query.pb.go index b2c27fd5..b7a353da 100644 --- a/x/rollapp/types/query.pb.go +++ b/x/rollapp/types/query.pb.go @@ -114,7 +114,7 @@ func (m *QueryParamsResponse) GetParams() Params { } type QueryGetRollappRequest struct { - RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` } func (m *QueryGetRollappRequest) Reset() { *m = QueryGetRollappRequest{} } @@ -202,7 +202,7 @@ func (m *QueryGetRollappByEIP155Request) GetEip155() uint64 { } type QueryGetLatestHeightRequest struct { - RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` Finalized bool `protobuf:"varint,2,opt,name=finalized,proto3" json:"finalized,omitempty"` } @@ -298,7 +298,7 @@ func (m *QueryGetLatestHeightResponse) GetHeight() uint64 { } type QueryGetLatestStateIndexRequest struct { - RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` Finalized bool `protobuf:"varint,2,opt,name=finalized,proto3" json:"finalized,omitempty"` } @@ -350,7 +350,7 @@ func (m *QueryGetLatestStateIndexRequest) GetFinalized() bool { } type QueryGetLatestStateIndexResponse struct { - StateIndex StateInfoIndex `protobuf:"bytes,1,opt,name=stateIndex,proto3" json:"stateIndex"` + StateIndex StateInfoIndex `protobuf:"bytes,1,opt,name=state_index,json=stateIndex,proto3" json:"state_index"` } func (m *QueryGetLatestStateIndexResponse) Reset() { *m = QueryGetLatestStateIndexResponse{} } @@ -396,11 +396,11 @@ func (m *QueryGetLatestStateIndexResponse) GetStateIndex() StateInfoIndex { type QueryGetRollappResponse struct { Rollapp Rollapp `protobuf:"bytes,1,opt,name=rollapp,proto3" json:"rollapp"` // Defines the index of the last rollapp UpdateState. - LatestStateIndex *StateInfoIndex `protobuf:"bytes,2,opt,name=latestStateIndex,proto3" json:"latestStateIndex,omitempty"` + LatestStateIndex *StateInfoIndex `protobuf:"bytes,2,opt,name=latest_state_index,json=latestStateIndex,proto3" json:"latest_state_index,omitempty"` // Defines the index of the last rollapp UpdateState that was finalized. - LatestFinalizedStateIndex *StateInfoIndex `protobuf:"bytes,3,opt,name=latestFinalizedStateIndex,proto3" json:"latestFinalizedStateIndex,omitempty"` - LatestHeight uint64 `protobuf:"varint,4,opt,name=latestHeight,proto3" json:"latestHeight,omitempty"` - LatestFinalizedHeight uint64 `protobuf:"varint,5,opt,name=latestFinalizedHeight,proto3" json:"latestFinalizedHeight,omitempty"` + LatestFinalizedStateIndex *StateInfoIndex `protobuf:"bytes,3,opt,name=latest_finalized_state_index,json=latestFinalizedStateIndex,proto3" json:"latest_finalized_state_index,omitempty"` + LatestHeight uint64 `protobuf:"varint,4,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height,omitempty"` + LatestFinalizedHeight uint64 `protobuf:"varint,5,opt,name=latest_finalized_height,json=latestFinalizedHeight,proto3" json:"latest_finalized_height,omitempty"` } func (m *QueryGetRollappResponse) Reset() { *m = QueryGetRollappResponse{} } @@ -568,7 +568,7 @@ func (m *QueryAllRollappResponse) GetPagination() *query.PageResponse { } type QueryGetStateInfoRequest struct { - RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` Finalized bool `protobuf:"varint,4,opt,name=finalized,proto3" json:"finalized,omitempty"` @@ -636,7 +636,7 @@ func (m *QueryGetStateInfoRequest) GetFinalized() bool { } type QueryGetStateInfoResponse struct { - StateInfo StateInfo `protobuf:"bytes,1,opt,name=stateInfo,proto3" json:"stateInfo"` + StateInfo StateInfo `protobuf:"bytes,1,opt,name=state_info,json=stateInfo,proto3" json:"state_info"` } func (m *QueryGetStateInfoResponse) Reset() { *m = QueryGetStateInfoResponse{} } @@ -698,63 +698,64 @@ func init() { func init() { proto.RegisterFile("nucleic/rollapp/query.proto", fileDescriptor_faa12a617c368b49) } var fileDescriptor_faa12a617c368b49 = []byte{ - // 884 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x4f, 0xe3, 0x56, - 0x10, 0x8e, 0x21, 0x04, 0x32, 0x45, 0x02, 0xbd, 0x52, 0x08, 0x86, 0x26, 0x91, 0x8b, 0x20, 0x45, - 0x60, 0x37, 0x69, 0x43, 0x39, 0xb5, 0x02, 0x09, 0x28, 0x2a, 0x07, 0x6a, 0x4e, 0x6d, 0x85, 0xa8, - 0x93, 0x3c, 0x8c, 0x55, 0xc7, 0x36, 0xb1, 0xd3, 0x92, 0x22, 0x0e, 0xad, 0x7a, 0xea, 0xa9, 0x52, - 0xa5, 0x1e, 0xda, 0xc3, 0x1e, 0xf6, 0x1f, 0xd8, 0x3f, 0x83, 0x23, 0xd2, 0x5e, 0x76, 0x2f, 0xab, - 0x15, 0xec, 0x1f, 0xb2, 0xca, 0x7b, 0xe3, 0xc4, 0x3f, 0xe2, 0x4d, 0x90, 0xf6, 0x04, 0x7e, 0x33, - 0xdf, 0x37, 0x5f, 0xe6, 0xf3, 0xcc, 0x33, 0x2c, 0x59, 0xed, 0xba, 0x49, 0x8d, 0xba, 0xd2, 0xb2, - 0x4d, 0x53, 0x73, 0x1c, 0xe5, 0xb2, 0x4d, 0x5b, 0x1d, 0xd9, 0x69, 0xd9, 0x9e, 0x4d, 0x66, 0x30, - 0x28, 0x63, 0x50, 0x9c, 0xd3, 0x6d, 0xdd, 0x66, 0x31, 0xa5, 0xfb, 0x1f, 0x4f, 0x13, 0x97, 0x75, - 0xdb, 0xd6, 0x4d, 0xaa, 0x68, 0x8e, 0xa1, 0x68, 0x96, 0x65, 0x7b, 0x9a, 0x67, 0xd8, 0x96, 0x8b, - 0xd1, 0xf5, 0xba, 0xed, 0x36, 0x6d, 0x57, 0xa9, 0x69, 0x2e, 0xe5, 0xec, 0xca, 0x2f, 0xe5, 0x1a, - 0xf5, 0xb4, 0xb2, 0xe2, 0x68, 0xba, 0x61, 0xb1, 0x64, 0x9f, 0x29, 0xaa, 0xc6, 0xd1, 0x5a, 0x5a, - 0xd3, 0x67, 0xfa, 0x38, 0x1a, 0xc5, 0xbf, 0x18, 0x2e, 0x46, 0xc3, 0xae, 0xa7, 0x79, 0xf4, 0xcc, - 0xb0, 0xce, 0x51, 0xa8, 0x34, 0x07, 0xe4, 0xbb, 0xae, 0x80, 0x63, 0xc6, 0xaa, 0xd2, 0xcb, 0x36, - 0x75, 0x3d, 0xe9, 0x08, 0x3e, 0x0c, 0x9d, 0xba, 0x8e, 0x6d, 0xb9, 0x94, 0x54, 0x21, 0xc3, 0xab, - 0xe7, 0x84, 0xa2, 0x50, 0xfa, 0xa0, 0xb2, 0x20, 0x47, 0xba, 0x21, 0x73, 0xc0, 0x6e, 0xfa, 0xf6, - 0x55, 0x21, 0xa5, 0x62, 0xb2, 0xb4, 0x05, 0xf3, 0x8c, 0xed, 0x80, 0x7a, 0x2a, 0xcf, 0xc3, 0x3a, - 0x64, 0x19, 0xb2, 0x88, 0x3c, 0x6c, 0x30, 0xce, 0xac, 0xda, 0x3f, 0x90, 0xb6, 0x21, 0x1f, 0xc1, - 0xed, 0x76, 0xf6, 0x0e, 0x8f, 0xcb, 0xd5, 0xaa, 0x8f, 0x9f, 0x87, 0x0c, 0x35, 0x9c, 0x72, 0xb5, - 0xca, 0xc0, 0x69, 0x15, 0x9f, 0xa4, 0xef, 0x61, 0xc9, 0x47, 0x1e, 0x69, 0x1e, 0x75, 0xbd, 0x6f, - 0xa8, 0xa1, 0x5f, 0x78, 0x23, 0x95, 0xed, 0x46, 0xcf, 0x0d, 0x4b, 0x33, 0x8d, 0xdf, 0x68, 0x23, - 0x37, 0x56, 0x14, 0x4a, 0x53, 0x6a, 0xff, 0x40, 0xda, 0x82, 0xe5, 0xc1, 0xd4, 0xd8, 0xa3, 0x79, - 0xc8, 0x5c, 0xb0, 0x13, 0x5f, 0x12, 0x7f, 0x92, 0x4e, 0xa1, 0x10, 0xc6, 0x9d, 0x74, 0xad, 0x38, - 0xb4, 0x1a, 0xf4, 0xea, 0x7d, 0xc8, 0x32, 0xa0, 0x98, 0x4c, 0x8f, 0xd2, 0xf6, 0x00, 0xdc, 0xde, - 0x29, 0x5a, 0x58, 0x88, 0x59, 0x88, 0xc0, 0x73, 0x9b, 0xa5, 0xa1, 0x95, 0x01, 0xa0, 0xf4, 0x72, - 0x0c, 0x16, 0x62, 0x7e, 0x62, 0x89, 0x6d, 0x98, 0x44, 0x1e, 0xe4, 0xcf, 0xc5, 0xf8, 0x7d, 0x2b, - 0x39, 0xb1, 0x9f, 0x4e, 0xbe, 0x85, 0x59, 0x33, 0x22, 0x9c, 0xfd, 0xca, 0xe1, 0x12, 0xd5, 0x18, - 0x90, 0x9c, 0xc2, 0x22, 0x3f, 0xdb, 0xf7, 0x1b, 0x14, 0x60, 0x1d, 0x1f, 0x8d, 0x35, 0x99, 0x81, - 0x48, 0x30, 0x6d, 0x06, 0xbc, 0xcf, 0xa5, 0x99, 0xd3, 0xa1, 0x33, 0xf2, 0x05, 0x7c, 0x14, 0x21, - 0xc0, 0xe4, 0x09, 0x96, 0x3c, 0x38, 0x28, 0xfd, 0x84, 0xa3, 0xb2, 0x63, 0x9a, 0x91, 0x51, 0xd9, - 0x07, 0xe8, 0xef, 0x06, 0x6c, 0xee, 0xaa, 0xcc, 0x17, 0x89, 0xdc, 0x5d, 0x24, 0x32, 0x5f, 0x53, - 0xb8, 0x48, 0xe4, 0x63, 0x4d, 0xa7, 0x88, 0x55, 0x03, 0x48, 0xe9, 0xa9, 0x80, 0xee, 0x05, 0x4b, - 0xa0, 0x7b, 0x5f, 0x07, 0xdd, 0x1b, 0x1f, 0xd8, 0x24, 0x84, 0x9c, 0xb4, 0x9b, 0x4d, 0xad, 0xd5, - 0x89, 0x9a, 0x78, 0x10, 0x12, 0xc9, 0xed, 0x5b, 0x1b, 0x2a, 0x92, 0x57, 0x0f, 0xa9, 0xfc, 0x53, - 0x80, 0x9c, 0xff, 0x8e, 0xf5, 0x7c, 0x19, 0x6d, 0x4e, 0xe6, 0x60, 0xc2, 0xe8, 0xbd, 0x3d, 0x69, - 0x95, 0x3f, 0x04, 0xc6, 0x72, 0x3c, 0x38, 0x96, 0xe1, 0xa9, 0x4a, 0x47, 0xa7, 0xea, 0x47, 0x58, - 0x1c, 0xa0, 0x02, 0xbb, 0xf5, 0x15, 0x64, 0x5d, 0xff, 0x10, 0x0d, 0x11, 0x93, 0x5f, 0x2a, 0x6c, - 0x55, 0x1f, 0x52, 0xf9, 0x6f, 0x0a, 0x26, 0x18, 0x3b, 0xf1, 0x20, 0xc3, 0x17, 0x27, 0xf9, 0x24, - 0x46, 0x10, 0xdf, 0xce, 0xe2, 0xca, 0xbb, 0x93, 0xb8, 0x3c, 0xa9, 0xf0, 0xc7, 0xf3, 0x37, 0xff, - 0x8c, 0x2d, 0x92, 0x05, 0x65, 0xf0, 0x0d, 0x42, 0xfe, 0x12, 0x60, 0x12, 0xed, 0x24, 0x6b, 0x83, - 0x29, 0x63, 0x1b, 0x5b, 0x2c, 0x0d, 0x4f, 0xc4, 0xfa, 0x1b, 0xac, 0xfe, 0x2a, 0x59, 0x51, 0x12, - 0xee, 0x28, 0xe5, 0xba, 0x67, 0xda, 0x0d, 0xf9, 0x57, 0x80, 0x99, 0xc8, 0x92, 0x27, 0xca, 0xb0, - 0x5a, 0x91, 0xeb, 0xe0, 0x11, 0xe2, 0x4a, 0x4c, 0x9c, 0x44, 0x8a, 0x31, 0x71, 0xfc, 0x06, 0x51, - 0xae, 0xf9, 0xdf, 0x1b, 0xf2, 0xbb, 0x00, 0x80, 0xe8, 0x1d, 0xd3, 0x4c, 0x6a, 0x54, 0x6c, 0x5e, - 0x93, 0xb4, 0xc4, 0xa7, 0x4e, 0x2a, 0x32, 0x2d, 0x22, 0xc9, 0x25, 0x35, 0x8a, 0x3c, 0x11, 0x60, - 0x3a, 0x78, 0xd9, 0x90, 0x8d, 0xc4, 0x1f, 0x3a, 0xe0, 0xba, 0x13, 0x37, 0x47, 0xcc, 0x46, 0x3d, - 0x15, 0xa6, 0x67, 0x83, 0xac, 0xc7, 0xf4, 0xf0, 0x9d, 0x75, 0xc6, 0x47, 0x27, 0x64, 0xdf, 0x33, - 0x01, 0x66, 0xa3, 0xf7, 0x0e, 0xf9, 0x6c, 0x48, 0xdd, 0xd8, 0x0d, 0x28, 0x96, 0x1f, 0x81, 0x40, - 0xb5, 0x5f, 0x32, 0xb5, 0x65, 0xa2, 0x24, 0xa9, 0xf5, 0x3f, 0x79, 0x1a, 0xf4, 0x2a, 0x24, 0xf9, - 0x7f, 0x01, 0xb2, 0xbd, 0xe9, 0x24, 0x9f, 0x26, 0x56, 0x8e, 0xae, 0x1f, 0x71, 0x7d, 0x94, 0xd4, - 0xa1, 0xea, 0xfa, 0x5f, 0x62, 0x41, 0x55, 0xca, 0x35, 0x13, 0x7a, 0xb3, 0x7b, 0x74, 0x7b, 0x9f, - 0x17, 0xee, 0xee, 0xf3, 0xc2, 0xeb, 0xfb, 0xbc, 0xf0, 0xf7, 0x43, 0x3e, 0x75, 0xf7, 0x90, 0x4f, - 0xbd, 0x78, 0xc8, 0xa7, 0x7e, 0xa8, 0xe8, 0x86, 0x77, 0xd1, 0xae, 0xc9, 0x75, 0xbb, 0xe9, 0x93, - 0x6e, 0x5a, 0xd4, 0xfb, 0xd5, 0x6e, 0xfd, 0xdc, 0x2b, 0x72, 0xd5, 0x2b, 0xe3, 0x75, 0x1c, 0xea, - 0xd6, 0x32, 0xec, 0x63, 0xef, 0xf3, 0xb7, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0b, 0xc0, 0xf9, 0xbc, - 0xdb, 0x0a, 0x00, 0x00, + // 897 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x4f, 0x2b, 0x55, + 0x14, 0xee, 0x94, 0xd2, 0xf7, 0x7a, 0xde, 0x33, 0xef, 0xe5, 0x8a, 0xb4, 0x0c, 0xa5, 0x6d, 0x06, + 0x95, 0x8a, 0x76, 0x86, 0x96, 0x14, 0xd9, 0x19, 0x48, 0x04, 0x49, 0x30, 0xc1, 0x61, 0x47, 0x8c, + 0x30, 0x6d, 0x2f, 0xc3, 0xe8, 0x74, 0x66, 0xe8, 0x4c, 0x95, 0x4a, 0x58, 0x68, 0xe2, 0xca, 0x8d, + 0x89, 0x89, 0x2b, 0x63, 0x4c, 0xfc, 0x0b, 0xfc, 0x2f, 0x58, 0x92, 0xb8, 0x71, 0x65, 0x14, 0xfc, + 0x43, 0x4c, 0xef, 0x3d, 0xd3, 0xce, 0x8f, 0x8e, 0x2d, 0xc9, 0x5b, 0x95, 0xde, 0x7b, 0xce, 0xf7, + 0x7d, 0x3d, 0xdf, 0x3d, 0xe7, 0x00, 0xcb, 0x56, 0xbf, 0x6d, 0x52, 0xa3, 0xad, 0xf4, 0x6c, 0xd3, + 0xd4, 0x1c, 0x47, 0xb9, 0xec, 0xd3, 0xde, 0x40, 0x76, 0x7a, 0xb6, 0x67, 0x93, 0x17, 0x78, 0x29, + 0xe3, 0xa5, 0xb8, 0xa0, 0xdb, 0xba, 0xcd, 0xee, 0x94, 0xe1, 0x5f, 0x3c, 0x4c, 0x2c, 0xea, 0xb6, + 0xad, 0x9b, 0x54, 0xd1, 0x1c, 0x43, 0xd1, 0x2c, 0xcb, 0xf6, 0x34, 0xcf, 0xb0, 0x2d, 0x17, 0x6f, + 0xd7, 0xdb, 0xb6, 0xdb, 0xb5, 0x5d, 0xa5, 0xa5, 0xb9, 0x94, 0xa3, 0x2b, 0x5f, 0xd6, 0x5b, 0xd4, + 0xd3, 0xea, 0x8a, 0xa3, 0xe9, 0x86, 0xc5, 0x82, 0x7d, 0xa4, 0xa8, 0x1a, 0x47, 0xeb, 0x69, 0x5d, + 0x1f, 0x69, 0x25, 0x7a, 0x8b, 0x9f, 0x78, 0x5d, 0x89, 0x5e, 0xbb, 0x9e, 0xe6, 0xd1, 0x53, 0xc3, + 0x3a, 0x47, 0xa1, 0xd2, 0x02, 0x90, 0x4f, 0x86, 0x02, 0x8e, 0x18, 0xaa, 0x4a, 0x2f, 0xfb, 0xd4, + 0xf5, 0xa4, 0x43, 0x78, 0x3d, 0x74, 0xea, 0x3a, 0xb6, 0xe5, 0x52, 0xd2, 0x84, 0x2c, 0x67, 0x2f, + 0x08, 0x15, 0xa1, 0xfa, 0xac, 0x91, 0x97, 0x23, 0xd5, 0x90, 0x79, 0xc2, 0x6e, 0xe6, 0xf6, 0xaf, + 0x72, 0x4a, 0xc5, 0x60, 0xe9, 0x7d, 0x58, 0x64, 0x68, 0xfb, 0xd4, 0x53, 0x79, 0x1c, 0xf2, 0x90, + 0x15, 0x00, 0xcc, 0x3c, 0x35, 0x3a, 0x0c, 0x34, 0xa7, 0xe6, 0xf0, 0xe4, 0xa0, 0x23, 0x6d, 0x43, + 0x29, 0x92, 0xb8, 0x3b, 0xf8, 0xf0, 0xe0, 0xa8, 0xde, 0x6c, 0xfa, 0x00, 0x8b, 0x90, 0xa5, 0x86, + 0x53, 0x6f, 0x36, 0x59, 0x72, 0x46, 0xc5, 0x6f, 0xd2, 0x09, 0x2c, 0xfb, 0x99, 0x87, 0x9a, 0x47, + 0x5d, 0xef, 0x23, 0x6a, 0xe8, 0x17, 0xde, 0x6c, 0xbc, 0xa4, 0x08, 0xb9, 0x73, 0xc3, 0xd2, 0x4c, + 0xe3, 0x6b, 0xda, 0x29, 0xa4, 0x2b, 0x42, 0xf5, 0xa9, 0x3a, 0x3e, 0x90, 0xb6, 0xa0, 0x38, 0x19, + 0x1b, 0xab, 0xb4, 0x08, 0xd9, 0x0b, 0x76, 0xe2, 0x6b, 0xe2, 0xdf, 0xa4, 0xcf, 0xa0, 0x1c, 0xce, + 0x3b, 0x1e, 0x9a, 0x71, 0x60, 0x75, 0xe8, 0xd5, 0x2b, 0xd1, 0xf5, 0x39, 0x54, 0x92, 0xf1, 0x51, + 0xdb, 0x1e, 0x3c, 0xf3, 0x9f, 0x40, 0x87, 0x5e, 0xa1, 0x8d, 0xe5, 0x98, 0x8d, 0x98, 0x79, 0x6e, + 0xb3, 0x6c, 0xb4, 0x13, 0xdc, 0x11, 0x9e, 0xf4, 0x4f, 0x1a, 0xf2, 0x31, 0x4f, 0x91, 0x63, 0x1b, + 0x9e, 0x20, 0x0e, 0xe2, 0x17, 0x62, 0xf8, 0xbe, 0x9b, 0x1c, 0xd8, 0x0f, 0x27, 0x1f, 0x03, 0x31, + 0x99, 0xf2, 0xd3, 0xa0, 0xc8, 0xf4, 0x4c, 0x22, 0xd5, 0x97, 0x66, 0xe4, 0x47, 0x93, 0x33, 0x28, + 0x22, 0xdc, 0xa8, 0x48, 0x21, 0xe0, 0xb9, 0xd9, 0x80, 0x97, 0x38, 0xc8, 0x9e, 0x8f, 0x11, 0x60, + 0x58, 0x85, 0xd7, 0x90, 0x01, 0x1d, 0xcf, 0x30, 0xc7, 0x9f, 0x9b, 0x81, 0x77, 0x41, 0xb6, 0x20, + 0x1f, 0x93, 0x81, 0xe1, 0xf3, 0x2c, 0xfc, 0x8d, 0x08, 0x01, 0xcf, 0x93, 0xce, 0xb0, 0x6d, 0x76, + 0x4c, 0x33, 0xd2, 0x36, 0x7b, 0x00, 0xe3, 0x39, 0x81, 0x45, 0x7e, 0x5b, 0xe6, 0x43, 0x45, 0x1e, + 0x0e, 0x15, 0x99, 0x8f, 0x2c, 0x1c, 0x2a, 0xf2, 0x91, 0xa6, 0x53, 0xcc, 0x55, 0x03, 0x99, 0xd2, + 0x6f, 0x02, 0xba, 0x18, 0xa4, 0x40, 0x17, 0x3f, 0x08, 0xba, 0x38, 0x37, 0xb1, 0x4e, 0x98, 0x72, + 0xdc, 0xef, 0x76, 0xb5, 0xde, 0x20, 0x6a, 0xe6, 0x7e, 0x48, 0x24, 0x37, 0x71, 0x6d, 0xaa, 0x48, + 0xce, 0x1e, 0x52, 0xf9, 0x9d, 0x00, 0x05, 0xff, 0xad, 0x8d, 0xac, 0x99, 0xb1, 0x63, 0x16, 0x60, + 0x7e, 0xfc, 0x88, 0x32, 0x2a, 0xff, 0x12, 0xe8, 0xd0, 0xb9, 0x60, 0x87, 0x86, 0xfb, 0x2b, 0x13, + 0xed, 0xaf, 0x4f, 0x61, 0x69, 0x82, 0x8c, 0x51, 0xb9, 0x60, 0x3c, 0x5b, 0xd1, 0x12, 0x31, 0xf9, + 0x65, 0x61, 0xb1, 0x72, 0xae, 0x7f, 0xd0, 0xf8, 0xe5, 0x29, 0xcc, 0x33, 0x78, 0xe2, 0x41, 0x96, + 0x8f, 0x51, 0xb2, 0x1a, 0x03, 0x88, 0xcf, 0x6a, 0xf1, 0xcd, 0xff, 0x0f, 0xe2, 0xfa, 0xa4, 0xf2, + 0xb7, 0x7f, 0xfc, 0xfb, 0x63, 0x7a, 0x89, 0xe4, 0x95, 0xc9, 0xfb, 0x84, 0x7c, 0x2f, 0xc0, 0x13, + 0x34, 0x94, 0xac, 0x4d, 0x86, 0x8c, 0xcd, 0x6f, 0xb1, 0x3a, 0x3d, 0x10, 0xf9, 0x6b, 0x8c, 0x7f, + 0x8d, 0xbc, 0xa5, 0x24, 0x6c, 0x2c, 0xe5, 0x7a, 0xec, 0xe3, 0x0d, 0xf9, 0x49, 0x80, 0x17, 0x91, + 0x91, 0x4f, 0x94, 0x69, 0x64, 0x91, 0xe5, 0xf0, 0x08, 0x75, 0x55, 0xa6, 0x4e, 0x22, 0x95, 0x98, + 0x3a, 0xbe, 0x4f, 0x94, 0x6b, 0xfe, 0x79, 0x43, 0xbe, 0x11, 0x00, 0x30, 0x7b, 0xc7, 0x34, 0x93, + 0x2a, 0x15, 0x6b, 0xd9, 0x24, 0x2d, 0xf1, 0xc6, 0x93, 0x2a, 0x4c, 0x8b, 0x48, 0x0a, 0x49, 0x95, + 0x22, 0xbf, 0x0a, 0xf0, 0x3c, 0xb8, 0x79, 0xc8, 0x7b, 0x89, 0x3f, 0x74, 0xc2, 0xf2, 0x13, 0x6b, + 0x33, 0x46, 0xa3, 0x9e, 0x4d, 0xa6, 0xa7, 0x46, 0xde, 0x8d, 0xe9, 0x09, 0x8d, 0xbe, 0xb0, 0x7f, + 0xbf, 0x0b, 0xf0, 0x32, 0xba, 0x84, 0xc8, 0xc6, 0x14, 0xe2, 0xd8, 0x3e, 0x14, 0xeb, 0x8f, 0xc8, + 0x40, 0xb9, 0xdb, 0x4c, 0x6e, 0x83, 0x6c, 0x24, 0xc9, 0x0d, 0x6c, 0x80, 0xb0, 0xe6, 0x9f, 0x05, + 0xc8, 0x8d, 0x1a, 0x94, 0xbc, 0x93, 0x48, 0x1d, 0x9d, 0x41, 0xe2, 0xfa, 0x2c, 0xa1, 0x53, 0xe5, + 0x8d, 0xc7, 0x47, 0x48, 0x96, 0x72, 0xcd, 0xa4, 0xde, 0xec, 0x1e, 0xde, 0xde, 0x97, 0x84, 0xbb, + 0xfb, 0x92, 0xf0, 0xf7, 0x7d, 0x49, 0xf8, 0xe1, 0xa1, 0x94, 0xba, 0x7b, 0x28, 0xa5, 0xfe, 0x7c, + 0x28, 0xa5, 0x4e, 0x1a, 0xba, 0xe1, 0x5d, 0xf4, 0x5b, 0x72, 0xdb, 0xee, 0xfa, 0xa8, 0x35, 0x8b, + 0x7a, 0x5f, 0xd9, 0xbd, 0x2f, 0x46, 0x2c, 0x57, 0x23, 0x1e, 0x6f, 0xe0, 0x50, 0xb7, 0x95, 0x65, + 0xff, 0xfe, 0x6d, 0xfe, 0x17, 0x00, 0x00, 0xff, 0xff, 0x66, 0x5a, 0x8a, 0xa5, 0xed, 0x0a, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/rollapp/types/query.pb.gw.go b/x/rollapp/types/query.pb.gw.go index f30646eb..dbb54666 100644 --- a/x/rollapp/types/query.pb.gw.go +++ b/x/rollapp/types/query.pb.gw.go @@ -62,15 +62,15 @@ func request_Query_Rollapp_0(ctx context.Context, marshaler runtime.Marshaler, c _ = err ) - val, ok = pathParams["rollappId"] + val, ok = pathParams["rollapp_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") } protoReq.RollappId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) } msg, err := client.Rollapp(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -89,15 +89,15 @@ func local_request_Query_Rollapp_0(ctx context.Context, marshaler runtime.Marsha _ = err ) - val, ok = pathParams["rollappId"] + val, ok = pathParams["rollapp_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") } protoReq.RollappId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) } msg, err := server.Rollapp(ctx, &protoReq) @@ -196,7 +196,7 @@ func local_request_Query_RollappAll_0(ctx context.Context, marshaler runtime.Mar } var ( - filter_Query_LatestHeight_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollappId": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_LatestHeight_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollapp_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Query_LatestHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -210,15 +210,15 @@ func request_Query_LatestHeight_0(ctx context.Context, marshaler runtime.Marshal _ = err ) - val, ok = pathParams["rollappId"] + val, ok = pathParams["rollapp_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") } protoReq.RollappId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) } if err := req.ParseForm(); err != nil { @@ -244,15 +244,15 @@ func local_request_Query_LatestHeight_0(ctx context.Context, marshaler runtime.M _ = err ) - val, ok = pathParams["rollappId"] + val, ok = pathParams["rollapp_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") } protoReq.RollappId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) } if err := req.ParseForm(); err != nil { @@ -268,7 +268,7 @@ func local_request_Query_LatestHeight_0(ctx context.Context, marshaler runtime.M } var ( - filter_Query_LatestStateIndex_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollappId": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_LatestStateIndex_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollapp_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Query_LatestStateIndex_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -282,15 +282,15 @@ func request_Query_LatestStateIndex_0(ctx context.Context, marshaler runtime.Mar _ = err ) - val, ok = pathParams["rollappId"] + val, ok = pathParams["rollapp_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") } protoReq.RollappId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) } if err := req.ParseForm(); err != nil { @@ -316,15 +316,15 @@ func local_request_Query_LatestStateIndex_0(ctx context.Context, marshaler runti _ = err ) - val, ok = pathParams["rollappId"] + val, ok = pathParams["rollapp_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") } protoReq.RollappId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) } if err := req.ParseForm(); err != nil { @@ -340,7 +340,7 @@ func local_request_Query_LatestStateIndex_0(ctx context.Context, marshaler runti } var ( - filter_Query_StateInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollappId": 0, "index": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} + filter_Query_StateInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollapp_id": 0, "index": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) func request_Query_StateInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -354,15 +354,15 @@ func request_Query_StateInfo_0(ctx context.Context, marshaler runtime.Marshaler, _ = err ) - val, ok = pathParams["rollappId"] + val, ok = pathParams["rollapp_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") } protoReq.RollappId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) } val, ok = pathParams["index"] @@ -399,15 +399,15 @@ func local_request_Query_StateInfo_0(ctx context.Context, marshaler runtime.Mars _ = err ) - val, ok = pathParams["rollappId"] + val, ok = pathParams["rollapp_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") } protoReq.RollappId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) } val, ok = pathParams["index"] @@ -787,17 +787,17 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nucleic", "rollapp", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Rollapp_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"nucleic", "rollapp", "rollappId"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Rollapp_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"nucleic", "rollapp", "rollapp_id"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_RollappByEIP155_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 2}, []string{"nucleic", "rollapp", "eip155"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_RollappAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1}, []string{"nucleic", "rollapp"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_LatestHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"nucleic", "rollapp", "latest_height", "rollappId"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_LatestHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"nucleic", "rollapp", "latest_height", "rollapp_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_LatestStateIndex_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"nucleic", "rollapp", "latest_state_index", "rollappId"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_LatestStateIndex_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"nucleic", "rollapp", "latest_state_index", "rollapp_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_StateInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"nucleic", "rollapp", "state_info", "rollappId", "index"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_StateInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"nucleic", "rollapp", "state_info", "rollapp_id", "index"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( diff --git a/x/rollapp/types/rollapp.pb.go b/x/rollapp/types/rollapp.pb.go index 4e3e342a..575d552e 100644 --- a/x/rollapp/types/rollapp.pb.go +++ b/x/rollapp/types/rollapp.pb.go @@ -79,11 +79,13 @@ func (m *GenesisAccount) GetAddress() string { return "" } -// RollappGenesisState is a partial repr of the state the hub can expect the rollapp to be in upon genesis +// RollappGenesisState is a partial repr of the state the hub can expect the +// rollapp to be in upon genesis type RollappGenesisState struct { // genesis_accounts is a list of token allocations GenesisAccounts []*GenesisAccount `protobuf:"bytes,1,rep,name=genesis_accounts,json=genesisAccounts,proto3" json:"genesis_accounts,omitempty"` - // is_genesis_event is a boolean that indicates if the genesis event has occured + // is_genesis_event is a boolean that indicates if the genesis event has + // occured IsGenesisEvent bool `protobuf:"varint,2,opt,name=is_genesis_event,json=isGenesisEvent,proto3" json:"is_genesis_event,omitempty"` } @@ -135,24 +137,28 @@ func (m *RollappGenesisState) GetIsGenesisEvent() bool { } // Rollapp defines a rollapp object. First the RollApp is created and then -// sequencers can be created and attached. The RollApp is identified by rollappId +// sequencers can be created and attached. The RollApp is identified by +// rollapp_id type Rollapp struct { // The unique identifier of the rollapp chain. - // The rollappId follows the same standard as cosmos chain_id. - RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + // The rollapp_id follows the same standard as cosmos chain_id. + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` // creator is the bech32-encoded address of the rollapp creator. Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` // version is the software and configuration version. // starts from 1 and increases by one on every MsgUpdateState Version uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` - // maxSequencers is the maximum number of sequencers. - MaxSequencers uint64 `protobuf:"varint,4,opt,name=maxSequencers,proto3" json:"maxSequencers,omitempty"` - // permissionedAddresses is a bech32-encoded address list of the sequencers that are allowed to serve this rollappId. - // In the case of an empty list, the rollapp is considered permissionless. - PermissionedAddresses []string `protobuf:"bytes,5,rep,name=permissionedAddresses,proto3" json:"permissionedAddresses,omitempty"` - // tokenMetadata is a list of TokenMetadata that are registered on this rollapp - TokenMetadata []*TokenMetadata `protobuf:"bytes,6,rep,name=tokenMetadata,proto3" json:"tokenMetadata,omitempty"` - // genesis_state is a partial repr of the state the hub can expect the rollapp to be in upon genesis + // max_sequencers is the maximum number of sequencers. + MaxSequencers uint64 `protobuf:"varint,4,opt,name=max_sequencers,json=maxSequencers,proto3" json:"max_sequencers,omitempty"` + // permissioned_addresses is a bech32-encoded address list of the sequencers + // that are allowed to serve this rollapp_id. In the case of an empty list, + // the rollapp is considered permissionless. + PermissionedAddresses []string `protobuf:"bytes,5,rep,name=permissioned_addresses,json=permissionedAddresses,proto3" json:"permissioned_addresses,omitempty"` + // token_metadata is a list of TokenMetadata that are registered on this + // rollapp + TokenMetadata []*TokenMetadata `protobuf:"bytes,6,rep,name=token_metadata,json=tokenMetadata,proto3" json:"token_metadata,omitempty"` + // genesis_state is a partial repr of the state the hub can expect the rollapp + // to be in upon genesis GenesisState RollappGenesisState `protobuf:"bytes,7,opt,name=genesis_state,json=genesisState,proto3" json:"genesis_state"` // channel_id will be set to the canonical IBC channel of the rollapp. ChannelId string `protobuf:"bytes,8,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` @@ -259,12 +265,12 @@ func (m *Rollapp) GetFrozen() bool { // Rollapp summary is a compact representation of Rollapp type RollappSummary struct { // The unique identifier of the rollapp chain. - // The rollappId follows the same standard as cosmos chain_id. - RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + // The rollapp_id follows the same standard as cosmos chain_id. + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` // Defines the index of the last rollapp UpdateState. - LatestStateIndex *StateInfoIndex `protobuf:"bytes,2,opt,name=latestStateIndex,proto3" json:"latestStateIndex,omitempty"` + LatestStateIndex *StateInfoIndex `protobuf:"bytes,2,opt,name=latest_state_index,json=latestStateIndex,proto3" json:"latest_state_index,omitempty"` // Defines the index of the last rollapp UpdateState that was finalized. - LatestFinalizedStateIndex *StateInfoIndex `protobuf:"bytes,3,opt,name=latestFinalizedStateIndex,proto3" json:"latestFinalizedStateIndex,omitempty"` + LatestFinalizedStateIndex *StateInfoIndex `protobuf:"bytes,3,opt,name=latest_finalized_state_index,json=latestFinalizedStateIndex,proto3" json:"latest_finalized_state_index,omitempty"` } func (m *RollappSummary) Reset() { *m = RollappSummary{} } @@ -331,42 +337,44 @@ func init() { func init() { proto.RegisterFile("nucleic/rollapp/rollapp.proto", fileDescriptor_aecaa292d97582fe) } var fileDescriptor_aecaa292d97582fe = []byte{ - // 560 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x49, 0x6f, 0xd3, 0x40, - 0x18, 0x8d, 0x49, 0x49, 0x9a, 0x29, 0x49, 0xa3, 0x61, 0x91, 0x1b, 0x51, 0xd7, 0x8a, 0x7a, 0xf0, - 0x05, 0x5b, 0x0d, 0x48, 0x9c, 0x5b, 0x36, 0x85, 0x45, 0x48, 0x0e, 0x27, 0x24, 0x14, 0x4d, 0xec, - 0x2f, 0xee, 0x28, 0xf6, 0x4c, 0xf0, 0x4c, 0x42, 0xda, 0x3b, 0x27, 0x2e, 0xfc, 0xac, 0x1e, 0x7b, - 0x44, 0x1c, 0x10, 0x4a, 0xfe, 0x08, 0xf2, 0x78, 0x0c, 0xd9, 0x10, 0x9c, 0xec, 0x6f, 0x7b, 0xef, - 0xcd, 0xf7, 0x66, 0xd0, 0x21, 0x9b, 0x04, 0x31, 0xd0, 0xc0, 0x4b, 0x79, 0x1c, 0x93, 0xf1, 0xb8, - 0xf8, 0xba, 0xe3, 0x94, 0x4b, 0x8e, 0xf7, 0x75, 0xd9, 0xd5, 0xe9, 0xd6, 0x9d, 0x88, 0x47, 0x5c, - 0xd5, 0xbc, 0xec, 0x2f, 0x6f, 0x6b, 0x59, 0x01, 0x17, 0x09, 0x17, 0xde, 0x80, 0x08, 0xf0, 0xa6, - 0x27, 0x03, 0x90, 0xe4, 0xc4, 0x0b, 0x38, 0x65, 0xba, 0x6e, 0xaf, 0xb3, 0x08, 0x49, 0x24, 0xf4, - 0x29, 0x1b, 0x16, 0x08, 0xad, 0xf5, 0x8e, 0x01, 0x61, 0xa3, 0xbc, 0xd6, 0x0e, 0x50, 0xe3, 0x05, - 0x30, 0x10, 0x54, 0x9c, 0x06, 0x01, 0x9f, 0x30, 0x89, 0x1f, 0xa3, 0x0a, 0x49, 0xb2, 0x3f, 0xd3, - 0xb0, 0x0d, 0x67, 0xaf, 0x73, 0xe0, 0xe6, 0x02, 0xdc, 0x4c, 0x80, 0xab, 0x05, 0xb8, 0x4f, 0x38, - 0x65, 0x67, 0x3b, 0x57, 0x3f, 0x8e, 0x4a, 0xbe, 0x6e, 0xc7, 0x26, 0xaa, 0x92, 0x30, 0x4c, 0x41, - 0x08, 0xf3, 0x86, 0x6d, 0x38, 0x35, 0xbf, 0x08, 0xdb, 0x5f, 0x0c, 0x74, 0xdb, 0xcf, 0xb9, 0x35, - 0x59, 0x2f, 0xd3, 0x88, 0x5f, 0xa2, 0x66, 0x94, 0xc7, 0x7d, 0x92, 0xb3, 0x0b, 0xd3, 0xb0, 0xcb, - 0xce, 0x5e, 0xe7, 0xc8, 0x5d, 0x5b, 0x8e, 0xbb, 0xaa, 0xd2, 0xdf, 0x8f, 0x56, 0x62, 0x81, 0x1d, - 0xd4, 0xa4, 0xa2, 0x5f, 0xc0, 0xc1, 0x14, 0x98, 0x54, 0x32, 0x76, 0xfd, 0x06, 0x15, 0x7a, 0xf8, - 0x59, 0x96, 0x6d, 0x7f, 0x2e, 0xa3, 0xaa, 0x56, 0x83, 0xef, 0xa3, 0x9a, 0x26, 0xe8, 0x86, 0xea, - 0xbc, 0x35, 0xff, 0x4f, 0x22, 0x3b, 0x51, 0x90, 0x02, 0x91, 0x3c, 0x2d, 0x4e, 0xa4, 0xc3, 0xac, - 0x32, 0x85, 0x54, 0x50, 0xce, 0xcc, 0xb2, 0x6d, 0x38, 0x3b, 0x7e, 0x11, 0xe2, 0x63, 0x54, 0x4f, - 0xc8, 0xac, 0x07, 0x1f, 0x27, 0xc0, 0x02, 0x48, 0x85, 0xb9, 0xa3, 0xea, 0xab, 0x49, 0xfc, 0x08, - 0xdd, 0x1d, 0x43, 0x9a, 0x50, 0x91, 0xcd, 0x40, 0x78, 0x9a, 0x2f, 0x0a, 0x84, 0x79, 0xd3, 0x2e, - 0x3b, 0x35, 0x7f, 0x7b, 0x11, 0x3f, 0x45, 0x75, 0xc9, 0x47, 0xc0, 0xde, 0x80, 0x24, 0x21, 0x91, - 0xc4, 0xac, 0xa8, 0x65, 0x59, 0x1b, 0xcb, 0x7a, 0xb7, 0xdc, 0xe5, 0xaf, 0x0e, 0xe1, 0xb7, 0xa8, - 0x5e, 0xac, 0x49, 0x5d, 0x15, 0xb3, 0xaa, 0x7c, 0x3e, 0xde, 0x40, 0xd9, 0x62, 0x99, 0xb6, 0xfc, - 0x56, 0xb4, 0x6c, 0xe3, 0x21, 0x42, 0xc1, 0x39, 0x61, 0x0c, 0xe2, 0x3e, 0x0d, 0xcd, 0xdd, 0x7c, - 0x8b, 0x3a, 0xd3, 0x0d, 0xf1, 0x3d, 0x54, 0x19, 0xa6, 0xfc, 0x12, 0x98, 0x59, 0x53, 0x7e, 0xe8, - 0xa8, 0xfd, 0xdd, 0x40, 0x0d, 0x4d, 0xd1, 0x9b, 0x24, 0x09, 0x49, 0x2f, 0xfe, 0x61, 0xc7, 0x2b, - 0xd4, 0x8c, 0x89, 0x04, 0x21, 0x15, 0x6d, 0x97, 0x85, 0x30, 0x53, 0xbe, 0x6c, 0xbb, 0x2e, 0xba, - 0x65, 0xc8, 0x55, 0x9b, 0xbf, 0x31, 0x88, 0x3f, 0xa0, 0x83, 0x3c, 0xf7, 0x9c, 0x32, 0x12, 0xd3, - 0x4b, 0x08, 0x97, 0x50, 0xcb, 0xff, 0x87, 0xfa, 0x77, 0x84, 0xb3, 0xd7, 0x57, 0x73, 0xcb, 0xb8, - 0x9e, 0x5b, 0xc6, 0xcf, 0xb9, 0x65, 0x7c, 0x5d, 0x58, 0xa5, 0xeb, 0x85, 0x55, 0xfa, 0xb6, 0xb0, - 0x4a, 0xef, 0x3b, 0x11, 0x95, 0xe7, 0x93, 0x81, 0x1b, 0xf0, 0xc4, 0xd3, 0xf8, 0x0f, 0x18, 0xc8, - 0x4f, 0x3c, 0x1d, 0x15, 0xb1, 0x37, 0xfb, 0xfd, 0x54, 0xe5, 0xc5, 0x18, 0xc4, 0xa0, 0xa2, 0x1e, - 0xeb, 0xc3, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb0, 0xdb, 0x41, 0x1c, 0x52, 0x04, 0x00, 0x00, + // 587 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x6f, 0xd3, 0x4c, + 0x10, 0x8d, 0xbf, 0xf4, 0x4b, 0x9b, 0x2d, 0x49, 0xa3, 0x05, 0x2a, 0x37, 0x22, 0xae, 0x15, 0x81, + 0xe4, 0x0b, 0xb6, 0x1a, 0x84, 0x38, 0xb7, 0xa8, 0xa0, 0x20, 0x2a, 0x24, 0x87, 0x13, 0x17, 0xb3, + 0xb1, 0x27, 0xee, 0x2a, 0xf6, 0x6e, 0xf0, 0x6e, 0x42, 0xda, 0x7f, 0x80, 0xb8, 0xf0, 0xb3, 0x7a, + 0xec, 0x91, 0x13, 0xaa, 0x92, 0x3f, 0x82, 0x6c, 0xef, 0x96, 0x24, 0xad, 0x04, 0x27, 0xfb, 0xcd, + 0xcc, 0xbe, 0x79, 0x3b, 0x6f, 0x16, 0x75, 0xd8, 0x34, 0x4c, 0x80, 0x86, 0x5e, 0xc6, 0x93, 0x84, + 0x4c, 0x26, 0xfa, 0xeb, 0x4e, 0x32, 0x2e, 0x39, 0xde, 0x53, 0x69, 0x57, 0x85, 0xdb, 0x8f, 0x62, + 0x1e, 0xf3, 0x22, 0xe7, 0xe5, 0x7f, 0x65, 0x59, 0xdb, 0x0a, 0xb9, 0x48, 0xb9, 0xf0, 0x86, 0x44, + 0x80, 0x37, 0x3b, 0x1a, 0x82, 0x24, 0x47, 0x5e, 0xc8, 0x29, 0x53, 0x79, 0x7b, 0xb3, 0x8b, 0x90, + 0x44, 0x42, 0x40, 0xd9, 0x48, 0x33, 0xb4, 0x37, 0x2b, 0x86, 0x84, 0x8d, 0xcb, 0x5c, 0x37, 0x44, + 0xcd, 0xb7, 0xc0, 0x40, 0x50, 0x71, 0x1c, 0x86, 0x7c, 0xca, 0x24, 0x7e, 0x85, 0x6a, 0x24, 0xcd, + 0xff, 0x4c, 0xc3, 0x36, 0x9c, 0xdd, 0xde, 0x81, 0x5b, 0x0a, 0x70, 0x73, 0x01, 0xae, 0x12, 0xe0, + 0xbe, 0xe6, 0x94, 0x9d, 0x6c, 0x5d, 0xfd, 0x3a, 0xac, 0xf8, 0xaa, 0x1c, 0x9b, 0x68, 0x9b, 0x44, + 0x51, 0x06, 0x42, 0x98, 0xff, 0xd9, 0x86, 0x53, 0xf7, 0x35, 0xec, 0x7e, 0x37, 0xd0, 0x43, 0xbf, + 0xec, 0xad, 0x9a, 0x0d, 0x72, 0x8d, 0xf8, 0x1d, 0x6a, 0xc5, 0x25, 0x0e, 0x48, 0xd9, 0x5d, 0x98, + 0x86, 0x5d, 0x75, 0x76, 0x7b, 0x87, 0xee, 0xc6, 0x70, 0xdc, 0x75, 0x95, 0xfe, 0x5e, 0xbc, 0x86, + 0x05, 0x76, 0x50, 0x8b, 0x8a, 0x40, 0xd3, 0xc1, 0x0c, 0x98, 0x2c, 0x64, 0xec, 0xf8, 0x4d, 0x2a, + 0xd4, 0xe1, 0xd3, 0x3c, 0xda, 0xfd, 0x56, 0x45, 0xdb, 0x4a, 0x0d, 0xee, 0x20, 0xa4, 0x1a, 0x04, + 0x34, 0x2a, 0x2e, 0x5c, 0xf7, 0xeb, 0x2a, 0xd2, 0x8f, 0xf2, 0x2b, 0x85, 0x19, 0x10, 0xc9, 0x33, + 0x7d, 0x25, 0x05, 0xf3, 0xcc, 0x0c, 0x32, 0x41, 0x39, 0x33, 0xab, 0xb6, 0xe1, 0x6c, 0xf9, 0x1a, + 0xe2, 0x67, 0xa8, 0x99, 0x92, 0x79, 0x20, 0xe0, 0xcb, 0x14, 0x58, 0x08, 0x99, 0x30, 0xb7, 0x8a, + 0x82, 0x46, 0x4a, 0xe6, 0x83, 0xdb, 0x20, 0x7e, 0x89, 0xf6, 0x27, 0x90, 0xa5, 0x54, 0xe4, 0x87, + 0x20, 0x0a, 0xd4, 0xac, 0x40, 0x98, 0xff, 0xdb, 0x55, 0xa7, 0xee, 0x3f, 0x5e, 0xcd, 0x1e, 0xeb, + 0x24, 0x3e, 0x45, 0x4d, 0xc9, 0xc7, 0xc0, 0x82, 0x14, 0x24, 0x89, 0x88, 0x24, 0x66, 0xad, 0x18, + 0x98, 0x75, 0x67, 0x60, 0x1f, 0xf3, 0xb2, 0x33, 0x55, 0xe5, 0x37, 0xe4, 0x2a, 0xc4, 0x1f, 0x50, + 0x43, 0x8f, 0xaa, 0x58, 0x17, 0x73, 0xbb, 0xf0, 0xfa, 0xe9, 0x1d, 0x96, 0x7b, 0x6c, 0x53, 0xb6, + 0x3f, 0x88, 0x57, 0xad, 0xec, 0x20, 0x14, 0x9e, 0x13, 0xc6, 0x20, 0xc9, 0x07, 0xb9, 0x53, 0x0e, + 0x52, 0x45, 0xfa, 0x11, 0xde, 0x47, 0xb5, 0x51, 0xc6, 0x2f, 0x81, 0x99, 0xf5, 0xc2, 0x13, 0x85, + 0xba, 0x37, 0x06, 0x6a, 0xaa, 0x16, 0x83, 0x69, 0x9a, 0x92, 0xec, 0xe2, 0x6f, 0x96, 0x9c, 0x21, + 0x9c, 0x10, 0x09, 0x42, 0x06, 0x7a, 0xcf, 0x23, 0x98, 0x17, 0xee, 0xdc, 0xb7, 0x35, 0x85, 0xb8, + 0x3e, 0x1b, 0xf1, 0x7e, 0x5e, 0xe6, 0xb7, 0xca, 0xa3, 0x2a, 0x1a, 0xc1, 0x1c, 0x7f, 0x46, 0x4f, + 0x14, 0xdd, 0x88, 0x32, 0x92, 0xd0, 0x4b, 0x88, 0xd6, 0x88, 0xab, 0xff, 0x46, 0x7c, 0x50, 0x92, + 0xbc, 0xd1, 0x1c, 0x7f, 0x3a, 0x9c, 0xbc, 0xbf, 0x5a, 0x58, 0xc6, 0xf5, 0xc2, 0x32, 0x6e, 0x16, + 0x96, 0xf1, 0x63, 0x69, 0x55, 0xae, 0x97, 0x56, 0xe5, 0xe7, 0xd2, 0xaa, 0x7c, 0xea, 0xc5, 0x54, + 0x9e, 0x4f, 0x87, 0x6e, 0xc8, 0x53, 0x4f, 0xf1, 0x3f, 0x67, 0x20, 0xbf, 0xf2, 0x6c, 0xac, 0xb1, + 0x37, 0xbf, 0x7d, 0xb4, 0xf2, 0x62, 0x02, 0x62, 0x58, 0x2b, 0x9e, 0xed, 0x8b, 0xdf, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x05, 0x4e, 0xba, 0x76, 0x5c, 0x04, 0x00, 0x00, } func (m *GenesisAccount) Marshal() (dAtA []byte, err error) { diff --git a/x/rollapp/types/state_info.go b/x/rollapp/types/state_info.go index 369399a1..b8338703 100644 --- a/x/rollapp/types/state_info.go +++ b/x/rollapp/types/state_info.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func NewStateInfo(rollappId string, newIndex uint64, creator string, startHeight, numBlocks uint64, daPath string, version, height uint64, BDs BlockDescriptors) *StateInfo { +func NewStateInfo(rollappId string, newIndex uint64, creator string, startHeight, numBlocks uint64, daPath string, version, height uint64, bds BlockDescriptors) *StateInfo { stateInfoIndex := StateInfoIndex{RollappId: rollappId, Index: newIndex} status := Status_PENDING return &StateInfo{ @@ -14,11 +14,11 @@ func NewStateInfo(rollappId string, newIndex uint64, creator string, startHeight Sequencer: creator, StartHeight: startHeight, NumBlocks: numBlocks, - DAPath: daPath, + DaPath: daPath, Version: version, CreationHeight: height, Status: status, - BDs: BDs, + Bds: bds, } } @@ -40,7 +40,7 @@ func (s *StateInfo) GetEvents() []sdk.Attribute { sdk.NewAttribute(AttributeKeyStateInfoIndex, strconv.FormatUint(s.StateInfoIndex.Index, 10)), sdk.NewAttribute(AttributeKeyStartHeight, strconv.FormatUint(s.StartHeight, 10)), sdk.NewAttribute(AttributeKeyNumBlocks, strconv.FormatUint(s.NumBlocks, 10)), - sdk.NewAttribute(AttributeKeyDAPath, s.DAPath), + sdk.NewAttribute(AttributeKeyDAPath, s.DaPath), sdk.NewAttribute(AttributeKeyStatus, s.Status.String()), } return eventAttributes diff --git a/x/rollapp/types/state_info.pb.go b/x/rollapp/types/state_info.pb.go index 7ad81e88..37d5afb0 100644 --- a/x/rollapp/types/state_info.pb.go +++ b/x/rollapp/types/state_info.pb.go @@ -23,6 +23,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// Status of state type Status int32 const ( @@ -54,15 +55,18 @@ func (Status) EnumDescriptor() ([]byte, []int) { // StateInfoIndex is the data used for indexing and retrieving a StateInfo // it updated and saved with every UpdateState in StateInfo. // We use the this structure also for: -// 1. LatestStateInfoIndex which defines the rollapps' current (latest) index of the last UpdateState -// 2. LatestFinalizedStateIndex which defines the rollapps' current (latest) index of the latest StateInfo that was finalized +// 1. LatestStateInfoIndex which defines the rollapps' current (latest) index of +// the last UpdateState +// 2. LatestFinalizedStateIndex which defines the rollapps' current (latest) +// index of the latest StateInfo that was finalized type StateInfoIndex struct { - // rollappId is the rollapp that the sequencer belongs to and asking to update - // it used to identify the what rollapp a StateInfo belongs - // The rollappId follows the same standard as cosmos chain_id - RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + // rollapp_id is the rollapp that the sequencer belongs to and asking to + // update it used to identify the what rollapp a StateInfo belongs The + // rollapp_id follows the same standard as cosmos chain_id + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` // index is a sequential increasing number, updating on each - // state update used for indexing to a specific state info, the first index is 1 + // state update used for indexing to a specific state info, the first index is + // 1 Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` } @@ -115,26 +119,27 @@ func (m *StateInfoIndex) GetIndex() uint64 { // StateInfo defines a rollapps' state. type StateInfo struct { - // stateInfoIndex defines what rollapp the state belongs to + // state_info_index defines what rollapp the state belongs to // and in which index it can be referenced - StateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=stateInfoIndex,proto3" json:"stateInfoIndex"` + StateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=state_info_index,json=stateInfoIndex,proto3" json:"state_info_index"` // sequencer is the bech32-encoded address of the sequencer sent the update Sequencer string `protobuf:"bytes,2,opt,name=sequencer,proto3" json:"sequencer,omitempty"` - // startHeight is the block height of the first block in the batch - StartHeight uint64 `protobuf:"varint,3,opt,name=startHeight,proto3" json:"startHeight,omitempty"` - // numBlocks is the number of blocks included in this batch update - NumBlocks uint64 `protobuf:"varint,4,opt,name=numBlocks,proto3" json:"numBlocks,omitempty"` - // DAPath is the description of the location on the DA layer - DAPath string `protobuf:"bytes,5,opt,name=DAPath,proto3" json:"DAPath,omitempty"` + // start_height is the block height of the first block in the batch + StartHeight uint64 `protobuf:"varint,3,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + // num_blocks is the number of blocks included in this batch update + NumBlocks uint64 `protobuf:"varint,4,opt,name=num_blocks,json=numBlocks,proto3" json:"num_blocks,omitempty"` + // da_path is the description of the location on the DA layer + DaPath string `protobuf:"bytes,5,opt,name=da_path,json=daPath,proto3" json:"da_path,omitempty"` // version is the version of the rollapp Version uint64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"` - // creationHeight is the height at which the UpdateState took place - CreationHeight uint64 `protobuf:"varint,7,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` + // creation_height is the height at which the UpdateState took place + CreationHeight uint64 `protobuf:"varint,7,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` // status is the status of the state update Status Status `protobuf:"varint,8,opt,name=status,proto3,enum=nucleic.rollapp.Status" json:"status,omitempty"` - // BDs is a list of block description objects (one per block) - // the list must be ordered by height, starting from startHeight to startHeight+numBlocks-1 - BDs BlockDescriptors `protobuf:"bytes,9,opt,name=BDs,proto3" json:"BDs"` + // bds is a list of block description objects (one per block) + // the list must be ordered by height, starting from start_height to + // start_height+num_blocks-1 + Bds BlockDescriptors `protobuf:"bytes,9,opt,name=bds,proto3" json:"bds"` } func (m *StateInfo) Reset() { *m = StateInfo{} } @@ -198,9 +203,9 @@ func (m *StateInfo) GetNumBlocks() uint64 { return 0 } -func (m *StateInfo) GetDAPath() string { +func (m *StateInfo) GetDaPath() string { if m != nil { - return m.DAPath + return m.DaPath } return "" } @@ -226,22 +231,22 @@ func (m *StateInfo) GetStatus() Status { return Status_PENDING } -func (m *StateInfo) GetBDs() BlockDescriptors { +func (m *StateInfo) GetBds() BlockDescriptors { if m != nil { - return m.BDs + return m.Bds } return BlockDescriptors{} } // StateInfoSummary is a compact representation of StateInfo type StateInfoSummary struct { - // stateInfoIndex defines what rollapp the state belongs to + // state_info_index defines what rollapp the state belongs to // and in which index it can be referenced - StateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=stateInfoIndex,proto3" json:"stateInfoIndex"` + StateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=state_info_index,json=stateInfoIndex,proto3" json:"state_info_index"` // status is the status of the state update Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=nucleic.rollapp.Status" json:"status,omitempty"` - // creationHeight is the height at which the UpdateState took place - CreationHeight uint64 `protobuf:"varint,3,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` + // creation_height is the height at which the UpdateState took place + CreationHeight uint64 `protobuf:"varint,3,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` } func (m *StateInfoSummary) Reset() { *m = StateInfoSummary{} } @@ -298,13 +303,14 @@ func (m *StateInfoSummary) GetCreationHeight() uint64 { return 0 } -// BlockHeightToFinalizationQueue defines a map from block height to list of states to finalized +// BlockHeightToFinalizationQueue defines a map from block height to list of +// states to finalized type BlockHeightToFinalizationQueue struct { - // creationHeight is the block height that the state should be finalized - CreationHeight uint64 `protobuf:"varint,1,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` - // finalizationQueue is a list of states that are waiting to be finalized - // when the block height becomes creationHeight - FinalizationQueue []StateInfoIndex `protobuf:"bytes,2,rep,name=finalizationQueue,proto3" json:"finalizationQueue"` + // creation_height is the block height that the state should be finalized + CreationHeight uint64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` + // finalization_queue is a list of states that are waiting to be finalized + // when the block height becomes creation_height + FinalizationQueue []StateInfoIndex `protobuf:"bytes,2,rep,name=finalization_queue,json=finalizationQueue,proto3" json:"finalization_queue"` } func (m *BlockHeightToFinalizationQueue) Reset() { *m = BlockHeightToFinalizationQueue{} } @@ -365,39 +371,41 @@ func init() { func init() { proto.RegisterFile("nucleic/rollapp/state_info.proto", fileDescriptor_759345ac0f400d2c) } var fileDescriptor_759345ac0f400d2c = []byte{ - // 512 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x41, 0x6f, 0xd3, 0x3c, - 0x18, 0xae, 0xdb, 0xae, 0x5d, 0xdc, 0xef, 0x2b, 0xc5, 0x9a, 0xc0, 0x9a, 0x50, 0x16, 0x7a, 0x98, - 0x2a, 0x24, 0x1a, 0xa9, 0x9c, 0x38, 0xae, 0x4a, 0x06, 0x91, 0x46, 0x35, 0xd2, 0x89, 0xc3, 0x2e, - 0x53, 0x9a, 0xba, 0xad, 0xb5, 0xd4, 0x0e, 0xb6, 0x03, 0x1b, 0xbf, 0x82, 0x3f, 0xc0, 0x1f, 0xe1, - 0x17, 0xec, 0xb8, 0x23, 0x27, 0x84, 0xda, 0xff, 0x81, 0x50, 0x9c, 0xac, 0x65, 0x69, 0x0f, 0x3b, - 0x70, 0xf3, 0xfb, 0xfa, 0x79, 0x9e, 0xf7, 0x7d, 0x1e, 0xcb, 0xd0, 0x62, 0x49, 0x18, 0x11, 0x1a, - 0xda, 0x82, 0x47, 0x51, 0x10, 0xc7, 0xb6, 0x54, 0x81, 0x22, 0x17, 0x94, 0x4d, 0x78, 0x37, 0x16, - 0x5c, 0x71, 0xf4, 0x28, 0x47, 0x74, 0x73, 0xc4, 0xfe, 0xde, 0x94, 0x4f, 0xb9, 0xbe, 0xb3, 0xd3, - 0x53, 0x06, 0xdb, 0x3f, 0x2c, 0x0a, 0x8d, 0x22, 0x1e, 0x5e, 0x5e, 0x8c, 0x89, 0x0c, 0x05, 0x8d, - 0x15, 0x17, 0x19, 0xae, 0xed, 0xc0, 0xe6, 0x30, 0x1d, 0xe1, 0xb1, 0x09, 0xf7, 0xd8, 0x98, 0x5c, - 0xa1, 0x67, 0xd0, 0xc8, 0x39, 0xde, 0x18, 0x03, 0x0b, 0x74, 0x0c, 0x7f, 0xdd, 0x40, 0x7b, 0x70, - 0x87, 0xa6, 0x30, 0x5c, 0xb6, 0x40, 0xa7, 0xea, 0x67, 0x45, 0xfb, 0x77, 0x19, 0x1a, 0x2b, 0x19, - 0xf4, 0x0e, 0x36, 0xe5, 0x3d, 0x4d, 0x2d, 0xd3, 0xe8, 0x1d, 0x74, 0x0b, 0xbb, 0x77, 0xef, 0x8f, - 0xee, 0x57, 0x6f, 0x7e, 0x1e, 0x94, 0xfc, 0x02, 0x39, 0x5d, 0x48, 0x92, 0x8f, 0x09, 0x61, 0x21, - 0x11, 0x7a, 0xac, 0xe1, 0xaf, 0x1b, 0xc8, 0x82, 0x0d, 0xa9, 0x02, 0xa1, 0xde, 0x12, 0x3a, 0x9d, - 0x29, 0x5c, 0xd1, 0x6b, 0xfd, 0xdd, 0x4a, 0xf9, 0x2c, 0x99, 0xf7, 0x53, 0xff, 0x12, 0x57, 0xf5, - 0xfd, 0xba, 0x81, 0x9e, 0xc0, 0x9a, 0x73, 0x74, 0x1a, 0xa8, 0x19, 0xde, 0xd1, 0xd2, 0x79, 0x85, - 0x30, 0xac, 0x7f, 0x22, 0x42, 0x52, 0xce, 0x70, 0x4d, 0x73, 0xee, 0x4a, 0x74, 0x08, 0x9b, 0xa1, - 0x20, 0x81, 0xa2, 0x9c, 0xe5, 0x43, 0xeb, 0x1a, 0x50, 0xe8, 0x22, 0x1b, 0xd6, 0x52, 0x27, 0x89, - 0xc4, 0xbb, 0x16, 0xe8, 0x34, 0x7b, 0x4f, 0xb7, 0xda, 0x4f, 0xa4, 0x9f, 0xc3, 0xd0, 0x6b, 0x58, - 0xe9, 0x3b, 0x12, 0x1b, 0x3a, 0xac, 0xe7, 0x1b, 0x68, 0xbd, 0xb0, 0xb3, 0x7a, 0x40, 0x99, 0xc7, - 0x95, 0x72, 0xda, 0xdf, 0x01, 0x6c, 0xad, 0xc2, 0x1c, 0x26, 0xf3, 0x79, 0x20, 0xae, 0xff, 0xf5, - 0x3b, 0xac, 0xfd, 0x94, 0x1f, 0xe6, 0x67, 0x33, 0xa8, 0xca, 0xb6, 0xa0, 0xda, 0xdf, 0x00, 0x34, - 0xb5, 0xb9, 0xac, 0x3e, 0xe3, 0xc7, 0x94, 0x05, 0x11, 0xfd, 0xa2, 0x31, 0xef, 0x13, 0x92, 0x90, - 0x2d, 0x52, 0x60, 0x6b, 0xe6, 0x43, 0xf8, 0x78, 0x52, 0x24, 0xe3, 0xb2, 0x55, 0x79, 0xb8, 0xeb, - 0x4d, 0xfe, 0x8b, 0x1e, 0xac, 0x65, 0xce, 0x50, 0x03, 0xd6, 0x4f, 0xdd, 0x81, 0xe3, 0x0d, 0xde, - 0xb4, 0x4a, 0xe8, 0x7f, 0x68, 0x1c, 0x7b, 0x83, 0xa3, 0x13, 0xef, 0xdc, 0x75, 0x5a, 0x00, 0xfd, - 0x07, 0x77, 0x7d, 0xf7, 0x83, 0xeb, 0x9f, 0xb9, 0x4e, 0xab, 0xd2, 0x3f, 0xb9, 0x59, 0x98, 0xe0, - 0x76, 0x61, 0x82, 0x5f, 0x0b, 0x13, 0x7c, 0x5d, 0x9a, 0xa5, 0xdb, 0xa5, 0x59, 0xfa, 0xb1, 0x34, - 0x4b, 0xe7, 0xbd, 0x29, 0x55, 0xb3, 0x64, 0xd4, 0x0d, 0xf9, 0xdc, 0xce, 0x37, 0x7a, 0xc9, 0x88, - 0xfa, 0xcc, 0xc5, 0xe5, 0x5d, 0x6d, 0x5f, 0xad, 0xbe, 0xad, 0xba, 0x8e, 0x89, 0x1c, 0xd5, 0xf4, - 0x67, 0x7d, 0xf5, 0x27, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xda, 0x50, 0x32, 0x1f, 0x04, 0x00, 0x00, + // 537 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xbf, 0x6e, 0xda, 0x40, + 0x18, 0xe7, 0x62, 0x02, 0xf1, 0x47, 0x4a, 0xe8, 0x29, 0x52, 0xac, 0xa8, 0x75, 0x08, 0x43, 0x8b, + 0x2a, 0x15, 0x4b, 0x74, 0xea, 0x58, 0x84, 0xd3, 0x5a, 0x8a, 0x68, 0xea, 0xa0, 0x0e, 0x59, 0x2c, + 0x63, 0x1f, 0x70, 0x0a, 0xdc, 0x39, 0xbe, 0x73, 0x9b, 0x74, 0xee, 0x03, 0xf4, 0x0d, 0xfa, 0x24, + 0xdd, 0x33, 0x66, 0xec, 0x54, 0x55, 0xf0, 0x22, 0x95, 0xcf, 0x06, 0x1a, 0xca, 0x90, 0xa1, 0x1b, + 0xdf, 0x8f, 0xdf, 0xf7, 0xfd, 0xfe, 0x58, 0x07, 0x75, 0x96, 0x04, 0x13, 0x42, 0x03, 0x2b, 0xe6, + 0x93, 0x89, 0x1f, 0x45, 0x96, 0x90, 0xbe, 0x24, 0x1e, 0x65, 0x43, 0xde, 0x8a, 0x62, 0x2e, 0x39, + 0xde, 0xcb, 0x19, 0xad, 0x9c, 0x71, 0xb8, 0x3f, 0xe2, 0x23, 0xae, 0xfe, 0xb3, 0xd2, 0x5f, 0x19, + 0xed, 0xf0, 0xd9, 0xfa, 0xa1, 0xc1, 0x84, 0x07, 0x97, 0x5e, 0x48, 0x44, 0x10, 0xd3, 0x48, 0xf2, + 0x38, 0xe3, 0x35, 0x6c, 0xa8, 0x9e, 0xa7, 0x12, 0x0e, 0x1b, 0x72, 0x87, 0x85, 0xe4, 0x1a, 0x3f, + 0x05, 0xc8, 0x77, 0x3c, 0x1a, 0x1a, 0xa8, 0x8e, 0x9a, 0xba, 0xab, 0xe7, 0x88, 0x13, 0xe2, 0x7d, + 0xd8, 0xa6, 0x29, 0xcf, 0xd8, 0xaa, 0xa3, 0x66, 0xd1, 0xcd, 0x86, 0xc6, 0x57, 0x0d, 0xf4, 0xe5, + 0x1d, 0xfc, 0x1e, 0x6a, 0x2b, 0xdf, 0x5e, 0x46, 0x4f, 0x0f, 0x55, 0xda, 0x47, 0xad, 0x35, 0xfb, + 0xad, 0xfb, 0xea, 0x9d, 0xe2, 0xed, 0xaf, 0xa3, 0x82, 0x5b, 0x15, 0xf7, 0x3d, 0x3d, 0x01, 0x5d, + 0x90, 0xab, 0x84, 0xb0, 0x80, 0xc4, 0x4a, 0x58, 0x77, 0x57, 0x00, 0x3e, 0x86, 0x5d, 0x21, 0xfd, + 0x58, 0x7a, 0x63, 0x42, 0x47, 0x63, 0x69, 0x68, 0xca, 0x59, 0x45, 0x61, 0xef, 0x14, 0x94, 0x86, + 0x62, 0xc9, 0xd4, 0x53, 0x25, 0x08, 0xa3, 0xa8, 0x08, 0x3a, 0x4b, 0xa6, 0x1d, 0x05, 0xe0, 0x03, + 0x28, 0x87, 0xbe, 0x17, 0xf9, 0x72, 0x6c, 0x6c, 0xab, 0xeb, 0xa5, 0xd0, 0x3f, 0xf3, 0xe5, 0x18, + 0x1b, 0x50, 0xfe, 0x44, 0x62, 0x41, 0x39, 0x33, 0x4a, 0x6a, 0x69, 0x31, 0xe2, 0xe7, 0xb0, 0x17, + 0xc4, 0xc4, 0x97, 0x94, 0xb3, 0x85, 0x6e, 0x59, 0x31, 0xaa, 0x0b, 0x38, 0x97, 0xb6, 0xa0, 0x94, + 0xa6, 0x49, 0x84, 0xb1, 0x53, 0x47, 0xcd, 0x6a, 0xfb, 0x60, 0x63, 0x05, 0x89, 0x70, 0x73, 0x1a, + 0x7e, 0x0d, 0xda, 0x20, 0x14, 0x86, 0xae, 0x0a, 0x3b, 0xfe, 0x87, 0xad, 0x2c, 0x77, 0x97, 0xdf, + 0x51, 0xe4, 0x95, 0xa5, 0x3b, 0x8d, 0x1f, 0x08, 0x6a, 0xcb, 0x42, 0xcf, 0x93, 0xe9, 0xd4, 0x8f, + 0x6f, 0xfe, 0xff, 0xd7, 0x58, 0x25, 0xda, 0x7a, 0x58, 0xa2, 0x0d, 0x5d, 0x69, 0x9b, 0xba, 0x6a, + 0x7c, 0x47, 0x60, 0xaa, 0x7c, 0xd9, 0xdc, 0xe7, 0x27, 0x94, 0xf9, 0x13, 0xfa, 0x45, 0x71, 0x3e, + 0x24, 0x24, 0x21, 0x9b, 0x6e, 0xa1, 0x8d, 0xbd, 0xf7, 0x01, 0x0f, 0xff, 0xda, 0xf6, 0xae, 0xd2, + 0x75, 0x63, 0xab, 0xae, 0x3d, 0x3c, 0xf8, 0xe3, 0xe1, 0xba, 0xfc, 0x8b, 0x36, 0x94, 0xb2, 0x70, + 0xb8, 0x02, 0xe5, 0x33, 0xbb, 0xd7, 0x75, 0x7a, 0x6f, 0x6b, 0x05, 0xfc, 0x08, 0xf4, 0x13, 0xa7, + 0xf7, 0xe6, 0xd4, 0xb9, 0xb0, 0xbb, 0x35, 0x84, 0x77, 0x61, 0xc7, 0xb5, 0x3f, 0xda, 0x6e, 0xdf, + 0xee, 0xd6, 0xb4, 0xce, 0xe9, 0xed, 0xcc, 0x44, 0x77, 0x33, 0x13, 0xfd, 0x9e, 0x99, 0xe8, 0xdb, + 0xdc, 0x2c, 0xdc, 0xcd, 0xcd, 0xc2, 0xcf, 0xb9, 0x59, 0xb8, 0x68, 0x8f, 0xa8, 0x1c, 0x27, 0x83, + 0x56, 0xc0, 0xa7, 0x56, 0xee, 0xe8, 0x25, 0x23, 0xf2, 0x33, 0x8f, 0x2f, 0x17, 0xb3, 0x75, 0xbd, + 0x7c, 0xc2, 0xf2, 0x26, 0x22, 0x62, 0x50, 0x52, 0x0f, 0xf7, 0xd5, 0x9f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x91, 0xfd, 0x10, 0x57, 0x2b, 0x04, 0x00, 0x00, } func (m *StateInfoIndex) Marshal() (dAtA []byte, err error) { @@ -456,7 +464,7 @@ func (m *StateInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.BDs.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Bds.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -480,10 +488,10 @@ func (m *StateInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x30 } - if len(m.DAPath) > 0 { - i -= len(m.DAPath) - copy(dAtA[i:], m.DAPath) - i = encodeVarintStateInfo(dAtA, i, uint64(len(m.DAPath))) + if len(m.DaPath) > 0 { + i -= len(m.DaPath) + copy(dAtA[i:], m.DaPath) + i = encodeVarintStateInfo(dAtA, i, uint64(len(m.DaPath))) i-- dAtA[i] = 0x2a } @@ -647,7 +655,7 @@ func (m *StateInfo) Size() (n int) { if m.NumBlocks != 0 { n += 1 + sovStateInfo(uint64(m.NumBlocks)) } - l = len(m.DAPath) + l = len(m.DaPath) if l > 0 { n += 1 + l + sovStateInfo(uint64(l)) } @@ -660,7 +668,7 @@ func (m *StateInfo) Size() (n int) { if m.Status != 0 { n += 1 + sovStateInfo(uint64(m.Status)) } - l = m.BDs.Size() + l = m.Bds.Size() n += 1 + l + sovStateInfo(uint64(l)) return n } @@ -941,7 +949,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { } case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DAPath", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DaPath", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -969,7 +977,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DAPath = string(dAtA[iNdEx:postIndex]) + m.DaPath = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 6: if wireType != 0 { @@ -1030,7 +1038,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { } case 9: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BDs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Bds", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1057,7 +1065,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.BDs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Bds.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/rollapp/types/tx.pb.go b/x/rollapp/types/tx.pb.go index 6eec9158..0202df2d 100644 --- a/x/rollapp/types/tx.pb.go +++ b/x/rollapp/types/tx.pb.go @@ -175,7 +175,8 @@ type MsgUpdateState struct { // version is the version of the rollapp Version uint64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"` // BDs is a list of block description objects (one per block) - // the list must be ordered by height, starting from startHeight to startHeight+numBlocks-1 + // the list must be ordered by height, starting from startHeight to + // startHeight+numBlocks-1 BDs BlockDescriptors `protobuf:"bytes,7,opt,name=BDs,proto3" json:"BDs"` } @@ -297,7 +298,8 @@ func (m *MsgUpdateStateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateStateResponse proto.InternalMessageInfo -// MsgRollappGenesisEvent is the message type for triggering the genesis event of the rollapp +// MsgRollappGenesisEvent is the message type for triggering the genesis event +// of the rollapp type MsgRollappGenesisEvent struct { // address is the bech32-encoded address of the sender Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` From c3a91a7a7092b6c5366b4c72ef0d52bfc49af809 Mon Sep 17 00:00:00 2001 From: tnv1 Date: Tue, 30 Apr 2024 14:27:06 +0700 Subject: [PATCH 09/12] Update readme --- x/rollapp/README.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/x/rollapp/README.md b/x/rollapp/README.md index 9f650282..c0cdd622 100644 --- a/x/rollapp/README.md +++ b/x/rollapp/README.md @@ -31,20 +31,20 @@ Here is a struct of a RollApp: ```protobuf message Rollapp { - string rollappId = 1; + string rollapp_id = 1; string creator = 2; // version is the software and configuration version. // starts from 1 and increases by one on every MsgUpdateState uint64 version = 3; - // maxSequencers is the maximum number of sequencers. - uint64 maxSequencers = 4; - // permissionedAddresses is a bech32-encoded address list of the sequencers - // that are allowed to serve this rollappId. In the case of an empty list, the + // max_sequencers is the maximum number of sequencers. + uint64 max_sequencers = 4; + // permissioned_addresses is a bech32-encoded address list of the sequencers + // that are allowed to serve this rollapp_id. In the case of an empty list, the // rollapp is considered permissionless. - repeated string permissionedAddresses = 5; - // tokenMetadata is a list of TokenMetadata that are registered on this + repeated string permissioned_addresses = 5; + // token_metadata is a list of TokenMetadata that are registered on this // rollapp - repeated TokenMetadata tokenMetadata = 6; + repeated TokenMetadata token_metadata = 6; // genesis_state is a partial repr of the state the hub can expect the rollapp // to be in upon genesis RollappGenesisState genesis_state = 7 [ (gogoproto.nullable) = false ]; @@ -55,8 +55,6 @@ message Rollapp { } ``` - - ## Events ## Keepers From 5c1d08c57931a1e433642a4d237e062739b7ee19 Mon Sep 17 00:00:00 2001 From: tnv1 Date: Sun, 5 May 2024 13:53:09 +0700 Subject: [PATCH 10/12] Add query cli --- x/rollapp/client/cli/flags.go | 7 ++ x/rollapp/client/cli/query.go | 7 ++ x/rollapp/client/cli/query_latest_height.go | 49 ++++++++++++ .../cli/query_latest_state_info_index.go | 48 ++++++++++++ x/rollapp/client/cli/query_params.go | 34 +++++++++ x/rollapp/client/cli/query_rollapp.go | 74 +++++++++++++++++++ x/rollapp/client/cli/query_state_info.go | 65 ++++++++++++++++ 7 files changed, 284 insertions(+) create mode 100644 x/rollapp/client/cli/flags.go create mode 100644 x/rollapp/client/cli/query_latest_height.go create mode 100644 x/rollapp/client/cli/query_latest_state_info_index.go create mode 100644 x/rollapp/client/cli/query_params.go create mode 100644 x/rollapp/client/cli/query_rollapp.go create mode 100644 x/rollapp/client/cli/query_state_info.go diff --git a/x/rollapp/client/cli/flags.go b/x/rollapp/client/cli/flags.go new file mode 100644 index 00000000..3f6a9014 --- /dev/null +++ b/x/rollapp/client/cli/flags.go @@ -0,0 +1,7 @@ +package cli + +const ( + FlagStateIndex = "index" + FlagRollappHeight = "rollapp-height" + FlagFinalized = "finalized" +) diff --git a/x/rollapp/client/cli/query.go b/x/rollapp/client/cli/query.go index c892000c..9c4f484b 100644 --- a/x/rollapp/client/cli/query.go +++ b/x/rollapp/client/cli/query.go @@ -19,5 +19,12 @@ func GetQueryCmd(queryRoute string) *cobra.Command { RunE: client.ValidateCmd, } + cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdQueryLatestHeight()) + cmd.AddCommand(CmdQueryLatestStateInfoIndex()) + cmd.AddCommand(CmdQueryStateInfo()) + cmd.AddCommand(CmdQueryRollapp()) + cmd.AddCommand(CmdQueryListRollapp()) + return cmd } diff --git a/x/rollapp/client/cli/query_latest_height.go b/x/rollapp/client/cli/query_latest_height.go new file mode 100644 index 00000000..966f6a6d --- /dev/null +++ b/x/rollapp/client/cli/query_latest_height.go @@ -0,0 +1,49 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/eve-network/eve/x/rollapp/types" + "github.com/spf13/cobra" +) + +func CmdQueryLatestHeight() *cobra.Command { + cmd := &cobra.Command{ + Use: "latest-height [rollapp-id]", + Short: "Query the last height of the last UpdateState associated with the specified rollapp-id.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + argRollappId := args[0] + + argFinalized, err := cmd.Flags().GetBool(FlagFinalized) + if err != nil { + return err + } + + req := &types.QueryGetLatestHeightRequest{ + RollappId: argRollappId, + Finalized: argFinalized, + } + + res, err := queryClient.LatestHeight(context.Background(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + cmd.Flags().Bool(FlagFinalized, false, "Indicates whether to return the latest finalized state index") + + flags.AddQueryFlagsToCmd(cmd) + + return cmd + +} diff --git a/x/rollapp/client/cli/query_latest_state_info_index.go b/x/rollapp/client/cli/query_latest_state_info_index.go new file mode 100644 index 00000000..87a81e3b --- /dev/null +++ b/x/rollapp/client/cli/query_latest_state_info_index.go @@ -0,0 +1,48 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/eve-network/eve/x/rollapp/types" + "github.com/spf13/cobra" +) + +func CmdQueryLatestStateInfoIndex() *cobra.Command { + cmd := &cobra.Command{ + Use: "latest-state-index [rollapp-id]", + Short: "Query the index of the last UpdateState associated with the specified rollapp-id.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + argRollappId := args[0] + + argFinalized, err := cmd.Flags().GetBool(FlagFinalized) + if err != nil { + return err + } + + params := &types.QueryGetLatestStateIndexRequest{ + RollappId: argRollappId, + Finalized: argFinalized, + } + + res, err := queryClient.LatestStateIndex(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + cmd.Flags().Bool(FlagFinalized, false, "Indicates whether to return the latest finalized state index") + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/rollapp/client/cli/query_params.go b/x/rollapp/client/cli/query_params.go new file mode 100644 index 00000000..cb46a96e --- /dev/null +++ b/x/rollapp/client/cli/query_params.go @@ -0,0 +1,34 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/eve-network/eve/x/rollapp/types" + "github.com/spf13/cobra" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/rollapp/client/cli/query_rollapp.go b/x/rollapp/client/cli/query_rollapp.go new file mode 100644 index 00000000..4e8e9182 --- /dev/null +++ b/x/rollapp/client/cli/query_rollapp.go @@ -0,0 +1,74 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/eve-network/eve/x/rollapp/types" + "github.com/spf13/cobra" +) + +func CmdQueryListRollapp() *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "Query all rollapps currently registered in the hub", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllRollappRequest{ + Pagination: pageReq, + } + + res, err := queryClient.RollappAll(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryRollapp() *cobra.Command { + cmd := &cobra.Command{ + Use: "show [rollapp-id]", + Short: "Query the rollapp associated with the specified rollapp-id", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + argRollappId := args[0] + + params := &types.QueryGetRollappRequest{ + RollappId: argRollappId, + } + + res, err := queryClient.Rollapp(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd + +} diff --git a/x/rollapp/client/cli/query_state_info.go b/x/rollapp/client/cli/query_state_info.go new file mode 100644 index 00000000..6a9c3a89 --- /dev/null +++ b/x/rollapp/client/cli/query_state_info.go @@ -0,0 +1,65 @@ +package cli + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/eve-network/eve/x/rollapp/types" + "github.com/spf13/cobra" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func CmdQueryStateInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "state [rollapp-id]", + Short: "Query the state associated with the specified rollapp-id and any other flags. If no flags are provided, return the latest state.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + argRollappId := args[0] + + flagSet := cmd.Flags() + argIndex, err := flagSet.GetUint64(FlagStateIndex) + if err != nil { + return err + } + argHeight, err := flagSet.GetUint64(FlagRollappHeight) + if err != nil { + return err + } + argFinalized, err := flagSet.GetBool(FlagFinalized) + if err != nil { + return err + } + + if (argHeight != 0 && argIndex != 0) || (argHeight != 0 && argFinalized) || (argIndex != 0 && argFinalized) { + return status.Error(codes.InvalidArgument, fmt.Sprintf("only one flag can be use for %s, %s or %s", FlagStateIndex, FlagRollappHeight, FlagFinalized)) + } + + params := &types.QueryGetStateInfoRequest{ + RollappId: argRollappId, + Index: argIndex, + Height: argHeight, + Finalized: argFinalized, + } + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.StateInfo(context.Background(), params) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + + cmd.Flags().Uint64(FlagStateIndex, 0, "Use a specific state-index to query state-info at") + cmd.Flags().Uint64(FlagRollappHeight, 0, "Use a specific height of the rollapp to query state-info at") + cmd.Flags().Bool(FlagFinalized, false, "Indicates whether to return the latest finalized state") + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} From 369242c2f00207cd1b8f87b17a8f1fb3eafae4d0 Mon Sep 17 00:00:00 2001 From: tnv1 Date: Mon, 6 May 2024 14:01:43 +0700 Subject: [PATCH 11/12] Add denommetadata module and refactor rollapp cli --- app/app.go | 32 +- proto/nucleic/denommetadata/genesis.proto | 8 + proto/nucleic/denommetadata/gov.proto | 23 + proto/nucleic/rollapp/block_descriptor.proto | 2 +- proto/nucleic/rollapp/state_info.proto | 2 +- proto/nucleic/rollapp/tx.proto | 42 +- utils/json.go | 22 + x/denommetadata/client/cli/query.go | 1 + x/denommetadata/client/cli/tx.go | 1 + x/denommetadata/keeper/keeper.go | 72 ++ x/denommetadata/types/codec.go | 35 + x/denommetadata/types/errors.go | 14 + x/denommetadata/types/expected_keepers.go | 31 + x/denommetadata/types/genesis.go | 17 + x/denommetadata/types/genesis.pb.go | 267 +++++++ x/denommetadata/types/gov.pb.go | 677 ++++++++++++++++++ x/denommetadata/types/hooks.go | 42 ++ x/denommetadata/types/keys.go | 12 + x/denommetadata/types/proposal_metadata.go | 123 ++++ x/rollapp/client/cli/flags.go | 17 +- x/rollapp/client/cli/query.go | 221 ++++++ x/rollapp/client/cli/query_latest_height.go | 49 -- .../cli/query_latest_state_info_index.go | 48 -- x/rollapp/client/cli/query_params.go | 34 - x/rollapp/client/cli/query_rollapp.go | 74 -- x/rollapp/client/cli/query_state_info.go | 65 -- x/rollapp/client/cli/tx.go | 120 ++++ x/rollapp/types/block_descriptor.pb.go | 42 +- x/rollapp/types/msg_create_rollapp.go | 69 ++ x/rollapp/types/msg_rollapp_genesis_event.go | 62 ++ x/rollapp/types/msg_update_state.go | 79 ++ x/rollapp/types/state_info.go | 14 +- x/rollapp/types/state_info.pb.go | 84 +-- x/rollapp/types/tx.pb.go | 147 ++-- 34 files changed, 2113 insertions(+), 435 deletions(-) create mode 100644 proto/nucleic/denommetadata/genesis.proto create mode 100644 proto/nucleic/denommetadata/gov.proto create mode 100644 utils/json.go create mode 100644 x/denommetadata/client/cli/query.go create mode 100644 x/denommetadata/client/cli/tx.go create mode 100644 x/denommetadata/keeper/keeper.go create mode 100644 x/denommetadata/types/codec.go create mode 100644 x/denommetadata/types/errors.go create mode 100644 x/denommetadata/types/expected_keepers.go create mode 100644 x/denommetadata/types/genesis.go create mode 100644 x/denommetadata/types/genesis.pb.go create mode 100644 x/denommetadata/types/gov.pb.go create mode 100644 x/denommetadata/types/hooks.go create mode 100644 x/denommetadata/types/keys.go create mode 100644 x/denommetadata/types/proposal_metadata.go delete mode 100644 x/rollapp/client/cli/query_latest_height.go delete mode 100644 x/rollapp/client/cli/query_latest_state_info_index.go delete mode 100644 x/rollapp/client/cli/query_params.go delete mode 100644 x/rollapp/client/cli/query_rollapp.go delete mode 100644 x/rollapp/client/cli/query_state_info.go create mode 100644 x/rollapp/types/msg_create_rollapp.go create mode 100644 x/rollapp/types/msg_rollapp_genesis_event.go create mode 100644 x/rollapp/types/msg_update_state.go diff --git a/app/app.go b/app/app.go index 7d7ede8a..c7eb7945 100644 --- a/app/app.go +++ b/app/app.go @@ -148,6 +148,10 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + + "github.com/eve-network/eve/x/rollapp" + rollappkeeper "github.com/eve-network/eve/x/rollapp/keeper" + rollapptypes "github.com/eve-network/eve/x/rollapp/types" ) const appName = "EveApp" @@ -262,6 +266,8 @@ type EveApp struct { TokenFactoryKeeper tokenfactorykeeper.Keeper + RollappKeeper rollappkeeper.Keeper + // the module manager ModuleManager *module.Manager BasicModuleManager module.BasicManager @@ -326,6 +332,7 @@ func NewEveApp( icacontrollertypes.StoreKey, tokenfactorytypes.StoreKey, ibchookstypes.StoreKey, alliancemoduletypes.StoreKey, + rollapptypes.StoreKey, ) tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) @@ -692,6 +699,18 @@ func NewEveApp( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + app.RollappKeeper = *rollappkeeper.NewKeeper( + appCodec, + keys[rollapptypes.StoreKey], + keys[rollapptypes.MemStoreKey], + app.GetSubspace(rollapptypes.ModuleName), + app.IBCKeeper.ClientKeeper, + app.TransferKeeper, + app.IBCKeeper.ChannelKeeper, + app.BankKeeper, + app.Deno + ) + wasmConfig, err := wasm.ReadWasmConfig(appOpts) if err != nil { panic(fmt.Sprintf("error while reading wasm config: %s", err)) @@ -764,6 +783,9 @@ func NewEveApp( // sdk crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them, tokenfactory.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(tokenfactorytypes.ModuleName)), + + // nucleic module + rollapp.NewAppModule(appCodec, app.RollappKeeper), ) // BasicModuleManager defines the module BasicManager is in charge of setting up basic, @@ -816,6 +838,7 @@ func NewEveApp( wasmtypes.ModuleName, tokenfactorytypes.ModuleName, alliancemoduletypes.ModuleName, + rollapptypes.ModuleName, ) app.ModuleManager.SetOrderEndBlockers( @@ -834,7 +857,9 @@ func NewEveApp( ibchookstypes.ModuleName, wasm08types.ModuleName, wasmtypes.ModuleName, - tokenfactorytypes.ModuleName, alliancemoduletypes.ModuleName, + tokenfactorytypes.ModuleName, + alliancemoduletypes.ModuleName, + rollapptypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -880,6 +905,8 @@ func NewEveApp( wasmtypes.ModuleName, tokenfactorytypes.ModuleName, alliancemoduletypes.ModuleName, + + rollapptypes.ModuleName, } app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...) @@ -1273,5 +1300,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(wasmtypes.ModuleName) paramsKeeper.Subspace(alliancemoduletypes.ModuleName) + // register nucleic module key tables + paramsKeeper.Subspace(rollapptypes.ModuleName) + return paramsKeeper } diff --git a/proto/nucleic/denommetadata/genesis.proto b/proto/nucleic/denommetadata/genesis.proto new file mode 100644 index 00000000..f3c58e36 --- /dev/null +++ b/proto/nucleic/denommetadata/genesis.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +package nucleic.denommetadata; + +option go_package = "github.com/nucleic-network/nucleic/x/denommetadata/types"; + +// GenesisState defines the denommetadata module's various parameters when first +// initialized +message GenesisState {} \ No newline at end of file diff --git a/proto/nucleic/denommetadata/gov.proto b/proto/nucleic/denommetadata/gov.proto new file mode 100644 index 00000000..c00d52d0 --- /dev/null +++ b/proto/nucleic/denommetadata/gov.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; +package nucleic.denommetadata; + +option go_package = "github.com/nucleic-network/nucleic/x/denommetadata/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/bank/v1beta1/bank.proto"; + +message CreateDenomMetadataProposal { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + string title = 1; + string description = 2; + repeated cosmos.bank.v1beta1.Metadata token_metadata = 3[ (gogoproto.nullable) = false ]; +} + +message UpdateDenomMetadataProposal { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + string title = 1; + string description = 2; + repeated cosmos.bank.v1beta1.Metadata token_metadata = 3[ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/proto/nucleic/rollapp/block_descriptor.proto b/proto/nucleic/rollapp/block_descriptor.proto index 10af505c..756186ee 100644 --- a/proto/nucleic/rollapp/block_descriptor.proto +++ b/proto/nucleic/rollapp/block_descriptor.proto @@ -16,5 +16,5 @@ message BlockDescriptor { // BlockDescriptors defines list of BlockDescriptor. message BlockDescriptors { - repeated BlockDescriptor bd = 1 [ (gogoproto.nullable) = false ]; + repeated BlockDescriptor block_descs = 1 [ (gogoproto.nullable) = false ]; } diff --git a/proto/nucleic/rollapp/state_info.proto b/proto/nucleic/rollapp/state_info.proto index 9fe2c32a..a903f4c0 100644 --- a/proto/nucleic/rollapp/state_info.proto +++ b/proto/nucleic/rollapp/state_info.proto @@ -46,7 +46,7 @@ message StateInfo { // bds is a list of block description objects (one per block) // the list must be ordered by height, starting from start_height to // start_height+num_blocks-1 - BlockDescriptors bds = 9 [ (gogoproto.nullable) = false ]; + BlockDescriptors block_descs = 9 [ (gogoproto.nullable) = false ]; } // StateInfoSummary is a compact representation of StateInfo diff --git a/proto/nucleic/rollapp/tx.proto b/proto/nucleic/rollapp/tx.proto index df899602..81a31b41 100644 --- a/proto/nucleic/rollapp/tx.proto +++ b/proto/nucleic/rollapp/tx.proto @@ -20,15 +20,15 @@ service Msg { message MsgCreateRollapp { // creator is the bech32-encoded address of the rollapp creator string creator = 1; - // rollappId is the unique identifier of the rollapp chain. - // The rollappId follows the same standard as cosmos chain_id - string rollappId = 2; // [(gogoproto.customname) = "ChainID"]; - // maxSequencers is the maximum number of sequencers - uint64 maxSequencers = 6; - // permissionedAddresses is a bech32-encoded address list of the - // sequencers that are allowed to serve this rollappId. + // rollapp_id is the unique identifier of the rollapp chain. + // The rollapp_id follows the same standard as cosmos chain_id + string rollapp_id = 2; // [(gogoproto.customname) = "ChainID"]; + // max_sequencers is the maximum number of sequencers + uint64 max_sequencers = 6; + // permissioned_addresses is a bech32-encoded address list of the + // sequencers that are allowed to serve this rollapp_id. // In the case of an empty list, the rollapp is considered permissionless - repeated string permissionedAddresses = 7; + repeated string permissioned_addresses = 7; // metadata provides the client information for all the registered tokens. repeated TokenMetadata metadatas = 8 [ (gogoproto.nullable) = false ]; // genesis_accounts for the rollapp on the hub @@ -42,21 +42,21 @@ message MsgCreateRollappResponse {} message MsgUpdateState { // creator is the bech32-encoded address of the sequencer sending the update string creator = 1; - // rollappId is the rollapp that the sequencer belongs to and asking to update - // The rollappId follows the same standard as cosmos chain_id - string rollappId = 2; - // startHeight is the block height of the first block in the batch - uint64 startHeight = 3; - // numBlocks is the number of blocks included in this batch update - uint64 numBlocks = 4; - // DAPath is the description of the location on the DA layer - string DAPath = 5; + // rollapp_id is the rollapp that the sequencer belongs to and asking to update + // The rollapp_id follows the same standard as cosmos chain_id + string rollapp_id = 2; + // start_height is the block height of the first block in the batch + uint64 start_height = 3; + // num_blocks is the number of blocks included in this batch update + uint64 num_blocks = 4; + // da_path is the description of the location on the DA layer + string da_path = 5; // version is the version of the rollapp uint64 version = 6; - // BDs is a list of block description objects (one per block) - // the list must be ordered by height, starting from startHeight to - // startHeight+numBlocks-1 - BlockDescriptors BDs = 7 [ (gogoproto.nullable) = false ]; + // block_descs is a list of block description objects (one per block) + // the list must be ordered by height, starting from start_height to + // start_height+num_blocks-1 + BlockDescriptors block_descs = 7 [ (gogoproto.nullable) = false ]; } message MsgUpdateStateResponse {} diff --git a/utils/json.go b/utils/json.go new file mode 100644 index 00000000..a2812c31 --- /dev/null +++ b/utils/json.go @@ -0,0 +1,22 @@ +package utils + +import ( + "encoding/json" + "os" +) + +// ParseJsonFromFile parses a json file into a slice of type T +func ParseJsonFromFile[T any](path string) ([]T, error) { + var result []T + + contents, err := os.ReadFile(path) + if err != nil { + return nil, err + } + + err = json.Unmarshal(contents, &result) + if err != nil { + return nil, err + } + return result, nil +} diff --git a/x/denommetadata/client/cli/query.go b/x/denommetadata/client/cli/query.go new file mode 100644 index 00000000..7f1e458c --- /dev/null +++ b/x/denommetadata/client/cli/query.go @@ -0,0 +1 @@ +package cli diff --git a/x/denommetadata/client/cli/tx.go b/x/denommetadata/client/cli/tx.go new file mode 100644 index 00000000..7f1e458c --- /dev/null +++ b/x/denommetadata/client/cli/tx.go @@ -0,0 +1 @@ +package cli diff --git a/x/denommetadata/keeper/keeper.go b/x/denommetadata/keeper/keeper.go new file mode 100644 index 00000000..2cd3696f --- /dev/null +++ b/x/denommetadata/keeper/keeper.go @@ -0,0 +1,72 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/log" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/eve-network/eve/x/denommetadata/types" +) + +type Keeper struct { + bankKeeper types.BankKeeper + hooks types.MultiDenomMetadataHooks +} + +// NewKeeper returns a new instance of the denommetadata keeper +func NewKeeper(bankKeeper types.BankKeeper) *Keeper { + return &Keeper{ + bankKeeper: bankKeeper, + hooks: nil, + } +} + +// CreateDenomMetadata creates a new denommetadata +func (k *Keeper) CreateDenomMetadata(ctx sdk.Context, metadata banktypes.Metadata) error { + found := k.bankKeeper.HasDenomMetaData(ctx, metadata.Base) + if found { + return types.ErrDenomAlreadyExists + } + k.bankKeeper.SetDenomMetaData(ctx, metadata) + err := k.hooks.AfterDenomMetadataCreation(ctx, metadata) + if err != nil { + return err + } + return nil +} + +// UpdateDenomMetadata returns the denommetadata of the specified denom +func (k *Keeper) UpdateDenomMetadata(ctx sdk.Context, metadata banktypes.Metadata) error { + found := k.bankKeeper.HasDenomMetaData(ctx, metadata.Base) + if !found { + return types.ErrDenomDoesNotExist + } + k.bankKeeper.SetDenomMetaData(ctx, metadata) + err := k.hooks.AfterDenomMetadataUpdate(ctx, metadata) + if err != nil { + return err + } + return nil +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} + +/* -------------------------------------------------------------------------- */ +/* Hooks */ +/* -------------------------------------------------------------------------- */ + +// SetHooks sets the hooks for the denommetadata keeper +func (k *Keeper) SetHooks(sh types.MultiDenomMetadataHooks) { + if k.hooks != nil { + panic("cannot set rollapp hooks twice") + } + k.hooks = sh +} + +// GetHooks returns the hooks for the denommetadata keeper +func (k *Keeper) GetHooks() types.MultiDenomMetadataHooks { + return k.hooks +} diff --git a/x/denommetadata/types/codec.go b/x/denommetadata/types/codec.go new file mode 100644 index 00000000..2fa8758a --- /dev/null +++ b/x/denommetadata/types/codec.go @@ -0,0 +1,35 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +var ( + amino = codec.NewLegacyAmino() +) + +// RegisterCodec registers the necessary x/denommetadata interfaces and concrete types on the provided +// LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterCodec(cdc *codec.LegacyAmino) { +} + +// RegisterInterfaces registers interfaces and implementations of the denommetadata module. +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*govtypes.Content)(nil), + &CreateDenomMetadataProposal{}, + &UpdateDenomMetadataProposal{}, + ) +} + +func init() { + RegisterCodec(amino) + // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be + // used to properly serialize MsgGrant and MsgExec instances + sdk.RegisterLegacyAminoCodec(amino) + + amino.Seal() +} diff --git a/x/denommetadata/types/errors.go b/x/denommetadata/types/errors.go new file mode 100644 index 00000000..9d5762ea --- /dev/null +++ b/x/denommetadata/types/errors.go @@ -0,0 +1,14 @@ +package types + +// DONTCOVER + +import ( + errorsmod "cosmossdk.io/errors" +) + +// x/denommetadata module sentinel errors +var ( + ErrDenomAlreadyExists = errorsmod.Register(ModuleName, 1000, "denom metadata is already registered") + ErrDenomDoesNotExist = errorsmod.Register(ModuleName, 1001, "unable to find denom metadata registered") + ErrUnknownRequest = errorsmod.Register(ModuleName, 1002, "unknown request") +) diff --git a/x/denommetadata/types/expected_keepers.go b/x/denommetadata/types/expected_keepers.go new file mode 100644 index 00000000..b4116f38 --- /dev/null +++ b/x/denommetadata/types/expected_keepers.go @@ -0,0 +1,31 @@ +package types + +import ( + tmbytes "github.com/cometbft/cometbft/libs/bytes" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + rollapptypes "github.com/eve-network/eve/x/rollapp/types" +) + +// TransferKeeper defines the expected transfer keeper +type TransferKeeper interface { + HasDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) bool +} + +// ChannelKeeper defines the expected IBC channel keeper +type ChannelKeeper interface { + GetChannelClientState(ctx sdk.Context, portID, channelID string) (string, exported.ClientState, error) +} + +// BankKeeper defines the expected interface needed +type BankKeeper interface { + HasDenomMetaData(ctx sdk.Context, denom string) bool + SetDenomMetaData(ctx sdk.Context, denomMetaData types.Metadata) +} + +type RollappKeeper interface { + GetParams(ctx sdk.Context) rollapptypes.Params + GetRollapp(ctx sdk.Context, chainID string) (rollapp rollapptypes.Rollapp, found bool) + RegisterDenomMetadata(ctx sdk.Context, rollapp rollapptypes.Rollapp, ibcBaseDenom, baseDenom string) +} diff --git a/x/denommetadata/types/genesis.go b/x/denommetadata/types/genesis.go new file mode 100644 index 00000000..50137fbf --- /dev/null +++ b/x/denommetadata/types/genesis.go @@ -0,0 +1,17 @@ +package types + +// this line is used by starport scaffolding # genesis/types/import + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{} +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + return nil +} diff --git a/x/denommetadata/types/genesis.pb.go b/x/denommetadata/types/genesis.pb.go new file mode 100644 index 00000000..dc984108 --- /dev/null +++ b/x/denommetadata/types/genesis.pb.go @@ -0,0 +1,267 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/denommetadata/genesis.proto + +package types + +import ( + fmt "fmt" + 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 denommetadata module's various parameters when first +// initialized +type GenesisState struct { +} + +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_17deed591ae0179d, []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 init() { + proto.RegisterType((*GenesisState)(nil), "nucleic.denommetadata.GenesisState") +} + +func init() { + proto.RegisterFile("nucleic/denommetadata/genesis.proto", fileDescriptor_17deed591ae0179d) +} + +var fileDescriptor_17deed591ae0179d = []byte{ + // 147 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xce, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x4f, 0x49, 0xcd, 0xcb, 0xcf, 0xcd, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, + 0x49, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x12, 0x85, 0x2a, 0xd2, 0x43, 0x51, 0xa4, 0xc4, 0xc7, 0xc5, 0xe3, 0x0e, 0x51, 0x17, 0x5c, 0x92, + 0x58, 0x92, 0xea, 0x14, 0x74, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, + 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x16, + 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, 0xb3, 0x74, 0xf3, 0x52, + 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0x61, 0x7c, 0xfd, 0x0a, 0x34, 0x27, 0x94, 0x54, 0x16, 0xa4, 0x16, + 0x27, 0xb1, 0x81, 0x5d, 0x60, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x41, 0x00, 0xd0, 0xa8, + 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 + 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 + 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 { + 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") +) diff --git a/x/denommetadata/types/gov.pb.go b/x/denommetadata/types/gov.pb.go new file mode 100644 index 00000000..52587c76 --- /dev/null +++ b/x/denommetadata/types/gov.pb.go @@ -0,0 +1,677 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/denommetadata/gov.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/x/bank/types" + _ "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 + +type CreateDenomMetadataProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + TokenMetadata []types.Metadata `protobuf:"bytes,3,rep,name=token_metadata,json=tokenMetadata,proto3" json:"token_metadata"` +} + +func (m *CreateDenomMetadataProposal) Reset() { *m = CreateDenomMetadataProposal{} } +func (*CreateDenomMetadataProposal) ProtoMessage() {} +func (*CreateDenomMetadataProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_0d035e1e06df011d, []int{0} +} +func (m *CreateDenomMetadataProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateDenomMetadataProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateDenomMetadataProposal.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 *CreateDenomMetadataProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateDenomMetadataProposal.Merge(m, src) +} +func (m *CreateDenomMetadataProposal) XXX_Size() int { + return m.Size() +} +func (m *CreateDenomMetadataProposal) XXX_DiscardUnknown() { + xxx_messageInfo_CreateDenomMetadataProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateDenomMetadataProposal proto.InternalMessageInfo + +type UpdateDenomMetadataProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + TokenMetadata []types.Metadata `protobuf:"bytes,3,rep,name=token_metadata,json=tokenMetadata,proto3" json:"token_metadata"` +} + +func (m *UpdateDenomMetadataProposal) Reset() { *m = UpdateDenomMetadataProposal{} } +func (*UpdateDenomMetadataProposal) ProtoMessage() {} +func (*UpdateDenomMetadataProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_0d035e1e06df011d, []int{1} +} +func (m *UpdateDenomMetadataProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdateDenomMetadataProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdateDenomMetadataProposal.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 *UpdateDenomMetadataProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateDenomMetadataProposal.Merge(m, src) +} +func (m *UpdateDenomMetadataProposal) XXX_Size() int { + return m.Size() +} +func (m *UpdateDenomMetadataProposal) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateDenomMetadataProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateDenomMetadataProposal proto.InternalMessageInfo + +func init() { + proto.RegisterType((*CreateDenomMetadataProposal)(nil), "nucleic.denommetadata.CreateDenomMetadataProposal") + proto.RegisterType((*UpdateDenomMetadataProposal)(nil), "nucleic.denommetadata.UpdateDenomMetadataProposal") +} + +func init() { proto.RegisterFile("nucleic/denommetadata/gov.proto", fileDescriptor_0d035e1e06df011d) } + +var fileDescriptor_0d035e1e06df011d = []byte{ + // 296 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcf, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x4f, 0x49, 0xcd, 0xcb, 0xcf, 0xcd, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, + 0x49, 0xd4, 0x4f, 0xcf, 0x2f, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0x2a, 0xd0, + 0x43, 0x51, 0x20, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa1, 0x0f, 0x62, 0x41, 0x14, 0x4b, + 0xc9, 0x25, 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0xeb, 0x27, 0x25, 0xe6, 0x65, 0xeb, 0x97, 0x19, 0x26, + 0xa5, 0x96, 0x24, 0x1a, 0x82, 0x39, 0x10, 0x79, 0xa5, 0xd5, 0x8c, 0x5c, 0xd2, 0xce, 0x45, 0xa9, + 0x89, 0x25, 0xa9, 0x2e, 0x20, 0xd3, 0x7c, 0xa1, 0xa6, 0x05, 0x14, 0xe5, 0x17, 0xe4, 0x17, 0x27, + 0xe6, 0x08, 0x89, 0x70, 0xb1, 0x96, 0x64, 0x96, 0xe4, 0xa4, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, + 0x06, 0x41, 0x38, 0x42, 0x0a, 0x5c, 0xdc, 0x29, 0xa9, 0xc5, 0xc9, 0x45, 0x99, 0x05, 0x25, 0x99, + 0xf9, 0x79, 0x12, 0x4c, 0x60, 0x39, 0x64, 0x21, 0x21, 0x2f, 0x2e, 0xbe, 0x92, 0xfc, 0xec, 0xd4, + 0xbc, 0x78, 0x98, 0xfb, 0x24, 0x98, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0x64, 0xf5, 0x20, 0x0e, 0xd2, + 0x03, 0xbb, 0x01, 0xea, 0x20, 0x3d, 0x98, 0xb5, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0xf1, + 0x82, 0xb5, 0xc2, 0x04, 0xad, 0x38, 0x3a, 0x16, 0xc8, 0x33, 0xcc, 0x58, 0x20, 0xcf, 0x00, 0x76, + 0x6d, 0x68, 0x41, 0xca, 0xd0, 0x70, 0xad, 0x53, 0xd0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, + 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, + 0xcb, 0x31, 0x44, 0x59, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, + 0x63, 0x53, 0x37, 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, 0x28, 0x1b, 0xc6, 0xd7, 0xaf, 0x40, 0x4b, 0x00, + 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x68, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, + 0x5a, 0x16, 0x99, 0x66, 0x26, 0x02, 0x00, 0x00, +} + +func (m *CreateDenomMetadataProposal) 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 *CreateDenomMetadataProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateDenomMetadataProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenMetadata) > 0 { + for iNdEx := len(m.TokenMetadata) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TokenMetadata[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGov(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UpdateDenomMetadataProposal) 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 *UpdateDenomMetadataProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdateDenomMetadataProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenMetadata) > 0 { + for iNdEx := len(m.TokenMetadata) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TokenMetadata[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGov(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGov(dAtA []byte, offset int, v uint64) int { + offset -= sovGov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *CreateDenomMetadataProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.TokenMetadata) > 0 { + for _, e := range m.TokenMetadata { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + return n +} + +func (m *UpdateDenomMetadataProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.TokenMetadata) > 0 { + for _, e := range m.TokenMetadata { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + return n +} + +func sovGov(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGov(x uint64) (n int) { + return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CreateDenomMetadataProposal) 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 ErrIntOverflowGov + } + 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: CreateDenomMetadataProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateDenomMetadataProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenMetadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenMetadata = append(m.TokenMetadata, types.Metadata{}) + if err := m.TokenMetadata[len(m.TokenMetadata)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpdateDenomMetadataProposal) 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 ErrIntOverflowGov + } + 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: UpdateDenomMetadataProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateDenomMetadataProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenMetadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenMetadata = append(m.TokenMetadata, types.Metadata{}) + if err := m.TokenMetadata[len(m.TokenMetadata)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGov(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, ErrIntOverflowGov + } + 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, ErrIntOverflowGov + } + 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, ErrIntOverflowGov + } + 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, ErrInvalidLengthGov + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGov + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGov + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGov = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGov = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/denommetadata/types/hooks.go b/x/denommetadata/types/hooks.go new file mode 100644 index 00000000..ef0f86d2 --- /dev/null +++ b/x/denommetadata/types/hooks.go @@ -0,0 +1,42 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +// DenomMetadataHooks event hooks for denom metadata creation/update +type DenomMetadataHooks interface { + AfterDenomMetadataCreation(ctx sdk.Context, metadata banktypes.Metadata) error + AfterDenomMetadataUpdate(ctx sdk.Context, metadata banktypes.Metadata) error +} + +var _ DenomMetadataHooks = MultiDenomMetadataHooks{} + +// combine multiple DenomMetadata hooks, all hook functions are run in array sequence +type MultiDenomMetadataHooks []DenomMetadataHooks + +// Creates hooks for the DenomMetadata Module. +func NewMultiDenomMetadataHooks(hooks ...DenomMetadataHooks) MultiDenomMetadataHooks { + return hooks +} + +func (h MultiDenomMetadataHooks) AfterDenomMetadataCreation(ctx sdk.Context, metadata banktypes.Metadata) error { + for i := range h { + err := h[i].AfterDenomMetadataCreation(ctx, metadata) + if err != nil { + return err + } + } + return nil +} + +func (h MultiDenomMetadataHooks) AfterDenomMetadataUpdate(ctx sdk.Context, metadata banktypes.Metadata) error { + for i := range h { + err := h[i].AfterDenomMetadataUpdate(ctx, metadata) + if err != nil { + return err + } + } + return nil +} diff --git a/x/denommetadata/types/keys.go b/x/denommetadata/types/keys.go new file mode 100644 index 00000000..d8de3ca2 --- /dev/null +++ b/x/denommetadata/types/keys.go @@ -0,0 +1,12 @@ +package types + +var ( + // ModuleName defines the module name. + ModuleName = "denommetadata" + + // RouterKey is the message route for the denommetadata module + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key. + QuerierRoute = ModuleName +) diff --git a/x/denommetadata/types/proposal_metadata.go b/x/denommetadata/types/proposal_metadata.go new file mode 100644 index 00000000..6951934d --- /dev/null +++ b/x/denommetadata/types/proposal_metadata.go @@ -0,0 +1,123 @@ +package types + +import ( + "fmt" + "strings" + + "github.com/cosmos/cosmos-sdk/x/bank/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +const ( + // ProposalTypeCreateDenomMetadata defines the type for a CreateDenomMetadata + ProposalTypeCreateDenomMetadata = "CreateDenomMetadata" + + // ProposalTypeUpdateDenomMetadata defines the type for a UpdateDenomMetadata + ProposalTypeUpdateDenomMetadata = "UpdateDenomMetadata" +) + +// Assert CreateDenomMetadataProposal implements govtypes.Content at compile-time +var ( + _ govtypes.Content = &CreateDenomMetadataProposal{} + _ govtypes.Content = &UpdateDenomMetadataProposal{} +) + +func init() { + govtypes.RegisterProposalType(ProposalTypeCreateDenomMetadata) + govtypes.RegisterProposalType(ProposalTypeUpdateDenomMetadata) +} + +// NewCreateMetadataProposal creates a new create denommetadata proposal. +func NewCreateMetadataProposal(title, description string, denommetadata []types.Metadata) *CreateDenomMetadataProposal { + return &CreateDenomMetadataProposal{ + Title: title, + Description: description, + TokenMetadata: denommetadata, + } +} + +// GetTitle returns the title of a community pool spend proposal. +func (csp *CreateDenomMetadataProposal) GetTitle() string { return csp.Title } + +// GetDescription returns the description of a community pool spend proposal. +func (csp *CreateDenomMetadataProposal) GetDescription() string { return csp.Description } + +// ProposalRoute returns the routing key of a community pool spend proposal. +func (csp *CreateDenomMetadataProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns the type of a community pool spend proposal. +func (csp *CreateDenomMetadataProposal) ProposalType() string { return ProposalTypeCreateDenomMetadata } + +// ValidateBasic runs basic stateless validity checks +func (csp *CreateDenomMetadataProposal) ValidateBasic() error { + err := govtypes.ValidateAbstract(csp) + if err != nil { + return err + } + + for _, metadata := range csp.TokenMetadata { + err = metadata.Validate() + if err != nil { + return err + } + } + return nil +} + +// String implements the Stringer interface. +func (csp CreateDenomMetadataProposal) String() string { + var b strings.Builder + b.WriteString(fmt.Sprintf(`Create denommetadata Proposal: + Title: %s + Description: %s + TokenMetadata: %s +`, csp.Title, csp.Description, &csp.TokenMetadata)) + return b.String() +} + +// NewUpdateDenomMetadataProposal creates a new proposal for updating existing token metadata. +func NewUpdateDenomMetadataProposal(title, description string, denommetadata []types.Metadata) *UpdateDenomMetadataProposal { + return &UpdateDenomMetadataProposal{ + Title: title, + Description: description, + TokenMetadata: denommetadata, + } +} + +// GetTitle returns the title of a community pool spend proposal. +func (csp *UpdateDenomMetadataProposal) GetTitle() string { return csp.Title } + +// GetDescription returns the description of a community pool spend proposal. +func (csp *UpdateDenomMetadataProposal) GetDescription() string { return csp.Description } + +// ProposalRoute returns the routing key of a community pool spend proposal. +func (csp *UpdateDenomMetadataProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns the type of a community pool spend proposal. +func (csp *UpdateDenomMetadataProposal) ProposalType() string { return ProposalTypeCreateDenomMetadata } + +// ValidateBasic runs basic stateless validity checks +func (csp *UpdateDenomMetadataProposal) ValidateBasic() error { + err := govtypes.ValidateAbstract(csp) + if err != nil { + return err + } + for _, metadata := range csp.TokenMetadata { + err = metadata.Validate() + if err != nil { + return err + } + } + return nil +} + +// String implements the Stringer interface. +func (csp UpdateDenomMetadataProposal) String() string { + var b strings.Builder + b.WriteString(fmt.Sprintf(`Update denommetadata Proposal: + Title: %s + Description: %s + TokenMetadata: %s +`, csp.Title, csp.Description, &csp.TokenMetadata)) + return b.String() +} diff --git a/x/rollapp/client/cli/flags.go b/x/rollapp/client/cli/flags.go index 3f6a9014..40e002df 100644 --- a/x/rollapp/client/cli/flags.go +++ b/x/rollapp/client/cli/flags.go @@ -1,7 +1,18 @@ package cli +import "github.com/spf13/pflag" + const ( - FlagStateIndex = "index" - FlagRollappHeight = "rollapp-height" - FlagFinalized = "finalized" + FlagStateIndex = "index" + FlagRollappHeight = "rollapp-height" + FlagFinalized = "finalized" + FlagGenesisAccountsPath = "genesis-accounts-path" ) + +// FlagSetCreateRollapp returns flags for creating gauges. +func FlagSetCreateRollapp() *pflag.FlagSet { + fs := pflag.NewFlagSet("", pflag.ContinueOnError) + + fs.String(FlagGenesisAccountsPath, "", "path to a json file containing genesis accounts") + return fs +} diff --git a/x/rollapp/client/cli/query.go b/x/rollapp/client/cli/query.go index 9c4f484b..8ec1bd1c 100644 --- a/x/rollapp/client/cli/query.go +++ b/x/rollapp/client/cli/query.go @@ -1,11 +1,15 @@ package cli import ( + "context" "fmt" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/eve-network/eve/x/rollapp/types" "github.com/spf13/cobra" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) // GetQueryCmd returns the cli query commands for this module @@ -28,3 +32,220 @@ func GetQueryCmd(queryRoute string) *cobra.Command { return cmd } + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryLatestHeight() *cobra.Command { + cmd := &cobra.Command{ + Use: "latest-height [rollapp-id]", + Short: "Query the last height of the last UpdateState associated with the specified rollapp-id.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + argRollappId := args[0] + + argFinalized, err := cmd.Flags().GetBool(FlagFinalized) + if err != nil { + return err + } + + req := &types.QueryGetLatestHeightRequest{ + RollappId: argRollappId, + Finalized: argFinalized, + } + + res, err := queryClient.LatestHeight(context.Background(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + cmd.Flags().Bool(FlagFinalized, false, "Indicates whether to return the latest finalized state index") + + flags.AddQueryFlagsToCmd(cmd) + + return cmd + +} + +func CmdQueryLatestStateInfoIndex() *cobra.Command { + cmd := &cobra.Command{ + Use: "latest-state-index [rollapp-id]", + Short: "Query the index of the last UpdateState associated with the specified rollapp-id.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + argRollappId := args[0] + + argFinalized, err := cmd.Flags().GetBool(FlagFinalized) + if err != nil { + return err + } + + params := &types.QueryGetLatestStateIndexRequest{ + RollappId: argRollappId, + Finalized: argFinalized, + } + + res, err := queryClient.LatestStateIndex(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + cmd.Flags().Bool(FlagFinalized, false, "Indicates whether to return the latest finalized state index") + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryListRollapp() *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "Query all rollapps currently registered in the hub", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllRollappRequest{ + Pagination: pageReq, + } + + res, err := queryClient.RollappAll(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryRollapp() *cobra.Command { + cmd := &cobra.Command{ + Use: "show [rollapp-id]", + Short: "Query the rollapp associated with the specified rollapp-id", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + argRollappId := args[0] + + params := &types.QueryGetRollappRequest{ + RollappId: argRollappId, + } + + res, err := queryClient.Rollapp(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd + +} + +func CmdQueryStateInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "state [rollapp-id]", + Short: "Query the state associated with the specified rollapp-id and any other flags. If no flags are provided, return the latest state.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + argRollappId := args[0] + + flagSet := cmd.Flags() + argIndex, err := flagSet.GetUint64(FlagStateIndex) + if err != nil { + return err + } + argHeight, err := flagSet.GetUint64(FlagRollappHeight) + if err != nil { + return err + } + argFinalized, err := flagSet.GetBool(FlagFinalized) + if err != nil { + return err + } + + if (argHeight != 0 && argIndex != 0) || (argHeight != 0 && argFinalized) || (argIndex != 0 && argFinalized) { + return status.Error(codes.InvalidArgument, fmt.Sprintf("only one flag can be use for %s, %s or %s", FlagStateIndex, FlagRollappHeight, FlagFinalized)) + } + + params := &types.QueryGetStateInfoRequest{ + RollappId: argRollappId, + Index: argIndex, + Height: argHeight, + Finalized: argFinalized, + } + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.StateInfo(context.Background(), params) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + + cmd.Flags().Uint64(FlagStateIndex, 0, "Use a specific state-index to query state-info at") + cmd.Flags().Uint64(FlagRollappHeight, 0, "Use a specific height of the rollapp to query state-info at") + cmd.Flags().Bool(FlagFinalized, false, "Indicates whether to return the latest finalized state") + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/rollapp/client/cli/query_latest_height.go b/x/rollapp/client/cli/query_latest_height.go deleted file mode 100644 index 966f6a6d..00000000 --- a/x/rollapp/client/cli/query_latest_height.go +++ /dev/null @@ -1,49 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/eve-network/eve/x/rollapp/types" - "github.com/spf13/cobra" -) - -func CmdQueryLatestHeight() *cobra.Command { - cmd := &cobra.Command{ - Use: "latest-height [rollapp-id]", - Short: "Query the last height of the last UpdateState associated with the specified rollapp-id.", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - argRollappId := args[0] - - argFinalized, err := cmd.Flags().GetBool(FlagFinalized) - if err != nil { - return err - } - - req := &types.QueryGetLatestHeightRequest{ - RollappId: argRollappId, - Finalized: argFinalized, - } - - res, err := queryClient.LatestHeight(context.Background(), req) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - cmd.Flags().Bool(FlagFinalized, false, "Indicates whether to return the latest finalized state index") - - flags.AddQueryFlagsToCmd(cmd) - - return cmd - -} diff --git a/x/rollapp/client/cli/query_latest_state_info_index.go b/x/rollapp/client/cli/query_latest_state_info_index.go deleted file mode 100644 index 87a81e3b..00000000 --- a/x/rollapp/client/cli/query_latest_state_info_index.go +++ /dev/null @@ -1,48 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/eve-network/eve/x/rollapp/types" - "github.com/spf13/cobra" -) - -func CmdQueryLatestStateInfoIndex() *cobra.Command { - cmd := &cobra.Command{ - Use: "latest-state-index [rollapp-id]", - Short: "Query the index of the last UpdateState associated with the specified rollapp-id.", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - argRollappId := args[0] - - argFinalized, err := cmd.Flags().GetBool(FlagFinalized) - if err != nil { - return err - } - - params := &types.QueryGetLatestStateIndexRequest{ - RollappId: argRollappId, - Finalized: argFinalized, - } - - res, err := queryClient.LatestStateIndex(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - cmd.Flags().Bool(FlagFinalized, false, "Indicates whether to return the latest finalized state index") - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/rollapp/client/cli/query_params.go b/x/rollapp/client/cli/query_params.go deleted file mode 100644 index cb46a96e..00000000 --- a/x/rollapp/client/cli/query_params.go +++ /dev/null @@ -1,34 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/eve-network/eve/x/rollapp/types" - "github.com/spf13/cobra" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/rollapp/client/cli/query_rollapp.go b/x/rollapp/client/cli/query_rollapp.go deleted file mode 100644 index 4e8e9182..00000000 --- a/x/rollapp/client/cli/query_rollapp.go +++ /dev/null @@ -1,74 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/eve-network/eve/x/rollapp/types" - "github.com/spf13/cobra" -) - -func CmdQueryListRollapp() *cobra.Command { - cmd := &cobra.Command{ - Use: "list", - Short: "Query all rollapps currently registered in the hub", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllRollappRequest{ - Pagination: pageReq, - } - - res, err := queryClient.RollappAll(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryRollapp() *cobra.Command { - cmd := &cobra.Command{ - Use: "show [rollapp-id]", - Short: "Query the rollapp associated with the specified rollapp-id", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - argRollappId := args[0] - - params := &types.QueryGetRollappRequest{ - RollappId: argRollappId, - } - - res, err := queryClient.Rollapp(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd - -} diff --git a/x/rollapp/client/cli/query_state_info.go b/x/rollapp/client/cli/query_state_info.go deleted file mode 100644 index 6a9c3a89..00000000 --- a/x/rollapp/client/cli/query_state_info.go +++ /dev/null @@ -1,65 +0,0 @@ -package cli - -import ( - "context" - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/eve-network/eve/x/rollapp/types" - "github.com/spf13/cobra" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func CmdQueryStateInfo() *cobra.Command { - cmd := &cobra.Command{ - Use: "state [rollapp-id]", - Short: "Query the state associated with the specified rollapp-id and any other flags. If no flags are provided, return the latest state.", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - argRollappId := args[0] - - flagSet := cmd.Flags() - argIndex, err := flagSet.GetUint64(FlagStateIndex) - if err != nil { - return err - } - argHeight, err := flagSet.GetUint64(FlagRollappHeight) - if err != nil { - return err - } - argFinalized, err := flagSet.GetBool(FlagFinalized) - if err != nil { - return err - } - - if (argHeight != 0 && argIndex != 0) || (argHeight != 0 && argFinalized) || (argIndex != 0 && argFinalized) { - return status.Error(codes.InvalidArgument, fmt.Sprintf("only one flag can be use for %s, %s or %s", FlagStateIndex, FlagRollappHeight, FlagFinalized)) - } - - params := &types.QueryGetStateInfoRequest{ - RollappId: argRollappId, - Index: argIndex, - Height: argHeight, - Finalized: argFinalized, - } - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.StateInfo(context.Background(), params) - if err != nil { - return err - } - return clientCtx.PrintProto(res) - }, - } - - cmd.Flags().Uint64(FlagStateIndex, 0, "Use a specific state-index to query state-info at") - cmd.Flags().Uint64(FlagRollappHeight, 0, "Use a specific height of the rollapp to query state-info at") - cmd.Flags().Bool(FlagFinalized, false, "Indicates whether to return the latest finalized state") - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/rollapp/client/cli/tx.go b/x/rollapp/client/cli/tx.go index 41cf8a6c..8cd696a0 100644 --- a/x/rollapp/client/cli/tx.go +++ b/x/rollapp/client/cli/tx.go @@ -1,13 +1,25 @@ package cli import ( + "encoding/json" "fmt" + "strconv" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/eve-network/eve/utils" "github.com/eve-network/eve/x/rollapp/types" + "github.com/spf13/cast" "github.com/spf13/cobra" ) +var _ = strconv.Itoa(0) + +type PermissionedAddresses struct { + Addresses []string `json:"addresses"` +} + // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { cmd := &cobra.Command{ @@ -18,5 +30,113 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } + cmd.AddCommand(CmdCreateRollapp()) + + return cmd +} + +func CmdCreateRollapp() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-rollapp [rollapp-id] [max-sequencers] [permissioned-addresses] [metadata.json]", + Short: "Create a new rollapp", + Example: "nucleicd tx rollapp create-rollapp ROLLAPP_CHAIN_ID 10 '{\"Addresses\":[]}' metadata.json", + Args: cobra.RangeArgs(3, 4), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argRollappId := args[0] + + argMaxSequencers, err := cast.ToUint64E(args[1]) + if err != nil { + return err + } + var argPermissionedAddresses PermissionedAddresses + if err := json.Unmarshal([]byte(args[2]), &argPermissionedAddresses); err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + // Parse metadata + var metadatas []types.TokenMetadata + if len(args) == 4 { + metadatas, err = utils.ParseJsonFromFile[types.TokenMetadata](args[3]) + if err != nil { + return err + } + } + // Parse genesis accounts + genesisAccountsPath, _ := cmd.Flags().GetString(FlagGenesisAccountsPath) + genesisAccounts, err := utils.ParseJsonFromFile[types.GenesisAccount](genesisAccountsPath) + if err != nil && genesisAccountsPath != "" { + return err + } + + msg := types.NewMsgCreateRollapp( + clientCtx.GetFromAddress().String(), + argRollappId, + argMaxSequencers, + argPermissionedAddresses.Addresses, + metadatas, + genesisAccounts, + ) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().AddFlagSet(FlagSetCreateRollapp()) + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func CmdUpdateState() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-state [rollapp-id] [start-height] [num-blocks] [da-path] [version] [block-desc]", + Short: "Update rollapp state", + Args: cobra.ExactArgs(6), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argRollappId := args[0] + argStartHeight, err := cast.ToUint64E(args[1]) + if err != nil { + return err + } + argNumBlocks, err := cast.ToUint64E(args[2]) + if err != nil { + return err + } + argDAPath := args[3] + argVersion, err := cast.ToUint64E(args[4]) + if err != nil { + return err + } + argBlockDescs := new(types.BlockDescriptors) + err = json.Unmarshal([]byte(args[5]), argBlockDescs) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgUpdateState( + clientCtx.GetFromAddress().String(), + argRollappId, + argStartHeight, + argNumBlocks, + argDAPath, + argVersion, + argBlockDescs, + ) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd } diff --git a/x/rollapp/types/block_descriptor.pb.go b/x/rollapp/types/block_descriptor.pb.go index a69a067b..55a5f6a0 100644 --- a/x/rollapp/types/block_descriptor.pb.go +++ b/x/rollapp/types/block_descriptor.pb.go @@ -81,7 +81,7 @@ func (m *BlockDescriptor) GetStateRoot() []byte { // BlockDescriptors defines list of BlockDescriptor. type BlockDescriptors struct { - Bd []BlockDescriptor `protobuf:"bytes,1,rep,name=bd,proto3" json:"bd"` + BlockDescs []BlockDescriptor `protobuf:"bytes,1,rep,name=block_descs,json=blockDescs,proto3" json:"block_descs"` } func (m *BlockDescriptors) Reset() { *m = BlockDescriptors{} } @@ -117,9 +117,9 @@ func (m *BlockDescriptors) XXX_DiscardUnknown() { var xxx_messageInfo_BlockDescriptors proto.InternalMessageInfo -func (m *BlockDescriptors) GetBd() []BlockDescriptor { +func (m *BlockDescriptors) GetBlockDescs() []BlockDescriptor { if m != nil { - return m.Bd + return m.BlockDescs } return nil } @@ -134,7 +134,7 @@ func init() { } var fileDescriptor_fccbdab1f9ac4db2 = []byte{ - // 245 bytes of a gzipped FileDescriptorProto + // 249 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcb, 0x2b, 0x4d, 0xce, 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0x4f, 0xca, 0xc9, 0x4f, 0xce, 0x8e, 0x4f, 0x49, 0x2d, 0x4e, 0x2e, 0xca, 0x2c, 0x28, 0xc9, 0x2f, 0xd2, 0x2b, 0x28, 0xca, @@ -142,15 +142,15 @@ var fileDescriptor_fccbdab1f9ac4db2 = []byte{ 0xcb, 0xe9, 0x83, 0x58, 0x10, 0x65, 0x4a, 0x1e, 0x5c, 0xfc, 0x4e, 0x20, 0x03, 0x5c, 0xe0, 0xfa, 0x85, 0xc4, 0xb8, 0xd8, 0x32, 0x52, 0x33, 0xd3, 0x33, 0x4a, 0x24, 0x18, 0x15, 0x18, 0x35, 0x58, 0x82, 0xa0, 0x3c, 0x21, 0x59, 0x2e, 0xae, 0xe2, 0x92, 0xc4, 0x92, 0xd4, 0xf8, 0xa2, 0xfc, 0xfc, - 0x12, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x9e, 0x20, 0x4e, 0xb0, 0x48, 0x50, 0x7e, 0x7e, 0x89, 0x92, - 0x17, 0x97, 0x00, 0x9a, 0x49, 0xc5, 0x42, 0x66, 0x5c, 0x4c, 0x49, 0x29, 0x12, 0x8c, 0x0a, 0xcc, - 0x1a, 0xdc, 0x46, 0x0a, 0x7a, 0x68, 0x2e, 0xd2, 0x43, 0x53, 0xee, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, - 0x43, 0x10, 0x53, 0x52, 0x8a, 0x93, 0xcf, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, - 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, - 0x44, 0x19, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0xcd, 0xd3, - 0xcd, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0x86, 0xf1, 0xf5, 0x2b, 0xe0, 0x61, 0x53, 0x52, 0x59, - 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0xaa, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x97, 0xc0, 0x31, - 0xb9, 0x3b, 0x01, 0x00, 0x00, + 0x12, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x9e, 0x20, 0x4e, 0xb0, 0x48, 0x50, 0x7e, 0x7e, 0x89, 0x52, + 0x34, 0x97, 0x00, 0x9a, 0x49, 0xc5, 0x42, 0xee, 0x5c, 0xdc, 0x08, 0xe7, 0x15, 0x4b, 0x30, 0x2a, + 0x30, 0x6b, 0x70, 0x1b, 0x29, 0xe8, 0xa1, 0x39, 0x4d, 0x0f, 0x4d, 0x9f, 0x13, 0xcb, 0x89, 0x7b, + 0xf2, 0x0c, 0x41, 0x5c, 0x49, 0x30, 0xe1, 0x62, 0x27, 0x9f, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, + 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, + 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4a, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, + 0x87, 0x9a, 0xab, 0x9b, 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0x0d, 0xe3, 0xeb, 0x57, 0xc0, 0x03, + 0xab, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x77, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x80, 0x4d, 0x06, 0x6e, 0x4c, 0x01, 0x00, 0x00, } func (m *BlockDescriptor) Marshal() (dAtA []byte, err error) { @@ -208,10 +208,10 @@ func (m *BlockDescriptors) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Bd) > 0 { - for iNdEx := len(m.Bd) - 1; iNdEx >= 0; iNdEx-- { + if len(m.BlockDescs) > 0 { + for iNdEx := len(m.BlockDescs) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Bd[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.BlockDescs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -258,8 +258,8 @@ func (m *BlockDescriptors) Size() (n int) { } var l int _ = l - if len(m.Bd) > 0 { - for _, e := range m.Bd { + if len(m.BlockDescs) > 0 { + for _, e := range m.BlockDescs { l = e.Size() n += 1 + l + sovBlockDescriptor(uint64(l)) } @@ -407,7 +407,7 @@ func (m *BlockDescriptors) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bd", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlockDescs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -434,8 +434,8 @@ func (m *BlockDescriptors) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Bd = append(m.Bd, BlockDescriptor{}) - if err := m.Bd[len(m.Bd)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.BlockDescs = append(m.BlockDescs, BlockDescriptor{}) + if err := m.BlockDescs[len(m.BlockDescs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/rollapp/types/msg_create_rollapp.go b/x/rollapp/types/msg_create_rollapp.go new file mode 100644 index 00000000..7d89a8d8 --- /dev/null +++ b/x/rollapp/types/msg_create_rollapp.go @@ -0,0 +1,69 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const TypeMsgCreateRollapp = "create_rollapp" + +var _ sdk.Msg = &MsgCreateRollapp{} + +func NewMsgCreateRollapp(creator string, rollappId string, maxSequencers uint64, permissionedAddresses []string, + metadatas []TokenMetadata, genesisAccounts []GenesisAccount, +) *MsgCreateRollapp { + return &MsgCreateRollapp{ + Creator: creator, + RollappId: rollappId, + MaxSequencers: maxSequencers, + PermissionedAddresses: permissionedAddresses, + Metadatas: metadatas, + GenesisAccounts: genesisAccounts, + } +} + +func (msg *MsgCreateRollapp) Route() string { + return RouterKey +} + +func (msg *MsgCreateRollapp) Type() string { + return TypeMsgCreateRollapp +} + +func (msg *MsgCreateRollapp) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgCreateRollapp) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgCreateRollapp) GetRollapp() Rollapp { + // Build the genesis state from the genesis accounts + rollappGenesisState := RollappGenesisState{ + IsGenesisEvent: false, + } + rollappGenesisState.GenesisAccounts = make([]*GenesisAccount, len(msg.GenesisAccounts)) + for i := range msg.GenesisAccounts { + rollappGenesisState.GenesisAccounts[i] = &msg.GenesisAccounts[i] + } + metadata := make([]*TokenMetadata, len(msg.Metadatas)) + for i := range msg.Metadatas { + metadata[i] = &msg.Metadatas[i] + } + + return NewRollapp(msg.Creator, msg.RollappId, msg.MaxSequencers, msg.PermissionedAddresses, metadata, rollappGenesisState) +} + +func (msg *MsgCreateRollapp) ValidateBasic() error { + rollapp := msg.GetRollapp() + if err := rollapp.ValidateBasic(); err != nil { + return err + } + + return nil +} diff --git a/x/rollapp/types/msg_rollapp_genesis_event.go b/x/rollapp/types/msg_rollapp_genesis_event.go new file mode 100644 index 00000000..da96518d --- /dev/null +++ b/x/rollapp/types/msg_rollapp_genesis_event.go @@ -0,0 +1,62 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const TypeMsgRollappGenesisEvent = "rollapp_genesis_event" + +var _ sdk.Msg = &MsgRollappGenesisEvent{} + +const ( + maxChannelIDLength = 100 + maxRollappIDLength = 100 +) + +func NewMsgRollappGenesisEvent(address string, channel_id string, rollapp_id string) *MsgRollappGenesisEvent { + return &MsgRollappGenesisEvent{ + Address: address, + ChannelId: channel_id, + RollappId: rollapp_id, + } +} + +func (msg *MsgRollappGenesisEvent) Route() string { + return RouterKey +} + +func (msg *MsgRollappGenesisEvent) Type() string { + return TypeMsgRollappGenesisEvent +} + +func (msg *MsgRollappGenesisEvent) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgRollappGenesisEvent) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgRollappGenesisEvent) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + return errorsmod.Wrapf(ErrInvalidAddress, "invalid address (%s)", err) + } + if msg.ChannelId == "" { + return errorsmod.Wrap(ErrInvalidGenesisChannelId, "channel id cannot be empty") + } else if len(msg.ChannelId) > maxChannelIDLength { + return errorsmod.Wrapf(ErrInvalidGenesisChannelId, "channel id cannot exceed %d characters", maxChannelIDLength) + } + if msg.RollappId == "" { + return errorsmod.Wrap(ErrInvalidRollappID, "rollapp id cannot be empty") + } else if len(msg.RollappId) > maxRollappIDLength { + return errorsmod.Wrapf(ErrInvalidRollappID, "rollapp id cannot exceed %d characters", maxRollappIDLength) + } + return nil +} diff --git a/x/rollapp/types/msg_update_state.go b/x/rollapp/types/msg_update_state.go new file mode 100644 index 00000000..79397e61 --- /dev/null +++ b/x/rollapp/types/msg_update_state.go @@ -0,0 +1,79 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const TypeMsgUpdateState = "update_state" + +var _ sdk.Msg = &MsgUpdateState{} + +func NewMsgUpdateState(creator string, rollappId string, startHeight uint64, numBlocks uint64, daPath string, version uint64, blockDescs *BlockDescriptors) *MsgUpdateState { + return &MsgUpdateState{ + Creator: creator, + RollappId: rollappId, + StartHeight: startHeight, + NumBlocks: numBlocks, + DaPath: daPath, + Version: version, + BlockDescs: *blockDescs, + } +} + +func (msg *MsgUpdateState) Route() string { + return RouterKey +} + +func (msg *MsgUpdateState) Type() string { + return TypeMsgUpdateState +} + +func (msg *MsgUpdateState) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateState) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateState) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return errorsmod.Wrapf(ErrInvalidAddress, "invalid creator address (%s)", err) + } + + // an update cann't be with no block descriptors + if msg.NumBlocks == uint64(0) { + return errorsmod.Wrap(ErrInvalidNumBlocks, "number of blocks can not be zero") + } + + // check to see that update contains all BDs + if len(msg.BlockDescs.BlockDescs) != int(msg.NumBlocks) { + return errorsmod.Wrapf(ErrInvalidNumBlocks, "number of blocks (%d) != number of block descriptors(%d)", msg.NumBlocks, len(msg.BlockDescs.BlockDescs)) + } + + // check to see that startHeight is not zaro + if msg.StartHeight == 0 { + return errorsmod.Wrapf(ErrWrongBlockHeight, "StartHeight must be greater than zero") + } + + // check that the blocks are sequential by height + for bdIndex := uint64(0); bdIndex < msg.NumBlocks; bdIndex += 1 { + if msg.BlockDescs.BlockDescs[bdIndex].Height != msg.StartHeight+bdIndex { + return ErrInvalidBlockSequence + } + // check to see stateRoot is a 32 byte array + if len(msg.BlockDescs.BlockDescs[bdIndex].StateRoot) != 32 { + return errorsmod.Wrapf(ErrInvalidStateRoot, "StateRoot of block high (%d) must be 32 byte array. But received (%d) bytes", + msg.BlockDescs.BlockDescs[bdIndex].Height, len(msg.BlockDescs.BlockDescs[bdIndex].StateRoot)) + } + } + + return nil +} diff --git a/x/rollapp/types/state_info.go b/x/rollapp/types/state_info.go index b8338703..23e1f07f 100644 --- a/x/rollapp/types/state_info.go +++ b/x/rollapp/types/state_info.go @@ -6,7 +6,17 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func NewStateInfo(rollappId string, newIndex uint64, creator string, startHeight, numBlocks uint64, daPath string, version, height uint64, bds BlockDescriptors) *StateInfo { +func NewStateInfo( + rollappId string, + newIndex uint64, + creator string, + startHeight, + numBlocks uint64, + daPath string, + version uint64, + height uint64, + blockDescs BlockDescriptors, +) *StateInfo { stateInfoIndex := StateInfoIndex{RollappId: rollappId, Index: newIndex} status := Status_PENDING return &StateInfo{ @@ -18,7 +28,7 @@ func NewStateInfo(rollappId string, newIndex uint64, creator string, startHeight Version: version, CreationHeight: height, Status: status, - Bds: bds, + BlockDescs: blockDescs, } } diff --git a/x/rollapp/types/state_info.pb.go b/x/rollapp/types/state_info.pb.go index 37d5afb0..f7ea78b2 100644 --- a/x/rollapp/types/state_info.pb.go +++ b/x/rollapp/types/state_info.pb.go @@ -139,7 +139,7 @@ type StateInfo struct { // bds is a list of block description objects (one per block) // the list must be ordered by height, starting from start_height to // start_height+num_blocks-1 - Bds BlockDescriptors `protobuf:"bytes,9,opt,name=bds,proto3" json:"bds"` + BlockDescs BlockDescriptors `protobuf:"bytes,9,opt,name=block_descs,json=blockDescs,proto3" json:"block_descs"` } func (m *StateInfo) Reset() { *m = StateInfo{} } @@ -231,9 +231,9 @@ func (m *StateInfo) GetStatus() Status { return Status_PENDING } -func (m *StateInfo) GetBds() BlockDescriptors { +func (m *StateInfo) GetBlockDescs() BlockDescriptors { if m != nil { - return m.Bds + return m.BlockDescs } return BlockDescriptors{} } @@ -371,41 +371,41 @@ func init() { func init() { proto.RegisterFile("nucleic/rollapp/state_info.proto", fileDescriptor_759345ac0f400d2c) } var fileDescriptor_759345ac0f400d2c = []byte{ - // 537 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xbf, 0x6e, 0xda, 0x40, - 0x18, 0xe7, 0x62, 0x02, 0xf1, 0x47, 0x4a, 0xe8, 0x29, 0x52, 0xac, 0xa8, 0x75, 0x08, 0x43, 0x8b, - 0x2a, 0x15, 0x4b, 0x74, 0xea, 0x58, 0x84, 0xd3, 0x5a, 0x8a, 0x68, 0xea, 0xa0, 0x0e, 0x59, 0x2c, - 0x63, 0x1f, 0x70, 0x0a, 0xdc, 0x39, 0xbe, 0x73, 0x9b, 0x74, 0xee, 0x03, 0xf4, 0x0d, 0xfa, 0x24, - 0xdd, 0x33, 0x66, 0xec, 0x54, 0x55, 0xf0, 0x22, 0x95, 0xcf, 0x06, 0x1a, 0xca, 0x90, 0xa1, 0x1b, - 0xdf, 0x8f, 0xdf, 0xf7, 0xfd, 0xfe, 0x58, 0x07, 0x75, 0x96, 0x04, 0x13, 0x42, 0x03, 0x2b, 0xe6, - 0x93, 0x89, 0x1f, 0x45, 0x96, 0x90, 0xbe, 0x24, 0x1e, 0x65, 0x43, 0xde, 0x8a, 0x62, 0x2e, 0x39, - 0xde, 0xcb, 0x19, 0xad, 0x9c, 0x71, 0xb8, 0x3f, 0xe2, 0x23, 0xae, 0xfe, 0xb3, 0xd2, 0x5f, 0x19, - 0xed, 0xf0, 0xd9, 0xfa, 0xa1, 0xc1, 0x84, 0x07, 0x97, 0x5e, 0x48, 0x44, 0x10, 0xd3, 0x48, 0xf2, - 0x38, 0xe3, 0x35, 0x6c, 0xa8, 0x9e, 0xa7, 0x12, 0x0e, 0x1b, 0x72, 0x87, 0x85, 0xe4, 0x1a, 0x3f, - 0x05, 0xc8, 0x77, 0x3c, 0x1a, 0x1a, 0xa8, 0x8e, 0x9a, 0xba, 0xab, 0xe7, 0x88, 0x13, 0xe2, 0x7d, - 0xd8, 0xa6, 0x29, 0xcf, 0xd8, 0xaa, 0xa3, 0x66, 0xd1, 0xcd, 0x86, 0xc6, 0x57, 0x0d, 0xf4, 0xe5, - 0x1d, 0xfc, 0x1e, 0x6a, 0x2b, 0xdf, 0x5e, 0x46, 0x4f, 0x0f, 0x55, 0xda, 0x47, 0xad, 0x35, 0xfb, - 0xad, 0xfb, 0xea, 0x9d, 0xe2, 0xed, 0xaf, 0xa3, 0x82, 0x5b, 0x15, 0xf7, 0x3d, 0x3d, 0x01, 0x5d, - 0x90, 0xab, 0x84, 0xb0, 0x80, 0xc4, 0x4a, 0x58, 0x77, 0x57, 0x00, 0x3e, 0x86, 0x5d, 0x21, 0xfd, - 0x58, 0x7a, 0x63, 0x42, 0x47, 0x63, 0x69, 0x68, 0xca, 0x59, 0x45, 0x61, 0xef, 0x14, 0x94, 0x86, - 0x62, 0xc9, 0xd4, 0x53, 0x25, 0x08, 0xa3, 0xa8, 0x08, 0x3a, 0x4b, 0xa6, 0x1d, 0x05, 0xe0, 0x03, - 0x28, 0x87, 0xbe, 0x17, 0xf9, 0x72, 0x6c, 0x6c, 0xab, 0xeb, 0xa5, 0xd0, 0x3f, 0xf3, 0xe5, 0x18, - 0x1b, 0x50, 0xfe, 0x44, 0x62, 0x41, 0x39, 0x33, 0x4a, 0x6a, 0x69, 0x31, 0xe2, 0xe7, 0xb0, 0x17, - 0xc4, 0xc4, 0x97, 0x94, 0xb3, 0x85, 0x6e, 0x59, 0x31, 0xaa, 0x0b, 0x38, 0x97, 0xb6, 0xa0, 0x94, - 0xa6, 0x49, 0x84, 0xb1, 0x53, 0x47, 0xcd, 0x6a, 0xfb, 0x60, 0x63, 0x05, 0x89, 0x70, 0x73, 0x1a, - 0x7e, 0x0d, 0xda, 0x20, 0x14, 0x86, 0xae, 0x0a, 0x3b, 0xfe, 0x87, 0xad, 0x2c, 0x77, 0x97, 0xdf, - 0x51, 0xe4, 0x95, 0xa5, 0x3b, 0x8d, 0x1f, 0x08, 0x6a, 0xcb, 0x42, 0xcf, 0x93, 0xe9, 0xd4, 0x8f, - 0x6f, 0xfe, 0xff, 0xd7, 0x58, 0x25, 0xda, 0x7a, 0x58, 0xa2, 0x0d, 0x5d, 0x69, 0x9b, 0xba, 0x6a, - 0x7c, 0x47, 0x60, 0xaa, 0x7c, 0xd9, 0xdc, 0xe7, 0x27, 0x94, 0xf9, 0x13, 0xfa, 0x45, 0x71, 0x3e, - 0x24, 0x24, 0x21, 0x9b, 0x6e, 0xa1, 0x8d, 0xbd, 0xf7, 0x01, 0x0f, 0xff, 0xda, 0xf6, 0xae, 0xd2, - 0x75, 0x63, 0xab, 0xae, 0x3d, 0x3c, 0xf8, 0xe3, 0xe1, 0xba, 0xfc, 0x8b, 0x36, 0x94, 0xb2, 0x70, - 0xb8, 0x02, 0xe5, 0x33, 0xbb, 0xd7, 0x75, 0x7a, 0x6f, 0x6b, 0x05, 0xfc, 0x08, 0xf4, 0x13, 0xa7, - 0xf7, 0xe6, 0xd4, 0xb9, 0xb0, 0xbb, 0x35, 0x84, 0x77, 0x61, 0xc7, 0xb5, 0x3f, 0xda, 0x6e, 0xdf, - 0xee, 0xd6, 0xb4, 0xce, 0xe9, 0xed, 0xcc, 0x44, 0x77, 0x33, 0x13, 0xfd, 0x9e, 0x99, 0xe8, 0xdb, - 0xdc, 0x2c, 0xdc, 0xcd, 0xcd, 0xc2, 0xcf, 0xb9, 0x59, 0xb8, 0x68, 0x8f, 0xa8, 0x1c, 0x27, 0x83, - 0x56, 0xc0, 0xa7, 0x56, 0xee, 0xe8, 0x25, 0x23, 0xf2, 0x33, 0x8f, 0x2f, 0x17, 0xb3, 0x75, 0xbd, - 0x7c, 0xc2, 0xf2, 0x26, 0x22, 0x62, 0x50, 0x52, 0x0f, 0xf7, 0xd5, 0x9f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x91, 0xfd, 0x10, 0x57, 0x2b, 0x04, 0x00, 0x00, + // 539 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xc1, 0x6e, 0xda, 0x40, + 0x10, 0x65, 0x03, 0x81, 0x78, 0x48, 0x09, 0x5d, 0x45, 0x8a, 0x15, 0xb5, 0x0e, 0xe1, 0xd0, 0xa2, + 0x4a, 0xc5, 0x12, 0xfd, 0x82, 0x22, 0x9c, 0xc6, 0x52, 0x44, 0x53, 0x07, 0xf5, 0x90, 0x8b, 0x65, + 0xec, 0x05, 0x56, 0x81, 0x5d, 0xc7, 0xbb, 0x6e, 0x93, 0x7e, 0x45, 0xa5, 0x7e, 0x40, 0xbf, 0xa4, + 0xf7, 0x1c, 0x73, 0xec, 0xa9, 0xaa, 0xe0, 0x47, 0x2a, 0xaf, 0x0d, 0x34, 0xd4, 0x87, 0x1c, 0x7a, + 0xf3, 0x3c, 0xbf, 0x99, 0x79, 0xef, 0x8d, 0x16, 0x1a, 0x2c, 0xf6, 0xa7, 0x84, 0xfa, 0x66, 0xc4, + 0xa7, 0x53, 0x2f, 0x0c, 0x4d, 0x21, 0x3d, 0x49, 0x5c, 0xca, 0x46, 0xbc, 0x1d, 0x46, 0x5c, 0x72, + 0xbc, 0x97, 0x31, 0xda, 0x19, 0xe3, 0x70, 0x7f, 0xcc, 0xc7, 0x5c, 0xfd, 0x33, 0x93, 0xaf, 0x94, + 0x76, 0xf8, 0x62, 0x73, 0xd0, 0x70, 0xca, 0xfd, 0x2b, 0x37, 0x20, 0xc2, 0x8f, 0x68, 0x28, 0x79, + 0x94, 0xf2, 0x9a, 0x16, 0xd4, 0x2e, 0x92, 0x15, 0x36, 0x1b, 0x71, 0x9b, 0x05, 0xe4, 0x06, 0x3f, + 0x07, 0xc8, 0x7a, 0x5c, 0x1a, 0xe8, 0xa8, 0x81, 0x5a, 0x9a, 0xa3, 0x65, 0x88, 0x1d, 0xe0, 0x7d, + 0xd8, 0xa6, 0x09, 0x4f, 0xdf, 0x6a, 0xa0, 0x56, 0xc9, 0x49, 0x8b, 0xe6, 0xb7, 0x22, 0x68, 0xab, + 0x39, 0xf8, 0x3d, 0xd4, 0xd7, 0xba, 0xdd, 0x94, 0x9e, 0x0c, 0xaa, 0x76, 0x8e, 0xda, 0x1b, 0xf2, + 0xdb, 0x0f, 0xb7, 0x77, 0x4b, 0x77, 0xbf, 0x8e, 0x0a, 0x4e, 0x4d, 0x3c, 0xd4, 0xf4, 0x0c, 0x34, + 0x41, 0xae, 0x63, 0xc2, 0x7c, 0x12, 0xa9, 0xc5, 0x9a, 0xb3, 0x06, 0xf0, 0x31, 0xec, 0x0a, 0xe9, + 0x45, 0xd2, 0x9d, 0x10, 0x3a, 0x9e, 0x48, 0xbd, 0xa8, 0x94, 0x55, 0x15, 0x76, 0xaa, 0xa0, 0xc4, + 0x14, 0x8b, 0x67, 0xae, 0x0a, 0x41, 0xe8, 0x25, 0x45, 0xd0, 0x58, 0x3c, 0xeb, 0x2a, 0x00, 0x1f, + 0x40, 0x25, 0xf0, 0xdc, 0xd0, 0x93, 0x13, 0x7d, 0x5b, 0x4d, 0x2f, 0x07, 0xde, 0xb9, 0x27, 0x27, + 0x58, 0x87, 0xca, 0x27, 0x12, 0x09, 0xca, 0x99, 0x5e, 0x56, 0x4d, 0xcb, 0x12, 0xbf, 0x84, 0x3d, + 0x3f, 0x22, 0x9e, 0xa4, 0x9c, 0x2d, 0xf7, 0x56, 0x14, 0xa3, 0xb6, 0x84, 0xb3, 0xd5, 0x26, 0x94, + 0x13, 0x37, 0xb1, 0xd0, 0x77, 0x1a, 0xa8, 0x55, 0xeb, 0x1c, 0xe4, 0x46, 0x10, 0x0b, 0x27, 0xa3, + 0xe1, 0x53, 0xa8, 0xae, 0x8f, 0x25, 0x74, 0x4d, 0x05, 0x77, 0xfc, 0x4f, 0x97, 0x92, 0xde, 0x5b, + 0xdd, 0x53, 0x64, 0xd1, 0xc1, 0x70, 0x89, 0x8b, 0xe6, 0x0f, 0x04, 0xf5, 0x55, 0xbe, 0x17, 0xf1, + 0x6c, 0xe6, 0x45, 0xb7, 0xff, 0xff, 0x38, 0x6b, 0x83, 0x5b, 0x8f, 0x33, 0x98, 0x13, 0x5d, 0x31, + 0x2f, 0xba, 0xe6, 0x77, 0x04, 0x86, 0xb2, 0x99, 0xd6, 0x03, 0x7e, 0x42, 0x99, 0x37, 0xa5, 0x5f, + 0x14, 0xe7, 0x43, 0x4c, 0x62, 0x92, 0x37, 0x0b, 0xe5, 0x9e, 0x61, 0x00, 0x78, 0xf4, 0x57, 0xb7, + 0x7b, 0x9d, 0xb4, 0xeb, 0x5b, 0x8d, 0xe2, 0xe3, 0x8d, 0x3f, 0x1d, 0x6d, 0xae, 0x7f, 0xd5, 0x81, + 0x72, 0x6a, 0x0e, 0x57, 0xa1, 0x72, 0x6e, 0xf5, 0x7b, 0x76, 0xff, 0x5d, 0xbd, 0x80, 0x9f, 0x80, + 0x76, 0x62, 0xf7, 0xdf, 0x9e, 0xd9, 0x97, 0x56, 0xaf, 0x8e, 0xf0, 0x2e, 0xec, 0x38, 0xd6, 0x47, + 0xcb, 0x19, 0x58, 0xbd, 0x7a, 0xb1, 0x7b, 0x76, 0x37, 0x37, 0xd0, 0xfd, 0xdc, 0x40, 0xbf, 0xe7, + 0x06, 0xfa, 0xba, 0x30, 0x0a, 0xf7, 0x0b, 0xa3, 0xf0, 0x73, 0x61, 0x14, 0x2e, 0x3b, 0x63, 0x2a, + 0x27, 0xf1, 0xb0, 0xed, 0xf3, 0x99, 0x99, 0x29, 0x7a, 0xcd, 0x88, 0xfc, 0xcc, 0xa3, 0xab, 0x65, + 0x6d, 0xde, 0xac, 0x5e, 0xb4, 0xbc, 0x0d, 0x89, 0x18, 0x96, 0xd5, 0x3b, 0x7e, 0xf3, 0x27, 0x00, + 0x00, 0xff, 0xff, 0x71, 0x92, 0x75, 0xc3, 0x3a, 0x04, 0x00, 0x00, } func (m *StateInfoIndex) Marshal() (dAtA []byte, err error) { @@ -464,7 +464,7 @@ func (m *StateInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.Bds.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.BlockDescs.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -668,7 +668,7 @@ func (m *StateInfo) Size() (n int) { if m.Status != 0 { n += 1 + sovStateInfo(uint64(m.Status)) } - l = m.Bds.Size() + l = m.BlockDescs.Size() n += 1 + l + sovStateInfo(uint64(l)) return n } @@ -1038,7 +1038,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { } case 9: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bds", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlockDescs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1065,7 +1065,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Bds.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.BlockDescs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/rollapp/types/tx.pb.go b/x/rollapp/types/tx.pb.go index 0202df2d..9f61cbfc 100644 --- a/x/rollapp/types/tx.pb.go +++ b/x/rollapp/types/tx.pb.go @@ -32,15 +32,15 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgCreateRollapp struct { // creator is the bech32-encoded address of the rollapp creator Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - // rollappId is the unique identifier of the rollapp chain. - // The rollappId follows the same standard as cosmos chain_id - RollappId string `protobuf:"bytes,2,opt,name=rollappId,proto3" json:"rollappId,omitempty"` - // maxSequencers is the maximum number of sequencers - MaxSequencers uint64 `protobuf:"varint,6,opt,name=maxSequencers,proto3" json:"maxSequencers,omitempty"` - // permissionedAddresses is a bech32-encoded address list of the - // sequencers that are allowed to serve this rollappId. + // rollapp_id is the unique identifier of the rollapp chain. + // The rollapp_id follows the same standard as cosmos chain_id + RollappId string `protobuf:"bytes,2,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // max_sequencers is the maximum number of sequencers + MaxSequencers uint64 `protobuf:"varint,6,opt,name=max_sequencers,json=maxSequencers,proto3" json:"max_sequencers,omitempty"` + // permissioned_addresses is a bech32-encoded address list of the + // sequencers that are allowed to serve this rollapp_id. // In the case of an empty list, the rollapp is considered permissionless - PermissionedAddresses []string `protobuf:"bytes,7,rep,name=permissionedAddresses,proto3" json:"permissionedAddresses,omitempty"` + PermissionedAddresses []string `protobuf:"bytes,7,rep,name=permissioned_addresses,json=permissionedAddresses,proto3" json:"permissioned_addresses,omitempty"` // metadata provides the client information for all the registered tokens. Metadatas []TokenMetadata `protobuf:"bytes,8,rep,name=metadatas,proto3" json:"metadatas"` // genesis_accounts for the rollapp on the hub @@ -163,21 +163,21 @@ var xxx_messageInfo_MsgCreateRollappResponse proto.InternalMessageInfo type MsgUpdateState struct { // creator is the bech32-encoded address of the sequencer sending the update Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - // rollappId is the rollapp that the sequencer belongs to and asking to update - // The rollappId follows the same standard as cosmos chain_id - RollappId string `protobuf:"bytes,2,opt,name=rollappId,proto3" json:"rollappId,omitempty"` - // startHeight is the block height of the first block in the batch - StartHeight uint64 `protobuf:"varint,3,opt,name=startHeight,proto3" json:"startHeight,omitempty"` - // numBlocks is the number of blocks included in this batch update - NumBlocks uint64 `protobuf:"varint,4,opt,name=numBlocks,proto3" json:"numBlocks,omitempty"` - // DAPath is the description of the location on the DA layer - DAPath string `protobuf:"bytes,5,opt,name=DAPath,proto3" json:"DAPath,omitempty"` + // rollapp_id is the rollapp that the sequencer belongs to and asking to update + // The rollapp_id follows the same standard as cosmos chain_id + RollappId string `protobuf:"bytes,2,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // start_height is the block height of the first block in the batch + StartHeight uint64 `protobuf:"varint,3,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + // num_blocks is the number of blocks included in this batch update + NumBlocks uint64 `protobuf:"varint,4,opt,name=num_blocks,json=numBlocks,proto3" json:"num_blocks,omitempty"` + // da_path is the description of the location on the DA layer + DaPath string `protobuf:"bytes,5,opt,name=da_path,json=daPath,proto3" json:"da_path,omitempty"` // version is the version of the rollapp Version uint64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"` - // BDs is a list of block description objects (one per block) - // the list must be ordered by height, starting from startHeight to - // startHeight+numBlocks-1 - BDs BlockDescriptors `protobuf:"bytes,7,opt,name=BDs,proto3" json:"BDs"` + // block_descs is a list of block description objects (one per block) + // the list must be ordered by height, starting from start_height to + // start_height+num_blocks-1 + BlockDescs BlockDescriptors `protobuf:"bytes,7,opt,name=block_descs,json=blockDescs,proto3" json:"block_descs"` } func (m *MsgUpdateState) Reset() { *m = MsgUpdateState{} } @@ -241,9 +241,9 @@ func (m *MsgUpdateState) GetNumBlocks() uint64 { return 0 } -func (m *MsgUpdateState) GetDAPath() string { +func (m *MsgUpdateState) GetDaPath() string { if m != nil { - return m.DAPath + return m.DaPath } return "" } @@ -255,9 +255,9 @@ func (m *MsgUpdateState) GetVersion() uint64 { return 0 } -func (m *MsgUpdateState) GetBDs() BlockDescriptors { +func (m *MsgUpdateState) GetBlockDescs() BlockDescriptors { if m != nil { - return m.BDs + return m.BlockDescs } return BlockDescriptors{} } @@ -412,44 +412,45 @@ func init() { func init() { proto.RegisterFile("nucleic/rollapp/tx.proto", fileDescriptor_eb8b6554f760aaec) } var fileDescriptor_eb8b6554f760aaec = []byte{ - // 587 bytes of a gzipped FileDescriptorProto + // 607 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xdf, 0x6e, 0xd3, 0x30, - 0x14, 0xc6, 0x9b, 0x65, 0x6c, 0xd4, 0xd5, 0xd8, 0x64, 0x60, 0xb2, 0x22, 0x96, 0x86, 0x0a, 0x41, - 0xb9, 0xa0, 0x91, 0x0a, 0x37, 0x5c, 0xb6, 0x14, 0xc1, 0x24, 0x2a, 0x4d, 0xd9, 0x10, 0x12, 0x12, - 0xaa, 0xdc, 0xe4, 0x28, 0x8d, 0xda, 0xda, 0xc1, 0x76, 0x47, 0x79, 0x0b, 0x9e, 0x84, 0x27, 0xe0, - 0x01, 0x76, 0xb9, 0x4b, 0xae, 0x10, 0x6a, 0x9f, 0x81, 0x7b, 0x94, 0xc4, 0xe9, 0x9f, 0xb4, 0xd2, - 0x10, 0x57, 0xed, 0x39, 0xdf, 0x77, 0x3e, 0x3b, 0x3f, 0x3b, 0x41, 0x84, 0x4d, 0xfc, 0x11, 0x44, - 0xbe, 0x2b, 0xf8, 0x68, 0x44, 0xe3, 0xd8, 0x55, 0xd3, 0x46, 0x2c, 0xb8, 0xe2, 0xf8, 0x50, 0x2b, - 0x0d, 0xad, 0x58, 0xf7, 0x42, 0x1e, 0xf2, 0x54, 0x73, 0x93, 0x7f, 0x99, 0xcd, 0x7a, 0x5c, 0x0c, - 0xe8, 0x8f, 0xb8, 0x3f, 0xec, 0x05, 0x20, 0x7d, 0x11, 0xc5, 0x8a, 0x0b, 0xed, 0xb3, 0x36, 0x7c, - 0x94, 0x0d, 0xb5, 0x76, 0x52, 0xd4, 0xf4, 0x6f, 0x26, 0xd7, 0x7e, 0xec, 0xa0, 0xa3, 0xae, 0x0c, - 0x5f, 0x09, 0xa0, 0x0a, 0xbc, 0x4c, 0xc2, 0x04, 0xed, 0xfb, 0x49, 0x83, 0x0b, 0x62, 0x38, 0x46, - 0xbd, 0xec, 0xe5, 0x25, 0x7e, 0x80, 0xca, 0x7a, 0xfe, 0x34, 0x20, 0x3b, 0xa9, 0xb6, 0x6c, 0xe0, - 0x47, 0xe8, 0x60, 0x4c, 0xa7, 0xe7, 0xf0, 0x79, 0x02, 0xcc, 0x07, 0x21, 0xc9, 0x9e, 0x63, 0xd4, - 0x77, 0xbd, 0xf5, 0x26, 0x7e, 0x81, 0xee, 0xc7, 0x20, 0xc6, 0x91, 0x94, 0x11, 0x67, 0x10, 0xb4, - 0x82, 0x40, 0x80, 0x94, 0x20, 0xc9, 0xbe, 0x63, 0xd6, 0xcb, 0xde, 0x76, 0x11, 0xb7, 0x51, 0x79, - 0x0c, 0x8a, 0x06, 0x54, 0x51, 0x49, 0x6e, 0x3b, 0x66, 0xbd, 0xd2, 0xb4, 0x1b, 0x05, 0x8c, 0x8d, - 0x0b, 0x3e, 0x04, 0xd6, 0xd5, 0xb6, 0xf6, 0xee, 0xd5, 0xaf, 0x6a, 0xc9, 0x5b, 0x8e, 0xe1, 0x33, - 0x74, 0x14, 0x02, 0x03, 0x19, 0xc9, 0x1e, 0xf5, 0x7d, 0x3e, 0x61, 0x4a, 0x92, 0x72, 0x1a, 0x55, - 0xdd, 0x88, 0x7a, 0x93, 0x19, 0x5b, 0x99, 0x4f, 0x67, 0x1d, 0x86, 0x6b, 0x5d, 0x59, 0xb3, 0x10, - 0x29, 0xd2, 0xf3, 0x40, 0xc6, 0x9c, 0x49, 0xa8, 0xfd, 0x31, 0xd0, 0x9d, 0xae, 0x0c, 0xdf, 0xc7, - 0x01, 0x55, 0x70, 0xae, 0xa8, 0x82, 0xff, 0x06, 0xeb, 0xa0, 0x8a, 0x54, 0x54, 0xa8, 0xb7, 0x10, - 0x85, 0x03, 0x45, 0xcc, 0x14, 0xeb, 0x6a, 0x2b, 0x99, 0x67, 0x93, 0x71, 0x3b, 0xb9, 0x1f, 0x92, - 0xec, 0xa6, 0xfa, 0xb2, 0x81, 0x8f, 0xd1, 0x5e, 0xa7, 0x75, 0x46, 0xd5, 0x80, 0xdc, 0x4a, 0xa3, - 0x75, 0x95, 0xec, 0xe7, 0x12, 0x44, 0x82, 0x5a, 0x1f, 0x55, 0x5e, 0xe2, 0x97, 0xc8, 0x6c, 0x77, - 0x92, 0x23, 0x31, 0xea, 0x95, 0xe6, 0xc3, 0x0d, 0x3a, 0x69, 0x6e, 0x67, 0x71, 0x0f, 0xa5, 0xe6, - 0x93, 0xcc, 0xd4, 0x08, 0x3a, 0x5e, 0x7f, 0xec, 0x05, 0x91, 0x38, 0x55, 0x34, 0x27, 0x0d, 0xf8, - 0xf5, 0x25, 0x30, 0x95, 0x6c, 0x84, 0x66, 0x47, 0x9d, 0x83, 0xd1, 0x25, 0x3e, 0x41, 0xc8, 0x1f, - 0x50, 0xc6, 0x60, 0xd4, 0x8b, 0x16, 0x64, 0x74, 0xe7, 0x34, 0x48, 0x64, 0xbd, 0xa7, 0x44, 0x36, - 0x0b, 0xe0, 0x6a, 0x0e, 0xb2, 0xb7, 0xaf, 0x98, 0xef, 0xa9, 0xf9, 0x7d, 0x07, 0x99, 0x5d, 0x19, - 0xe2, 0x4f, 0xe8, 0x60, 0xfd, 0x25, 0xd8, 0x7c, 0xe8, 0xe2, 0x49, 0x5b, 0x4f, 0x6f, 0xb4, 0xe4, - 0xcb, 0xe0, 0x0f, 0xa8, 0xb2, 0x7a, 0x11, 0xaa, 0xdb, 0x26, 0x57, 0x0c, 0xd6, 0x93, 0x1b, 0x0c, - 0x8b, 0x60, 0x8e, 0xee, 0x5e, 0x88, 0x28, 0x0c, 0x41, 0xac, 0x01, 0xdd, 0x3a, 0xbf, 0x85, 0x83, - 0xe5, 0xfe, 0xa3, 0x31, 0x5f, 0xb0, 0xfd, 0xee, 0x6a, 0x66, 0x1b, 0xd7, 0x33, 0xdb, 0xf8, 0x3d, - 0xb3, 0x8d, 0x6f, 0x73, 0xbb, 0x74, 0x3d, 0xb7, 0x4b, 0x3f, 0xe7, 0x76, 0xe9, 0x63, 0x33, 0x8c, - 0xd4, 0x60, 0xd2, 0x6f, 0xf8, 0x7c, 0xec, 0xea, 0xd0, 0x67, 0x0c, 0xd4, 0x17, 0x2e, 0x86, 0x79, - 0xed, 0x4e, 0x97, 0x1f, 0xc3, 0xaf, 0x31, 0xc8, 0xfe, 0x5e, 0xfa, 0x19, 0x7a, 0xfe, 0x37, 0x00, - 0x00, 0xff, 0xff, 0xa9, 0x66, 0x3c, 0x6b, 0x2c, 0x05, 0x00, 0x00, + 0x14, 0xc6, 0x9b, 0x76, 0x6c, 0xc4, 0x65, 0x7f, 0x14, 0x60, 0x58, 0x91, 0x96, 0x75, 0x95, 0x80, + 0x72, 0x41, 0x23, 0x15, 0xf1, 0x00, 0x2b, 0x20, 0x36, 0x89, 0x4a, 0x53, 0x36, 0x84, 0x84, 0x84, + 0x22, 0x37, 0x39, 0x4a, 0xa2, 0x36, 0x76, 0xb0, 0x9d, 0x51, 0xde, 0x80, 0x4b, 0x9e, 0x84, 0x57, + 0xe0, 0x76, 0x97, 0xbb, 0xe4, 0x0a, 0xa1, 0xed, 0x45, 0x50, 0x5c, 0xa7, 0x6b, 0xd3, 0x4a, 0x43, + 0x5c, 0xb5, 0xfe, 0xbe, 0xcf, 0xe7, 0x38, 0x3f, 0x9f, 0x04, 0x61, 0x9a, 0x07, 0x63, 0x48, 0x02, + 0x97, 0xb3, 0xf1, 0x98, 0x64, 0x99, 0x2b, 0x27, 0xdd, 0x8c, 0x33, 0xc9, 0xac, 0x6d, 0xed, 0x74, + 0xb5, 0x63, 0x3f, 0x88, 0x58, 0xc4, 0x94, 0xe7, 0x16, 0xff, 0xa6, 0x31, 0xfb, 0x49, 0xb5, 0xc0, + 0x70, 0xcc, 0x82, 0x91, 0x1f, 0x82, 0x08, 0x78, 0x92, 0x49, 0xc6, 0x75, 0xce, 0x5e, 0xca, 0x11, + 0x3a, 0xd2, 0xde, 0x5e, 0xd5, 0xd3, 0xbf, 0x53, 0xbb, 0xfd, 0xb3, 0x8e, 0x76, 0x06, 0x22, 0x7a, + 0xc5, 0x81, 0x48, 0xf0, 0xa6, 0x96, 0x85, 0xd1, 0x46, 0x50, 0x08, 0x8c, 0x63, 0xa3, 0x65, 0x74, + 0x4c, 0xaf, 0x5c, 0x5a, 0x7b, 0x08, 0xe9, 0xfd, 0x7e, 0x12, 0xe2, 0xba, 0x32, 0x4d, 0xad, 0x1c, + 0x87, 0xd6, 0x63, 0xb4, 0x95, 0x92, 0x89, 0x2f, 0xe0, 0x73, 0x0e, 0x34, 0x00, 0x2e, 0xf0, 0x7a, + 0xcb, 0xe8, 0xac, 0x79, 0x9b, 0x29, 0x99, 0x9c, 0xce, 0x44, 0xeb, 0x25, 0xda, 0xcd, 0x80, 0xa7, + 0x89, 0x10, 0x09, 0xa3, 0x10, 0xfa, 0x24, 0x0c, 0x39, 0x08, 0x01, 0x02, 0x6f, 0xb4, 0x1a, 0x1d, + 0xd3, 0x7b, 0x38, 0xef, 0x1e, 0x96, 0xa6, 0xd5, 0x47, 0x66, 0x0a, 0x92, 0x84, 0x44, 0x12, 0x81, + 0xef, 0xb6, 0x1a, 0x9d, 0x66, 0xcf, 0xe9, 0x56, 0x48, 0x76, 0xcf, 0xd8, 0x08, 0xe8, 0x40, 0xc7, + 0xfa, 0x6b, 0x17, 0xbf, 0xf7, 0x6b, 0xde, 0xcd, 0x36, 0xeb, 0x04, 0xed, 0x44, 0x40, 0x41, 0x24, + 0xc2, 0x27, 0x41, 0xc0, 0x72, 0x2a, 0x05, 0x36, 0x55, 0xa9, 0xfd, 0xa5, 0x52, 0x6f, 0xa7, 0xc1, + 0xc3, 0x69, 0x4e, 0xd7, 0xda, 0x8e, 0x16, 0x54, 0xd1, 0xb6, 0x11, 0xae, 0x02, 0xf4, 0x40, 0x64, + 0x8c, 0x0a, 0x68, 0x7f, 0xab, 0xa3, 0xad, 0x81, 0x88, 0xde, 0x67, 0x21, 0x91, 0x70, 0x2a, 0x89, + 0x84, 0xff, 0x67, 0x7b, 0x80, 0xee, 0x09, 0x49, 0xb8, 0xf4, 0x63, 0x48, 0xa2, 0x58, 0xe2, 0x86, + 0x22, 0xdb, 0x54, 0xda, 0x91, 0x92, 0x8a, 0x0a, 0x34, 0x4f, 0x7d, 0x35, 0x25, 0x02, 0xaf, 0xa9, + 0x80, 0x49, 0xf3, 0xb4, 0xaf, 0x04, 0xeb, 0x11, 0xda, 0x08, 0x89, 0x9f, 0x11, 0x19, 0xe3, 0x3b, + 0xaa, 0xfa, 0x7a, 0x48, 0x4e, 0x88, 0x8c, 0x8b, 0x33, 0x9d, 0x03, 0x2f, 0x70, 0xeb, 0xfb, 0x2a, + 0x97, 0xd6, 0x11, 0x6a, 0xde, 0xcc, 0x5c, 0x71, 0x3d, 0x46, 0xa7, 0xd9, 0x3b, 0x58, 0x22, 0xa5, + 0x1a, 0xbc, 0x9e, 0x8d, 0xa5, 0xd0, 0xac, 0xd0, 0xb0, 0xd4, 0x45, 0x1b, 0xa3, 0xdd, 0x45, 0x12, + 0x33, 0x48, 0x99, 0x72, 0x34, 0x3a, 0xcd, 0xfc, 0xcd, 0x39, 0x50, 0x59, 0x9c, 0x4b, 0x8f, 0x46, + 0xc9, 0x4a, 0x2f, 0x8b, 0x27, 0x0d, 0x62, 0x42, 0x29, 0x8c, 0xe7, 0x58, 0x69, 0xe5, 0x38, 0xac, + 0xa0, 0x6c, 0x54, 0x50, 0xb6, 0x5b, 0xc8, 0x59, 0xdd, 0xb1, 0x3c, 0x53, 0xef, 0x47, 0x1d, 0x35, + 0x06, 0x22, 0xb2, 0x3e, 0xa1, 0xcd, 0xc5, 0x57, 0x63, 0xf9, 0xd9, 0xab, 0x97, 0x6f, 0x3f, 0xbb, + 0x35, 0x52, 0xb6, 0xb1, 0x3e, 0xa0, 0xe6, 0xfc, 0x6c, 0xec, 0xaf, 0xda, 0x39, 0x17, 0xb0, 0x9f, + 0xde, 0x12, 0x98, 0x15, 0x66, 0xe8, 0xfe, 0x19, 0x4f, 0xa2, 0x08, 0xf8, 0x02, 0xd0, 0x95, 0xfb, + 0x57, 0x70, 0xb0, 0xdd, 0x7f, 0x0c, 0x96, 0x0d, 0xfb, 0xef, 0x2e, 0xae, 0x1c, 0xe3, 0xf2, 0xca, + 0x31, 0xfe, 0x5c, 0x39, 0xc6, 0xf7, 0x6b, 0xa7, 0x76, 0x79, 0xed, 0xd4, 0x7e, 0x5d, 0x3b, 0xb5, + 0x8f, 0xbd, 0x28, 0x91, 0x71, 0x3e, 0xec, 0x06, 0x2c, 0x75, 0x75, 0xd1, 0xe7, 0x14, 0xe4, 0x17, + 0xc6, 0x47, 0xe5, 0xda, 0x9d, 0xdc, 0x7c, 0x22, 0xbf, 0x66, 0x20, 0x86, 0xeb, 0xea, 0xe3, 0xf4, + 0xe2, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xd6, 0xea, 0x8f, 0x42, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -727,7 +728,7 @@ func (m *MsgUpdateState) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.BDs.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.BlockDescs.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -741,10 +742,10 @@ func (m *MsgUpdateState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x30 } - if len(m.DAPath) > 0 { - i -= len(m.DAPath) - copy(dAtA[i:], m.DAPath) - i = encodeVarintTx(dAtA, i, uint64(len(m.DAPath))) + if len(m.DaPath) > 0 { + i -= len(m.DaPath) + copy(dAtA[i:], m.DaPath) + i = encodeVarintTx(dAtA, i, uint64(len(m.DaPath))) i-- dAtA[i] = 0x2a } @@ -943,14 +944,14 @@ func (m *MsgUpdateState) Size() (n int) { if m.NumBlocks != 0 { n += 1 + sovTx(uint64(m.NumBlocks)) } - l = len(m.DAPath) + l = len(m.DaPath) if l > 0 { n += 1 + l + sovTx(uint64(l)) } if m.Version != 0 { n += 1 + sovTx(uint64(m.Version)) } - l = m.BDs.Size() + l = m.BlockDescs.Size() n += 1 + l + sovTx(uint64(l)) return n } @@ -1416,7 +1417,7 @@ func (m *MsgUpdateState) Unmarshal(dAtA []byte) error { } case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DAPath", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DaPath", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1444,7 +1445,7 @@ func (m *MsgUpdateState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DAPath = string(dAtA[iNdEx:postIndex]) + m.DaPath = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 6: if wireType != 0 { @@ -1467,7 +1468,7 @@ func (m *MsgUpdateState) Unmarshal(dAtA []byte) error { } case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BDs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlockDescs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1494,7 +1495,7 @@ func (m *MsgUpdateState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.BDs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.BlockDescs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From 2beb0734c8eec1ccdeb9f31ffa3b530bbc14d451 Mon Sep 17 00:00:00 2001 From: tnv1 Date: Sun, 19 May 2024 16:09:53 +0700 Subject: [PATCH 12/12] Change to use bank custom of terra-core --- app/app.go | 13 +- x/denommetadata/module.go | 177 ++++++++++++++++++++++ x/denommetadata/proposal_handler.go | 52 +++++++ x/denommetadata/types/expected_keepers.go | 6 +- x/rollapp/types/expected_keepers.go | 8 +- 5 files changed, 250 insertions(+), 6 deletions(-) create mode 100644 x/denommetadata/module.go create mode 100644 x/denommetadata/proposal_handler.go diff --git a/app/app.go b/app/app.go index c7eb7945..08a70f51 100644 --- a/app/app.go +++ b/app/app.go @@ -152,6 +152,9 @@ import ( "github.com/eve-network/eve/x/rollapp" rollappkeeper "github.com/eve-network/eve/x/rollapp/keeper" rollapptypes "github.com/eve-network/eve/x/rollapp/types" + + denommetadatakeeper "github.com/eve-network/eve/x/denommetadata/keeper" + denommetadatatypes "github.com/eve-network/eve/x/denommetadata/types" ) const appName = "EveApp" @@ -268,6 +271,8 @@ type EveApp struct { RollappKeeper rollappkeeper.Keeper + DenomMetadataKeeper *denommetadatakeeper.Keeper + // the module manager ModuleManager *module.Manager BasicModuleManager module.BasicManager @@ -332,6 +337,7 @@ func NewEveApp( icacontrollertypes.StoreKey, tokenfactorytypes.StoreKey, ibchookstypes.StoreKey, alliancemoduletypes.StoreKey, + denommetadatatypes.ModuleName, rollapptypes.StoreKey, ) @@ -699,6 +705,8 @@ func NewEveApp( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + app.DenomMetadataKeeper = denommetadatakeeper.NewKeeper(app.BankKeeper) + app.RollappKeeper = *rollappkeeper.NewKeeper( appCodec, keys[rollapptypes.StoreKey], @@ -708,7 +716,8 @@ func NewEveApp( app.TransferKeeper, app.IBCKeeper.ChannelKeeper, app.BankKeeper, - app.Deno + app.DenomMetadataKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) wasmConfig, err := wasm.ReadWasmConfig(appOpts) @@ -906,6 +915,7 @@ func NewEveApp( tokenfactorytypes.ModuleName, alliancemoduletypes.ModuleName, + denommetadatatypes.ModuleName, rollapptypes.ModuleName, } app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) @@ -1301,6 +1311,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(alliancemoduletypes.ModuleName) // register nucleic module key tables + paramsKeeper.Subspace(denommetadatatypes.ModuleName) paramsKeeper.Subspace(rollapptypes.ModuleName) return paramsKeeper diff --git a/x/denommetadata/module.go b/x/denommetadata/module.go new file mode 100644 index 00000000..de169423 --- /dev/null +++ b/x/denommetadata/module.go @@ -0,0 +1,177 @@ +package denommetadata + +import ( + "context" + "encoding/json" + + "cosmossdk.io/core/appmodule" + "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" + "github.com/cosmos/cosmos-sdk/types/simulation" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/eve-network/eve/x/denommetadata/keeper" + "github.com/eve-network/eve/x/denommetadata/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" +) + +var ( + _ module.AppModuleBasic = AppModuleBasic{} + _ module.HasGenesisBasics = AppModuleBasic{} + + _ appmodule.AppModule = AppModule{} + _ module.HasConsensusVersion = AppModule{} + _ module.HasGenesis = AppModule{} + _ module.HasServices = AppModule{} +) + +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { +} + +// DefaultGenesis implements module.HasGenesisBasics. +func (a AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis implements module.HasGenesisBasics. +func (a AppModuleBasic) ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage) error { + return nil +} + +// Name implements module.AppModuleBasic. +func (a AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterGRPCGatewayRoutes implements module.AppModuleBasic. +func (a AppModuleBasic) RegisterGRPCGatewayRoutes(client.Context, *runtime.ServeMux) { +} + +// RegisterInterfaces implements module.AppModuleBasic. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// RegisterLegacyAminoCodec implements module.AppModuleBasic. +func (a AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +func NewAppModuleBasic() AppModuleBasic { + return AppModuleBasic{} +} + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + bankKeeper bankkeeper.Keeper +} + +// RegisterServices implements module.HasServices. +func (a AppModule) RegisterServices(module.Configurator) { +} + +// DefaultGenesis implements module.HasGenesis. +func (a AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ExportGenesis implements module.HasGenesis. +func (a AppModule) ExportGenesis(sdk.Context, codec.JSONCodec) json.RawMessage { + return nil +} + +// InitGenesis implements module.HasGenesis. +func (a AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + a.bankKeeper.IterateAllDenomMetaData(ctx, func(metadata banktypes.Metadata) bool { + // run hooks for each denom metadata, thus `x/denommetadata` genesis init order must be after `x/bank` genesis init + err := a.keeper.GetHooks().AfterDenomMetadataCreation(ctx, metadata) + if err != nil { + panic(err) // error at genesis level should be reported by panic + } + + return false + }) +} + +// ValidateGenesis implements module.HasGenesis. +func (a AppModule) ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage) error { + panic("unimplemented") +} + +// ConsensusVersion implements module.HasConsensusVersion. +func (a AppModule) ConsensusVersion() uint64 { + return 1 +} + +// IsAppModule implements appmodule.AppModule. +func (a AppModule) IsAppModule() { +} + +// IsOnePerModuleType implements appmodule.AppModule. +func (a AppModule) IsOnePerModuleType() { + panic("unimplemented") +} + +// EndBlock implements appmodule.HasEndBlocker. +func (a *AppModule) EndBlock(context.Context) error { + panic("unimplemented") +} + +// BeginBlock implements appmodule.HasBeginBlocker. +func (a *AppModule) BeginBlock(context.Context) error { + panic("unimplemented") +} + +// GenerateGenesisState implements module.AppModuleSimulation. +func (a *AppModule) GenerateGenesisState(input *module.SimulationState) { + panic("unimplemented") +} + +// RegisterStoreDecoder implements module.AppModuleSimulation. +func (a *AppModule) RegisterStoreDecoder(simulation.StoreDecoderRegistry) { + panic("unimplemented") +} + +// WeightedOperations implements module.AppModuleSimulation. +func (a *AppModule) WeightedOperations(simState module.SimulationState) []simulation.WeightedOperation { + panic("unimplemented") +} + +// Name implements module.AppModuleBasic. +func (a *AppModule) Name() string { + return types.ModuleName +} + +// RegisterGRPCGatewayRoutes implements module.AppModuleBasic. +func (a *AppModule) RegisterGRPCGatewayRoutes(client.Context, *runtime.ServeMux) { + panic("unimplemented") +} + +// RegisterInterfaces implements module.AppModuleBasic. +func (a *AppModule) RegisterInterfaces(cdctypes.InterfaceRegistry) { + panic("unimplemented") +} + +// RegisterLegacyAminoCodec implements module.AppModuleBasic. +func (a *AppModule) RegisterLegacyAminoCodec(*codec.LegacyAmino) { + panic("unimplemented") +} + +func NewAppModule( + keeper keeper.Keeper, + bankKeeper bankkeeper.Keeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(), + keeper: keeper, + bankKeeper: bankKeeper, + } +} diff --git a/x/denommetadata/proposal_handler.go b/x/denommetadata/proposal_handler.go new file mode 100644 index 00000000..d517be14 --- /dev/null +++ b/x/denommetadata/proposal_handler.go @@ -0,0 +1,52 @@ +package denommetadata + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/eve-network/eve/x/denommetadata/keeper" + "github.com/eve-network/eve/x/denommetadata/types" +) + +func NewDenomMetadataProposalHandler(k *keeper.Keeper) govtypes.Handler { + return func(ctx sdk.Context, content govtypes.Content) error { + switch c := content.(type) { + case *types.CreateDenomMetadataProposal: + return HandleCreateDenomMetadataProposal(ctx, k, c) + case *types.UpdateDenomMetadataProposal: + return HandleUpdateDenomMetadataProposal(ctx, k, c) + default: + return errorsmod.Wrapf(types.ErrUnknownRequest, "unrecognized denommetadata proposal content type: %T", c) + } + } +} + +// HandleCreateDenomMetadataProposal is a handler for executing a passed denom metadata creation proposal +func HandleCreateDenomMetadataProposal(ctx sdk.Context, k *keeper.Keeper, p *types.CreateDenomMetadataProposal) error { + if err := p.ValidateBasic(); err != nil { + return err + } + + for _, metadata := range p.TokenMetadata { + err := k.CreateDenomMetadata(ctx, metadata) + if err != nil { + return err + } + } + return nil +} + +// HandleUpdateDenomMetadataProposal is a handler for executing a passed denom metadata update proposal +func HandleUpdateDenomMetadataProposal(ctx sdk.Context, k *keeper.Keeper, p *types.UpdateDenomMetadataProposal) error { + if err := p.ValidateBasic(); err != nil { + return err + } + + for _, metadata := range p.TokenMetadata { + err := k.UpdateDenomMetadata(ctx, metadata) + if err != nil { + return err + } + } + return nil +} diff --git a/x/denommetadata/types/expected_keepers.go b/x/denommetadata/types/expected_keepers.go index b4116f38..62885171 100644 --- a/x/denommetadata/types/expected_keepers.go +++ b/x/denommetadata/types/expected_keepers.go @@ -1,6 +1,8 @@ package types import ( + "context" + tmbytes "github.com/cometbft/cometbft/libs/bytes" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -20,8 +22,8 @@ type ChannelKeeper interface { // BankKeeper defines the expected interface needed type BankKeeper interface { - HasDenomMetaData(ctx sdk.Context, denom string) bool - SetDenomMetaData(ctx sdk.Context, denomMetaData types.Metadata) + HasDenomMetaData(ctx context.Context, denom string) bool + SetDenomMetaData(ctx context.Context, denomMetaData types.Metadata) } type RollappKeeper interface { diff --git a/x/rollapp/types/expected_keepers.go b/x/rollapp/types/expected_keepers.go index 1b2735c1..9f428c7a 100644 --- a/x/rollapp/types/expected_keepers.go +++ b/x/rollapp/types/expected_keepers.go @@ -1,6 +1,8 @@ package types import ( + context "context" + cmbytes "github.com/cometbft/cometbft/libs/bytes" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" "github.com/cosmos/ibc-go/v8/modules/core/exported" @@ -18,9 +20,9 @@ type AccountKeeper interface { // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error } type IBCClientKeeper interface {