diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index ef947e9a4..0dd155c35 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -23,17 +23,19 @@ paths: type: string format: uint64 title: epoch number of this checkpoint - earliest_btc_block_number: + best_submission_btc_block_height: type: string format: uint64 - title: >- - height of earliest BTC block that includes this - checkpoint - earliest_btc_block_hash: + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: type: string format: byte - title: hash of earliest BTC block that includes this checkpoint - earliest_btc_block_txs: + title: >- + hash of the btc block which determines checkpoint btc + block height i.e. + + youngest block of best submission + best_submission_transactions: type: array items: type: object @@ -96,8 +98,8 @@ paths: - the Merkle proof that this tx is on the above position - title: the BTC checkpoint transactions on the above block - vigilante_address_list: + title: the BTC checkpoint transactions of the best submission + best_submission_vigilante_address_list: type: array items: type: object @@ -126,12 +128,13 @@ paths: submitter and reporter of a given checkpoint - title: list of vigilantes' addresses - description: >- - BTCCheckpointInfo contains all checkpoint related data - expected in a query + title: list of vigilantes' addresses of the best submission + title: >- + BTCCheckpointInfo contains all data about best submission of + checkpoint for - response. + given epoch. Best submission is the submission which is + deeper in btc ledger pagination: title: pagination defines the pagination in the response type: object @@ -338,15 +341,19 @@ paths: type: string format: uint64 title: epoch number of this checkpoint - earliest_btc_block_number: + best_submission_btc_block_height: type: string format: uint64 - title: height of earliest BTC block that includes this checkpoint - earliest_btc_block_hash: + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: type: string format: byte - title: hash of earliest BTC block that includes this checkpoint - earliest_btc_block_txs: + title: >- + hash of the btc block which determines checkpoint btc + block height i.e. + + youngest block of best submission + best_submission_transactions: type: array items: type: object @@ -408,8 +415,8 @@ paths: - the full tx content - the Merkle proof that this tx is on the above position - title: the BTC checkpoint transactions on the above block - vigilante_address_list: + title: the BTC checkpoint transactions of the best submission + best_submission_vigilante_address_list: type: array items: type: object @@ -438,12 +445,13 @@ paths: submitter and reporter of a given checkpoint - title: list of vigilantes' addresses - description: >- - BTCCheckpointInfo contains all checkpoint related data - expected in a query + title: list of vigilantes' addresses of the best submission + title: >- + BTCCheckpointInfo contains all data about best submission of + checkpoint for - response. + given epoch. Best submission is the submission which is deeper + in btc ledger title: |- QueryBtcCheckpointInfoResponse is response type for the Query/BtcCheckpointInfo RPC method @@ -5461,319 +5469,291 @@ paths: type: boolean tags: - Query - /babylon/zoneconcierge/v1/chain_info/{chain_id}/epochs/{epoch_num}: + /babylon/zoneconcierge/v1/chain_info/{chain_id}/header/{height}: get: - summary: |- - EpochChainInfo queries the latest info of a chain in a given epoch of - Babylon's view - operationId: EpochChainInfo + summary: Header queries the CZ header and fork headers at a given height. + operationId: Header responses: '200': description: A successful response. schema: type: object properties: - chain_info: - title: chain_info is the info of the CZ + header: type: object properties: chain_id: type: string - title: chain_id is the ID of the chain - latest_header: - title: latest_header is the latest header in CZ's canonical chain + title: chain_id is the unique ID of the chain + hash: + type: string + format: byte + title: hash is the hash of this header + height: + type: string + format: uint64 + title: >- + height is the height of this header on CZ ledger + + (hash, height) jointly provides the position of the header + on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ + + header type: object properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing + a block in the blockchain, + + including all blockchain data structures and the rules + of the application's + + state transition machine. chain_id: type: string - title: chain_id is the unique ID of the chain - hash: - type: string - format: byte - title: hash is the hash of this header height: type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the - header on CZ ledger - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ - - header + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info type: object properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and the - rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: + hash: type: string - format: date-time - last_block_id: - title: prev block info + format: byte + part_set_header: type: object properties: + total: + type: integer + format: int64 hash: type: string format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a block header. - babylon_epoch: + title: PartsetHeader + last_commit_hash: type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: + format: byte + title: hashes of block data + data_hash: type: string format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes - this header + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block header. + babylon_epoch: + type: string + format: uint64 + title: epoch is the epoch number of this header on Babylon ledger + babylon_tx_hash: + type: string + format: byte + title: >- + babylon_tx_hash is the hash of the tx that includes this + header - (babylon_block_height, babylon_tx_hash) jointly - provides the position of + (babylon_block_height, babylon_tx_hash) jointly provides + the position of - the header on Babylon ledger - latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from + the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header + fork_headers: + type: object + properties: + headers: + type: array + items: + type: object + properties: + chain_id: + type: string + title: chain_id is the unique ID of the chain + hash: + type: string + format: byte + title: hash is the hash of this header + height: + type: string + format: uint64 + title: >- + height is the height of this header on CZ ledger - low to high) - type: object - properties: - headers: - type: array - items: + (hash, height) jointly provides the position of the + header on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon block + that includes this CZ + + header type: object properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of - the header on CZ ledger - babylon_header: - title: >- - babylon_header is the header of the babylon - block that includes this CZ - - header + version: + title: basic block info type: object properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and - the rules of the application's - - state transition machine. - chain_id: + block: type: string - height: + format: uint64 + app: type: string - format: int64 - time: + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and the + rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: type: string - format: date-time - last_block_id: - title: prev block info + format: byte + part_set_header: type: object properties: + total: + type: integer + format: int64 hash: type: string format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a block header. - babylon_epoch: + title: PartsetHeader + last_commit_hash: type: string - format: uint64 - title: >- - epoch is the epoch number of this header on - Babylon ledger - babylon_tx_hash: + format: byte + title: hashes of block data + data_hash: type: string format: byte - title: >- - babylon_tx_hash is the hash of the tx that - includes this header - - (babylon_block_height, babylon_tx_hash) jointly - provides the position of + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block header. + babylon_epoch: + type: string + format: uint64 + title: >- + epoch is the epoch number of this header on Babylon + ledger + babylon_tx_hash: + type: string + format: byte + title: >- + babylon_tx_hash is the hash of the tx that includes + this header - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers at - the same height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at the - same height. + (babylon_block_height, babylon_tx_hash) jointly + provides the position of - For example, assuming the following blockchain + the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header + title: >- + blocks is the list of non-canonical indexed headers at the + same height + description: >- + Forks is a list of non-canonical `IndexedHeader`s at the same + height. - ``` + For example, assuming the following blockchain - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` + ``` - Then the fork will be {[D1, D2]} where each item is in - struct `IndexedBlock`. + A <- B <- C <- D <- E + \ -- D1 + \ -- D2 + ``` + Then the fork will be {[D1, D2]} where each item is in struct + `IndexedBlock`. - Note that each `IndexedHeader` in the fork should have a - valid quorum - certificate. Such forks exist since Babylon considers CZs - might have + Note that each `IndexedHeader` in the fork should have a valid + quorum - dishonest majority. Also note that the IBC-Go - implementation will only + certificate. Such forks exist since Babylon considers CZs + might have - consider the first header in a fork valid, since the - subsequent headers + dishonest majority. Also note that the IBC-Go implementation + will only - cannot be verified without knowing the validator set in - the previous header. - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped - headers in CZ's + consider the first header in a fork valid, since the + subsequent headers - canonical chain + cannot be verified without knowing the validator set in the + previous header. description: >- - QueryEpochChainInfoResponse is response type for the - Query/EpochChainInfo RPC - + QueryHeaderResponse is response type for the Query/Header RPC method. default: description: An unexpected error response. @@ -5971,299 +5951,62 @@ paths: in: path required: true type: string - - name: epoch_num + - name: height in: path required: true type: string format: uint64 tags: - Query - /babylon/zoneconcierge/v1/chain_info/{chain_id}/header/{height}: + /babylon/zoneconcierge/v1/chains: get: - summary: Header queries the CZ header and fork headers at a given height. - operationId: Header + summary: ChainList queries the list of chains that checkpoint to Babylon + operationId: ChainList responses: '200': description: A successful response. schema: type: object properties: - header: + chain_ids: + type: array + items: + type: string + title: >- + chain_ids are IDs of the chains in ascending alphabetical + order + pagination: + title: pagination defines the pagination in the response type: object properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - hash: + next_key: type: string format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the header - on CZ ledger - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ - - header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, - - including all blockchain data structures and the rules - of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a block header. - babylon_epoch: + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: type: string format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: - type: string - format: byte title: >- - babylon_tx_hash is the hash of the tx that includes this - header - - (babylon_block_height, babylon_tx_hash) jointly provides - the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - fork_headers: - type: object - properties: - headers: - type: array - items: - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the - header on CZ ledger - babylon_header: - title: >- - babylon_header is the header of the babylon block - that includes this CZ - - header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and the - rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a block header. - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes - this header - - (babylon_block_height, babylon_tx_hash) jointly - provides the position of + total is total number of results available if + PageRequest.count_total - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers at the - same height + was set, its value is undefined otherwise description: >- - Forks is a list of non-canonical `IndexedHeader`s at the same - height. - - For example, assuming the following blockchain - - ``` - - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` - - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. - - - Note that each `IndexedHeader` in the fork should have a valid - quorum - - certificate. Such forks exist since Babylon considers CZs - might have - - dishonest majority. Also note that the IBC-Go implementation - will only + PageResponse is to be embedded in gRPC response messages where + the - consider the first header in a fork valid, since the - subsequent headers + corresponding request message has used PageRequest. - cannot be verified without knowing the validator set in the - previous header. - description: >- - QueryHeaderResponse is response type for the Query/Header RPC - method. + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + title: >- + QueryChainListResponse is response type for the Query/ChainList + RPC method default: description: An unexpected error response. schema: @@ -6420,102 +6163,417 @@ paths: JSON - The JSON representation of an `Any` value uses the regular + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + 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 + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /babylon/zoneconcierge/v1/chains_info: + get: + summary: >- + ChainsInfo queries the latest info for a given list of chains in + Babylon's view + operationId: ChainsInfo + responses: + '200': + description: A successful response. + schema: + type: object + properties: + chains_info: + type: array + items: + type: object + properties: + chain_id: + type: string + title: chain_id is the ID of the chain + latest_header: + type: object + properties: + chain_id: + type: string + title: chain_id is the unique ID of the chain + hash: + type: string + format: byte + title: hash is the hash of this header + height: + type: string + format: uint64 + title: >- + height is the height of this header on CZ ledger + + (hash, height) jointly provides the position of the + header on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon block + that includes this CZ + + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and the + rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block header. + babylon_epoch: + type: string + format: uint64 + title: >- + epoch is the epoch number of this header on Babylon + ledger + babylon_tx_hash: + type: string + format: byte + title: >- + babylon_tx_hash is the hash of the tx that includes + this header + + (babylon_block_height, babylon_tx_hash) jointly + provides the position of + + the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header + latest_forks: + type: object + properties: + headers: + type: array + items: + type: object + properties: + chain_id: + type: string + title: chain_id is the unique ID of the chain + hash: + type: string + format: byte + title: hash is the hash of this header + height: + type: string + format: uint64 + title: >- + height is the height of this header on CZ + ledger - representation of the deserialized, embedded message, with - an + (hash, height) jointly provides the position + of the header on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon + block that includes this CZ - additional field `@type` which contains the type URL. - Example: + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + including all blockchain data structures + and the rules of the application's - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: >- + hashes from the app output from the prev + block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: >- + Header defines the structure of a block + header. + babylon_epoch: + type: string + format: uint64 + title: >- + epoch is the epoch number of this header on + Babylon ledger + babylon_tx_hash: + type: string + format: byte + title: >- + babylon_tx_hash is the hash of the tx that + includes this header - If the embedded message type is well-known and has a custom - JSON + (babylon_block_height, babylon_tx_hash) + jointly provides the position of - representation, that representation will be embedded adding - a field + the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header + title: >- + blocks is the list of non-canonical indexed headers + at the same height + description: >- + Forks is a list of non-canonical `IndexedHeader`s at the + same height. - `value` which holds the custom JSON in addition to the - `@type` + For example, assuming the following blockchain - field. Example (for message [google.protobuf.Duration][]): + ``` - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: chain_id - in: path - required: true - type: string - - name: height - in: path - required: true - type: string - format: uint64 - tags: - - Query - /babylon/zoneconcierge/v1/chains: - get: - summary: ChainList queries the list of chains that checkpoint to Babylon - operationId: ChainList - responses: - '200': - description: A successful response. - schema: - type: object - properties: - chain_ids: - type: array - items: - type: string - title: >- - chain_ids are IDs of the chains in ascending alphabetical - order - pagination: - title: pagination defines the pagination in the response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + A <- B <- C <- D <- E + \ -- D1 + \ -- D2 + ``` - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the + Then the fork will be {[D1, D2]} where each item is in + struct `IndexedBlock`. - corresponding request message has used PageRequest. - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: >- - QueryChainListResponse is response type for the Query/ChainList - RPC method + Note that each `IndexedHeader` in the fork should have a + valid quorum + + certificate. Such forks exist since Babylon considers + CZs might have + + dishonest majority. Also note that the IBC-Go + implementation will only + + consider the first header in a fork valid, since the + subsequent headers + + cannot be verified without knowing the validator set in + the previous header. + title: >- + latest_forks is the latest forks, formed as a series of + IndexedHeader (from + + low to high) + timestamped_headers_count: + type: string + format: uint64 + title: >- + timestamped_headers_count is the number of timestamped + headers in CZ's + + canonical chain + title: ChainInfo is the information of a CZ + description: >- + QueryChainsInfoResponse is response type for the Query/ChainsInfo + RPC method. default: description: An unexpected error response. schema: @@ -6708,68 +6766,21 @@ paths: "value": "1.212s" } 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 - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 + - name: chain_ids in: query required: false - type: boolean + type: array + items: + type: string + collectionFormat: multi tags: - Query - /babylon/zoneconcierge/v1/chains_info: + /babylon/zoneconcierge/v1/epoch_chains_info: get: - summary: ChainInfo queries the latest info of a chain in Babylon's view - operationId: ChainsInfo + summary: |- + EpochChainsInfo queries the latest info for a list of chains + in a given epoch in Babylon's view + operationId: EpochChainsInfo responses: '200': description: A successful response. @@ -6785,9 +6796,6 @@ paths: type: string title: chain_id is the ID of the chain latest_header: - title: >- - latest_header is the latest header in CZ's canonical - chain type: object properties: chain_id: @@ -6904,12 +6912,8 @@ paths: provides the position of the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from - - low to high) type: object properties: headers: @@ -7071,6 +7075,11 @@ paths: cannot be verified without knowing the validator set in the previous header. + title: >- + latest_forks is the latest forks, formed as a series of + IndexedHeader (from + + low to high) timestamped_headers_count: type: string format: uint64 @@ -7080,9 +7089,12 @@ paths: canonical chain title: ChainInfo is the information of a CZ + title: chain_info is the info of the CZ description: >- - QueryChainsInfoResponse is response type for the Query/ChainsInfo - RPC method. + QueryEpochChainsInfoResponse is response type for the + Query/EpochChainsInfo RPC + + method. default: description: An unexpected error response. schema: @@ -7275,6 +7287,11 @@ paths: "value": "1.212s" } parameters: + - name: epoch_num + in: query + required: false + type: string + format: uint64 - name: chain_ids in: query required: false @@ -7305,7 +7322,6 @@ paths: type: string title: chain_id is the ID of the chain latest_header: - title: latest_header is the latest header in CZ's canonical chain type: object properties: chain_id: @@ -7422,12 +7438,8 @@ paths: provides the position of the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from - - low to high) type: object properties: headers: @@ -7586,6 +7598,11 @@ paths: cannot be verified without knowing the validator set in the previous header. + title: >- + latest_forks is the latest forks, formed as a series of + IndexedHeader (from + + low to high) timestamped_headers_count: type: string format: uint64 @@ -8314,9 +8331,6 @@ paths: type: string title: chain_id is the ID of the chain latest_header: - title: >- - latest_header is the latest header in CZ's canonical - chain type: object properties: chain_id: @@ -8435,12 +8449,8 @@ paths: provides the position of the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header latest_forks: - title: >- - latest_forks is the latest forks, formed as a series - of IndexedHeader (from - - low to high) type: object properties: headers: @@ -8603,6 +8613,11 @@ paths: cannot be verified without knowing the validator set in the previous header. + title: >- + latest_forks is the latest forks, formed as a series + of IndexedHeader (from + + low to high) timestamped_headers_count: type: string format: uint64 @@ -10072,15 +10087,19 @@ definitions: type: string format: uint64 title: epoch number of this checkpoint - earliest_btc_block_number: + best_submission_btc_block_height: type: string format: uint64 - title: height of earliest BTC block that includes this checkpoint - earliest_btc_block_hash: + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: type: string format: byte - title: hash of earliest BTC block that includes this checkpoint - earliest_btc_block_txs: + title: >- + hash of the btc block which determines checkpoint btc block height + i.e. + + youngest block of best submission + best_submission_transactions: type: array items: type: object @@ -10142,8 +10161,8 @@ definitions: - the full tx content - the Merkle proof that this tx is on the above position - title: the BTC checkpoint transactions on the above block - vigilante_address_list: + title: the BTC checkpoint transactions of the best submission + best_submission_vigilante_address_list: type: array items: type: object @@ -10171,10 +10190,13 @@ definitions: reporter of a given checkpoint - title: list of vigilantes' addresses - description: |- - BTCCheckpointInfo contains all checkpoint related data expected in a query - response. + title: list of vigilantes' addresses of the best submission + title: >- + BTCCheckpointInfo contains all data about best submission of checkpoint + for + + given epoch. Best submission is the submission which is deeper in btc + ledger babylon.btccheckpoint.v1.CheckpointAddresses: type: object properties: @@ -10248,15 +10270,19 @@ definitions: type: string format: uint64 title: epoch number of this checkpoint - earliest_btc_block_number: + best_submission_btc_block_height: type: string format: uint64 - title: height of earliest BTC block that includes this checkpoint - earliest_btc_block_hash: + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: type: string format: byte - title: hash of earliest BTC block that includes this checkpoint - earliest_btc_block_txs: + title: >- + hash of the btc block which determines checkpoint btc block height + i.e. + + youngest block of best submission + best_submission_transactions: type: array items: type: object @@ -10318,8 +10344,8 @@ definitions: - the full tx content - the Merkle proof that this tx is on the above position - title: the BTC checkpoint transactions on the above block - vigilante_address_list: + title: the BTC checkpoint transactions of the best submission + best_submission_vigilante_address_list: type: array items: type: object @@ -10348,12 +10374,13 @@ definitions: reporter of a given checkpoint - title: list of vigilantes' addresses - description: >- - BTCCheckpointInfo contains all checkpoint related data expected in a - query + title: list of vigilantes' addresses of the best submission + title: >- + BTCCheckpointInfo contains all data about best submission of + checkpoint for - response. + given epoch. Best submission is the submission which is deeper in btc + ledger title: |- QueryBtcCheckpointInfoResponse is response type for the Query/BtcCheckpointInfo RPC method @@ -10369,15 +10396,19 @@ definitions: type: string format: uint64 title: epoch number of this checkpoint - earliest_btc_block_number: + best_submission_btc_block_height: type: string format: uint64 - title: height of earliest BTC block that includes this checkpoint - earliest_btc_block_hash: + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: type: string format: byte - title: hash of earliest BTC block that includes this checkpoint - earliest_btc_block_txs: + title: >- + hash of the btc block which determines checkpoint btc block + height i.e. + + youngest block of best submission + best_submission_transactions: type: array items: type: object @@ -10439,8 +10470,8 @@ definitions: - the full tx content - the Merkle proof that this tx is on the above position - title: the BTC checkpoint transactions on the above block - vigilante_address_list: + title: the BTC checkpoint transactions of the best submission + best_submission_vigilante_address_list: type: array items: type: object @@ -10469,12 +10500,13 @@ definitions: and reporter of a given checkpoint - title: list of vigilantes' addresses - description: >- - BTCCheckpointInfo contains all checkpoint related data expected in a - query + title: list of vigilantes' addresses of the best submission + title: >- + BTCCheckpointInfo contains all data about best submission of + checkpoint for - response. + given epoch. Best submission is the submission which is deeper in + btc ledger pagination: title: pagination defines the pagination in the response type: object @@ -14879,7 +14911,6 @@ definitions: type: string title: chain_id is the ID of the chain latest_header: - title: latest_header is the latest header in CZ's canonical chain type: object properties: chain_id: @@ -14993,12 +15024,8 @@ definitions: position of the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of IndexedHeader - (from - - low to high) type: object properties: headers: @@ -15149,6 +15176,11 @@ definitions: cannot be verified without knowing the validator set in the previous header. + title: >- + latest_forks is the latest forks, formed as a series of IndexedHeader + (from + + low to high) timestamped_headers_count: type: string format: uint64 @@ -15169,7 +15201,6 @@ definitions: type: string title: chain_id is the ID of the chain latest_header: - title: latest_header is the latest header in CZ's canonical chain type: object properties: chain_id: @@ -15284,12 +15315,8 @@ definitions: position of the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from - - low to high) type: object properties: headers: @@ -15446,6 +15473,11 @@ definitions: cannot be verified without knowing the validator set in the previous header. + title: >- + latest_forks is the latest forks, formed as a series of + IndexedHeader (from + + low to high) timestamped_headers_count: type: string format: uint64 @@ -16542,7 +16574,6 @@ definitions: type: string title: chain_id is the ID of the chain latest_header: - title: latest_header is the latest header in CZ's canonical chain type: object properties: chain_id: @@ -16657,12 +16688,8 @@ definitions: position of the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from - - low to high) type: object properties: headers: @@ -16819,317 +16846,325 @@ definitions: cannot be verified without knowing the validator set in the previous header. - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped headers - in CZ's - - canonical chain - title: ChainInfo is the information of a CZ - description: >- - QueryChainsInfoResponse is response type for the Query/ChainsInfo RPC - method. - babylon.zoneconcierge.v1.QueryEpochChainInfoResponse: - type: object - properties: - chain_info: - title: chain_info is the info of the CZ - type: object - properties: - chain_id: - type: string - title: chain_id is the ID of the chain - latest_header: - title: latest_header is the latest header in CZ's canonical chain - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the header on - CZ ledger - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ - - header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a - block in the blockchain, - - including all blockchain data structures and the rules of - the application's + title: >- + latest_forks is the latest forks, formed as a series of + IndexedHeader (from - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a block header. - babylon_epoch: - type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header + low to high) + timestamped_headers_count: + type: string + format: uint64 + title: >- + timestamped_headers_count is the number of timestamped headers + in CZ's - (babylon_block_height, babylon_tx_hash) jointly provides the - position of + canonical chain + title: ChainInfo is the information of a CZ + description: >- + QueryChainsInfoResponse is response type for the Query/ChainsInfo RPC + method. + babylon.zoneconcierge.v1.QueryEpochChainsInfoResponse: + type: object + properties: + chains_info: + type: array + items: + type: object + properties: + chain_id: + type: string + title: chain_id is the ID of the chain + latest_header: + type: object + properties: + chain_id: + type: string + title: chain_id is the unique ID of the chain + hash: + type: string + format: byte + title: hash is the hash of this header + height: + type: string + format: uint64 + title: >- + height is the height of this header on CZ ledger - the header on Babylon ledger - latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from + (hash, height) jointly provides the position of the header + on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ - low to high) - type: object - properties: - headers: - type: array - items: + header type: object properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing a + block in the blockchain, + + including all blockchain data structures and the rules + of the application's + + state transition machine. chain_id: type: string - title: chain_id is the unique ID of the chain - hash: - type: string - format: byte - title: hash is the hash of this header height: type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the - header on CZ ledger - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ - - header + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info type: object properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and the - rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: + hash: type: string - format: date-time - last_block_id: - title: prev block info + format: byte + part_set_header: type: object properties: + total: + type: integer + format: int64 hash: type: string format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a block header. - babylon_epoch: + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: + format: byte + consensus_hash: type: string format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block header. + babylon_epoch: + type: string + format: uint64 + title: epoch is the epoch number of this header on Babylon ledger + babylon_tx_hash: + type: string + format: byte + title: >- + babylon_tx_hash is the hash of the tx that includes this + header - (babylon_block_height, babylon_tx_hash) jointly provides - the position of + (babylon_block_height, babylon_tx_hash) jointly provides the + position of - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers at the - same height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at the same - height. + the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header + latest_forks: + type: object + properties: + headers: + type: array + items: + type: object + properties: + chain_id: + type: string + title: chain_id is the unique ID of the chain + hash: + type: string + format: byte + title: hash is the hash of this header + height: + type: string + format: uint64 + title: >- + height is the height of this header on CZ ledger - For example, assuming the following blockchain + (hash, height) jointly provides the position of the + header on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ - ``` + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` + including all blockchain data structures and the + rules of the application's - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block header. + babylon_epoch: + type: string + format: uint64 + title: >- + epoch is the epoch number of this header on Babylon + ledger + babylon_tx_hash: + type: string + format: byte + title: >- + babylon_tx_hash is the hash of the tx that includes + this header + (babylon_block_height, babylon_tx_hash) jointly + provides the position of - Note that each `IndexedHeader` in the fork should have a valid - quorum + the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header + title: >- + blocks is the list of non-canonical indexed headers at the + same height + description: >- + Forks is a list of non-canonical `IndexedHeader`s at the same + height. - certificate. Such forks exist since Babylon considers CZs might - have + For example, assuming the following blockchain - dishonest majority. Also note that the IBC-Go implementation will - only + ``` - consider the first header in a fork valid, since the subsequent - headers + A <- B <- C <- D <- E + \ -- D1 + \ -- D2 + ``` - cannot be verified without knowing the validator set in the - previous header. - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped headers in - CZ's + Then the fork will be {[D1, D2]} where each item is in struct + `IndexedBlock`. - canonical chain + + Note that each `IndexedHeader` in the fork should have a valid + quorum + + certificate. Such forks exist since Babylon considers CZs might + have + + dishonest majority. Also note that the IBC-Go implementation + will only + + consider the first header in a fork valid, since the subsequent + headers + + cannot be verified without knowing the validator set in the + previous header. + title: >- + latest_forks is the latest forks, formed as a series of + IndexedHeader (from + + low to high) + timestamped_headers_count: + type: string + format: uint64 + title: >- + timestamped_headers_count is the number of timestamped headers + in CZ's + + canonical chain + title: ChainInfo is the information of a CZ + title: chain_info is the info of the CZ description: >- - QueryEpochChainInfoResponse is response type for the Query/EpochChainInfo - RPC + QueryEpochChainsInfoResponse is response type for the + Query/EpochChainsInfo RPC method. babylon.zoneconcierge.v1.QueryFinalizedChainInfoUntilHeightResponse: @@ -17142,7 +17177,6 @@ definitions: type: string title: chain_id is the ID of the chain latest_header: - title: latest_header is the latest header in CZ's canonical chain type: object properties: chain_id: @@ -17257,12 +17291,8 @@ definitions: position of the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from - - low to high) type: object properties: headers: @@ -17419,6 +17449,11 @@ definitions: cannot be verified without knowing the validator set in the previous header. + title: >- + latest_forks is the latest forks, formed as a series of + IndexedHeader (from + + low to high) timestamped_headers_count: type: string format: uint64 @@ -17911,7 +17946,6 @@ definitions: type: string title: chain_id is the ID of the chain latest_header: - title: latest_header is the latest header in CZ's canonical chain type: object properties: chain_id: @@ -18028,12 +18062,8 @@ definitions: the position of the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from - - low to high) type: object properties: headers: @@ -18190,6 +18220,11 @@ definitions: cannot be verified without knowing the validator set in the previous header. + title: >- + latest_forks is the latest forks, formed as a series of + IndexedHeader (from + + low to high) timestamped_headers_count: type: string format: uint64 diff --git a/proto/babylon/zoneconcierge/v1/query.proto b/proto/babylon/zoneconcierge/v1/query.proto index e9b7cd267..e3675682d 100644 --- a/proto/babylon/zoneconcierge/v1/query.proto +++ b/proto/babylon/zoneconcierge/v1/query.proto @@ -21,17 +21,17 @@ service Query { rpc ChainList(QueryChainListRequest) returns (QueryChainListResponse) { option (google.api.http).get = "/babylon/zoneconcierge/v1/chains"; } - // ChainInfo queries the latest info of a chain in Babylon's view + // ChainsInfo queries the latest info for a given list of chains in Babylon's view rpc ChainsInfo(QueryChainsInfoRequest) returns (QueryChainsInfoResponse) { option (google.api.http).get = "/babylon/zoneconcierge/v1/chains_info"; } - // EpochChainInfo queries the latest info of a chain in a given epoch of - // Babylon's view - rpc EpochChainInfo(QueryEpochChainInfoRequest) - returns (QueryEpochChainInfoResponse) { + // EpochChainsInfo queries the latest info for a list of chains + // in a given epoch in Babylon's view + rpc EpochChainsInfo(QueryEpochChainsInfoRequest) + returns (QueryEpochChainsInfoResponse) { option (google.api.http).get = - "/babylon/zoneconcierge/v1/chain_info/{chain_id}/epochs/{epoch_num}"; + "/babylon/zoneconcierge/v1/epoch_chains_info"; } // ListHeaders queries the headers of a chain in Babylon's view, with // pagination support @@ -96,18 +96,18 @@ message QueryChainsInfoResponse { repeated babylon.zoneconcierge.v1.ChainInfo chains_info = 1; } -// QueryEpochChainInfoRequest is request type for the Query/EpochChainInfo RPC +// QueryEpochChainsInfoRequest is request type for the Query/EpochChainsInfo RPC // method. -message QueryEpochChainInfoRequest { +message QueryEpochChainsInfoRequest { uint64 epoch_num = 1; - string chain_id = 2; + repeated string chain_ids = 2; } -// QueryEpochChainInfoResponse is response type for the Query/EpochChainInfo RPC +// QueryEpochChainsInfoResponse is response type for the Query/EpochChainsInfo RPC // method. -message QueryEpochChainInfoResponse { +message QueryEpochChainsInfoResponse { // chain_info is the info of the CZ - babylon.zoneconcierge.v1.ChainInfo chain_info = 1; + repeated babylon.zoneconcierge.v1.ChainInfo chains_info = 1; } // QueryListHeadersRequest is request type for the Query/ListHeaders RPC method. diff --git a/test/e2e/configurer/chain/queries.go b/test/e2e/configurer/chain/queries.go index 16f3d5460..b6764c4c2 100644 --- a/test/e2e/configurer/chain/queries.go +++ b/test/e2e/configurer/chain/queries.go @@ -179,7 +179,7 @@ func (n *NodeConfig) QueryTip() (*blc.BTCHeaderInfo, error) { return blcResponse.Header, nil } -func (n *NodeConfig) QueryFinalizedChainsInfo(chainIDs []string) (*zctypes.QueryFinalizedChainsInfoResponse, error) { +func (n *NodeConfig) QueryFinalizedChainsInfo(chainIDs []string) ([]*zctypes.FinalizedChainInfo, error) { queryParams := url.Values{} for _, chainId := range chainIDs { queryParams.Add("chain_ids", chainId) @@ -193,10 +193,28 @@ func (n *NodeConfig) QueryFinalizedChainsInfo(chainIDs []string) (*zctypes.Query return nil, err } - return &resp, nil + return resp.FinalizedChainsInfo, nil } -func (n *NodeConfig) QueryCheckpointChains() (*[]string, error) { +func (n *NodeConfig) QueryEpochChainsInfo(epochNum uint64, chainIDs []string) ([]*zctypes.ChainInfo, error) { + queryParams := url.Values{} + for _, chainId := range chainIDs { + queryParams.Add("epoch_num", fmt.Sprintf("%d", epochNum)) + queryParams.Add("chain_ids", chainId) + } + + bz, err := n.QueryGRPCGateway("babylon/zoneconcierge/v1/epoch_chains_info", queryParams) + require.NoError(n.t, err) + + var resp zctypes.QueryEpochChainsInfoResponse + if err := util.Cdc.UnmarshalJSON(bz, &resp); err != nil { + return nil, err + } + + return resp.ChainsInfo, nil +} + +func (n *NodeConfig) QueryChains() (*[]string, error) { bz, err := n.QueryGRPCGateway("babylon/zoneconcierge/v1/chains", url.Values{}) require.NoError(n.t, err) var chainsResponse zctypes.QueryChainListResponse @@ -206,7 +224,7 @@ func (n *NodeConfig) QueryCheckpointChains() (*[]string, error) { return &chainsResponse.ChainIds, nil } -func (n *NodeConfig) QueryCheckpointChainsInfo(chainIDs []string) ([]*zctypes.ChainInfo, error) { +func (n *NodeConfig) QueryChainsInfo(chainIDs []string) ([]*zctypes.ChainInfo, error) { queryParams := url.Values{} for _, chainId := range chainIDs { queryParams.Add("chain_ids", chainId) @@ -214,11 +232,11 @@ func (n *NodeConfig) QueryCheckpointChainsInfo(chainIDs []string) ([]*zctypes.Ch bz, err := n.QueryGRPCGateway("/babylon/zoneconcierge/v1/chains_info", queryParams) require.NoError(n.t, err) - var infoResponse zctypes.QueryChainsInfoResponse - if err := util.Cdc.UnmarshalJSON(bz, &infoResponse); err != nil { + var resp zctypes.QueryChainsInfoResponse + if err := util.Cdc.UnmarshalJSON(bz, &resp); err != nil { return nil, err } - return infoResponse.ChainsInfo, nil + return resp.ChainsInfo, nil } func (n *NodeConfig) QueryCurrentEpoch() (uint64, error) { diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index c86c512a7..8c29d1b64 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -30,28 +30,35 @@ func (s *IntegrationTestSuite) TestIbcCheckpointing() { s.NoError(err) // Query checkpoint chain info for opposing chain - chainInfo, err := nonValidatorNode.QueryCheckpointChainsInfo([]string{initialization.ChainBID}) + chainsInfo, err := nonValidatorNode.QueryChainsInfo([]string{initialization.ChainBID}) s.NoError(err) - s.Equal(chainInfo[0].ChainId, initialization.ChainBID) + s.Equal(chainsInfo[0].ChainId, initialization.ChainBID) // Finalize epoch 1,2,3 , as first headers of opposing chain are in epoch 3 - nonValidatorNode.FinalizeSealedEpochs(1, 3) + var ( + startEpochNum uint64 = 1 + endEpochNum uint64 = 3 + ) - epoch3, err := nonValidatorNode.QueryCheckpointForEpoch(3) + nonValidatorNode.FinalizeSealedEpochs(startEpochNum, endEpochNum) + + endEpoch, err := nonValidatorNode.QueryCheckpointForEpoch(endEpochNum) s.NoError(err) + s.Equal(endEpoch.Status, ct.Finalized) - if epoch3.Status != ct.Finalized { - s.FailNow("Epoch 2 should be finalized") - } + // Check we have epoch info for opposing chain and some basic assertions + epochChainsInfo, err := nonValidatorNode.QueryEpochChainsInfo(endEpochNum, []string{initialization.ChainBID}) + s.NoError(err) + s.Equal(epochChainsInfo[0].ChainId, initialization.ChainBID) + s.Equal(epochChainsInfo[0].LatestHeader.BabylonEpoch, endEpochNum) // Check we have finalized epoch info for opposing chain and some basic assertions - finalizedResp, err := nonValidatorNode.QueryFinalizedChainsInfo([]string{initialization.ChainBID}) + finalizedChainsInfo, err := nonValidatorNode.QueryFinalizedChainsInfo([]string{initialization.ChainBID}) s.NoError(err) - finalizedInfo := finalizedResp.FinalizedChainsInfo[0] // TODO Add more assertion here. Maybe check proofs ? - s.Equal(finalizedInfo.FinalizedChainInfo.ChainId, initialization.ChainBID) - s.Equal(finalizedInfo.EpochInfo.EpochNumber, uint64(3)) + s.Equal(finalizedChainsInfo[0].FinalizedChainInfo.ChainId, initialization.ChainBID) + s.Equal(finalizedChainsInfo[0].EpochInfo.EpochNumber, endEpochNum) currEpoch, err := nonValidatorNode.QueryCurrentEpoch() s.NoError(err) diff --git a/x/zoneconcierge/client/cli/query.go b/x/zoneconcierge/client/cli/query.go index 67d8069c4..270ad106e 100644 --- a/x/zoneconcierge/client/cli/query.go +++ b/x/zoneconcierge/client/cli/query.go @@ -2,6 +2,7 @@ package cli import ( "fmt" + "strconv" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" @@ -24,13 +25,14 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdChainsInfo()) cmd.AddCommand(CmdFinalizedChainsInfo()) + cmd.AddCommand(CmdEpochChainsInfoInfo()) return cmd } func CmdChainsInfo() *cobra.Command { cmd := &cobra.Command{ Use: "chains-info ", - Short: "retrieves the latest info for a list of chains with given IDs", + Short: "retrieve the latest info for a given list of chains", Args: cobra.ArbitraryArgs, RunE: func(cmd *cobra.Command, args []string) error { clientCtx := client.GetClientContextFromCmd(cmd) @@ -52,7 +54,7 @@ func CmdChainsInfo() *cobra.Command { func CmdFinalizedChainsInfo() *cobra.Command { cmd := &cobra.Command{ Use: "finalized-chains-info ", - Short: "retrieves the finalized info for a list of chains with given IDs", + Short: "retrieve the finalized info for a given list of chains", Args: cobra.ArbitraryArgs, RunE: func(cmd *cobra.Command, args []string) error { clientCtx := client.GetClientContextFromCmd(cmd) @@ -70,3 +72,30 @@ func CmdFinalizedChainsInfo() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } + +func CmdEpochChainsInfoInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "epoch-chains-info ", + Short: "retrieve the latest info for a list of chains in a given epoch", + Args: cobra.MinimumNArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + queryClient := types.NewQueryClient(clientCtx) + + epoch, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + req := types.QueryEpochChainsInfoRequest{EpochNum: epoch, ChainIds: args[1:]} + resp, err := queryClient.EpochChainsInfo(cmd.Context(), &req) + if err != nil { + return err + } + + return clientCtx.PrintProto(resp) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/zoneconcierge/keeper/chain_info_indexer.go b/x/zoneconcierge/keeper/chain_info_indexer.go index 1f6f07c14..cd71c2904 100644 --- a/x/zoneconcierge/keeper/chain_info_indexer.go +++ b/x/zoneconcierge/keeper/chain_info_indexer.go @@ -4,9 +4,10 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" - "github.com/babylonchain/babylon/x/zoneconcierge/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/babylonchain/babylon/x/zoneconcierge/types" ) func (k Keeper) setChainInfo(ctx sdk.Context, chainInfo *types.ChainInfo) { @@ -48,11 +49,11 @@ func (k Keeper) HasChainInfo(ctx sdk.Context, chainID string) bool { // Since IBC does not provide API that allows to initialise chain info right before creating an IBC connection, // we can only check its existence every time, and return an empty one if it's not initialised yet. func (k Keeper) GetChainInfo(ctx sdk.Context, chainID string) (*types.ChainInfo, error) { - store := k.chainInfoStore(ctx) - - if !store.Has([]byte(chainID)) { - return nil, types.ErrEpochChainInfoNotFound + if !k.HasChainInfo(ctx, chainID) { + return nil, types.ErrChainInfoNotFound } + + store := k.chainInfoStore(ctx) chainInfoBytes := store.Get([]byte(chainID)) var chainInfo types.ChainInfo k.cdc.MustUnmarshal(chainInfoBytes, &chainInfo) diff --git a/x/zoneconcierge/keeper/grpc_query.go b/x/zoneconcierge/keeper/grpc_query.go index e67554c59..191f59f32 100644 --- a/x/zoneconcierge/keeper/grpc_query.go +++ b/x/zoneconcierge/keeper/grpc_query.go @@ -42,7 +42,7 @@ func (k Keeper) ChainList(c context.Context, req *types.QueryChainListRequest) ( return resp, nil } -// ChainsInfo returns the latest info for a list of chains with given IDs +// ChainsInfo returns the latest info for a given list of chains func (k Keeper) ChainsInfo(c context.Context, req *types.QueryChainsInfoRequest) (*types.QueryChainsInfoResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") @@ -103,24 +103,51 @@ func (k Keeper) Header(c context.Context, req *types.QueryHeaderRequest) (*types return resp, nil } -// EpochChainInfo returns the info of a chain with given ID in a given epoch -func (k Keeper) EpochChainInfo(c context.Context, req *types.QueryEpochChainInfoRequest) (*types.QueryEpochChainInfoResponse, error) { +// EpochChainsInfo returns the latest info for list of chains in a given epoch +func (k Keeper) EpochChainsInfo(c context.Context, req *types.QueryEpochChainsInfoRequest) (*types.QueryEpochChainsInfoResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - if len(req.ChainId) == 0 { - return nil, status.Error(codes.InvalidArgument, "chain ID cannot be empty") + // return if no chain IDs are provided + if len(req.ChainIds) == 0 { + return nil, status.Error(codes.InvalidArgument, "chain IDs cannot be empty") + } + + // return if chain IDs exceed the limit + if len(req.ChainIds) > maxQueryChainsInfoLimit { + return nil, status.Errorf(codes.InvalidArgument, "cannot query more than %d chains", maxQueryChainsInfoLimit) + } + + // return if chain IDs contain duplicates or empty strings + if err := bbntypes.CheckForDuplicatesAndEmptyStrings(req.ChainIds); err != nil { + return nil, status.Error(codes.InvalidArgument, types.ErrInvalidChainIDs.Wrap(err.Error()).Error()) } ctx := sdk.UnwrapSDKContext(c) + var chainsInfo []*types.ChainInfo + for _, chainID := range req.ChainIds { + // check if chain ID is valid + if !k.HasChainInfo(ctx, chainID) { + return nil, status.Error(codes.InvalidArgument, types.ErrChainInfoNotFound.Wrapf("chain ID %s", chainID).Error()) + } - // find the chain info of the given epoch - chainInfo, err := k.GetEpochChainInfo(ctx, req.ChainId, req.EpochNum) - if err != nil { - return nil, err + // if the chain info is not found in the given epoch, return with empty fields + if !k.EpochChainInfoExists(ctx, chainID, req.EpochNum) { + chainsInfo = append(chainsInfo, &types.ChainInfo{ChainId: chainID}) + continue + } + + // find the chain info of the given epoch + chainInfo, err := k.GetEpochChainInfo(ctx, chainID, req.EpochNum) + if err != nil { + return nil, err + } + + chainsInfo = append(chainsInfo, chainInfo) } - resp := &types.QueryEpochChainInfoResponse{ChainInfo: chainInfo} + + resp := &types.QueryEpochChainsInfoResponse{ChainsInfo: chainsInfo} return resp, nil } @@ -179,7 +206,7 @@ func (k Keeper) ListEpochHeaders(c context.Context, req *types.QueryListEpochHea return resp, nil } -// FinalizedChainsInfo returns the finalized info of chains with given IDs +// FinalizedChainsInfo returns the finalized info for a given list of chains func (k Keeper) FinalizedChainsInfo(c context.Context, req *types.QueryFinalizedChainsInfoRequest) (*types.QueryFinalizedChainsInfoResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") @@ -210,9 +237,14 @@ func (k Keeper) FinalizedChainsInfo(c context.Context, req *types.QueryFinalized } for _, chainID := range req.ChainIds { + // check if chain ID is valid + if !k.HasChainInfo(ctx, chainID) { + return nil, status.Error(codes.InvalidArgument, types.ErrChainInfoNotFound.Wrapf("chain ID %s", chainID).Error()) + } + data := &types.FinalizedChainInfo{ChainId: chainID} - // if the chain info is not found in the last finalised epoch, return the chain info with empty fields + // if the chain info is not found in the last finalised epoch, return with empty fields if !k.EpochChainInfoExists(ctx, chainID, lastFinalizedEpoch) { resp.FinalizedChainsInfo = append(resp.FinalizedChainsInfo, data) continue diff --git a/x/zoneconcierge/keeper/grpc_query_test.go b/x/zoneconcierge/keeper/grpc_query_test.go index e699942f7..08ad7f6cf 100644 --- a/x/zoneconcierge/keeper/grpc_query_test.go +++ b/x/zoneconcierge/keeper/grpc_query_test.go @@ -20,9 +20,10 @@ import ( ) type chainInfo struct { - chainID string - numHeaders uint64 - numForkHeaders uint64 + chainID string + numHeaders uint64 + numForkHeaders uint64 + headerStartHeight uint64 } func FuzzChainList(f *testing.F) { @@ -108,10 +109,10 @@ func FuzzChainsInfo(f *testing.F) { }) require.NoError(t, err) - for i, data := range resp.ChainsInfo { - require.Equal(t, chainsInfo[i].chainID, data.ChainId) - require.Equal(t, chainsInfo[i].numHeaders-1, data.LatestHeader.Height) - require.Equal(t, chainsInfo[i].numForkHeaders, uint64(len(data.LatestForks.Headers))) + for i, respData := range resp.ChainsInfo { + require.Equal(t, chainsInfo[i].chainID, respData.ChainId) + require.Equal(t, chainsInfo[i].numHeaders-1, respData.LatestHeader.Height) + require.Equal(t, chainsInfo[i].numForkHeaders, uint64(len(respData.LatestForks.Headers))) } }) } @@ -151,50 +152,100 @@ func FuzzHeader(f *testing.F) { }) } -func FuzzEpochChainInfo(f *testing.F) { +func FuzzEpochChainsInfo(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { r := rand.New(rand.NewSource(seed)) - - _, babylonChain, czChain, babylonApp := SetupTest(t) + _, babylonChain, _, babylonApp := SetupTest(t) zcKeeper := babylonApp.ZoneConciergeKeeper ctx := babylonChain.GetContext() hooks := zcKeeper.Hooks() - numReqs := datagen.RandomInt(r, 5) + 1 + // generate a random number of chains + numChains := datagen.RandomInt(r, 10) + 1 + var chainIDs []string + for j := uint64(0); j < numChains; j++ { + chainID := datagen.GenRandomHexStr(r, 30) + chainIDs = append(chainIDs, chainID) + } - epochNumList := []uint64{datagen.RandomInt(r, 10) + 1} - nextHeightList := []uint64{0} - numHeadersList := []uint64{} - numForkHeadersList := []uint64{} + // generate a random number of epochNums + totalNumEpochs := datagen.RandomInt(r, 5) + 1 + epochNums := []uint64{datagen.RandomInt(r, 10) + 1} + for i := uint64(1); i < totalNumEpochs; i++ { + nextEpoch := epochNums[i-1] + datagen.RandomInt(r, 10) + 1 + epochNums = append(epochNums, nextEpoch) + } - // we test the scenario of ending an epoch for multiple times, in order to ensure that - // consecutive epoch infos do not affect each other. - for i := uint64(0); i < numReqs; i++ { - // generate a random number of headers and fork headers - numHeadersList = append(numHeadersList, datagen.RandomInt(r, 100)+1) - numForkHeadersList = append(numForkHeadersList, datagen.RandomInt(r, 10)+1) - // trigger hooks to append these headers and fork headers - SimulateHeadersAndForksViaHook(ctx, r, hooks, czChain.ChainID, nextHeightList[i], numHeadersList[i], numForkHeadersList[i]) - // prepare nextHeight for the next request - nextHeightList = append(nextHeightList, nextHeightList[i]+numHeadersList[i]) + // we insert random number of headers and fork headers for each chain in each epoch, + // chainHeaderStartHeights keeps track of the next start height of header for each chain + chainHeaderStartHeights := make([]uint64, numChains) + epochToChainInfo := make(map[uint64]map[string]chainInfo) + for _, epochNum := range epochNums { + epochToChainInfo[epochNum] = make(map[string]chainInfo) + for j, chainID := range chainIDs { + // generate a random number of headers and fork headers for each chain + numHeaders := datagen.RandomInt(r, 100) + 1 + numForkHeaders := datagen.RandomInt(r, 10) + 1 + + // trigger hooks to append these headers and fork headers + SimulateHeadersAndForksViaHook(ctx, r, hooks, chainID, chainHeaderStartHeights[j], numHeaders, numForkHeaders) + + epochToChainInfo[epochNum][chainID] = chainInfo{ + chainID: chainID, + numHeaders: numHeaders, + numForkHeaders: numForkHeaders, + headerStartHeight: chainHeaderStartHeights[j], + } + + // update next insertion height for this chain + chainHeaderStartHeights[j] += numHeaders + } // simulate the scenario that a random epoch has ended - hooks.AfterEpochEnds(ctx, epochNumList[i]) - // prepare epochNum for the next request - epochNumList = append(epochNumList, epochNumList[i]+datagen.RandomInt(r, 10)+1) + hooks.AfterEpochEnds(ctx, epochNum) } - // attest the correctness of epoch info for each tested epoch - for i := uint64(0); i < numReqs; i++ { - resp, err := zcKeeper.EpochChainInfo(ctx, &zctypes.QueryEpochChainInfoRequest{EpochNum: epochNumList[i], ChainId: czChain.ChainID}) + // assert correctness of best case scenario + for _, epochNum := range epochNums { + resp, err := zcKeeper.EpochChainsInfo(ctx, &zctypes.QueryEpochChainsInfoRequest{EpochNum: epochNum, ChainIds: chainIDs}) require.NoError(t, err) - chainInfo := resp.ChainInfo - require.Equal(t, nextHeightList[i+1]-1, chainInfo.LatestHeader.Height) - require.Equal(t, numForkHeadersList[i], uint64(len(chainInfo.LatestForks.Headers))) + epochChainsInfo := resp.ChainsInfo + require.Len(t, epochChainsInfo, int(numChains)) + for _, info := range epochChainsInfo { + require.Equal(t, epochToChainInfo[epochNum][info.ChainId].numForkHeaders, uint64(len(info.LatestForks.Headers))) + + actualHeight := epochToChainInfo[epochNum][info.ChainId].headerStartHeight + (epochToChainInfo[epochNum][info.ChainId].numHeaders - 1) + require.Equal(t, actualHeight, info.LatestHeader.Height) + + } + } + + // if num of chain ids exceed the max limit, query should fail + largeNumChains := datagen.RandomInt(r, 10) + 101 + var maxChainIDs []string + for i := uint64(0); i < largeNumChains; i++ { + maxChainIDs = append(maxChainIDs, datagen.GenRandomHexStr(r, 30)) } + randomEpochNum := datagen.RandomInt(r, 10) + 1 + _, err := zcKeeper.EpochChainsInfo(ctx, &zctypes.QueryEpochChainsInfoRequest{EpochNum: randomEpochNum, ChainIds: maxChainIDs}) + require.Error(t, err) + + // if no input is passed in, query should fail + _, err = zcKeeper.EpochChainsInfo(ctx, &zctypes.QueryEpochChainsInfoRequest{EpochNum: randomEpochNum, ChainIds: nil}) + require.Error(t, err) + + // if len of chain ids is 0, query should fail + _, err = zcKeeper.EpochChainsInfo(ctx, &zctypes.QueryEpochChainsInfoRequest{EpochNum: randomEpochNum, ChainIds: []string{}}) + require.Error(t, err) + + // if chain ids contain duplicates, query should fail + randomChainID := datagen.GenRandomHexStr(r, 30) + dupChainIds := []string{randomChainID, randomChainID} + _, err = zcKeeper.EpochChainsInfo(ctx, &zctypes.QueryEpochChainsInfoRequest{EpochNum: randomEpochNum, ChainIds: dupChainIds}) + require.Error(t, err) }) } @@ -385,11 +436,10 @@ func FuzzFinalizedChainInfo(f *testing.F) { // check if the chain info of this epoch is recorded or not resp, err := zcKeeper.FinalizedChainsInfo(ctx, &zctypes.QueryFinalizedChainsInfoRequest{ChainIds: chainIDs, Prove: true}) require.NoError(t, err) - for i, data := range resp.FinalizedChainsInfo { - finalizedInfo := data.FinalizedChainInfo - require.Equal(t, chainsInfo[i].chainID, data.ChainId) - require.Equal(t, chainsInfo[i].numHeaders-1, finalizedInfo.LatestHeader.Height) - require.Equal(t, chainsInfo[i].numForkHeaders, uint64(len(finalizedInfo.LatestForks.Headers))) + for i, respData := range resp.FinalizedChainsInfo { + require.Equal(t, chainsInfo[i].chainID, respData.FinalizedChainInfo.ChainId) + require.Equal(t, chainsInfo[i].numHeaders-1, respData.FinalizedChainInfo.LatestHeader.Height) + require.Equal(t, chainsInfo[i].numForkHeaders, uint64(len(respData.FinalizedChainInfo.LatestForks.Headers))) } }) } diff --git a/x/zoneconcierge/keeper/hooks.go b/x/zoneconcierge/keeper/hooks.go index 12e58ee3c..95b52a65f 100644 --- a/x/zoneconcierge/keeper/hooks.go +++ b/x/zoneconcierge/keeper/hooks.go @@ -3,12 +3,12 @@ package keeper import ( "fmt" - errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" epochingtypes "github.com/babylonchain/babylon/x/epoching/types" extendedkeeper "github.com/babylonchain/babylon/x/zoneconcierge/extended-client-keeper" "github.com/babylonchain/babylon/x/zoneconcierge/types" - sdk "github.com/cosmos/cosmos-sdk/types" ) type Hooks struct { @@ -28,22 +28,26 @@ func (h Hooks) AfterHeaderWithValidCommit(ctx sdk.Context, txHash []byte, header indexedHeader := types.IndexedHeader{ ChainId: header.ChaindId, Hash: header.Hash, - Height: uint64(header.Height), + Height: header.Height, BabylonHeader: &babylonHeader, BabylonEpoch: h.k.GetEpoch(ctx).EpochNumber, BabylonTxHash: txHash, } - // initialise chain info if not exist - chainInfo, err := h.k.GetChainInfo(ctx, indexedHeader.ChainId) - if err != nil { - if errorsmod.IsOf(err, types.ErrEpochChainInfoNotFound) { - // chain info does not exist yet, initialise chain info for this chain - chainInfo, err = h.k.InitChainInfo(ctx, indexedHeader.ChainId) - if err != nil { - panic(fmt.Errorf("failed to initialize chain info of %s: %w", indexedHeader.ChainId, err)) - } - } else { + var ( + chainInfo *types.ChainInfo + err error + ) + if !h.k.HasChainInfo(ctx, indexedHeader.ChainId) { + // chain info does not exist yet, initialise chain info for this chain + chainInfo, err = h.k.InitChainInfo(ctx, indexedHeader.ChainId) + if err != nil { + panic(fmt.Errorf("failed to initialize chain info of %s: %w", indexedHeader.ChainId, err)) + } + } else { + // get chain info + chainInfo, err = h.k.GetChainInfo(ctx, indexedHeader.ChainId) + if err != nil { panic(fmt.Errorf("failed to get chain info of %s: %w", indexedHeader.ChainId, err)) } } diff --git a/x/zoneconcierge/types/query.pb.go b/x/zoneconcierge/types/query.pb.go index ca1f0842c..fa90d6a3d 100644 --- a/x/zoneconcierge/types/query.pb.go +++ b/x/zoneconcierge/types/query.pb.go @@ -329,25 +329,25 @@ func (m *QueryChainsInfoResponse) GetChainsInfo() []*ChainInfo { return nil } -// QueryEpochChainInfoRequest is request type for the Query/EpochChainInfo RPC +// QueryEpochChainsInfoRequest is request type for the Query/EpochChainsInfo RPC // method. -type QueryEpochChainInfoRequest struct { - EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` - ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +type QueryEpochChainsInfoRequest struct { + EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` + ChainIds []string `protobuf:"bytes,2,rep,name=chain_ids,json=chainIds,proto3" json:"chain_ids,omitempty"` } -func (m *QueryEpochChainInfoRequest) Reset() { *m = QueryEpochChainInfoRequest{} } -func (m *QueryEpochChainInfoRequest) String() string { return proto.CompactTextString(m) } -func (*QueryEpochChainInfoRequest) ProtoMessage() {} -func (*QueryEpochChainInfoRequest) Descriptor() ([]byte, []int) { +func (m *QueryEpochChainsInfoRequest) Reset() { *m = QueryEpochChainsInfoRequest{} } +func (m *QueryEpochChainsInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEpochChainsInfoRequest) ProtoMessage() {} +func (*QueryEpochChainsInfoRequest) Descriptor() ([]byte, []int) { return fileDescriptor_cd665af90102da38, []int{6} } -func (m *QueryEpochChainInfoRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryEpochChainsInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryEpochChainInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryEpochChainsInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryEpochChainInfoRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryEpochChainsInfoRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -357,51 +357,51 @@ func (m *QueryEpochChainInfoRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryEpochChainInfoRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryEpochChainInfoRequest.Merge(m, src) +func (m *QueryEpochChainsInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEpochChainsInfoRequest.Merge(m, src) } -func (m *QueryEpochChainInfoRequest) XXX_Size() int { +func (m *QueryEpochChainsInfoRequest) XXX_Size() int { return m.Size() } -func (m *QueryEpochChainInfoRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryEpochChainInfoRequest.DiscardUnknown(m) +func (m *QueryEpochChainsInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEpochChainsInfoRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryEpochChainInfoRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryEpochChainsInfoRequest proto.InternalMessageInfo -func (m *QueryEpochChainInfoRequest) GetEpochNum() uint64 { +func (m *QueryEpochChainsInfoRequest) GetEpochNum() uint64 { if m != nil { return m.EpochNum } return 0 } -func (m *QueryEpochChainInfoRequest) GetChainId() string { +func (m *QueryEpochChainsInfoRequest) GetChainIds() []string { if m != nil { - return m.ChainId + return m.ChainIds } - return "" + return nil } -// QueryEpochChainInfoResponse is response type for the Query/EpochChainInfo RPC +// QueryEpochChainsInfoResponse is response type for the Query/EpochChainsInfo RPC // method. -type QueryEpochChainInfoResponse struct { +type QueryEpochChainsInfoResponse struct { // chain_info is the info of the CZ - ChainInfo *ChainInfo `protobuf:"bytes,1,opt,name=chain_info,json=chainInfo,proto3" json:"chain_info,omitempty"` + ChainsInfo []*ChainInfo `protobuf:"bytes,1,rep,name=chains_info,json=chainsInfo,proto3" json:"chains_info,omitempty"` } -func (m *QueryEpochChainInfoResponse) Reset() { *m = QueryEpochChainInfoResponse{} } -func (m *QueryEpochChainInfoResponse) String() string { return proto.CompactTextString(m) } -func (*QueryEpochChainInfoResponse) ProtoMessage() {} -func (*QueryEpochChainInfoResponse) Descriptor() ([]byte, []int) { +func (m *QueryEpochChainsInfoResponse) Reset() { *m = QueryEpochChainsInfoResponse{} } +func (m *QueryEpochChainsInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEpochChainsInfoResponse) ProtoMessage() {} +func (*QueryEpochChainsInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_cd665af90102da38, []int{7} } -func (m *QueryEpochChainInfoResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryEpochChainsInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryEpochChainInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryEpochChainsInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryEpochChainInfoResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryEpochChainsInfoResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -411,21 +411,21 @@ func (m *QueryEpochChainInfoResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryEpochChainInfoResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryEpochChainInfoResponse.Merge(m, src) +func (m *QueryEpochChainsInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEpochChainsInfoResponse.Merge(m, src) } -func (m *QueryEpochChainInfoResponse) XXX_Size() int { +func (m *QueryEpochChainsInfoResponse) XXX_Size() int { return m.Size() } -func (m *QueryEpochChainInfoResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryEpochChainInfoResponse.DiscardUnknown(m) +func (m *QueryEpochChainsInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEpochChainsInfoResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryEpochChainInfoResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryEpochChainsInfoResponse proto.InternalMessageInfo -func (m *QueryEpochChainInfoResponse) GetChainInfo() *ChainInfo { +func (m *QueryEpochChainsInfoResponse) GetChainsInfo() []*ChainInfo { if m != nil { - return m.ChainInfo + return m.ChainsInfo } return nil } @@ -909,8 +909,8 @@ func init() { proto.RegisterType((*QueryChainListResponse)(nil), "babylon.zoneconcierge.v1.QueryChainListResponse") proto.RegisterType((*QueryChainsInfoRequest)(nil), "babylon.zoneconcierge.v1.QueryChainsInfoRequest") proto.RegisterType((*QueryChainsInfoResponse)(nil), "babylon.zoneconcierge.v1.QueryChainsInfoResponse") - proto.RegisterType((*QueryEpochChainInfoRequest)(nil), "babylon.zoneconcierge.v1.QueryEpochChainInfoRequest") - proto.RegisterType((*QueryEpochChainInfoResponse)(nil), "babylon.zoneconcierge.v1.QueryEpochChainInfoResponse") + proto.RegisterType((*QueryEpochChainsInfoRequest)(nil), "babylon.zoneconcierge.v1.QueryEpochChainsInfoRequest") + proto.RegisterType((*QueryEpochChainsInfoResponse)(nil), "babylon.zoneconcierge.v1.QueryEpochChainsInfoResponse") proto.RegisterType((*QueryListHeadersRequest)(nil), "babylon.zoneconcierge.v1.QueryListHeadersRequest") proto.RegisterType((*QueryListHeadersResponse)(nil), "babylon.zoneconcierge.v1.QueryListHeadersResponse") proto.RegisterType((*QueryListEpochHeadersRequest)(nil), "babylon.zoneconcierge.v1.QueryListEpochHeadersRequest") @@ -926,76 +926,76 @@ func init() { } var fileDescriptor_cd665af90102da38 = []byte{ - // 1103 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,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, 0x00, 0x00, + // 1101 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xce, 0x3a, 0x1f, 0x4d, 0x5e, 0xf3, 0x51, 0x4d, 0xda, 0x62, 0xb6, 0xad, 0x6b, 0x2d, 0x1f, + 0x4d, 0x4b, 0xb2, 0x8b, 0x5d, 0xd2, 0xaa, 0x5c, 0xaa, 0x36, 0x25, 0x69, 0x54, 0x54, 0xda, 0x85, + 0x80, 0xc4, 0x65, 0xd9, 0x5d, 0x8f, 0xed, 0x55, 0xe2, 0x1d, 0xd7, 0xb3, 0x76, 0xeb, 0x86, 0x70, + 0x40, 0xfc, 0x00, 0x24, 0x2e, 0x88, 0x13, 0x27, 0x0e, 0x1c, 0x7a, 0xe3, 0x27, 0x20, 0x71, 0xe0, + 0x50, 0x89, 0x0b, 0x47, 0x94, 0xf0, 0x0b, 0xb8, 0x23, 0xa1, 0x9d, 0x99, 0xb5, 0xf7, 0xd3, 0x5e, + 0x87, 0xdc, 0x32, 0xe3, 0xf7, 0x7d, 0x9e, 0xe7, 0xfd, 0x9a, 0x77, 0x03, 0x6f, 0x5a, 0xa6, 0x35, + 0xd8, 0x23, 0xae, 0xf6, 0x8c, 0xb8, 0xd8, 0x26, 0xae, 0xed, 0xe0, 0x6e, 0x13, 0x6b, 0xfd, 0xaa, + 0xf6, 0xb8, 0x87, 0xbb, 0x03, 0xb5, 0xd3, 0x25, 0x1e, 0x41, 0x25, 0x61, 0xa5, 0x46, 0xac, 0xd4, + 0x7e, 0x55, 0xbe, 0xd0, 0x24, 0xa4, 0xb9, 0x87, 0x35, 0xb3, 0xe3, 0x68, 0xa6, 0xeb, 0x12, 0xcf, + 0xf4, 0x1c, 0xe2, 0x52, 0xee, 0x27, 0x5f, 0xb5, 0x09, 0x6d, 0x13, 0xaa, 0x59, 0x26, 0xc5, 0x1c,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 0x8f, 0xf2, 0xda, 0x7f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x4b, 0x80, 0x0f, 0x7d, 0x88, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1014,11 +1014,11 @@ type QueryClient interface { Header(ctx context.Context, in *QueryHeaderRequest, opts ...grpc.CallOption) (*QueryHeaderResponse, error) // ChainList queries the list of chains that checkpoint to Babylon ChainList(ctx context.Context, in *QueryChainListRequest, opts ...grpc.CallOption) (*QueryChainListResponse, error) - // ChainInfo queries the latest info of a chain in Babylon's view + // ChainsInfo queries the latest info for a given list of chains in Babylon's view ChainsInfo(ctx context.Context, in *QueryChainsInfoRequest, opts ...grpc.CallOption) (*QueryChainsInfoResponse, error) - // EpochChainInfo queries the latest info of a chain in a given epoch of - // Babylon's view - EpochChainInfo(ctx context.Context, in *QueryEpochChainInfoRequest, opts ...grpc.CallOption) (*QueryEpochChainInfoResponse, error) + // EpochChainsInfo queries the latest info for a list of chains + // in a given epoch in Babylon's view + EpochChainsInfo(ctx context.Context, in *QueryEpochChainsInfoRequest, opts ...grpc.CallOption) (*QueryEpochChainsInfoResponse, error) // ListHeaders queries the headers of a chain in Babylon's view, with // pagination support ListHeaders(ctx context.Context, in *QueryListHeadersRequest, opts ...grpc.CallOption) (*QueryListHeadersResponse, error) @@ -1067,9 +1067,9 @@ func (c *queryClient) ChainsInfo(ctx context.Context, in *QueryChainsInfoRequest return out, nil } -func (c *queryClient) EpochChainInfo(ctx context.Context, in *QueryEpochChainInfoRequest, opts ...grpc.CallOption) (*QueryEpochChainInfoResponse, error) { - out := new(QueryEpochChainInfoResponse) - err := c.cc.Invoke(ctx, "/babylon.zoneconcierge.v1.Query/EpochChainInfo", in, out, opts...) +func (c *queryClient) EpochChainsInfo(ctx context.Context, in *QueryEpochChainsInfoRequest, opts ...grpc.CallOption) (*QueryEpochChainsInfoResponse, error) { + out := new(QueryEpochChainsInfoResponse) + err := c.cc.Invoke(ctx, "/babylon.zoneconcierge.v1.Query/EpochChainsInfo", in, out, opts...) if err != nil { return nil, err } @@ -1118,11 +1118,11 @@ type QueryServer interface { Header(context.Context, *QueryHeaderRequest) (*QueryHeaderResponse, error) // ChainList queries the list of chains that checkpoint to Babylon ChainList(context.Context, *QueryChainListRequest) (*QueryChainListResponse, error) - // ChainInfo queries the latest info of a chain in Babylon's view + // ChainsInfo queries the latest info for a given list of chains in Babylon's view ChainsInfo(context.Context, *QueryChainsInfoRequest) (*QueryChainsInfoResponse, error) - // EpochChainInfo queries the latest info of a chain in a given epoch of - // Babylon's view - EpochChainInfo(context.Context, *QueryEpochChainInfoRequest) (*QueryEpochChainInfoResponse, error) + // EpochChainsInfo queries the latest info for a list of chains + // in a given epoch in Babylon's view + EpochChainsInfo(context.Context, *QueryEpochChainsInfoRequest) (*QueryEpochChainsInfoResponse, error) // ListHeaders queries the headers of a chain in Babylon's view, with // pagination support ListHeaders(context.Context, *QueryListHeadersRequest) (*QueryListHeadersResponse, error) @@ -1149,8 +1149,8 @@ func (*UnimplementedQueryServer) ChainList(ctx context.Context, req *QueryChainL func (*UnimplementedQueryServer) ChainsInfo(ctx context.Context, req *QueryChainsInfoRequest) (*QueryChainsInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChainsInfo not implemented") } -func (*UnimplementedQueryServer) EpochChainInfo(ctx context.Context, req *QueryEpochChainInfoRequest) (*QueryEpochChainInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method EpochChainInfo not implemented") +func (*UnimplementedQueryServer) EpochChainsInfo(ctx context.Context, req *QueryEpochChainsInfoRequest) (*QueryEpochChainsInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EpochChainsInfo not implemented") } func (*UnimplementedQueryServer) ListHeaders(ctx context.Context, req *QueryListHeadersRequest) (*QueryListHeadersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListHeaders not implemented") @@ -1223,20 +1223,20 @@ func _Query_ChainsInfo_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } -func _Query_EpochChainInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryEpochChainInfoRequest) +func _Query_EpochChainsInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEpochChainsInfoRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).EpochChainInfo(ctx, in) + return srv.(QueryServer).EpochChainsInfo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.zoneconcierge.v1.Query/EpochChainInfo", + FullMethod: "/babylon.zoneconcierge.v1.Query/EpochChainsInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).EpochChainInfo(ctx, req.(*QueryEpochChainInfoRequest)) + return srv.(QueryServer).EpochChainsInfo(ctx, req.(*QueryEpochChainsInfoRequest)) } return interceptor(ctx, in, info, handler) } @@ -1330,8 +1330,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_ChainsInfo_Handler, }, { - MethodName: "EpochChainInfo", - Handler: _Query_EpochChainInfo_Handler, + MethodName: "EpochChainsInfo", + Handler: _Query_EpochChainsInfo_Handler, }, { MethodName: "ListHeaders", @@ -1584,7 +1584,7 @@ func (m *QueryChainsInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryEpochChainInfoRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryEpochChainsInfoRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1594,22 +1594,24 @@ func (m *QueryEpochChainInfoRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryEpochChainInfoRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryEpochChainsInfoRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryEpochChainInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryEpochChainsInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0x12 + if len(m.ChainIds) > 0 { + for iNdEx := len(m.ChainIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ChainIds[iNdEx]) + copy(dAtA[i:], m.ChainIds[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainIds[iNdEx]))) + i-- + dAtA[i] = 0x12 + } } if m.EpochNum != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.EpochNum)) @@ -1619,7 +1621,7 @@ func (m *QueryEpochChainInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func (m *QueryEpochChainInfoResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryEpochChainsInfoResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1629,27 +1631,29 @@ func (m *QueryEpochChainInfoResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryEpochChainInfoResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryEpochChainsInfoResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryEpochChainInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryEpochChainsInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.ChainInfo != nil { - { - size, err := m.ChainInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.ChainsInfo) > 0 { + for iNdEx := len(m.ChainsInfo) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ChainsInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -2130,7 +2134,7 @@ func (m *QueryChainsInfoResponse) Size() (n int) { return n } -func (m *QueryEpochChainInfoRequest) Size() (n int) { +func (m *QueryEpochChainsInfoRequest) Size() (n int) { if m == nil { return 0 } @@ -2139,22 +2143,26 @@ func (m *QueryEpochChainInfoRequest) Size() (n int) { if m.EpochNum != 0 { n += 1 + sovQuery(uint64(m.EpochNum)) } - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ChainIds) > 0 { + for _, s := range m.ChainIds { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } } return n } -func (m *QueryEpochChainInfoResponse) Size() (n int) { +func (m *QueryEpochChainsInfoResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.ChainInfo != nil { - l = m.ChainInfo.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.ChainsInfo) > 0 { + for _, e := range m.ChainsInfo { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } } return n } @@ -2906,7 +2914,7 @@ func (m *QueryChainsInfoResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryEpochChainInfoRequest) Unmarshal(dAtA []byte) error { +func (m *QueryEpochChainsInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2929,10 +2937,10 @@ func (m *QueryEpochChainInfoRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryEpochChainInfoRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEpochChainsInfoRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryEpochChainInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEpochChainsInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2956,7 +2964,7 @@ func (m *QueryEpochChainInfoRequest) Unmarshal(dAtA []byte) error { } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainIds", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2984,7 +2992,7 @@ func (m *QueryEpochChainInfoRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.ChainIds = append(m.ChainIds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -3007,7 +3015,7 @@ func (m *QueryEpochChainInfoRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryEpochChainInfoResponse) Unmarshal(dAtA []byte) error { +func (m *QueryEpochChainsInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3030,15 +3038,15 @@ func (m *QueryEpochChainInfoResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryEpochChainInfoResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEpochChainsInfoResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryEpochChainInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEpochChainsInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainInfo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainsInfo", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3065,10 +3073,8 @@ func (m *QueryEpochChainInfoResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ChainInfo == nil { - m.ChainInfo = &ChainInfo{} - } - if err := m.ChainInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ChainsInfo = append(m.ChainsInfo, &ChainInfo{}) + if err := m.ChainsInfo[len(m.ChainsInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/zoneconcierge/types/query.pb.gw.go b/x/zoneconcierge/types/query.pb.gw.go index 5b7d961fd..607477240 100644 --- a/x/zoneconcierge/types/query.pb.gw.go +++ b/x/zoneconcierge/types/query.pb.gw.go @@ -181,78 +181,38 @@ func local_request_Query_ChainsInfo_0(ctx context.Context, marshaler runtime.Mar } -func request_Query_EpochChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryEpochChainInfoRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) +var ( + filter_Query_EpochChainsInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } +func request_Query_EpochChainsInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEpochChainsInfoRequest + var metadata runtime.ServerMetadata - val, ok = pathParams["epoch_num"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - - protoReq.EpochNum, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EpochChainsInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.EpochChainInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.EpochChainsInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_EpochChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryEpochChainInfoRequest +func local_request_Query_EpochChainsInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEpochChainsInfoRequest var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - val, ok = pathParams["epoch_num"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - - protoReq.EpochNum, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EpochChainsInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.EpochChainInfo(ctx, &protoReq) + msg, err := server.EpochChainsInfo(ctx, &protoReq) return msg, metadata, err } @@ -610,7 +570,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_EpochChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_EpochChainsInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -621,7 +581,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_EpochChainInfo_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_EpochChainsInfo_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 { @@ -629,7 +589,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_EpochChainInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_EpochChainsInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -826,7 +786,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_EpochChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_EpochChainsInfo_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) @@ -835,14 +795,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_EpochChainInfo_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_EpochChainsInfo_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_EpochChainInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_EpochChainsInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -936,7 +896,7 @@ var ( pattern_Query_ChainsInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "zoneconcierge", "v1", "chains_info"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_EpochChainInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"babylon", "zoneconcierge", "v1", "chain_info", "chain_id", "epochs", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_EpochChainsInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "zoneconcierge", "v1", "epoch_chains_info"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ListHeaders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "zoneconcierge", "v1", "headers", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) @@ -954,7 +914,7 @@ var ( forward_Query_ChainsInfo_0 = runtime.ForwardResponseMessage - forward_Query_EpochChainInfo_0 = runtime.ForwardResponseMessage + forward_Query_EpochChainsInfo_0 = runtime.ForwardResponseMessage forward_Query_ListHeaders_0 = runtime.ForwardResponseMessage