diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 06023f5c5..e31505b4c 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -20122,6 +20122,208 @@ paths: format: int64 tags: - Query + /dymensionxyz/dymension/rollapp/latest_state_info_index: + get: + summary: Queries a list of LatestStateInfoIndex items. + operationId: DymensionxyzDymensionRollappLatestStateInfoIndexAll + responses: + '200': + description: A successful response. + schema: + type: object + properties: + latestStateInfoIndex: + type: array + items: + type: object + properties: + rollappId: + type: string + title: >- + 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 + index: + type: string + format: uint64 + title: >- + latestStateInfoIndex is a sequential increasing number, + updating on each + + state update used for indexing to a specific state info + title: >- + 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 LatestStateInfoIndex + which defines the rollapps' current (latest) + + index of the last UpdateState + pagination: + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the + + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + tags: + - Query + '/dymensionxyz/dymension/rollapp/latest_state_info_index/{rollappId}': + get: + summary: Queries a LatestStateInfoIndex by index. + operationId: DymensionxyzDymensionRollappLatestStateInfoIndex + responses: + '200': + description: A successful response. + schema: + type: object + properties: + latestStateInfoIndex: + type: object + properties: + rollappId: + type: string + title: >- + 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 + index: + type: string + format: uint64 + title: >- + latestStateInfoIndex is a sequential increasing number, + updating on each + + state update used for indexing to a specific state info + title: >- + 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 LatestStateInfoIndex which + defines the rollapps' current (latest) + + index of the last UpdateState + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: rollappId + in: path + required: true + type: string + tags: + - Query /dymensionxyz/dymension/rollapp/params: get: summary: Parameters queries the parameters of the module. @@ -20437,191 +20639,6 @@ paths: type: string tags: - Query - /dymensionxyz/dymension/rollapp/state_index: - get: - summary: Queries a list of StateIndex items. - operationId: DymensionxyzDymensionRollappStateIndexAll - responses: - '200': - description: A successful response. - schema: - type: object - properties: - stateIndex: - type: array - items: - type: object - properties: - rollappId: - type: string - title: >- - rollappId is the rollapp that we save the index for - - The rollappId follows the same standard as cosmos - chain_id - index: - type: string - format: uint64 - title: |- - index is a sequentially increasing number - the index increases on every state update - title: >- - StateIndex defines a rollapps' the current (latest) - - index of the last UpdateState - - the index also saved with every UpdateState in StateInfo. - - the pair is used for retrieving a - StateInfo - pagination: - type: object - properties: - next_key: - type: string - format: byte - title: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - tags: - - Query - '/dymensionxyz/dymension/rollapp/state_index/{rollappId}': - get: - summary: Queries a StateIndex by index. - operationId: DymensionxyzDymensionRollappStateIndex - responses: - '200': - description: A successful response. - schema: - type: object - properties: - stateIndex: - type: object - properties: - rollappId: - type: string - title: |- - rollappId is the rollapp that we save the index for - The rollappId follows the same standard as cosmos chain_id - index: - type: string - format: uint64 - title: |- - index is a sequentially increasing number - the index increases on every state update - title: |- - StateIndex defines a rollapps' the current (latest) - index of the last UpdateState - the index also saved with every UpdateState in StateInfo. - the pair is used for retrieving a StateInfo - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: rollappId - in: path - required: true - type: string - tags: - - Query /dymensionxyz/dymension/rollapp/state_info: get: summary: Queries a list of StateInfo items. @@ -20637,22 +20654,40 @@ paths: items: type: object properties: - rollappId: - type: string - title: >- - rollappId is the rollapp that the sequencer belongs to - and asking to update + stateInfoIndex: + type: object + properties: + rollappId: + type: string + title: >- + 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 - stateIndex: - type: string - format: uint64 + The rollappId follows the same standard as cosmos + chain_id + index: + type: string + format: uint64 + title: >- + latestStateInfoIndex is a sequential increasing + number, updating on each + + state update used for indexing to a specific state + info title: >- - stateIndex is a sequential increasing number, updating - on each + StateInfoIndex is the data used for indexing and + retrieving a StateInfo - state update used for indexing to a specific state info + it updated and saved with every UpdateState in + StateInfo. + + We use the this structure also for LatestStateInfoIndex + which defines the rollapps' current (latest) + + index of the last UpdateState sequencer: type: string title: >- @@ -20821,7 +20856,7 @@ paths: type: boolean tags: - Query - '/dymensionxyz/dymension/rollapp/state_info/{rollappId}/{stateIndex}': + '/dymensionxyz/dymension/rollapp/state_info/{rollappId}/{index}': get: summary: Queries a StateInfo by index. operationId: DymensionxyzDymensionRollappStateInfo @@ -20834,21 +20869,39 @@ paths: stateInfo: type: object properties: - rollappId: - type: string - title: >- - rollappId is the rollapp that the sequencer belongs to and - asking to update + stateInfoIndex: + type: object + properties: + rollappId: + type: string + title: >- + rollappId is the rollapp that the sequencer belongs to + and asking to update - The rollappId follows the same standard as cosmos chain_id - stateIndex: - type: string - format: uint64 + it used to identify the what rollapp a StateInfo + belongs + + The rollappId follows the same standard as cosmos + chain_id + index: + type: string + format: uint64 + title: >- + latestStateInfoIndex is a sequential increasing + number, updating on each + + state update used for indexing to a specific state + info title: >- - stateIndex is a sequential increasing number, updating on - each + StateInfoIndex is the data used for indexing and + retrieving a StateInfo - state update used for indexing to a specific state info + it updated and saved with every UpdateState in StateInfo. + + We use the this structure also for LatestStateInfoIndex + which defines the rollapps' current (latest) + + index of the last UpdateState sequencer: type: string title: >- @@ -20943,7 +20996,7 @@ paths: in: path required: true type: string - - name: stateIndex + - name: index in: path required: true type: string @@ -50225,6 +50278,66 @@ definitions: to change a status of a state from received to finalized. during that period, any user could submit fraud proof description: Params defines the parameters for the module. + dymensionxyz.dymension.rollapp.QueryAllLatestStateInfoIndexResponse: + type: object + properties: + latestStateInfoIndex: + type: array + items: + type: object + properties: + rollappId: + type: string + title: >- + 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 + index: + type: string + format: uint64 + title: >- + latestStateInfoIndex is a sequential increasing number, updating + on each + + state update used for indexing to a specific state info + title: >- + 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 LatestStateInfoIndex which + defines the rollapps' current (latest) + + index of the last UpdateState + pagination: + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } dymensionxyz.dymension.rollapp.QueryAllRollappResponse: type: object properties: @@ -50311,55 +50424,6 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } - dymensionxyz.dymension.rollapp.QueryAllStateIndexResponse: - type: object - properties: - stateIndex: - type: array - items: - type: object - properties: - rollappId: - type: string - title: |- - rollappId is the rollapp that we save the index for - The rollappId follows the same standard as cosmos chain_id - index: - type: string - format: uint64 - title: |- - index is a sequentially increasing number - the index increases on every state update - title: |- - StateIndex defines a rollapps' the current (latest) - index of the last UpdateState - the index also saved with every UpdateState in StateInfo. - the pair is used for retrieving a StateInfo - pagination: - type: object - properties: - next_key: - type: string - format: byte - title: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } dymensionxyz.dymension.rollapp.QueryAllStateInfoResponse: type: object properties: @@ -50368,19 +50432,36 @@ definitions: items: type: object properties: - rollappId: - type: string + stateInfoIndex: + type: object + properties: + rollappId: + type: string + title: >- + 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 + index: + type: string + format: uint64 + title: >- + latestStateInfoIndex is a sequential increasing number, + updating on each + + state update used for indexing to a specific state info title: >- - rollappId is the rollapp that the sequencer belongs to and - asking to update + StateInfoIndex is the data used for indexing and retrieving a + StateInfo - The rollappId follows the same standard as cosmos chain_id - stateIndex: - type: string - format: uint64 - title: |- - stateIndex is a sequential increasing number, updating on each - state update used for indexing to a specific state info + it updated and saved with every UpdateState in StateInfo. + + We use the this structure also for LatestStateInfoIndex which + defines the rollapps' current (latest) + + index of the last UpdateState sequencer: type: string title: >- @@ -50470,6 +50551,39 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } + dymensionxyz.dymension.rollapp.QueryGetLatestStateInfoIndexResponse: + type: object + properties: + latestStateInfoIndex: + type: object + properties: + rollappId: + type: string + title: >- + 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 + index: + type: string + format: uint64 + title: >- + latestStateInfoIndex is a sequential increasing number, updating + on each + + state update used for indexing to a specific state info + title: >- + 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 LatestStateInfoIndex which defines + the rollapps' current (latest) + + index of the last UpdateState dymensionxyz.dymension.rollapp.QueryGetRollappResponse: type: object properties: @@ -50529,47 +50643,42 @@ definitions: sequencers can be create and attach to it. Rollapp is identified by rollappId - dymensionxyz.dymension.rollapp.QueryGetStateIndexResponse: - type: object - properties: - stateIndex: - type: object - properties: - rollappId: - type: string - title: |- - rollappId is the rollapp that we save the index for - The rollappId follows the same standard as cosmos chain_id - index: - type: string - format: uint64 - title: |- - index is a sequentially increasing number - the index increases on every state update - title: |- - StateIndex defines a rollapps' the current (latest) - index of the last UpdateState - the index also saved with every UpdateState in StateInfo. - the pair is used for retrieving a StateInfo dymensionxyz.dymension.rollapp.QueryGetStateInfoResponse: type: object properties: stateInfo: type: object properties: - rollappId: - type: string + stateInfoIndex: + type: object + properties: + rollappId: + type: string + title: >- + 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 + index: + type: string + format: uint64 + title: >- + latestStateInfoIndex is a sequential increasing number, + updating on each + + state update used for indexing to a specific state info title: >- - rollappId is the rollapp that the sequencer belongs to and asking - to update + StateInfoIndex is the data used for indexing and retrieving a + StateInfo - The rollappId follows the same standard as cosmos chain_id - stateIndex: - type: string - format: uint64 - title: |- - stateIndex is a sequential increasing number, updating on each - state update used for indexing to a specific state info + it updated and saved with every UpdateState in StateInfo. + + We use the this structure also for LatestStateInfoIndex which + defines the rollapps' current (latest) + + index of the last UpdateState sequencer: type: string title: >- @@ -50703,41 +50812,39 @@ definitions: sequencers can be create and attach to it. Rollapp is identified by rollappId - dymensionxyz.dymension.rollapp.StateIndex: - type: object - properties: - rollappId: - type: string - title: |- - rollappId is the rollapp that we save the index for - The rollappId follows the same standard as cosmos chain_id - index: - type: string - format: uint64 - title: |- - index is a sequentially increasing number - the index increases on every state update - title: |- - StateIndex defines a rollapps' the current (latest) - index of the last UpdateState - the index also saved with every UpdateState in StateInfo. - the pair is used for retrieving a StateInfo dymensionxyz.dymension.rollapp.StateInfo: type: object properties: - rollappId: - type: string + stateInfoIndex: + type: object + properties: + rollappId: + type: string + title: >- + 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 + index: + type: string + format: uint64 + title: >- + latestStateInfoIndex is a sequential increasing number, updating + on each + + state update used for indexing to a specific state info title: >- - rollappId is the rollapp that the sequencer belongs to and asking to - update + StateInfoIndex is the data used for indexing and retrieving a + StateInfo - The rollappId follows the same standard as cosmos chain_id - stateIndex: - type: string - format: uint64 - title: |- - stateIndex is a sequential increasing number, updating on each - state update used for indexing to a specific state info + it updated and saved with every UpdateState in StateInfo. + + We use the this structure also for LatestStateInfoIndex which defines + the rollapps' current (latest) + + index of the last UpdateState sequencer: type: string title: >- @@ -50802,6 +50909,35 @@ definitions: description. description: BlockDescriptors defines list of BlockDescriptor. description: StateInfo defines a rollapps' state. + dymensionxyz.dymension.rollapp.StateInfoIndex: + type: object + properties: + rollappId: + type: string + title: >- + 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 + index: + type: string + format: uint64 + title: >- + latestStateInfoIndex is a sequential increasing number, updating on + each + + state update used for indexing to a specific state info + title: >- + 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 LatestStateInfoIndex which defines the + rollapps' current (latest) + + index of the last UpdateState dymensionxyz.dymension.rollapp.StateStatus: type: string enum: diff --git a/proto/rollapp/genesis.proto b/proto/rollapp/genesis.proto index 284ad5051..2aa9ba05a 100644 --- a/proto/rollapp/genesis.proto +++ b/proto/rollapp/genesis.proto @@ -5,7 +5,6 @@ import "gogoproto/gogo.proto"; import "rollapp/params.proto"; import "rollapp/rollapp.proto"; import "rollapp/state_info.proto"; -import "rollapp/state_index.proto"; // this line is used by starport scaffolding # genesis/proto/import option go_package = "github.com/dymensionxyz/dymension/x/rollapp/types"; @@ -15,6 +14,6 @@ message GenesisState { Params params = 1 [(gogoproto.nullable) = false]; repeated Rollapp rollappList = 2 [(gogoproto.nullable) = false]; repeated StateInfo stateInfoList = 3 [(gogoproto.nullable) = false]; - repeated StateIndex stateIndexList = 4 [(gogoproto.nullable) = false]; + repeated StateInfoIndex latestStateInfoIndexList = 4 [(gogoproto.nullable) = false]; // this line is used by starport scaffolding # genesis/proto/state } diff --git a/proto/rollapp/query.proto b/proto/rollapp/query.proto index 929f59760..8efb4104c 100644 --- a/proto/rollapp/query.proto +++ b/proto/rollapp/query.proto @@ -7,7 +7,6 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "rollapp/params.proto"; import "rollapp/rollapp.proto"; import "rollapp/state_info.proto"; -import "rollapp/state_index.proto"; // this line is used by starport scaffolding # 1 option go_package = "github.com/dymensionxyz/dymension/x/rollapp/types"; @@ -30,7 +29,7 @@ service Query { // Queries a StateInfo by index. rpc StateInfo(QueryGetStateInfoRequest) returns (QueryGetStateInfoResponse) { - option (google.api.http).get = "/dymensionxyz/dymension/rollapp/state_info/{rollappId}/{stateIndex}"; + option (google.api.http).get = "/dymensionxyz/dymension/rollapp/state_info/{rollappId}/{index}"; } // Queries a list of StateInfo items. @@ -38,14 +37,14 @@ service Query { option (google.api.http).get = "/dymensionxyz/dymension/rollapp/state_info"; } -// Queries a StateIndex by index. - rpc StateIndex(QueryGetStateIndexRequest) returns (QueryGetStateIndexResponse) { - option (google.api.http).get = "/dymensionxyz/dymension/rollapp/state_index/{rollappId}"; +// Queries a LatestStateInfoIndex by index. + rpc LatestStateInfoIndex(QueryGetLatestStateInfoIndexRequest) returns (QueryGetLatestStateInfoIndexResponse) { + option (google.api.http).get = "/dymensionxyz/dymension/rollapp/latest_state_info_index/{rollappId}"; } - // Queries a list of StateIndex items. - rpc StateIndexAll(QueryAllStateIndexRequest) returns (QueryAllStateIndexResponse) { - option (google.api.http).get = "/dymensionxyz/dymension/rollapp/state_index"; + // Queries a list of LatestStateInfoIndex items. + rpc LatestStateInfoIndexAll(QueryAllLatestStateInfoIndexRequest) returns (QueryAllLatestStateInfoIndexResponse) { + option (google.api.http).get = "/dymensionxyz/dymension/rollapp/latest_state_info_index"; } // this line is used by starport scaffolding # 2 @@ -80,7 +79,7 @@ message QueryAllRollappResponse { message QueryGetStateInfoRequest { string rollappId = 1; - uint64 stateIndex = 2; + uint64 index = 2; } message QueryGetStateInfoResponse { @@ -96,21 +95,21 @@ message QueryAllStateInfoResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -message QueryGetStateIndexRequest { +message QueryGetLatestStateInfoIndexRequest { string rollappId = 1; } -message QueryGetStateIndexResponse { - StateIndex stateIndex = 1 [(gogoproto.nullable) = false]; +message QueryGetLatestStateInfoIndexResponse { + StateInfoIndex latestStateInfoIndex = 1 [(gogoproto.nullable) = false]; } -message QueryAllStateIndexRequest { +message QueryAllLatestStateInfoIndexRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; } -message QueryAllStateIndexResponse { - repeated StateIndex stateIndex = 1 [(gogoproto.nullable) = false]; +message QueryAllLatestStateInfoIndexResponse { + repeated StateInfoIndex latestStateInfoIndex = 1 [(gogoproto.nullable) = false]; cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/proto/rollapp/state_index.proto b/proto/rollapp/state_index.proto deleted file mode 100644 index 483fb2cb8..000000000 --- a/proto/rollapp/state_index.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; -package dymensionxyz.dymension.rollapp; - -option go_package = "github.com/dymensionxyz/dymension/x/rollapp/types"; - -// StateIndex defines a rollapps' the current (latest) -// index of the last UpdateState -// the index also saved with every UpdateState in StateInfo. -// the pair is used for retrieving a StateInfo -message StateIndex { - // rollappId is the rollapp that we save the index for - // The rollappId follows the same standard as cosmos chain_id - string rollappId = 1; - // index is a sequentially increasing number - // the index increases on every state update - uint64 index = 2; - -} - diff --git a/proto/rollapp/state_info.proto b/proto/rollapp/state_info.proto index a6474e1bb..a0d4a3cb1 100644 --- a/proto/rollapp/state_info.proto +++ b/proto/rollapp/state_info.proto @@ -8,29 +8,41 @@ import "gogoproto/gogo.proto"; import "rollapp/block_descriptor.proto"; import "rollapp/state_status.proto"; -// StateInfo defines a rollapps' state. -message StateInfo { +// 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 LatestStateInfoIndex which defines the rollapps' current (latest) +// index of the last UpdateState +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; - // stateIndex is a sequential increasing number, updating on each + string rollappId = 1; + // latestStateInfoIndex is a sequential increasing number, updating on each // state update used for indexing to a specific state info - uint64 stateIndex = 2; + 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 = 3; + string sequencer = 2; // startHeight is the block height of the first block in the batch - uint64 startHeight = 4; + uint64 startHeight = 3; // numBlocks is the number of blocks included in this batch update - uint64 numBlocks = 5; + uint64 numBlocks = 4; // DAPath is the description of the location on the DA layer - string DAPath = 6; + string DAPath = 5; // version is the version of the rollapp - uint64 version = 7; + uint64 version = 6; // creationHeight is the height at which the UpdateState took place - uint64 creationHeight = 8; + uint64 creationHeight = 7; // status is the status of the state update - StateStatus status = 9; + 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 = 10 [(gogoproto.nullable) = false]; + BlockDescriptors BDs = 9 [(gogoproto.nullable) = false]; } diff --git a/x/rollapp/client/cli/query.go b/x/rollapp/client/cli/query.go index b4074f448..0fa65e0b8 100644 --- a/x/rollapp/client/cli/query.go +++ b/x/rollapp/client/cli/query.go @@ -29,8 +29,8 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdShowRollapp()) cmd.AddCommand(CmdListStateInfo()) cmd.AddCommand(CmdShowStateInfo()) - cmd.AddCommand(CmdListStateIndex()) - cmd.AddCommand(CmdShowStateIndex()) + cmd.AddCommand(CmdListLatestStateInfoIndex()) + cmd.AddCommand(CmdShowLatestStateInfoIndex()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/rollapp/client/cli/query_state_index.go b/x/rollapp/client/cli/query_latest_state_info_index.go similarity index 71% rename from x/rollapp/client/cli/query_state_index.go rename to x/rollapp/client/cli/query_latest_state_info_index.go index aa45dbfd6..c05295eb1 100644 --- a/x/rollapp/client/cli/query_state_index.go +++ b/x/rollapp/client/cli/query_latest_state_info_index.go @@ -9,10 +9,10 @@ import ( "github.com/spf13/cobra" ) -func CmdListStateIndex() *cobra.Command { +func CmdListLatestStateInfoIndex() *cobra.Command { cmd := &cobra.Command{ Use: "list-state-index", - Short: "list all state_index", + Short: "list all latest_state_info_index", RunE: func(cmd *cobra.Command, args []string) error { clientCtx := client.GetClientContextFromCmd(cmd) @@ -23,11 +23,11 @@ func CmdListStateIndex() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryAllStateIndexRequest{ + params := &types.QueryAllLatestStateInfoIndexRequest{ Pagination: pageReq, } - res, err := queryClient.StateIndexAll(context.Background(), params) + res, err := queryClient.LatestStateInfoIndexAll(context.Background(), params) if err != nil { return err } @@ -42,10 +42,10 @@ func CmdListStateIndex() *cobra.Command { return cmd } -func CmdShowStateIndex() *cobra.Command { +func CmdShowLatestStateInfoIndex() *cobra.Command { cmd := &cobra.Command{ Use: "show-state-index [rollapp-id]", - Short: "shows a state_index", + Short: "shows a latest_state_info_index", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx := client.GetClientContextFromCmd(cmd) @@ -54,11 +54,11 @@ func CmdShowStateIndex() *cobra.Command { argRollappId := args[0] - params := &types.QueryGetStateIndexRequest{ + params := &types.QueryGetLatestStateInfoIndexRequest{ RollappId: argRollappId, } - res, err := queryClient.StateIndex(context.Background(), params) + res, err := queryClient.LatestStateInfoIndex(context.Background(), params) if err != nil { return err } diff --git a/x/rollapp/client/cli/query_state_index_test.go b/x/rollapp/client/cli/query_latest_state_info_index_test.go similarity index 68% rename from x/rollapp/client/cli/query_state_index_test.go rename to x/rollapp/client/cli/query_latest_state_info_index_test.go index 1721ff9b5..87cc63674 100644 --- a/x/rollapp/client/cli/query_state_index_test.go +++ b/x/rollapp/client/cli/query_latest_state_info_index_test.go @@ -21,27 +21,27 @@ import ( // Prevent strconv unused error var _ = strconv.IntSize -func networkWithStateIndexObjects(t *testing.T, n int) (*network.Network, []types.StateIndex) { +func networkWithLatestStateInfoIndexObjects(t *testing.T, n int) (*network.Network, []types.StateInfoIndex) { t.Helper() cfg := network.DefaultConfig() state := types.GenesisState{} require.NoError(t, cfg.Codec.UnmarshalJSON(cfg.GenesisState[types.ModuleName], &state)) for i := 0; i < n; i++ { - stateIndex := types.StateIndex{ + latestStateInfoIndex := types.StateInfoIndex{ RollappId: strconv.Itoa(i), } - nullify.Fill(&stateIndex) - state.StateIndexList = append(state.StateIndexList, stateIndex) + nullify.Fill(&latestStateInfoIndex) + state.LatestStateInfoIndexList = append(state.LatestStateInfoIndexList, latestStateInfoIndex) } buf, err := cfg.Codec.MarshalJSON(&state) require.NoError(t, err) cfg.GenesisState[types.ModuleName] = buf - return network.New(t, cfg), state.StateIndexList + return network.New(t, cfg), state.LatestStateInfoIndexList } -func TestShowStateIndex(t *testing.T) { - net, objs := networkWithStateIndexObjects(t, 2) +func TestShowLatestStateInfoIndex(t *testing.T) { + net, objs := networkWithLatestStateInfoIndexObjects(t, 2) ctx := net.Validators[0].ClientCtx common := []string{ @@ -53,7 +53,7 @@ func TestShowStateIndex(t *testing.T) { args []string err error - obj types.StateIndex + obj types.StateInfoIndex }{ { desc: "found", @@ -75,27 +75,27 @@ func TestShowStateIndex(t *testing.T) { tc.idRollappId, } args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowStateIndex(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowLatestStateInfoIndex(), args) if tc.err != nil { stat, ok := status.FromError(tc.err) require.True(t, ok) require.ErrorIs(t, stat.Err(), tc.err) } else { require.NoError(t, err) - var resp types.QueryGetStateIndexResponse + var resp types.QueryGetLatestStateInfoIndexResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.StateIndex) + require.NotNil(t, resp.LatestStateInfoIndex) require.Equal(t, nullify.Fill(&tc.obj), - nullify.Fill(&resp.StateIndex), + nullify.Fill(&resp.LatestStateInfoIndex), ) } }) } } -func TestListStateIndex(t *testing.T) { - net, objs := networkWithStateIndexObjects(t, 5) +func TestListLatestStateInfoIndex(t *testing.T) { + net, objs := networkWithLatestStateInfoIndexObjects(t, 5) ctx := net.Validators[0].ClientCtx request := func(next []byte, offset, limit uint64, total bool) []string { @@ -117,14 +117,14 @@ func TestListStateIndex(t *testing.T) { step := 2 for i := 0; i < len(objs); i += step { args := request(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListStateIndex(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListLatestStateInfoIndex(), args) require.NoError(t, err) - var resp types.QueryAllStateIndexResponse + var resp types.QueryAllLatestStateInfoIndexResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.StateIndex), step) + require.LessOrEqual(t, len(resp.LatestStateInfoIndex), step) require.Subset(t, nullify.Fill(objs), - nullify.Fill(resp.StateIndex), + nullify.Fill(resp.LatestStateInfoIndex), ) } }) @@ -133,29 +133,29 @@ func TestListStateIndex(t *testing.T) { var next []byte for i := 0; i < len(objs); i += step { args := request(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListStateIndex(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListLatestStateInfoIndex(), args) require.NoError(t, err) - var resp types.QueryAllStateIndexResponse + var resp types.QueryAllLatestStateInfoIndexResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.StateIndex), step) + require.LessOrEqual(t, len(resp.LatestStateInfoIndex), step) require.Subset(t, nullify.Fill(objs), - nullify.Fill(resp.StateIndex), + nullify.Fill(resp.LatestStateInfoIndex), ) next = resp.Pagination.NextKey } }) t.Run("Total", func(t *testing.T) { args := request(nil, 0, uint64(len(objs)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListStateIndex(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListLatestStateInfoIndex(), args) require.NoError(t, err) - var resp types.QueryAllStateIndexResponse + var resp types.QueryAllLatestStateInfoIndexResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) require.NoError(t, err) require.Equal(t, len(objs), int(resp.Pagination.Total)) require.ElementsMatch(t, nullify.Fill(objs), - nullify.Fill(resp.StateIndex), + nullify.Fill(resp.LatestStateInfoIndex), ) }) } diff --git a/x/rollapp/client/cli/query_state_info.go b/x/rollapp/client/cli/query_state_info.go index 186e46c0e..a17c8e02f 100644 --- a/x/rollapp/client/cli/query_state_info.go +++ b/x/rollapp/client/cli/query_state_info.go @@ -54,15 +54,12 @@ func CmdShowStateInfo() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) argRollappId := args[0] - argStateIndex, err := cast.ToUint64E(args[1]) + argIndex, err := cast.ToUint64E(args[1]) if err != nil { return err } - params := &types.QueryGetStateInfoRequest{ - RollappId: argRollappId, - StateIndex: argStateIndex, - } + params := &types.QueryGetStateInfoRequest{RollappId: argRollappId, Index: argIndex} res, err := queryClient.StateInfo(context.Background(), params) if err != nil { diff --git a/x/rollapp/client/cli/query_state_info_test.go b/x/rollapp/client/cli/query_state_info_test.go index e117830a1..b1ccb8d6d 100644 --- a/x/rollapp/client/cli/query_state_info_test.go +++ b/x/rollapp/client/cli/query_state_info_test.go @@ -29,8 +29,9 @@ func networkWithStateInfoObjects(t *testing.T, n int) (*network.Network, []types for i := 0; i < n; i++ { stateInfo := types.StateInfo{ - RollappId: strconv.Itoa(i), - StateIndex: uint64(i), + StateInfoIndex: types.StateInfoIndex{ + RollappId: strconv.Itoa(i), + Index: uint64(i)}, } nullify.Fill(&stateInfo) state.StateInfoList = append(state.StateInfoList, stateInfo) @@ -59,8 +60,8 @@ func TestShowStateInfo(t *testing.T) { }{ { desc: "found", - idRollappId: objs[0].RollappId, - idStateIndex: objs[0].StateIndex, + idRollappId: objs[0].StateInfoIndex.RollappId, + idStateIndex: objs[0].StateInfoIndex.Index, args: common, obj: objs[0], @@ -68,14 +69,14 @@ func TestShowStateInfo(t *testing.T) { { desc: "not found", idRollappId: strconv.Itoa(100000), - idStateIndex: objs[0].StateIndex, + idStateIndex: objs[0].StateInfoIndex.Index, args: common, err: status.Error(codes.NotFound, "not found"), }, { desc: "not found", - idRollappId: objs[0].RollappId, + idRollappId: objs[0].StateInfoIndex.RollappId, idStateIndex: 1000, args: common, diff --git a/x/rollapp/genesis.go b/x/rollapp/genesis.go index 9e1235377..efd3026bd 100644 --- a/x/rollapp/genesis.go +++ b/x/rollapp/genesis.go @@ -17,9 +17,9 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) for _, elem := range genState.StateInfoList { k.SetStateInfo(ctx, elem) } - // Set all the stateIndex - for _, elem := range genState.StateIndexList { - k.SetStateIndex(ctx, elem) + // Set all the latestStateInfoIndex + for _, elem := range genState.LatestStateInfoIndexList { + k.SetLatestStateInfoIndex(ctx, elem) } // this line is used by starport scaffolding # genesis/module/init k.SetParams(ctx, genState.Params) @@ -32,7 +32,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.RollappList = k.GetAllRollapp(ctx) genesis.StateInfoList = k.GetAllStateInfo(ctx) - genesis.StateIndexList = k.GetAllStateIndex(ctx) + genesis.LatestStateInfoIndexList = k.GetAllLatestStateInfoIndex(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/rollapp/genesis_test.go b/x/rollapp/genesis_test.go index fd239bb57..cab0a1cc4 100644 --- a/x/rollapp/genesis_test.go +++ b/x/rollapp/genesis_test.go @@ -24,15 +24,19 @@ func TestGenesis(t *testing.T) { }, StateInfoList: []types.StateInfo{ { - RollappId: "0", - StateIndex: 0, + StateInfoIndex: types.StateInfoIndex{ + RollappId: "0", + Index: 0, + }, }, { - RollappId: "1", - StateIndex: 1, + StateInfoIndex: types.StateInfoIndex{ + RollappId: "1", + Index: 1, + }, }, }, - StateIndexList: []types.StateIndex{ + LatestStateInfoIndexList: []types.StateInfoIndex{ { RollappId: "0", }, @@ -53,6 +57,6 @@ func TestGenesis(t *testing.T) { require.ElementsMatch(t, genesisState.RollappList, got.RollappList) require.ElementsMatch(t, genesisState.StateInfoList, got.StateInfoList) - require.ElementsMatch(t, genesisState.StateIndexList, got.StateIndexList) + require.ElementsMatch(t, genesisState.LatestStateInfoIndexList, got.LatestStateInfoIndexList) // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/rollapp/keeper/grpc_query_latest_state_info_index.go b/x/rollapp/keeper/grpc_query_latest_state_info_index.go new file mode 100644 index 000000000..4a234ec02 --- /dev/null +++ b/x/rollapp/keeper/grpc_query_latest_state_info_index.go @@ -0,0 +1,57 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/dymensionxyz/dymension/x/rollapp/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) LatestStateInfoIndexAll(c context.Context, req *types.QueryAllLatestStateInfoIndexRequest) (*types.QueryAllLatestStateInfoIndexResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var latestStateInfoIndexs []types.StateInfoIndex + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(k.storeKey) + latestStateInfoIndexStore := prefix.NewStore(store, types.KeyPrefix(types.LatestStateInfoIndexKeyPrefix)) + + pageRes, err := query.Paginate(latestStateInfoIndexStore, req.Pagination, func(key []byte, value []byte) error { + var latestStateInfoIndex types.StateInfoIndex + if err := k.cdc.Unmarshal(value, &latestStateInfoIndex); err != nil { + return err + } + + latestStateInfoIndexs = append(latestStateInfoIndexs, latestStateInfoIndex) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllLatestStateInfoIndexResponse{LatestStateInfoIndex: latestStateInfoIndexs, Pagination: pageRes}, nil +} + +func (k Keeper) LatestStateInfoIndex(c context.Context, req *types.QueryGetLatestStateInfoIndexRequest) (*types.QueryGetLatestStateInfoIndexResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetLatestStateInfoIndex( + ctx, + req.RollappId, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetLatestStateInfoIndexResponse{LatestStateInfoIndex: val}, nil +} diff --git a/x/rollapp/keeper/grpc_query_state_index_test.go b/x/rollapp/keeper/grpc_query_latest_state_info_index_test.go similarity index 60% rename from x/rollapp/keeper/grpc_query_state_index_test.go rename to x/rollapp/keeper/grpc_query_latest_state_info_index_test.go index 95bdc6f61..dd50d9fa9 100644 --- a/x/rollapp/keeper/grpc_query_state_index_test.go +++ b/x/rollapp/keeper/grpc_query_latest_state_info_index_test.go @@ -18,33 +18,33 @@ import ( // Prevent strconv unused error var _ = strconv.IntSize -func TestStateIndexQuerySingle(t *testing.T) { +func TestLatestStateInfoIndexQuerySingle(t *testing.T) { keeper, ctx := keepertest.RollappKeeper(t) wctx := sdk.WrapSDKContext(ctx) - msgs := createNStateIndex(keeper, ctx, 2) + msgs := createNLatestStateInfoIndex(keeper, ctx, 2) for _, tc := range []struct { desc string - request *types.QueryGetStateIndexRequest - response *types.QueryGetStateIndexResponse + request *types.QueryGetLatestStateInfoIndexRequest + response *types.QueryGetLatestStateInfoIndexResponse err error }{ { desc: "First", - request: &types.QueryGetStateIndexRequest{ + request: &types.QueryGetLatestStateInfoIndexRequest{ RollappId: msgs[0].RollappId, }, - response: &types.QueryGetStateIndexResponse{StateIndex: msgs[0]}, + response: &types.QueryGetLatestStateInfoIndexResponse{LatestStateInfoIndex: msgs[0]}, }, { desc: "Second", - request: &types.QueryGetStateIndexRequest{ + request: &types.QueryGetLatestStateInfoIndexRequest{ RollappId: msgs[1].RollappId, }, - response: &types.QueryGetStateIndexResponse{StateIndex: msgs[1]}, + response: &types.QueryGetLatestStateInfoIndexResponse{LatestStateInfoIndex: msgs[1]}, }, { desc: "KeyNotFound", - request: &types.QueryGetStateIndexRequest{ + request: &types.QueryGetLatestStateInfoIndexRequest{ RollappId: strconv.Itoa(100000), }, err: status.Error(codes.NotFound, "not found"), @@ -55,7 +55,7 @@ func TestStateIndexQuerySingle(t *testing.T) { }, } { t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.StateIndex(wctx, tc.request) + response, err := keeper.LatestStateInfoIndex(wctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { @@ -69,13 +69,13 @@ func TestStateIndexQuerySingle(t *testing.T) { } } -func TestStateIndexQueryPaginated(t *testing.T) { +func TestLatestStateInfoIndexQueryPaginated(t *testing.T) { keeper, ctx := keepertest.RollappKeeper(t) wctx := sdk.WrapSDKContext(ctx) - msgs := createNStateIndex(keeper, ctx, 5) + msgs := createNLatestStateInfoIndex(keeper, ctx, 5) - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllStateIndexRequest { - return &types.QueryAllStateIndexRequest{ + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllLatestStateInfoIndexRequest { + return &types.QueryAllLatestStateInfoIndexRequest{ Pagination: &query.PageRequest{ Key: next, Offset: offset, @@ -87,12 +87,12 @@ func TestStateIndexQueryPaginated(t *testing.T) { t.Run("ByOffset", func(t *testing.T) { step := 2 for i := 0; i < len(msgs); i += step { - resp, err := keeper.StateIndexAll(wctx, request(nil, uint64(i), uint64(step), false)) + resp, err := keeper.LatestStateInfoIndexAll(wctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) - require.LessOrEqual(t, len(resp.StateIndex), step) + require.LessOrEqual(t, len(resp.LatestStateInfoIndex), step) require.Subset(t, nullify.Fill(msgs), - nullify.Fill(resp.StateIndex), + nullify.Fill(resp.LatestStateInfoIndex), ) } }) @@ -100,27 +100,27 @@ func TestStateIndexQueryPaginated(t *testing.T) { step := 2 var next []byte for i := 0; i < len(msgs); i += step { - resp, err := keeper.StateIndexAll(wctx, request(next, 0, uint64(step), false)) + resp, err := keeper.LatestStateInfoIndexAll(wctx, request(next, 0, uint64(step), false)) require.NoError(t, err) - require.LessOrEqual(t, len(resp.StateIndex), step) + require.LessOrEqual(t, len(resp.LatestStateInfoIndex), step) require.Subset(t, nullify.Fill(msgs), - nullify.Fill(resp.StateIndex), + nullify.Fill(resp.LatestStateInfoIndex), ) next = resp.Pagination.NextKey } }) t.Run("Total", func(t *testing.T) { - resp, err := keeper.StateIndexAll(wctx, request(nil, 0, 0, true)) + resp, err := keeper.LatestStateInfoIndexAll(wctx, request(nil, 0, 0, true)) require.NoError(t, err) require.Equal(t, len(msgs), int(resp.Pagination.Total)) require.ElementsMatch(t, nullify.Fill(msgs), - nullify.Fill(resp.StateIndex), + nullify.Fill(resp.LatestStateInfoIndex), ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.StateIndexAll(wctx, nil) + _, err := keeper.LatestStateInfoIndexAll(wctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/x/rollapp/keeper/grpc_query_state_index.go b/x/rollapp/keeper/grpc_query_state_index.go deleted file mode 100644 index 10b93d04e..000000000 --- a/x/rollapp/keeper/grpc_query_state_index.go +++ /dev/null @@ -1,57 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/dymensionxyz/dymension/x/rollapp/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) StateIndexAll(c context.Context, req *types.QueryAllStateIndexRequest) (*types.QueryAllStateIndexResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var stateIndexs []types.StateIndex - ctx := sdk.UnwrapSDKContext(c) - - store := ctx.KVStore(k.storeKey) - stateIndexStore := prefix.NewStore(store, types.KeyPrefix(types.StateIndexKeyPrefix)) - - pageRes, err := query.Paginate(stateIndexStore, req.Pagination, func(key []byte, value []byte) error { - var stateIndex types.StateIndex - if err := k.cdc.Unmarshal(value, &stateIndex); err != nil { - return err - } - - stateIndexs = append(stateIndexs, stateIndex) - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllStateIndexResponse{StateIndex: stateIndexs, Pagination: pageRes}, nil -} - -func (k Keeper) StateIndex(c context.Context, req *types.QueryGetStateIndexRequest) (*types.QueryGetStateIndexResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - val, found := k.GetStateIndex( - ctx, - req.RollappId, - ) - if !found { - return nil, status.Error(codes.NotFound, "not found") - } - - return &types.QueryGetStateIndexResponse{StateIndex: val}, nil -} diff --git a/x/rollapp/keeper/grpc_query_state_info.go b/x/rollapp/keeper/grpc_query_state_info.go index 46a743df6..29b74b447 100644 --- a/x/rollapp/keeper/grpc_query_state_info.go +++ b/x/rollapp/keeper/grpc_query_state_info.go @@ -48,7 +48,7 @@ func (k Keeper) StateInfo(c context.Context, req *types.QueryGetStateInfoRequest val, found := k.GetStateInfo( ctx, req.RollappId, - req.StateIndex, + req.Index, ) if !found { return nil, status.Error(codes.NotFound, "not found") diff --git a/x/rollapp/keeper/grpc_query_state_info_test.go b/x/rollapp/keeper/grpc_query_state_info_test.go index 45172a3a7..d8fa354dc 100644 --- a/x/rollapp/keeper/grpc_query_state_info_test.go +++ b/x/rollapp/keeper/grpc_query_state_info_test.go @@ -31,32 +31,32 @@ func TestStateInfoQuerySingle(t *testing.T) { { desc: "First", request: &types.QueryGetStateInfoRequest{ - RollappId: msgs[0].RollappId, - StateIndex: msgs[0].StateIndex, + RollappId: msgs[0].StateInfoIndex.RollappId, + Index: msgs[0].StateInfoIndex.Index, }, response: &types.QueryGetStateInfoResponse{StateInfo: msgs[0]}, }, { desc: "Second", request: &types.QueryGetStateInfoRequest{ - RollappId: msgs[1].RollappId, - StateIndex: msgs[1].StateIndex, + RollappId: msgs[1].StateInfoIndex.RollappId, + Index: msgs[1].StateInfoIndex.Index, }, response: &types.QueryGetStateInfoResponse{StateInfo: msgs[1]}, }, { desc: "KeyNotFound", request: &types.QueryGetStateInfoRequest{ - RollappId: strconv.Itoa(100000), - StateIndex: msgs[0].StateIndex, + RollappId: strconv.Itoa(100000), + Index: msgs[0].StateInfoIndex.Index, }, err: status.Error(codes.NotFound, "not found"), }, { desc: "KeyNotFound", request: &types.QueryGetStateInfoRequest{ - RollappId: msgs[1].RollappId, - StateIndex: 100000, + RollappId: msgs[1].StateInfoIndex.RollappId, + Index: 100000, }, err: status.Error(codes.NotFound, "not found"), }, diff --git a/x/rollapp/keeper/keeper_integration_test.go b/x/rollapp/keeper/keeper_integration_test.go index e2dd48d8c..e7683a586 100644 --- a/x/rollapp/keeper/keeper_integration_test.go +++ b/x/rollapp/keeper/keeper_integration_test.go @@ -185,7 +185,7 @@ func (suite *IntegrationTestSuite) TestFirstUpdateState() { suite.app.SequencerKeeper.SetScheduler(suite.ctx, scheduler) // check no index exists - expectedStateIndex, found := suite.app.RollappKeeper.GetStateIndex(suite.ctx, rollapp.GetRollappId()) + expectedLatestStateInfoIndex, found := suite.app.RollappKeeper.GetLatestStateInfoIndex(suite.ctx, rollapp.GetRollappId()) suite.Require().EqualValues(false, found) // update state @@ -203,9 +203,9 @@ func (suite *IntegrationTestSuite) TestFirstUpdateState() { suite.Require().Nil(err) // check first index is 1 - expectedStateIndex, found = suite.app.RollappKeeper.GetStateIndex(suite.ctx, rollapp.GetRollappId()) + expectedLatestStateInfoIndex, found = suite.app.RollappKeeper.GetLatestStateInfoIndex(suite.ctx, rollapp.GetRollappId()) suite.Require().EqualValues(true, found) - suite.Require().EqualValues(expectedStateIndex.Index, 1) + suite.Require().EqualValues(expectedLatestStateInfoIndex.Index, 1) } func (suite *IntegrationTestSuite) TestUpdateState() { @@ -235,14 +235,13 @@ func (suite *IntegrationTestSuite) TestUpdateState() { } suite.app.SequencerKeeper.SetScheduler(suite.ctx, scheduler) - // set initial stateIndex & StateInfo - stateIndex := types.StateIndex{ + // set initial latestStateInfoIndex & StateInfo + latestStateInfoIndex := types.StateInfoIndex{ RollappId: "rollapp1", Index: 1, } stateInfo := types.StateInfo{ - RollappId: "rollapp1", - StateIndex: 1, + StateInfoIndex: types.StateInfoIndex{RollappId: "rollapp1", Index: 1}, Sequencer: sequencer.SequencerAddress, StartHeight: 1, NumBlocks: 3, @@ -252,7 +251,7 @@ func (suite *IntegrationTestSuite) TestUpdateState() { Status: types.STATE_STATUS_RECEIVED, BDs: types.BlockDescriptors{BD: []types.BlockDescriptor{{Height: 1}, {Height: 2}, {Height: 3}}}, } - suite.app.RollappKeeper.SetStateIndex(suite.ctx, stateIndex) + suite.app.RollappKeeper.SetLatestStateInfoIndex(suite.ctx, latestStateInfoIndex) suite.app.RollappKeeper.SetStateInfo(suite.ctx, stateInfo) // test 10 update state @@ -262,12 +261,12 @@ func (suite *IntegrationTestSuite) TestUpdateState() { goCtx = sdk.WrapSDKContext(suite.ctx) // calc new updateState - expectedStateIndex, found := suite.app.RollappKeeper.GetStateIndex(suite.ctx, rollapp.GetRollappId()) + expectedLatestStateInfoIndex, found := suite.app.RollappKeeper.GetLatestStateInfoIndex(suite.ctx, rollapp.GetRollappId()) suite.Require().EqualValues(true, found) // verify index - suite.Require().EqualValues(i+1, expectedStateIndex.Index) + suite.Require().EqualValues(i+1, expectedLatestStateInfoIndex.Index) // load last state info - expectedStateInfo, found := suite.app.RollappKeeper.GetStateInfo(suite.ctx, rollapp.GetRollappId(), expectedStateIndex.GetIndex()) + expectedStateInfo, found := suite.app.RollappKeeper.GetStateInfo(suite.ctx, rollapp.GetRollappId(), expectedLatestStateInfoIndex.GetIndex()) suite.Require().EqualValues(true, found) updateState := types.MsgUpdateState{ Creator: bob, @@ -555,14 +554,13 @@ func (suite *IntegrationTestSuite) TestUpdateStateErrWrongBlockHeight() { } suite.app.SequencerKeeper.SetScheduler(suite.ctx, scheduler) - // set initial stateIndex & StateInfo - stateIndex := types.StateIndex{ + // set initial latestStateInfoIndex & StateInfo + latestStateInfoIndex := types.StateInfoIndex{ RollappId: "rollapp1", Index: 1, } stateInfo := types.StateInfo{ - RollappId: "rollapp1", - StateIndex: 1, + StateInfoIndex: types.StateInfoIndex{RollappId: "rollapp1", Index: 1}, Sequencer: sequencer.SequencerAddress, StartHeight: 1, NumBlocks: 3, @@ -572,7 +570,7 @@ func (suite *IntegrationTestSuite) TestUpdateStateErrWrongBlockHeight() { Status: types.STATE_STATUS_RECEIVED, BDs: types.BlockDescriptors{BD: []types.BlockDescriptor{{Height: 1}, {Height: 2}, {Height: 3}}}, } - suite.app.RollappKeeper.SetStateIndex(suite.ctx, stateIndex) + suite.app.RollappKeeper.SetLatestStateInfoIndex(suite.ctx, latestStateInfoIndex) suite.app.RollappKeeper.SetStateInfo(suite.ctx, stateInfo) // bump block height @@ -618,12 +616,12 @@ func (suite *IntegrationTestSuite) TestUpdateStateErrLogicMissingStateInfo() { } suite.app.SequencerKeeper.SetSequencer(suite.ctx, sequencer) - // set initial stateIndex - stateIndex := types.StateIndex{ + // set initial latestStateInfoIndex + latestStateInfoIndex := types.StateInfoIndex{ RollappId: "rollapp1", Index: 1, } - suite.app.RollappKeeper.SetStateIndex(suite.ctx, stateIndex) + suite.app.RollappKeeper.SetLatestStateInfoIndex(suite.ctx, latestStateInfoIndex) // update state updateState := types.MsgUpdateState{ @@ -670,14 +668,13 @@ func (suite *IntegrationTestSuite) TestUpdateStateErrMultiUpdateStateInBlock() { } suite.app.SequencerKeeper.SetScheduler(suite.ctx, scheduler) - // set initial stateIndex & StateInfo - stateIndex := types.StateIndex{ + // set initial latestStateInfoIndex & StateInfo + latestStateInfoIndex := types.StateInfoIndex{ RollappId: "rollapp1", Index: 1, } stateInfo := types.StateInfo{ - RollappId: "rollapp1", - StateIndex: 1, + StateInfoIndex: types.StateInfoIndex{RollappId: "rollapp1", Index: 1}, Sequencer: sequencer.SequencerAddress, StartHeight: 1, NumBlocks: 3, @@ -687,7 +684,7 @@ func (suite *IntegrationTestSuite) TestUpdateStateErrMultiUpdateStateInBlock() { Status: types.STATE_STATUS_RECEIVED, BDs: types.BlockDescriptors{BD: []types.BlockDescriptor{{Height: 1}, {Height: 2}, {Height: 3}}}, } - suite.app.RollappKeeper.SetStateIndex(suite.ctx, stateIndex) + suite.app.RollappKeeper.SetLatestStateInfoIndex(suite.ctx, latestStateInfoIndex) suite.app.RollappKeeper.SetStateInfo(suite.ctx, stateInfo) // we don't bump block height 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 000000000..8b6e8f04d --- /dev/null +++ b/x/rollapp/keeper/latest_state_info_index.go @@ -0,0 +1,66 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dymensionxyz/dymension/x/rollapp/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 := sdk.KVStorePrefixIterator(store, []byte{}) + + // nolint: errcheck + 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/state_index_test.go b/x/rollapp/keeper/latest_state_info_index_test.go similarity index 57% rename from x/rollapp/keeper/state_index_test.go rename to x/rollapp/keeper/latest_state_info_index_test.go index 779886d37..99f635e7c 100644 --- a/x/rollapp/keeper/state_index_test.go +++ b/x/rollapp/keeper/latest_state_info_index_test.go @@ -15,21 +15,21 @@ import ( // Prevent strconv unused error var _ = strconv.IntSize -func createNStateIndex(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.StateIndex { - items := make([]types.StateIndex, n) +func createNLatestStateInfoIndex(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.StateInfoIndex { + items := make([]types.StateInfoIndex, n) for i := range items { items[i].RollappId = strconv.Itoa(i) - keeper.SetStateIndex(ctx, items[i]) + keeper.SetLatestStateInfoIndex(ctx, items[i]) } return items } -func TestStateIndexGet(t *testing.T) { +func TestLatestStateInfoIndexGet(t *testing.T) { keeper, ctx := keepertest.RollappKeeper(t) - items := createNStateIndex(keeper, ctx, 10) + items := createNLatestStateInfoIndex(keeper, ctx, 10) for _, item := range items { - rst, found := keeper.GetStateIndex(ctx, + rst, found := keeper.GetLatestStateInfoIndex(ctx, item.RollappId, ) require.True(t, found) @@ -39,25 +39,25 @@ func TestStateIndexGet(t *testing.T) { ) } } -func TestStateIndexRemove(t *testing.T) { +func TestLatestStateInfoIndexRemove(t *testing.T) { keeper, ctx := keepertest.RollappKeeper(t) - items := createNStateIndex(keeper, ctx, 10) + items := createNLatestStateInfoIndex(keeper, ctx, 10) for _, item := range items { - keeper.RemoveStateIndex(ctx, + keeper.RemoveLatestStateInfoIndex(ctx, item.RollappId, ) - _, found := keeper.GetStateIndex(ctx, + _, found := keeper.GetLatestStateInfoIndex(ctx, item.RollappId, ) require.False(t, found) } } -func TestStateIndexGetAll(t *testing.T) { +func TestLatestStateInfoIndexGetAll(t *testing.T) { keeper, ctx := keepertest.RollappKeeper(t) - items := createNStateIndex(keeper, ctx, 10) + items := createNLatestStateInfoIndex(keeper, ctx, 10) require.ElementsMatch(t, nullify.Fill(items), - nullify.Fill(keeper.GetAllStateIndex(ctx)), + nullify.Fill(keeper.GetAllLatestStateInfoIndex(ctx)), ) } diff --git a/x/rollapp/keeper/msg_server_update_state.go b/x/rollapp/keeper/msg_server_update_state.go index 142ddee01..29648f1e5 100644 --- a/x/rollapp/keeper/msg_server_update_state.go +++ b/x/rollapp/keeper/msg_server_update_state.go @@ -54,7 +54,7 @@ func (k msgServer) UpdateState(goCtx context.Context, msg *types.MsgUpdateState) } // retrieve last updating index - stateIndex, isFound := k.GetStateIndex(ctx, msg.RollappId) + latestStateInfoIndex, isFound := k.GetLatestStateInfoIndex(ctx, msg.RollappId) var newIndex uint64 if !isFound { // check to see if it's the first update @@ -68,13 +68,13 @@ func (k msgServer) UpdateState(goCtx context.Context, msg *types.MsgUpdateState) newIndex = 1 } else { // retrieve last updating index - stateInfo, isFound := k.GetStateInfo(ctx, msg.RollappId, stateIndex.Index) - // Check Error: if stateIndex exists, there must me an info for this state + stateInfo, isFound := k.GetStateInfo(ctx, msg.RollappId, latestStateInfoIndex.Index) + // Check Error: if latestStateInfoIndex exists, there must me an info for this state if !isFound { // if not, it's a logic error return nil, sdkerrors.Wrapf(sdkerrors.ErrLogic, "missing stateInfo for state-index (%d) of rollappId(%s)", - stateIndex.Index, msg.RollappId) + latestStateInfoIndex.Index, msg.RollappId) } // check to see if we have already got an update for current block @@ -92,19 +92,18 @@ func (k msgServer) UpdateState(goCtx context.Context, msg *types.MsgUpdateState) } // bump state index - newIndex = stateIndex.Index + 1 + newIndex = latestStateInfoIndex.Index + 1 } // Write new index information to the store - k.SetStateIndex(ctx, types.StateIndex{ + k.SetLatestStateInfoIndex(ctx, types.StateInfoIndex{ RollappId: msg.RollappId, Index: newIndex, }) - // Write new state information to the store indexed by + // Write new state information to the store indexed by k.SetStateInfo(ctx, types.StateInfo{ - RollappId: msg.RollappId, - StateIndex: newIndex, + StateInfoIndex: types.StateInfoIndex{RollappId: msg.RollappId, Index: newIndex}, Sequencer: msg.Creator, StartHeight: msg.StartHeight, NumBlocks: msg.NumBlocks, diff --git a/x/rollapp/keeper/state_index.go b/x/rollapp/keeper/state_index.go deleted file mode 100644 index 3e4c15101..000000000 --- a/x/rollapp/keeper/state_index.go +++ /dev/null @@ -1,64 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/dymensionxyz/dymension/x/rollapp/types" -) - -// SetStateIndex set a specific stateIndex in the store from its index -func (k Keeper) SetStateIndex(ctx sdk.Context, stateIndex types.StateIndex) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateIndexKeyPrefix)) - b := k.cdc.MustMarshal(&stateIndex) - store.Set(types.StateIndexKey( - stateIndex.RollappId, - ), b) -} - -// GetStateIndex returns a stateIndex from its index -func (k Keeper) GetStateIndex( - ctx sdk.Context, - rollappId string, - -) (val types.StateIndex, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateIndexKeyPrefix)) - - b := store.Get(types.StateIndexKey( - rollappId, - )) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -// RemoveStateIndex removes a stateIndex from the store -func (k Keeper) RemoveStateIndex( - ctx sdk.Context, - rollappId string, - -) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateIndexKeyPrefix)) - store.Delete(types.StateIndexKey( - rollappId, - )) -} - -// GetAllStateIndex returns all stateIndex -func (k Keeper) GetAllStateIndex(ctx sdk.Context) (list []types.StateIndex) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateIndexKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - // nolint: errcheck - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.StateIndex - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return -} diff --git a/x/rollapp/keeper/state_info.go b/x/rollapp/keeper/state_info.go index ec45d2b64..2b4e1e91d 100644 --- a/x/rollapp/keeper/state_info.go +++ b/x/rollapp/keeper/state_info.go @@ -11,8 +11,7 @@ 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.RollappId, - stateInfo.StateIndex, + stateInfo.StateInfoIndex, ), b) } @@ -20,14 +19,13 @@ func (k Keeper) SetStateInfo(ctx sdk.Context, stateInfo types.StateInfo) { func (k Keeper) GetStateInfo( ctx sdk.Context, rollappId string, - stateIndex uint64, + index uint64, ) (val types.StateInfo, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateInfoKeyPrefix)) b := store.Get(types.StateInfoKey( - rollappId, - stateIndex, + types.StateInfoIndex{RollappId: rollappId, Index: index}, )) if b == nil { return val, false @@ -41,13 +39,12 @@ func (k Keeper) GetStateInfo( func (k Keeper) RemoveStateInfo( ctx sdk.Context, rollappId string, - stateIndex uint64, + index uint64, ) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateInfoKeyPrefix)) store.Delete(types.StateInfoKey( - rollappId, - stateIndex, + types.StateInfoIndex{RollappId: rollappId, Index: index}, )) } diff --git a/x/rollapp/keeper/state_info_test.go b/x/rollapp/keeper/state_info_test.go index 44d100ec2..c5fbd4706 100644 --- a/x/rollapp/keeper/state_info_test.go +++ b/x/rollapp/keeper/state_info_test.go @@ -18,8 +18,8 @@ var _ = strconv.IntSize func createNStateInfo(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.StateInfo { items := make([]types.StateInfo, n) for i := range items { - items[i].RollappId = strconv.Itoa(i) - items[i].StateIndex = uint64(i) + items[i].StateInfoIndex.RollappId = strconv.Itoa(i) + items[i].StateInfoIndex.Index = uint64(i) keeper.SetStateInfo(ctx, items[i]) } @@ -31,8 +31,8 @@ func TestStateInfoGet(t *testing.T) { items := createNStateInfo(keeper, ctx, 10) for _, item := range items { rst, found := keeper.GetStateInfo(ctx, - item.RollappId, - item.StateIndex, + item.StateInfoIndex.RollappId, + item.StateInfoIndex.Index, ) require.True(t, found) require.Equal(t, @@ -46,12 +46,12 @@ func TestStateInfoRemove(t *testing.T) { items := createNStateInfo(keeper, ctx, 10) for _, item := range items { keeper.RemoveStateInfo(ctx, - item.RollappId, - item.StateIndex, + item.StateInfoIndex.RollappId, + item.StateInfoIndex.Index, ) _, found := keeper.GetStateInfo(ctx, - item.RollappId, - item.StateIndex, + item.StateInfoIndex.RollappId, + item.StateInfoIndex.Index, ) require.False(t, found) } diff --git a/x/rollapp/types/genesis.go b/x/rollapp/types/genesis.go index 6f122eef1..d53235eb2 100644 --- a/x/rollapp/types/genesis.go +++ b/x/rollapp/types/genesis.go @@ -10,9 +10,9 @@ const DefaultIndex uint64 = 1 // DefaultGenesis returns the default Capability genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - RollappList: []Rollapp{}, - StateInfoList: []StateInfo{}, - StateIndexList: []StateIndex{}, + RollappList: []Rollapp{}, + StateInfoList: []StateInfo{}, + LatestStateInfoIndexList: []StateInfoIndex{}, // this line is used by starport scaffolding # genesis/types/default Params: DefaultParams(), } @@ -35,21 +35,21 @@ func (gs GenesisState) Validate() error { stateInfoIndexMap := make(map[string]struct{}) for _, elem := range gs.StateInfoList { - index := string(StateInfoKey(elem.RollappId, elem.StateIndex)) + index := string(StateInfoKey(elem.StateInfoIndex)) if _, ok := stateInfoIndexMap[index]; ok { return fmt.Errorf("duplicated index for stateInfo") } stateInfoIndexMap[index] = struct{}{} } - // Check for duplicated index in stateIndex - stateIndexIndexMap := make(map[string]struct{}) + // Check for duplicated index in latestStateInfoIndex + latestStateInfoIndexIndexMap := make(map[string]struct{}) - for _, elem := range gs.StateIndexList { - index := string(StateIndexKey(elem.RollappId)) - if _, ok := stateIndexIndexMap[index]; ok { - return fmt.Errorf("duplicated index for stateIndex") + for _, elem := range gs.LatestStateInfoIndexList { + index := string(LatestStateInfoIndexKey(elem.RollappId)) + if _, ok := latestStateInfoIndexIndexMap[index]; ok { + return fmt.Errorf("duplicated index for latestStateInfoIndex") } - stateIndexIndexMap[index] = struct{}{} + latestStateInfoIndexIndexMap[index] = struct{}{} } // this line is used by starport scaffolding # genesis/types/validate diff --git a/x/rollapp/types/genesis.pb.go b/x/rollapp/types/genesis.pb.go index c0c93c254..277d185e4 100644 --- a/x/rollapp/types/genesis.pb.go +++ b/x/rollapp/types/genesis.pb.go @@ -25,10 +25,10 @@ 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"` - StateIndexList []StateIndex `protobuf:"bytes,4,rep,name=stateIndexList,proto3" json:"stateIndexList"` + 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"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -85,9 +85,9 @@ func (m *GenesisState) GetStateInfoList() []StateInfo { return nil } -func (m *GenesisState) GetStateIndexList() []StateIndex { +func (m *GenesisState) GetLatestStateInfoIndexList() []StateInfoIndex { if m != nil { - return m.StateIndexList + return m.LatestStateInfoIndexList } return nil } @@ -106,19 +106,19 @@ var fileDescriptor_8f8d02f842af9bdf = []byte{ 0x83, 0x73, 0xf4, 0xa0, 0xaa, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x4a, 0xf5, 0x41, 0x2c, 0x88, 0x2e, 0x29, 0x11, 0x98, 0x61, 0x05, 0x89, 0x45, 0x89, 0xb9, 0x50, 0xb3, 0xa4, 0xe0, 0x56, 0x40, 0x69, 0xa8, 0xb0, 0x04, 0x4c, 0xb8, 0xb8, 0x24, 0xb1, 0x24, 0x35, 0x3e, 0x33, 0x2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0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x91, 0xed, 0x44, 0x70, 0xf4, 0x2b, + 0x60, 0xf1, 0xaa, 0x5f, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x8e, 0x44, 0x63, 0x40, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x20, 0x0a, 0xa7, 0x42, 0x5a, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -141,10 +141,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.StateIndexList) > 0 { - for iNdEx := len(m.StateIndexList) - 1; iNdEx >= 0; iNdEx-- { + if len(m.LatestStateInfoIndexList) > 0 { + for iNdEx := len(m.LatestStateInfoIndexList) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.StateIndexList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.LatestStateInfoIndexList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -227,8 +227,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.StateIndexList) > 0 { - for _, e := range m.StateIndexList { + if len(m.LatestStateInfoIndexList) > 0 { + for _, e := range m.LatestStateInfoIndexList { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -374,7 +374,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StateIndexList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LatestStateInfoIndexList", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -401,8 +401,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.StateIndexList = append(m.StateIndexList, StateIndex{}) - if err := m.StateIndexList[len(m.StateIndexList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.LatestStateInfoIndexList = append(m.LatestStateInfoIndexList, StateInfoIndex{}) + if err := m.LatestStateInfoIndexList[len(m.LatestStateInfoIndexList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/rollapp/types/genesis_test.go b/x/rollapp/types/genesis_test.go index 81e154ecd..66cc05c2b 100644 --- a/x/rollapp/types/genesis_test.go +++ b/x/rollapp/types/genesis_test.go @@ -32,15 +32,19 @@ func TestGenesisState_Validate(t *testing.T) { }, StateInfoList: []types.StateInfo{ { - RollappId: "0", - StateIndex: 0, + StateInfoIndex: types.StateInfoIndex{ + RollappId: "0", + Index: 0, + }, }, { - RollappId: "1", - StateIndex: 1, + StateInfoIndex: types.StateInfoIndex{ + RollappId: "1", + Index: 1, + }, }, }, - StateIndexList: []types.StateIndex{ + LatestStateInfoIndexList: []types.StateInfoIndex{ { RollappId: "0", }, @@ -84,21 +88,25 @@ func TestGenesisState_Validate(t *testing.T) { genState: &types.GenesisState{ StateInfoList: []types.StateInfo{ { - RollappId: "0", - StateIndex: 0, + StateInfoIndex: types.StateInfoIndex{ + RollappId: "0", + Index: 0, + }, }, { - RollappId: "0", - StateIndex: 0, + StateInfoIndex: types.StateInfoIndex{ + RollappId: "0", + Index: 0, + }, }, }, }, valid: false, }, { - desc: "duplicated stateIndex", + desc: "duplicated latestStateInfoIndex", genState: &types.GenesisState{ - StateIndexList: []types.StateIndex{ + LatestStateInfoIndexList: []types.StateInfoIndex{ { RollappId: "0", }, 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 000000000..3c6eb3c32 --- /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_state_index.go b/x/rollapp/types/key_state_index.go deleted file mode 100644 index 16786bb19..000000000 --- a/x/rollapp/types/key_state_index.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -import "encoding/binary" - -var _ binary.ByteOrder - -const ( - // StateIndexKeyPrefix is the prefix to retrieve all StateIndex - StateIndexKeyPrefix = "StateIndex/value/" -) - -// StateIndexKey returns the store key to retrieve a StateIndex from the index fields -func StateIndexKey( - 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_state_info.go b/x/rollapp/types/key_state_info.go index 6034b0d7d..41278802e 100644 --- a/x/rollapp/types/key_state_info.go +++ b/x/rollapp/types/key_state_info.go @@ -14,16 +14,15 @@ const ( // StateInfoKey returns the store key to retrieve a StateInfo from the index fields func StateInfoKey( - rollappId string, - stateIndex uint64, + stateInfoIndex StateInfoIndex, ) []byte { var key []byte - rollappIdBytes := []byte(rollappId) + rollappIdBytes := []byte(stateInfoIndex.RollappId) key = append(key, rollappIdBytes...) key = append(key, []byte("/")...) - stateIndexBytes := []byte(fmt.Sprint(stateIndex)) - key = append(key, stateIndexBytes...) + stateInfoIndexBytes := []byte(fmt.Sprint(stateInfoIndex.Index)) + key = append(key, stateInfoIndexBytes...) key = append(key, []byte("/")...) return key diff --git a/x/rollapp/types/query.pb.go b/x/rollapp/types/query.pb.go index bf0913366..e271e7c3c 100644 --- a/x/rollapp/types/query.pb.go +++ b/x/rollapp/types/query.pb.go @@ -298,8 +298,8 @@ func (m *QueryAllRollappResponse) GetPagination() *query.PageResponse { } type QueryGetStateInfoRequest struct { - RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` - StateIndex uint64 `protobuf:"varint,2,opt,name=stateIndex,proto3" json:"stateIndex,omitempty"` + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` } func (m *QueryGetStateInfoRequest) Reset() { *m = QueryGetStateInfoRequest{} } @@ -342,9 +342,9 @@ func (m *QueryGetStateInfoRequest) GetRollappId() string { return "" } -func (m *QueryGetStateInfoRequest) GetStateIndex() uint64 { +func (m *QueryGetStateInfoRequest) GetIndex() uint64 { if m != nil { - return m.StateIndex + return m.Index } return 0 } @@ -489,22 +489,22 @@ func (m *QueryAllStateInfoResponse) GetPagination() *query.PageResponse { return nil } -type QueryGetStateIndexRequest struct { +type QueryGetLatestStateInfoIndexRequest struct { RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` } -func (m *QueryGetStateIndexRequest) Reset() { *m = QueryGetStateIndexRequest{} } -func (m *QueryGetStateIndexRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetStateIndexRequest) ProtoMessage() {} -func (*QueryGetStateIndexRequest) Descriptor() ([]byte, []int) { +func (m *QueryGetLatestStateInfoIndexRequest) Reset() { *m = QueryGetLatestStateInfoIndexRequest{} } +func (m *QueryGetLatestStateInfoIndexRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestStateInfoIndexRequest) ProtoMessage() {} +func (*QueryGetLatestStateInfoIndexRequest) Descriptor() ([]byte, []int) { return fileDescriptor_b2fc533dd2941a55, []int{10} } -func (m *QueryGetStateIndexRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryGetLatestStateInfoIndexRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetStateIndexRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetLatestStateInfoIndexRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetStateIndexRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetLatestStateInfoIndexRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -514,41 +514,41 @@ func (m *QueryGetStateIndexRequest) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *QueryGetStateIndexRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetStateIndexRequest.Merge(m, src) +func (m *QueryGetLatestStateInfoIndexRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestStateInfoIndexRequest.Merge(m, src) } -func (m *QueryGetStateIndexRequest) XXX_Size() int { +func (m *QueryGetLatestStateInfoIndexRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetStateIndexRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetStateIndexRequest.DiscardUnknown(m) +func (m *QueryGetLatestStateInfoIndexRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestStateInfoIndexRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetStateIndexRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryGetLatestStateInfoIndexRequest proto.InternalMessageInfo -func (m *QueryGetStateIndexRequest) GetRollappId() string { +func (m *QueryGetLatestStateInfoIndexRequest) GetRollappId() string { if m != nil { return m.RollappId } return "" } -type QueryGetStateIndexResponse struct { - StateIndex StateIndex `protobuf:"bytes,1,opt,name=stateIndex,proto3" json:"stateIndex"` +type QueryGetLatestStateInfoIndexResponse struct { + LatestStateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=latestStateInfoIndex,proto3" json:"latestStateInfoIndex"` } -func (m *QueryGetStateIndexResponse) Reset() { *m = QueryGetStateIndexResponse{} } -func (m *QueryGetStateIndexResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetStateIndexResponse) ProtoMessage() {} -func (*QueryGetStateIndexResponse) Descriptor() ([]byte, []int) { +func (m *QueryGetLatestStateInfoIndexResponse) Reset() { *m = QueryGetLatestStateInfoIndexResponse{} } +func (m *QueryGetLatestStateInfoIndexResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestStateInfoIndexResponse) ProtoMessage() {} +func (*QueryGetLatestStateInfoIndexResponse) Descriptor() ([]byte, []int) { return fileDescriptor_b2fc533dd2941a55, []int{11} } -func (m *QueryGetStateIndexResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetLatestStateInfoIndexResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetStateIndexResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetLatestStateInfoIndexResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetStateIndexResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetLatestStateInfoIndexResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -558,41 +558,41 @@ func (m *QueryGetStateIndexResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryGetStateIndexResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetStateIndexResponse.Merge(m, src) +func (m *QueryGetLatestStateInfoIndexResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestStateInfoIndexResponse.Merge(m, src) } -func (m *QueryGetStateIndexResponse) XXX_Size() int { +func (m *QueryGetLatestStateInfoIndexResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetStateIndexResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetStateIndexResponse.DiscardUnknown(m) +func (m *QueryGetLatestStateInfoIndexResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestStateInfoIndexResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetStateIndexResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryGetLatestStateInfoIndexResponse proto.InternalMessageInfo -func (m *QueryGetStateIndexResponse) GetStateIndex() StateIndex { +func (m *QueryGetLatestStateInfoIndexResponse) GetLatestStateInfoIndex() StateInfoIndex { if m != nil { - return m.StateIndex + return m.LatestStateInfoIndex } - return StateIndex{} + return StateInfoIndex{} } -type QueryAllStateIndexRequest struct { +type QueryAllLatestStateInfoIndexRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryAllStateIndexRequest) Reset() { *m = QueryAllStateIndexRequest{} } -func (m *QueryAllStateIndexRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllStateIndexRequest) ProtoMessage() {} -func (*QueryAllStateIndexRequest) Descriptor() ([]byte, []int) { +func (m *QueryAllLatestStateInfoIndexRequest) Reset() { *m = QueryAllLatestStateInfoIndexRequest{} } +func (m *QueryAllLatestStateInfoIndexRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllLatestStateInfoIndexRequest) ProtoMessage() {} +func (*QueryAllLatestStateInfoIndexRequest) Descriptor() ([]byte, []int) { return fileDescriptor_b2fc533dd2941a55, []int{12} } -func (m *QueryAllStateIndexRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllLatestStateInfoIndexRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllStateIndexRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllLatestStateInfoIndexRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllStateIndexRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllLatestStateInfoIndexRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -602,42 +602,42 @@ func (m *QueryAllStateIndexRequest) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *QueryAllStateIndexRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllStateIndexRequest.Merge(m, src) +func (m *QueryAllLatestStateInfoIndexRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllLatestStateInfoIndexRequest.Merge(m, src) } -func (m *QueryAllStateIndexRequest) XXX_Size() int { +func (m *QueryAllLatestStateInfoIndexRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllStateIndexRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllStateIndexRequest.DiscardUnknown(m) +func (m *QueryAllLatestStateInfoIndexRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllLatestStateInfoIndexRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllStateIndexRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllLatestStateInfoIndexRequest proto.InternalMessageInfo -func (m *QueryAllStateIndexRequest) GetPagination() *query.PageRequest { +func (m *QueryAllLatestStateInfoIndexRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -type QueryAllStateIndexResponse struct { - StateIndex []StateIndex `protobuf:"bytes,1,rep,name=stateIndex,proto3" json:"stateIndex"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +type QueryAllLatestStateInfoIndexResponse struct { + LatestStateInfoIndex []StateInfoIndex `protobuf:"bytes,1,rep,name=latestStateInfoIndex,proto3" json:"latestStateInfoIndex"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryAllStateIndexResponse) Reset() { *m = QueryAllStateIndexResponse{} } -func (m *QueryAllStateIndexResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllStateIndexResponse) ProtoMessage() {} -func (*QueryAllStateIndexResponse) Descriptor() ([]byte, []int) { +func (m *QueryAllLatestStateInfoIndexResponse) Reset() { *m = QueryAllLatestStateInfoIndexResponse{} } +func (m *QueryAllLatestStateInfoIndexResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllLatestStateInfoIndexResponse) ProtoMessage() {} +func (*QueryAllLatestStateInfoIndexResponse) Descriptor() ([]byte, []int) { return fileDescriptor_b2fc533dd2941a55, []int{13} } -func (m *QueryAllStateIndexResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllLatestStateInfoIndexResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllStateIndexResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllLatestStateInfoIndexResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllStateIndexResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllLatestStateInfoIndexResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -647,26 +647,26 @@ func (m *QueryAllStateIndexResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryAllStateIndexResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllStateIndexResponse.Merge(m, src) +func (m *QueryAllLatestStateInfoIndexResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllLatestStateInfoIndexResponse.Merge(m, src) } -func (m *QueryAllStateIndexResponse) XXX_Size() int { +func (m *QueryAllLatestStateInfoIndexResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllStateIndexResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllStateIndexResponse.DiscardUnknown(m) +func (m *QueryAllLatestStateInfoIndexResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllLatestStateInfoIndexResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllStateIndexResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllLatestStateInfoIndexResponse proto.InternalMessageInfo -func (m *QueryAllStateIndexResponse) GetStateIndex() []StateIndex { +func (m *QueryAllLatestStateInfoIndexResponse) GetLatestStateInfoIndex() []StateInfoIndex { if m != nil { - return m.StateIndex + return m.LatestStateInfoIndex } return nil } -func (m *QueryAllStateIndexResponse) GetPagination() *query.PageResponse { +func (m *QueryAllLatestStateInfoIndexResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } @@ -684,65 +684,66 @@ func init() { proto.RegisterType((*QueryGetStateInfoResponse)(nil), "dymensionxyz.dymension.rollapp.QueryGetStateInfoResponse") proto.RegisterType((*QueryAllStateInfoRequest)(nil), "dymensionxyz.dymension.rollapp.QueryAllStateInfoRequest") proto.RegisterType((*QueryAllStateInfoResponse)(nil), "dymensionxyz.dymension.rollapp.QueryAllStateInfoResponse") - proto.RegisterType((*QueryGetStateIndexRequest)(nil), "dymensionxyz.dymension.rollapp.QueryGetStateIndexRequest") - proto.RegisterType((*QueryGetStateIndexResponse)(nil), "dymensionxyz.dymension.rollapp.QueryGetStateIndexResponse") - proto.RegisterType((*QueryAllStateIndexRequest)(nil), "dymensionxyz.dymension.rollapp.QueryAllStateIndexRequest") - proto.RegisterType((*QueryAllStateIndexResponse)(nil), "dymensionxyz.dymension.rollapp.QueryAllStateIndexResponse") + proto.RegisterType((*QueryGetLatestStateInfoIndexRequest)(nil), "dymensionxyz.dymension.rollapp.QueryGetLatestStateInfoIndexRequest") + proto.RegisterType((*QueryGetLatestStateInfoIndexResponse)(nil), "dymensionxyz.dymension.rollapp.QueryGetLatestStateInfoIndexResponse") + proto.RegisterType((*QueryAllLatestStateInfoIndexRequest)(nil), "dymensionxyz.dymension.rollapp.QueryAllLatestStateInfoIndexRequest") + proto.RegisterType((*QueryAllLatestStateInfoIndexResponse)(nil), "dymensionxyz.dymension.rollapp.QueryAllLatestStateInfoIndexResponse") } func init() { proto.RegisterFile("rollapp/query.proto", fileDescriptor_b2fc533dd2941a55) } var fileDescriptor_b2fc533dd2941a55 = []byte{ - // 772 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x3d, 0x6f,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5, 0xd3, 0x02, 0xfa, 0x51, 0x48, 0xaf, 0xe9, 0x50, - 0xb7, 0x3a, 0xcc, 0xff, 0x44, 0x97, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x2d, 0x5b, 0xd7, - 0x3d, 0x0c, 0x00, 0x00, + // 788 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x6e, 0xd3, 0x4a, + 0x14, 0xce, 0xf4, 0x57, 0x39, 0xf7, 0xae, 0xa6, 0xb9, 0xb7, 0x25, 0xaa, 0x0c, 0x32, 0xa8, 0x7f, + 0x42, 0xb6, 0x9a, 0x8a, 0xfe, 0x08, 0x09, 0x48, 0x53, 0x5a, 0x55, 0x05, 0x54, 0xc2, 0x0e, 0x16, + 0xc5, 0x69, 0xa7, 0xae, 0x91, 0xe3, 0x71, 0x63, 0x17, 0x35, 0x54, 0xdd, 0xf0, 0x04, 0x95, 0x78, + 0x02, 0xd6, 0x48, 0x6c, 0x58, 0xf0, 0x0a, 0x5d, 0x56, 0x62, 0x03, 0x1b, 0x84, 0x5a, 0xd8, 0xb2, + 0xe2, 0x01, 0x90, 0xc7, 0xc7, 0x76, 0xd2, 0xb8, 0xb1, 0x9b, 0x66, 0x95, 0x78, 0x3c, 0xe7, 0x3b, + 0xdf, 0xf7, 0x9d, 0x99, 0x73, 0x0c, 0x43, 0x35, 0x6e, 0x9a, 0x9a, 0x6d, 0xab, 0xbb, 0x7b, 0xac, + 0x56, 0x57, 0xec, 0x1a, 0x77, 0x39, 0x95, 0xb6, 0xea, 0x55, 0x66, 0x39, 0x06, 0xb7, 0xf6, 0xeb, + 0x6f, 0x94, 0xf0, 0x41, 0xc1, 0xbd, 0xf9, 0x9c, 0xce, 0x75, 0x2e, 0xb6, 0xaa, 0xde, 0x3f, 0x3f, + 0x2a, 0x3f, 0xaa, 0x73, 0xae, 0x9b, 0x4c, 0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, 0xbc, 0x0d, 0x51, 0x9f, 0xa6, 0x6b, 0xf2, 0x8b, 0xc0, + 0x70, 0x5c, 0x36, 0xaf, 0x6a, 0xa5, 0xb4, 0xde, 0x5f, 0x5d, 0x73, 0x42, 0xa3, 0x97, 0xef, 0x0b, + 0xcd, 0x0b, 0x74, 0xae, 0x43, 0xcd, 0x8b, 0x6b, 0xc7, 0xa7, 0x12, 0x39, 0x39, 0x95, 0xc8, 0x8f, + 0x53, 0x89, 0x1c, 0x9d, 0x49, 0x99, 0x93, 0x33, 0x29, 0xf3, 0xf5, 0x4c, 0xca, 0x3c, 0x9f, 0xd6, + 0x0d, 0x77, 0x67, 0xaf, 0xa2, 0x6c, 0xf2, 0xea, 0x45, 0xe0, 0xfb, 0x21, 0xbc, 0x5b, 0xb7, 0x99, + 0x53, 0x19, 0x10, 0x9f, 0xf8, 0x33, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x93, 0xce, 0x17, + 0xc0, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -767,10 +768,10 @@ type QueryClient interface { StateInfo(ctx context.Context, in *QueryGetStateInfoRequest, opts ...grpc.CallOption) (*QueryGetStateInfoResponse, error) // Queries a list of StateInfo items. StateInfoAll(ctx context.Context, in *QueryAllStateInfoRequest, opts ...grpc.CallOption) (*QueryAllStateInfoResponse, error) - // Queries a StateIndex by index. - StateIndex(ctx context.Context, in *QueryGetStateIndexRequest, opts ...grpc.CallOption) (*QueryGetStateIndexResponse, error) - // Queries a list of StateIndex items. - StateIndexAll(ctx context.Context, in *QueryAllStateIndexRequest, opts ...grpc.CallOption) (*QueryAllStateIndexResponse, error) + // Queries a LatestStateInfoIndex by index. + LatestStateInfoIndex(ctx context.Context, in *QueryGetLatestStateInfoIndexRequest, opts ...grpc.CallOption) (*QueryGetLatestStateInfoIndexResponse, error) + // Queries a list of LatestStateInfoIndex items. + LatestStateInfoIndexAll(ctx context.Context, in *QueryAllLatestStateInfoIndexRequest, opts ...grpc.CallOption) (*QueryAllLatestStateInfoIndexResponse, error) } type queryClient struct { @@ -826,18 +827,18 @@ func (c *queryClient) StateInfoAll(ctx context.Context, in *QueryAllStateInfoReq return out, nil } -func (c *queryClient) StateIndex(ctx context.Context, in *QueryGetStateIndexRequest, opts ...grpc.CallOption) (*QueryGetStateIndexResponse, error) { - out := new(QueryGetStateIndexResponse) - err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Query/StateIndex", in, out, opts...) +func (c *queryClient) LatestStateInfoIndex(ctx context.Context, in *QueryGetLatestStateInfoIndexRequest, opts ...grpc.CallOption) (*QueryGetLatestStateInfoIndexResponse, error) { + out := new(QueryGetLatestStateInfoIndexResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Query/LatestStateInfoIndex", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) StateIndexAll(ctx context.Context, in *QueryAllStateIndexRequest, opts ...grpc.CallOption) (*QueryAllStateIndexResponse, error) { - out := new(QueryAllStateIndexResponse) - err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Query/StateIndexAll", in, out, opts...) +func (c *queryClient) LatestStateInfoIndexAll(ctx context.Context, in *QueryAllLatestStateInfoIndexRequest, opts ...grpc.CallOption) (*QueryAllLatestStateInfoIndexResponse, error) { + out := new(QueryAllLatestStateInfoIndexResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.rollapp.Query/LatestStateInfoIndexAll", in, out, opts...) if err != nil { return nil, err } @@ -856,10 +857,10 @@ type QueryServer interface { StateInfo(context.Context, *QueryGetStateInfoRequest) (*QueryGetStateInfoResponse, error) // Queries a list of StateInfo items. StateInfoAll(context.Context, *QueryAllStateInfoRequest) (*QueryAllStateInfoResponse, error) - // Queries a StateIndex by index. - StateIndex(context.Context, *QueryGetStateIndexRequest) (*QueryGetStateIndexResponse, error) - // Queries a list of StateIndex items. - StateIndexAll(context.Context, *QueryAllStateIndexRequest) (*QueryAllStateIndexResponse, error) + // Queries a LatestStateInfoIndex by index. + LatestStateInfoIndex(context.Context, *QueryGetLatestStateInfoIndexRequest) (*QueryGetLatestStateInfoIndexResponse, error) + // Queries a list of LatestStateInfoIndex items. + LatestStateInfoIndexAll(context.Context, *QueryAllLatestStateInfoIndexRequest) (*QueryAllLatestStateInfoIndexResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -881,11 +882,11 @@ func (*UnimplementedQueryServer) StateInfo(ctx context.Context, req *QueryGetSta func (*UnimplementedQueryServer) StateInfoAll(ctx context.Context, req *QueryAllStateInfoRequest) (*QueryAllStateInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StateInfoAll not implemented") } -func (*UnimplementedQueryServer) StateIndex(ctx context.Context, req *QueryGetStateIndexRequest) (*QueryGetStateIndexResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method StateIndex not implemented") +func (*UnimplementedQueryServer) LatestStateInfoIndex(ctx context.Context, req *QueryGetLatestStateInfoIndexRequest) (*QueryGetLatestStateInfoIndexResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LatestStateInfoIndex not implemented") } -func (*UnimplementedQueryServer) StateIndexAll(ctx context.Context, req *QueryAllStateIndexRequest) (*QueryAllStateIndexResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method StateIndexAll not implemented") +func (*UnimplementedQueryServer) LatestStateInfoIndexAll(ctx context.Context, req *QueryAllLatestStateInfoIndexRequest) (*QueryAllLatestStateInfoIndexResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LatestStateInfoIndexAll not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { @@ -982,38 +983,38 @@ func _Query_StateInfoAll_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _Query_StateIndex_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetStateIndexRequest) +func _Query_LatestStateInfoIndex_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetLatestStateInfoIndexRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).StateIndex(ctx, in) + return srv.(QueryServer).LatestStateInfoIndex(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/dymensionxyz.dymension.rollapp.Query/StateIndex", + FullMethod: "/dymensionxyz.dymension.rollapp.Query/LatestStateInfoIndex", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).StateIndex(ctx, req.(*QueryGetStateIndexRequest)) + return srv.(QueryServer).LatestStateInfoIndex(ctx, req.(*QueryGetLatestStateInfoIndexRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_StateIndexAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllStateIndexRequest) +func _Query_LatestStateInfoIndexAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllLatestStateInfoIndexRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).StateIndexAll(ctx, in) + return srv.(QueryServer).LatestStateInfoIndexAll(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/dymensionxyz.dymension.rollapp.Query/StateIndexAll", + FullMethod: "/dymensionxyz.dymension.rollapp.Query/LatestStateInfoIndexAll", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).StateIndexAll(ctx, req.(*QueryAllStateIndexRequest)) + return srv.(QueryServer).LatestStateInfoIndexAll(ctx, req.(*QueryAllLatestStateInfoIndexRequest)) } return interceptor(ctx, in, info, handler) } @@ -1043,12 +1044,12 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_StateInfoAll_Handler, }, { - MethodName: "StateIndex", - Handler: _Query_StateIndex_Handler, + MethodName: "LatestStateInfoIndex", + Handler: _Query_LatestStateInfoIndex_Handler, }, { - MethodName: "StateIndexAll", - Handler: _Query_StateIndexAll_Handler, + MethodName: "LatestStateInfoIndexAll", + Handler: _Query_LatestStateInfoIndexAll_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -1278,8 +1279,8 @@ func (m *QueryGetStateInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if m.StateIndex != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.StateIndex)) + if m.Index != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Index)) i-- dAtA[i] = 0x10 } @@ -1410,7 +1411,7 @@ func (m *QueryAllStateInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *QueryGetStateIndexRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryGetLatestStateInfoIndexRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1420,12 +1421,12 @@ func (m *QueryGetStateIndexRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetStateIndexRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetLatestStateInfoIndexRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetStateIndexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetLatestStateInfoIndexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1440,7 +1441,7 @@ func (m *QueryGetStateIndexRequest) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *QueryGetStateIndexResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryGetLatestStateInfoIndexResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1450,18 +1451,18 @@ func (m *QueryGetStateIndexResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetStateIndexResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetLatestStateInfoIndexResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetStateIndexResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetLatestStateInfoIndexResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.StateIndex.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.LatestStateInfoIndex.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1473,7 +1474,7 @@ func (m *QueryGetStateIndexResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func (m *QueryAllStateIndexRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllLatestStateInfoIndexRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1483,12 +1484,12 @@ func (m *QueryAllStateIndexRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllStateIndexRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllLatestStateInfoIndexRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllStateIndexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllLatestStateInfoIndexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1508,7 +1509,7 @@ func (m *QueryAllStateIndexRequest) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *QueryAllStateIndexResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllLatestStateInfoIndexResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1518,12 +1519,12 @@ func (m *QueryAllStateIndexResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllStateIndexResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllLatestStateInfoIndexResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllStateIndexResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllLatestStateInfoIndexResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1540,10 +1541,10 @@ func (m *QueryAllStateIndexResponse) MarshalToSizedBuffer(dAtA []byte) (int, err i-- dAtA[i] = 0x12 } - if len(m.StateIndex) > 0 { - for iNdEx := len(m.StateIndex) - 1; iNdEx >= 0; iNdEx-- { + if len(m.LatestStateInfoIndex) > 0 { + for iNdEx := len(m.LatestStateInfoIndex) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.StateIndex[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.LatestStateInfoIndex[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1654,8 +1655,8 @@ func (m *QueryGetStateInfoRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - if m.StateIndex != 0 { - n += 1 + sovQuery(uint64(m.StateIndex)) + if m.Index != 0 { + n += 1 + sovQuery(uint64(m.Index)) } return n } @@ -1703,7 +1704,7 @@ func (m *QueryAllStateInfoResponse) Size() (n int) { return n } -func (m *QueryGetStateIndexRequest) Size() (n int) { +func (m *QueryGetLatestStateInfoIndexRequest) Size() (n int) { if m == nil { return 0 } @@ -1716,18 +1717,18 @@ func (m *QueryGetStateIndexRequest) Size() (n int) { return n } -func (m *QueryGetStateIndexResponse) Size() (n int) { +func (m *QueryGetLatestStateInfoIndexResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.StateIndex.Size() + l = m.LatestStateInfoIndex.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryAllStateIndexRequest) Size() (n int) { +func (m *QueryAllLatestStateInfoIndexRequest) Size() (n int) { if m == nil { return 0 } @@ -1740,14 +1741,14 @@ func (m *QueryAllStateIndexRequest) Size() (n int) { return n } -func (m *QueryAllStateIndexResponse) Size() (n int) { +func (m *QueryAllLatestStateInfoIndexResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.StateIndex) > 0 { - for _, e := range m.StateIndex { + if len(m.LatestStateInfoIndex) > 0 { + for _, e := range m.LatestStateInfoIndex { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -2332,9 +2333,9 @@ func (m *QueryGetStateInfoRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StateIndex", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) } - m.StateIndex = 0 + m.Index = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2344,7 +2345,7 @@ func (m *QueryGetStateInfoRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.StateIndex |= uint64(b&0x7F) << shift + m.Index |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2659,7 +2660,7 @@ func (m *QueryAllStateInfoResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetStateIndexRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetLatestStateInfoIndexRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2682,10 +2683,10 @@ func (m *QueryGetStateIndexRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetStateIndexRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetLatestStateInfoIndexRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetStateIndexRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetLatestStateInfoIndexRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2741,7 +2742,7 @@ func (m *QueryGetStateIndexRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetStateIndexResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetLatestStateInfoIndexResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2764,15 +2765,15 @@ func (m *QueryGetStateIndexResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetStateIndexResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetLatestStateInfoIndexResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetStateIndexResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetLatestStateInfoIndexResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field LatestStateInfoIndex", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2799,7 +2800,7 @@ func (m *QueryGetStateIndexResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.StateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.LatestStateInfoIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2824,7 +2825,7 @@ func (m *QueryGetStateIndexResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllStateIndexRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllLatestStateInfoIndexRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2847,10 +2848,10 @@ func (m *QueryAllStateIndexRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllStateIndexRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllLatestStateInfoIndexRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllStateIndexRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllLatestStateInfoIndexRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2910,7 +2911,7 @@ func (m *QueryAllStateIndexRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllStateIndexResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllLatestStateInfoIndexResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2933,15 +2934,15 @@ func (m *QueryAllStateIndexResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllStateIndexResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllLatestStateInfoIndexResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllStateIndexResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllLatestStateInfoIndexResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field LatestStateInfoIndex", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2968,8 +2969,8 @@ func (m *QueryAllStateIndexResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.StateIndex = append(m.StateIndex, StateIndex{}) - if err := m.StateIndex[len(m.StateIndex)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.LatestStateInfoIndex = append(m.LatestStateInfoIndex, StateInfoIndex{}) + if err := m.LatestStateInfoIndex[len(m.LatestStateInfoIndex)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/rollapp/types/query.pb.gw.go b/x/rollapp/types/query.pb.gw.go index 9eecc2500..a8fa445ac 100644 --- a/x/rollapp/types/query.pb.gw.go +++ b/x/rollapp/types/query.pb.gw.go @@ -163,15 +163,15 @@ func request_Query_StateInfo_0(ctx context.Context, marshaler runtime.Marshaler, return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) } - val, ok = pathParams["stateIndex"] + val, ok = pathParams["index"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "stateIndex") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") } - protoReq.StateIndex, err = runtime.Uint64(val) + protoReq.Index, err = runtime.Uint64(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "stateIndex", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) } msg, err := client.StateInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -201,15 +201,15 @@ func local_request_Query_StateInfo_0(ctx context.Context, marshaler runtime.Mars return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) } - val, ok = pathParams["stateIndex"] + val, ok = pathParams["index"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "stateIndex") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") } - protoReq.StateIndex, err = runtime.Uint64(val) + protoReq.Index, err = runtime.Uint64(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "stateIndex", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) } msg, err := server.StateInfo(ctx, &protoReq) @@ -253,8 +253,8 @@ func local_request_Query_StateInfoAll_0(ctx context.Context, marshaler runtime.M } -func request_Query_StateIndex_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetStateIndexRequest +func request_Query_LatestStateInfoIndex_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestStateInfoIndexRequest var metadata runtime.ServerMetadata var ( @@ -275,13 +275,13 @@ func request_Query_StateIndex_0(ctx context.Context, marshaler runtime.Marshaler return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) } - msg, err := client.StateIndex(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.LatestStateInfoIndex(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_StateIndex_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetStateIndexRequest +func local_request_Query_LatestStateInfoIndex_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestStateInfoIndexRequest var metadata runtime.ServerMetadata var ( @@ -302,43 +302,43 @@ func local_request_Query_StateIndex_0(ctx context.Context, marshaler runtime.Mar return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) } - msg, err := server.StateIndex(ctx, &protoReq) + msg, err := server.LatestStateInfoIndex(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_StateIndexAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_LatestStateInfoIndexAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_StateIndexAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllStateIndexRequest +func request_Query_LatestStateInfoIndexAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllLatestStateInfoIndexRequest 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_StateIndexAll_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestStateInfoIndexAll_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.StateIndexAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.LatestStateInfoIndexAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_StateIndexAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllStateIndexRequest +func local_request_Query_LatestStateInfoIndexAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllLatestStateInfoIndexRequest 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_StateIndexAll_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestStateInfoIndexAll_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.StateIndexAll(ctx, &protoReq) + msg, err := server.LatestStateInfoIndexAll(ctx, &protoReq) return msg, metadata, err } @@ -464,7 +464,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_StateIndex_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_LatestStateInfoIndex_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -475,7 +475,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_StateIndex_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_LatestStateInfoIndex_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 { @@ -483,11 +483,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_StateIndex_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_LatestStateInfoIndex_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_StateIndexAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_LatestStateInfoIndexAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -498,7 +498,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_StateIndexAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_LatestStateInfoIndexAll_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 { @@ -506,7 +506,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_StateIndexAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_LatestStateInfoIndexAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -651,7 +651,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_StateIndex_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_LatestStateInfoIndex_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) @@ -660,18 +660,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_StateIndex_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_LatestStateInfoIndex_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_StateIndex_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_LatestStateInfoIndex_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_StateIndexAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_LatestStateInfoIndexAll_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) @@ -680,14 +680,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_StateIndexAll_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_LatestStateInfoIndexAll_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_StateIndexAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_LatestStateInfoIndexAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -701,13 +701,13 @@ var ( pattern_Query_RollappAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 2}, []string{"dymensionxyz", "dymension", "rollapp"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_StateInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"dymensionxyz", "dymension", "rollapp", "state_info", "rollappId", "stateIndex"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_StateInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"dymensionxyz", "dymension", "rollapp", "state_info", "rollappId", "index"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_StateInfoAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dymensionxyz", "dymension", "rollapp", "state_info"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_StateIndex_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"dymensionxyz", "dymension", "rollapp", "state_index", "rollappId"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_LatestStateInfoIndex_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"dymensionxyz", "dymension", "rollapp", "latest_state_info_index", "rollappId"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_StateIndexAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dymensionxyz", "dymension", "rollapp", "state_index"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_LatestStateInfoIndexAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dymensionxyz", "dymension", "rollapp", "latest_state_info_index"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -721,7 +721,7 @@ var ( forward_Query_StateInfoAll_0 = runtime.ForwardResponseMessage - forward_Query_StateIndex_0 = runtime.ForwardResponseMessage + forward_Query_LatestStateInfoIndex_0 = runtime.ForwardResponseMessage - forward_Query_StateIndexAll_0 = runtime.ForwardResponseMessage + forward_Query_LatestStateInfoIndexAll_0 = runtime.ForwardResponseMessage ) diff --git a/x/rollapp/types/state_index.pb.go b/x/rollapp/types/state_index.pb.go deleted file mode 100644 index 88b55d651..000000000 --- a/x/rollapp/types/state_index.pb.go +++ /dev/null @@ -1,358 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: rollapp/state_index.proto - -package types - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// StateIndex defines a rollapps' the current (latest) -// index of the last UpdateState -// the index also saved with every UpdateState in StateInfo. -// the pair is used for retrieving a StateInfo -type StateIndex struct { - // rollappId is the rollapp that we save the index for - // 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 sequentially increasing number - // the index increases on every state update - Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` -} - -func (m *StateIndex) Reset() { *m = StateIndex{} } -func (m *StateIndex) String() string { return proto.CompactTextString(m) } -func (*StateIndex) ProtoMessage() {} -func (*StateIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_ed407355e585fc57, []int{0} -} -func (m *StateIndex) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StateIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StateIndex.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 *StateIndex) XXX_Merge(src proto.Message) { - xxx_messageInfo_StateIndex.Merge(m, src) -} -func (m *StateIndex) XXX_Size() int { - return m.Size() -} -func (m *StateIndex) XXX_DiscardUnknown() { - xxx_messageInfo_StateIndex.DiscardUnknown(m) -} - -var xxx_messageInfo_StateIndex proto.InternalMessageInfo - -func (m *StateIndex) GetRollappId() string { - if m != nil { - return m.RollappId - } - return "" -} - -func (m *StateIndex) GetIndex() uint64 { - if m != nil { - return m.Index - } - return 0 -} - -func init() { - proto.RegisterType((*StateIndex)(nil), "dymensionxyz.dymension.rollapp.StateIndex") -} - -func init() { proto.RegisterFile("rollapp/state_index.proto", fileDescriptor_ed407355e585fc57) } - -var fileDescriptor_ed407355e585fc57 = []byte{ - // 173 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2c, 0xca, 0xcf, 0xc9, - 0x49, 0x2c, 0x28, 0xd0, 0x2f, 0x2e, 0x49, 0x2c, 0x49, 0x8d, 0xcf, 0xcc, 0x4b, 0x49, 0xad, 0xd0, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4b, 0xa9, 0xcc, 0x4d, 0xcd, 0x2b, 0xce, 0xcc, 0xcf, - 0xab, 0xa8, 0xac, 0xd2, 0x83, 0x73, 0xf4, 0xa0, 0x3a, 0x94, 0x1c, 0xb8, 0xb8, 0x82, 0x41, 0x9a, - 0x3c, 0x41, 0x7a, 0x84, 0x64, 0xb8, 0x38, 0xa1, 0x12, 0x9e, 0x29, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, - 0x9c, 0x41, 0x08, 0x01, 0x21, 0x11, 0x2e, 0x56, 0xb0, 0xd1, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x2c, - 0x41, 0x10, 0x8e, 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, 0x23, 0x3b, 0x03, 0xc1, 0xd1, - 0xaf, 0xd0, 0x87, 0x39, 0xbd, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x6a, 0x63, 0x40, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x33, 0x7e, 0x0f, 0x26, 0xd2, 0x00, 0x00, 0x00, -} - -func (m *StateIndex) 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 *StateIndex) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StateIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Index != 0 { - i = encodeVarintStateIndex(dAtA, i, uint64(m.Index)) - i-- - dAtA[i] = 0x10 - } - if len(m.RollappId) > 0 { - i -= len(m.RollappId) - copy(dAtA[i:], m.RollappId) - i = encodeVarintStateIndex(dAtA, i, uint64(len(m.RollappId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintStateIndex(dAtA []byte, offset int, v uint64) int { - offset -= sovStateIndex(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *StateIndex) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RollappId) - if l > 0 { - n += 1 + l + sovStateIndex(uint64(l)) - } - if m.Index != 0 { - n += 1 + sovStateIndex(uint64(m.Index)) - } - return n -} - -func sovStateIndex(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozStateIndex(x uint64) (n int) { - return sovStateIndex(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *StateIndex) 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 ErrIntOverflowStateIndex - } - 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: StateIndex: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StateIndex: 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 ErrIntOverflowStateIndex - } - 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 ErrInvalidLengthStateIndex - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStateIndex - } - 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 ErrIntOverflowStateIndex - } - 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 := skipStateIndex(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStateIndex - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipStateIndex(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, ErrIntOverflowStateIndex - } - 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, ErrIntOverflowStateIndex - } - 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, ErrIntOverflowStateIndex - } - 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, ErrInvalidLengthStateIndex - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupStateIndex - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthStateIndex - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthStateIndex = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowStateIndex = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupStateIndex = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/rollapp/types/state_info.pb.go b/x/rollapp/types/state_info.pb.go index 0e0183ac8..88730a63b 100644 --- a/x/rollapp/types/state_info.pb.go +++ b/x/rollapp/types/state_info.pb.go @@ -23,38 +23,96 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// StateInfo defines a rollapps' state. -type StateInfo struct { +// 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 LatestStateInfoIndex which defines the rollapps' current (latest) +// index of the last UpdateState +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"` - // stateIndex is a sequential increasing number, updating on each + // latestStateInfoIndex is a sequential increasing number, updating on each // state update used for indexing to a specific state info - StateIndex uint64 `protobuf:"varint,2,opt,name=stateIndex,proto3" json:"stateIndex,omitempty"` + 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_0f682a28ae3061a0, []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,3,opt,name=sequencer,proto3" json:"sequencer,omitempty"` + 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,4,opt,name=startHeight,proto3" json:"startHeight,omitempty"` + 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,5,opt,name=numBlocks,proto3" json:"numBlocks,omitempty"` + 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,6,opt,name=DAPath,proto3" json:"DAPath,omitempty"` + DAPath string `protobuf:"bytes,5,opt,name=DAPath,proto3" json:"DAPath,omitempty"` // version is the version of the rollapp - Version uint64 `protobuf:"varint,7,opt,name=version,proto3" json:"version,omitempty"` + 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,8,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` + CreationHeight uint64 `protobuf:"varint,7,opt,name=creationHeight,proto3" json:"creationHeight,omitempty"` // status is the status of the state update - Status StateStatus `protobuf:"varint,9,opt,name=status,proto3,enum=dymensionxyz.dymension.rollapp.StateStatus" json:"status,omitempty"` + Status StateStatus `protobuf:"varint,8,opt,name=status,proto3,enum=dymensionxyz.dymension.rollapp.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,10,opt,name=BDs,proto3" json:"BDs"` + 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_0f682a28ae3061a0, []int{0} + return fileDescriptor_0f682a28ae3061a0, []int{1} } func (m *StateInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -83,18 +141,11 @@ func (m *StateInfo) XXX_DiscardUnknown() { var xxx_messageInfo_StateInfo proto.InternalMessageInfo -func (m *StateInfo) GetRollappId() string { - if m != nil { - return m.RollappId - } - return "" -} - -func (m *StateInfo) GetStateIndex() uint64 { +func (m *StateInfo) GetStateInfoIndex() StateInfoIndex { if m != nil { - return m.StateIndex + return m.StateInfoIndex } - return 0 + return StateInfoIndex{} } func (m *StateInfo) GetSequencer() string { @@ -154,37 +205,74 @@ func (m *StateInfo) GetBDs() BlockDescriptors { } func init() { + proto.RegisterType((*StateInfoIndex)(nil), "dymensionxyz.dymension.rollapp.StateInfoIndex") proto.RegisterType((*StateInfo)(nil), "dymensionxyz.dymension.rollapp.StateInfo") } func init() { proto.RegisterFile("rollapp/state_info.proto", fileDescriptor_0f682a28ae3061a0) } var fileDescriptor_0f682a28ae3061a0 = []byte{ - // 373 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xcf, 0x4e, 0xea, 0x40, - 0x14, 0xc6, 0x3b, 0x17, 0x6e, 0xb9, 0x1d, 0x12, 0x16, 0x93, 0x1b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0x6b, 0xfc, 0x58, 0x52, 0x7c, 0x56, 0xcc, 0x7c, 0xf5, 0x08, 0x81, 0xff, 0xea, 0xfe, 0x41, - 0x40, 0x27, 0xd0, 0xec, 0xde, 0x3e, 0x84, 0x72, 0x82, 0x4d, 0x6d, 0x5d, 0x55, 0x08, 0xc3, 0xc6, - 0x0b, 0xe5, 0xea, 0x4c, 0xb8, 0xa1, 0x99, 0x5d, 0x89, 0x2e, 0x60, 0x2b, 0xe2, 0x34, 0x94, 0x29, - 0xcb, 0xaa, 0xa5, 0xff, 0xf4, 0xc0, 0x37, 0x15, 0xdd, 0x41, 0xb3, 0xbc, 0x09, 0xb6, 0x6c, 0xe0, - 0xb4, 0x3a, 0x97, 0xee, 0xcf, 0x31, 0xb8, 0xfa, 0x60, 0x03, 0x8d, 0x04, 0x15, 0x8a, 0x7a, 0xb0, - 0xe6, 0x77, 0x05, 0x86, 0x36, 0x70, 0x9a, 0x9d, 0xab, 0xdf, 0x1c, 0xf4, 0x9b, 0xba, 0xfb, 0xa0, - 0x84, 0x5f, 0x5f, 0xbd, 0x9f, 0x19, 0x81, 0xb2, 0xf0, 0xef, 0x57, 0x1b, 0x02, 0xd6, 0x1b, 0x02, - 0x3e, 0x36, 0x04, 0x2c, 0xb7, 0xc4, 0x58, 0x6f, 0x89, 0xf1, 0xb6, 0x25, 0xc6, 0xe3, 0x75, 0x92, - 0xca, 0x49, 0x31, 0x72, 0x23, 0x36, 0xf3, 0x8e, 0x17, 0x1c, 0x0a, 0x6f, 0xee, 0xed, 0xc2, 0x96, - 0x8b, 0x9c, 0x8a, 0x91, 0xa9, 0x63, 0xbe, 0xf9, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x34, 0x8f, 0x06, - 0x16, 0x74, 0x02, 0x00, 0x00, + // 399 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xc1, 0xaa, 0xda, 0x40, + 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 0x61, 0xe9, 0x63, + 0x7a, 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x90, 0x7a, 0x4f, 0xad, 0xda, 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 = 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) { @@ -216,58 +304,56 @@ func (m *StateInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintStateInfo(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x52 + dAtA[i] = 0x4a if m.Status != 0 { i = encodeVarintStateInfo(dAtA, i, uint64(m.Status)) i-- - dAtA[i] = 0x48 + dAtA[i] = 0x40 } if m.CreationHeight != 0 { i = encodeVarintStateInfo(dAtA, i, uint64(m.CreationHeight)) i-- - dAtA[i] = 0x40 + dAtA[i] = 0x38 } if m.Version != 0 { i = encodeVarintStateInfo(dAtA, i, uint64(m.Version)) i-- - dAtA[i] = 0x38 + 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] = 0x32 + dAtA[i] = 0x2a } if m.NumBlocks != 0 { i = encodeVarintStateInfo(dAtA, i, uint64(m.NumBlocks)) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x20 } if m.StartHeight != 0 { i = encodeVarintStateInfo(dAtA, i, uint64(m.StartHeight)) i-- - dAtA[i] = 0x20 + 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] = 0x1a + dAtA[i] = 0x12 } - if m.StateIndex != 0 { - i = encodeVarintStateInfo(dAtA, i, uint64(m.StateIndex)) - 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 + { + 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 } @@ -282,7 +368,7 @@ func encodeVarintStateInfo(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *StateInfo) Size() (n int) { +func (m *StateInfoIndex) Size() (n int) { if m == nil { return 0 } @@ -292,9 +378,20 @@ func (m *StateInfo) Size() (n int) { if l > 0 { n += 1 + l + sovStateInfo(uint64(l)) } - if m.StateIndex != 0 { - n += 1 + sovStateInfo(uint64(m.StateIndex)) + 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)) @@ -329,7 +426,7 @@ func sovStateInfo(x uint64) (n int) { func sozStateInfo(x uint64) (n int) { return sovStateInfo(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *StateInfo) Unmarshal(dAtA []byte) error { +func (m *StateInfoIndex) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -352,10 +449,10 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: StateInfo: wiretype end group for non-group") + return fmt.Errorf("proto: StateInfoIndex: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: StateInfo: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: StateInfoIndex: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -392,9 +489,9 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StateIndex", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) } - m.StateIndex = 0 + m.Index = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowStateInfo @@ -404,12 +501,95 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.StateIndex |= uint64(b&0x7F) << shift + m.Index |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 3: + 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) } @@ -441,7 +621,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { } m.Sequencer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) } @@ -460,7 +640,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { break } } - case 5: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NumBlocks", wireType) } @@ -479,7 +659,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { break } } - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DAPath", wireType) } @@ -511,7 +691,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { } m.DAPath = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) } @@ -530,7 +710,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { break } } - case 8: + case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) } @@ -549,7 +729,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { break } } - case 9: + case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } @@ -568,7 +748,7 @@ func (m *StateInfo) Unmarshal(dAtA []byte) error { break } } - case 10: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BDs", wireType) }