Merge branch 'master' into sunny/change-pubkey-adr
This commit is contained in:
commit
dc9d36bfbd
@ -382,6 +382,11 @@ func (app *BaseApp) snapshot(height int64) {
|
||||
func (app *BaseApp) Query(req abci.RequestQuery) abci.ResponseQuery {
|
||||
defer telemetry.MeasureSince(time.Now(), "abci", "query")
|
||||
|
||||
// when a client did not provide a query height, manually inject the latest
|
||||
if req.Height == 0 {
|
||||
req.Height = app.LastBlockHeight()
|
||||
}
|
||||
|
||||
// handle gRPC routes first rather than calling splitPath because '/' characters
|
||||
// are used as part of gRPC paths
|
||||
if grpcHandler := app.grpcQueryRouter.Route(req.Path); grpcHandler != nil {
|
||||
@ -742,11 +747,6 @@ func handleQueryStore(app *BaseApp, path []string, req abci.RequestQuery) abci.R
|
||||
|
||||
req.Path = "/" + strings.Join(path[1:], "/")
|
||||
|
||||
// when a client did not provide a query height, manually inject the latest
|
||||
if req.Height == 0 {
|
||||
req.Height = app.LastBlockHeight()
|
||||
}
|
||||
|
||||
if req.Height <= 1 && req.Prove {
|
||||
return sdkerrors.QueryResult(
|
||||
sdkerrors.Wrap(
|
||||
|
||||
1441
client/docs/swagger-ui/swagger.yaml
vendored
1441
client/docs/swagger-ui/swagger.yaml
vendored
File diff suppressed because it is too large
Load Diff
@ -1,22 +0,0 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// ErrInvalidAccount returns a standardized error reflecting that a given
|
||||
// account address does not exist.
|
||||
func ErrInvalidAccount(addr sdk.AccAddress) error {
|
||||
return fmt.Errorf(`no account with address %s was found in the state.
|
||||
Are you sure there has been a transaction involving it?`, addr)
|
||||
}
|
||||
|
||||
// ErrVerifyCommit returns a common error reflecting that the blockchain commit at a given
|
||||
// height can't be verified. The reason is that the base checkpoint of the certifier is
|
||||
// newer than the given height
|
||||
func ErrVerifyCommit(height int64) error {
|
||||
return fmt.Errorf(`the height of base truststore in the light client is higher than height %d.
|
||||
Can't verify blockchain proof at this height. Please set --trust-node to true and try again`, height)
|
||||
}
|
||||
@ -6,12 +6,17 @@ import (
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// DeprecationURL is the URL for migrating deprecated REST endpoints to newer ones.
|
||||
// TODO Switch to `/` (not `/master`) once v0.40 docs are deployed.
|
||||
// https://github.com/cosmos/cosmos-sdk/issues/8019
|
||||
const DeprecationURL = "https://docs.cosmos.network/master/migrations/rest.html"
|
||||
|
||||
// addHTTPDeprecationHeaders is a mux middleware function for adding HTTP
|
||||
// Deprecation headers to a http handler
|
||||
func addHTTPDeprecationHeaders(h http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Deprecation", "true")
|
||||
w.Header().Set("Link", "<https://docs.cosmos.network/v0.40/interfaces/rest.html>; rel=\"deprecation\"")
|
||||
w.Header().Set("Link", "<"+DeprecationURL+">; rel=\"deprecation\"")
|
||||
w.Header().Set("Warning", "199 - \"this endpoint is deprecated and may not work as before, see deprecation link for more info\"")
|
||||
h.ServeHTTP(w, r)
|
||||
})
|
||||
|
||||
@ -11,7 +11,6 @@ import (
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/codec/legacy"
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
)
|
||||
|
||||
@ -68,7 +67,7 @@ func getBlock(clientCtx client.Context, height *int64) ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return legacy.Cdc.MarshalJSON(res)
|
||||
return clientCtx.LegacyAmino.MarshalJSON(res)
|
||||
}
|
||||
|
||||
// get the current blockchain height
|
||||
|
||||
@ -61,6 +61,7 @@ func CopyTx(tx signing.Tx, builder client.TxBuilder, ignoreSignatureError bool)
|
||||
builder.SetMemo(tx.GetMemo())
|
||||
builder.SetFeeAmount(tx.GetFee())
|
||||
builder.SetGasLimit(tx.GetGas())
|
||||
builder.SetTimeoutHeight(tx.GetTimeoutHeight())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -21,8 +21,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
memo = "waboom"
|
||||
gas = uint64(10000)
|
||||
memo = "waboom"
|
||||
gas = uint64(10000)
|
||||
timeoutHeight = 5
|
||||
)
|
||||
|
||||
var (
|
||||
@ -47,6 +48,7 @@ func buildTestTx(t *testing.T, builder client.TxBuilder) {
|
||||
require.NoError(t, err)
|
||||
err = builder.SetSignatures(sig)
|
||||
require.NoError(t, err)
|
||||
builder.SetTimeoutHeight(timeoutHeight)
|
||||
}
|
||||
|
||||
type TestSuite struct {
|
||||
@ -105,6 +107,7 @@ func (s *TestSuite) TestConvertTxToStdTx() {
|
||||
s.Require().Equal(gas, stdTx.Fee.Gas)
|
||||
s.Require().Equal(fee, stdTx.Fee.Amount)
|
||||
s.Require().Equal(msg, stdTx.Msgs[0])
|
||||
s.Require().Equal(timeoutHeight, stdTx.TimeoutHeight)
|
||||
s.Require().Equal(sig.PubKey, stdTx.Signatures[0].PubKey)
|
||||
s.Require().Equal(sig.Data.(*signing2.SingleSignatureData).Signature, stdTx.Signatures[0].Signature)
|
||||
|
||||
@ -123,6 +126,7 @@ func (s *TestSuite) TestConvertTxToStdTx() {
|
||||
s.Require().Equal(gas, stdTx.Fee.Gas)
|
||||
s.Require().Equal(fee, stdTx.Fee.Amount)
|
||||
s.Require().Equal(msg, stdTx.Msgs[0])
|
||||
s.Require().Equal(timeoutHeight, stdTx.TimeoutHeight)
|
||||
s.Require().Empty(stdTx.Signatures)
|
||||
|
||||
// std tx
|
||||
|
||||
@ -16,6 +16,10 @@ All `Msg` processing is done by a [`Msg`](messages-and-queries.md#msg-services)
|
||||
|
||||
As further described in [ADR 031](../architecture/adr-031-msg-service.md), this approach has the advantage of clearly specifying return types and generating server and client code.
|
||||
|
||||
Based on the definition of the `Msg` service, Protobuf generates a `MsgServer` interface. It is the role of the module developer to implement this interface, by implementing the state transition logic that should happen upon receival of each `Msg`. As an example, here is the generated `MsgServer` interface for `x/bank`, which exposes two `Msg`s:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/x/bank/types/tx.pb.go#L285-L291
|
||||
|
||||
When possible, the existing module's [`Keeper`](keeper.md) should implement `MsgServer`, otherwise a `msgServer` struct that embeds the `Keeper` can be created, typically in `./keeper/msg_server.go`:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc1/x/bank/keeper/msg_server.go#L14-L16
|
||||
|
||||
@ -8,7 +8,7 @@ parent:
|
||||
|
||||
This repository contains reference documentation on the core concepts of the Cosmos SDK.
|
||||
|
||||
1. [`Baseapp`](./baseapp.md)
|
||||
1. [`BaseApp`](./baseapp.md)
|
||||
2. [Transaction](./transactions.md)
|
||||
3. [Context](./context.md)
|
||||
4. [Node Client](./node.md)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
order: 1
|
||||
-->
|
||||
|
||||
# Baseapp
|
||||
# BaseApp
|
||||
|
||||
This document describes `BaseApp`, the abstraction that implements the core functionalities of an SDK application. {synopsis}
|
||||
|
||||
@ -15,11 +15,9 @@ This document describes `BaseApp`, the abstraction that implements the core func
|
||||
|
||||
`BaseApp` is a base type that implements the core of an SDK application, namely:
|
||||
|
||||
- The [Application Blockchain Interface](#abci), for the state-machine to communicate with the
|
||||
underlying consensus engine (e.g. Tendermint).
|
||||
- A [Router](#routing), to route messages and queries to the appropriate module.
|
||||
- Different [states](#states), as the state-machine can have different volatile
|
||||
states updated based on the ABCI message received.
|
||||
- The [Application Blockchain Interface](#abci), for the state-machine to communicate with the underlying consensus engine (e.g. Tendermint).
|
||||
- [Service Routers](#service-routers), to route messages and queries to the appropriate module.
|
||||
- Different [states](#states), as the state-machine can have different volatile states updated based on the ABCI message received.
|
||||
|
||||
The goal of `BaseApp` is to provide the fundamental layer of an SDK application
|
||||
that developers can easily extend to build their own custom application. Usually,
|
||||
@ -40,67 +38,67 @@ type App struct {
|
||||
|
||||
Extending the application with `BaseApp` gives the former access to all of `BaseApp`'s methods.
|
||||
This allows developers to compose their custom application with the modules they want, while not
|
||||
having to concern themselves with the hard work of implementing the ABCI, the routing and state
|
||||
having to concern themselves with the hard work of implementing the ABCI, the service routers and state
|
||||
management logic.
|
||||
|
||||
## Type Definition
|
||||
|
||||
The `BaseApp` type holds many important parameters for any Cosmos SDK based application.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/baseapp/baseapp.go#L54-L108
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/baseapp/baseapp.go#L46-L131
|
||||
|
||||
Let us go through the most important components.
|
||||
|
||||
> __Note__: Not all parameters are described, only the most important ones. Refer to the
|
||||
type definition for the full list.
|
||||
> **Note**: Not all parameters are described, only the most important ones. Refer to the
|
||||
> type definition for the full list.
|
||||
|
||||
First, the important parameters that are initialized during the bootstrapping of the application:
|
||||
|
||||
- [`CommitMultiStore`](./store.md#commitmultistore): This is the main store of the application,
|
||||
which holds the canonical state that is committed at the [end of each block](#commit). This store
|
||||
is **not** cached, meaning it is not used to update the application's volatile (un-committed) states.
|
||||
The `CommitMultiStore` is a multi-store, meaning a store of stores. Each module of the application
|
||||
uses one or multiple `KVStores` in the multi-store to persist their subset of the state.
|
||||
which holds the canonical state that is committed at the [end of each block](#commit). This store
|
||||
is **not** cached, meaning it is not used to update the application's volatile (un-committed) states.
|
||||
The `CommitMultiStore` is a multi-store, meaning a store of stores. Each module of the application
|
||||
uses one or multiple `KVStores` in the multi-store to persist their subset of the state.
|
||||
- Database: The `db` is used by the `CommitMultiStore` to handle data persistence.
|
||||
- [Router](#message-routing): The `router` facilitates the routing of `messages` to the appropriate
|
||||
module for it to be processed. Here a `message` refers to the transaction components that need to be
|
||||
processed by the application in order to update the state, and not to ABCI messages which implement
|
||||
the interface between the application and the underlying consensus engine.
|
||||
- [Query Router](#query-routing): The `query router` facilitates the routing of queries to the
|
||||
appropriate module for it to be processed. These `queries` are not ABCI messages themselves, but they
|
||||
are relayed to the application from the underlying consensus engine via the ABCI message [`Query`](#query).
|
||||
- [`Msg` Service Router](#msg-service-router): The `msgServiceRouter` facilitates the routing of service `Msg`s to the appropriate
|
||||
module for it to be processed. Here a service `Msg` refers to the transaction components that need to be
|
||||
processed by the application in order to update the state, and not to ABCI messages which implement
|
||||
the interface between the application and the underlying consensus engine.
|
||||
- [gRPC Query Router](#grpc-query-router): The `grpcQueryRouter` facilitates the routing of gRPC queries to the
|
||||
appropriate module for it to be processed. These queries are not ABCI messages themselves, but they
|
||||
are relayed to the relevant module's gRPC `Query` service.
|
||||
- [`TxDecoder`](https://godoc.org/github.com/cosmos/cosmos-sdk/types#TxDecoder): It is used to decode
|
||||
raw transaction bytes relayed by the underlying Tendermint engine.
|
||||
raw transaction bytes relayed by the underlying Tendermint engine.
|
||||
- [`ParamStore`](#paramstore): The parameter store used to get and set application consensus parameters.
|
||||
- [`AnteHandler`](#antehandler): This handler is used to handle signature verification, fee payment,
|
||||
and other pre-message execution checks when a transaction is received. It's executed during
|
||||
[`CheckTx/RecheckTx`](#checktx) and [`DeliverTx`](#delivertx).
|
||||
and other pre-message execution checks when a transaction is received. It's executed during
|
||||
[`CheckTx/RecheckTx`](#checktx) and [`DeliverTx`](#delivertx).
|
||||
- [`InitChainer`](../basics/app-anatomy.md#initchainer),
|
||||
[`BeginBlocker` and `EndBlocker`](../basics/app-anatomy.md#beginblocker-and-endblocker): These are
|
||||
the functions executed when the application receives the `InitChain`, `BeginBlock` and `EndBlock`
|
||||
ABCI messages from the underlying Tendermint engine.
|
||||
[`BeginBlocker` and `EndBlocker`](../basics/app-anatomy.md#beginblocker-and-endblocker): These are
|
||||
the functions executed when the application receives the `InitChain`, `BeginBlock` and `EndBlock`
|
||||
ABCI messages from the underlying Tendermint engine.
|
||||
|
||||
Then, parameters used to define [volatile states](#volatile-states) (i.e. cached states):
|
||||
|
||||
- `checkState`: This state is updated during [`CheckTx`](#checktx), and reset on [`Commit`](#commit).
|
||||
- `deliverState`: This state is updated during [`DeliverTx`](#delivertx), and set to `nil` on
|
||||
[`Commit`](#commit) and gets re-initialized on BeginBlock.
|
||||
[`Commit`](#commit) and gets re-initialized on BeginBlock.
|
||||
|
||||
Finally, a few more important parameterd:
|
||||
|
||||
- `voteInfos`: This parameter carries the list of validators whose precommit is missing, either
|
||||
because they did not vote or because the proposer did not include their vote. This information is
|
||||
carried by the [Context](#context) and can be used by the application for various things like
|
||||
punishing absent validators.
|
||||
because they did not vote or because the proposer did not include their vote. This information is
|
||||
carried by the [Context](#context) and can be used by the application for various things like
|
||||
punishing absent validators.
|
||||
- `minGasPrices`: This parameter defines the minimum gas prices accepted by the node. This is a
|
||||
**local** parameter, meaning each full-node can set a different `minGasPrices`. It is used in the
|
||||
`AnteHandler` during [`CheckTx`](#checktx), mainly as a spam protection mechanism. The transaction
|
||||
enters the [mempool](https://tendermint.com/docs/tendermint-core/mempool.html#transaction-ordering)
|
||||
only if the gas prices of the transaction are greater than one of the minimum gas price in
|
||||
`minGasPrices` (e.g. if `minGasPrices == 1uatom,1photon`, the `gas-price` of the transaction must be
|
||||
greater than `1uatom` OR `1photon`).
|
||||
**local** parameter, meaning each full-node can set a different `minGasPrices`. It is used in the
|
||||
`AnteHandler` during [`CheckTx`](#checktx), mainly as a spam protection mechanism. The transaction
|
||||
enters the [mempool](https://tendermint.com/docs/tendermint-core/mempool.html#transaction-ordering)
|
||||
only if the gas prices of the transaction are greater than one of the minimum gas price in
|
||||
`minGasPrices` (e.g. if `minGasPrices == 1uatom,1photon`, the `gas-price` of the transaction must be
|
||||
greater than `1uatom` OR `1photon`).
|
||||
- `appVersion`: Version of the application. It is set in the
|
||||
[application's constructor function](../basics/app-anatomy.md#constructor-function).
|
||||
[application's constructor function](../basics/app-anatomy.md#constructor-function).
|
||||
|
||||
## Constructor
|
||||
|
||||
@ -114,7 +112,7 @@ func NewBaseApp(
|
||||
```
|
||||
|
||||
The `BaseApp` constructor function is pretty straightforward. The only thing worth noting is the
|
||||
possibility to provide additional [`options`](https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/baseapp/options.go)
|
||||
possibility to provide additional [`options`](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/baseapp/options.go)
|
||||
to the `BaseApp`, which will execute them in order. The `options` are generally `setter` functions
|
||||
for important parameters, like `SetPruning()` to set pruning options or `SetMinGasPrices()` to set
|
||||
the node's `min-gas-prices`.
|
||||
@ -143,7 +141,7 @@ the root `CommitMultiStore`. Any subsequent reads and writes happen on cached ve
|
||||
### CheckTx State Updates
|
||||
|
||||
During `CheckTx`, the `checkState`, which is based off of the last committed state from the root
|
||||
store, is used for any reads and writes. Here we only execute the `AnteHandler` and verify a router
|
||||
store, is used for any reads and writes. Here we only execute the `AnteHandler` and verify a service router
|
||||
exists for every message in the transaction. Note, when we execute the `AnteHandler`, we cache-wrap
|
||||
the already cache-wrapped `checkState`. This has the side effect that if the `AnteHandler` fails,
|
||||
the state transitions won't be reflected in the `checkState` -- i.e. `checkState` is only updated on
|
||||
@ -186,23 +184,23 @@ parameters are non-nil, they are set in the BaseApp's `ParamStore`. Behind the s
|
||||
is actually managed by an `x/params` module `Subspace`. This allows the parameters to be tweaked via
|
||||
on-chain governance.
|
||||
|
||||
## Routing
|
||||
## Service Routers
|
||||
|
||||
When messages and queries are received by the application, they must be routed to the appropriate module in order to be processed. Routing is done via `baseapp`, which holds a `router` for messages, and a `query router` for queries.
|
||||
When messages and queries are received by the application, they must be routed to the appropriate module in order to be processed. Routing is done via `BaseApp`, which holds a `msgServiceRouter` for messages, and a `grpcQueryRouter` for queries.
|
||||
|
||||
### Message Routing
|
||||
### `Msg` Service Router
|
||||
|
||||
[Messages](#../building-modules/messages-and-queries.md#messages) need to be routed after they are extracted from transactions, which are sent from the underlying Tendermint engine via the [`CheckTx`](#checktx) and [`DeliverTx`](#delivertx) ABCI messages. To do so, `BaseApp` holds a router which maps string paths to the appropriate module [handler](../building-modules/msg-services.md#handler-type) using the `.Route(ctx sdk.Context, path string)` function. Usually, the `path` is the name of the module.
|
||||
[`Msg`s](#../building-modules/messages-and-queries.md#messages) need to be routed after they are extracted from transactions, which are sent from the underlying Tendermint engine via the [`CheckTx`](#checktx) and [`DeliverTx`](#delivertx) ABCI messages. To do so, `BaseApp` holds a `msgServiceRouter` which maps fully-qualified service methods (`string`, defined in each module's `Msg` Protobuf service) to the appropriate module's `Msg` server implementation.
|
||||
|
||||
The [default router included in baseapp](https://github.com/cosmos/cosmos-sdk/blob/master/baseapp/router.go) is stateless. However, some applications may want to make use of more stateful routing mechanisms such as allowing governance to disable certain routes or point them to new modules for upgrade purposes. For this reason, the `sdk.Context` is also passed into the `Route` function of the [Router interface](https://github.com/cosmos/cosmos-sdk/blob/master/types/router.go#L12). For a stateless router that doesn't want to make use of this, can just ignore the ctx.
|
||||
The [default `msgServiceRouter` included in `BaseApp`](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/baseapp/msg_service_router.go) is stateless. However, some applications may want to make use of more stateful routing mechanisms such as allowing governance to disable certain routes or point them to new modules for upgrade purposes. For this reason, the `sdk.Context` is also passed into each [route handler inside `msgServiceRouter`](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/baseapp/msg_service_router.go#L31-L32). For a stateless router that doesn't want to make use of this, you can just ignore the `ctx`.
|
||||
|
||||
The application's `router` is initilalized with all the routes using the application's [module manager](../building-modules/module-manager.md#manager), which itself is initialized with all the application's modules in the application's [constructor](../basics/app-anatomy.md#app-constructor).
|
||||
The application's `msgServiceRouter` is initialized with all the routes using the application's [module manager](../building-modules/module-manager.md#manager) (via the `RegisterServices` method), which itself is initialized with all the application's modules in the application's [constructor](../basics/app-anatomy.md#app-constructor).
|
||||
|
||||
### Query Routing
|
||||
### gRPC Query Router
|
||||
|
||||
Similar to `message`s, [`queries`](../building-modules/messages-and-queries.md#queries) need to be routed to the appropriate module's [querier](../building-modules/query-services.md). To do so, `baseapp` holds a `query router`, which maps module names to module `querier`s. The `queryRouter` is called during the initial stages of `query` processing, which is done via the [`Query` ABCI message](#query).
|
||||
Similar to `Msg`s, [`queries`](../building-modules/messages-and-queries.md#queries) need to be routed to the appropriate module's [`Query` service](../building-modules/query-services.md). To do so, `BaseApp` holds a `grpcQueryRouter`, which maps modules' fully-qualified service methods (`string`, defined in their Protobuf `Query` gRPC) to their `Query` server implementation. The `grpcQueryRouter` is called during the initial stages of query processing, which can be either by directly sending a gRPC query to the gRPC endpoint, or via the [`Query` ABCI message](#query) on the Tendermint RPC endpoint.
|
||||
|
||||
Just like the `router`, the `query router` is initilalized with all the query routes using the application's [module manager](../building-modules/module-manager.md), which itself is initialized with all the application's modules in the application's [constructor](../basics/app-anatomy.md#app-constructor).
|
||||
Just like the `msgServiceRouter`, the `grpcQueryRouter` is initialized with all the query routes using the application's [module manager](../building-modules/module-manager.md) (via the `RegisterServices` method), which itself is initialized with all the application's modules in the application's [constructor](../basics/app-anatomy.md#app-constructor).
|
||||
|
||||
## Main ABCI Messages
|
||||
|
||||
@ -211,11 +209,11 @@ The [Application-Blockchain Interface](https://tendermint.com/docs/spec/abci/) (
|
||||
The consensus engine handles two main tasks:
|
||||
|
||||
- The networking logic, which mainly consists in gossiping block parts, transactions and consensus votes.
|
||||
- The consensus logic, which results in the deterministic ordering of transactions in the form of blocks.
|
||||
- The consensus logic, which results in the deterministic ordering of transactions in the form of blocks.
|
||||
|
||||
It is **not** the role of the consensus engine to define the state or the validity of transactions. Generally, transactions are handled by the consensus engine in the form of `[]bytes`, and relayed to the application via the ABCI to be decoded and processed. At keys moments in the networking and consensus processes (e.g. beginning of a block, commit of a block, reception of an unconfirmed transaction, ...), the consensus engine emits ABCI messages for the state-machine to act on.
|
||||
It is **not** the role of the consensus engine to define the state or the validity of transactions. Generally, transactions are handled by the consensus engine in the form of `[]bytes`, and relayed to the application via the ABCI to be decoded and processed. At keys moments in the networking and consensus processes (e.g. beginning of a block, commit of a block, reception of an unconfirmed transaction, ...), the consensus engine emits ABCI messages for the state-machine to act on.
|
||||
|
||||
Developers building on top of the Cosmos SDK need not implement the ABCI themselves, as `baseapp` comes with a built-in implementation of the interface. Let us go through the main ABCI messages that `baseapp` implements: [`CheckTx`](#checktx) and [`DeliverTx`](#delivertx)
|
||||
Developers building on top of the Cosmos SDK need not implement the ABCI themselves, as `BaseApp` comes with a built-in implementation of the interface. Let us go through the main ABCI messages that `BaseApp` implements: [`CheckTx`](#checktx) and [`DeliverTx`](#delivertx)
|
||||
|
||||
### CheckTx
|
||||
|
||||
@ -228,18 +226,18 @@ Unconfirmed transactions are relayed to peers only if they pass `CheckTx`.
|
||||
make them lightweight. In the Cosmos SDK, after [decoding transactions](./encoding.md), `CheckTx()` is implemented
|
||||
to do the following checks:
|
||||
|
||||
1. Extract the `message`s from the transaction.
|
||||
2. Perform _stateless_ checks by calling `ValidateBasic()` on each of the `messages`. This is done
|
||||
1. Extract the `Msg`s from the transaction.
|
||||
2. Perform _stateless_ checks by calling `ValidateBasic()` on each of the `Msg`s. This is done
|
||||
first, as _stateless_ checks are less computationally expensive than _stateful_ checks. If
|
||||
`ValidateBasic()` fail, `CheckTx` returns before running _stateful_ checks, which saves resources.
|
||||
3. Perform non-module related _stateful_ checks on the [account](../basics/accounts.md). This step is mainly about checking
|
||||
that the `message` signatures are valid, that enough fees are provided and that the sending account
|
||||
that the `Msg` signatures are valid, that enough fees are provided and that the sending account
|
||||
has enough funds to pay for said fees. Note that no precise [`gas`](../basics/gas-fees.md) counting occurs here,
|
||||
as `message`s are not processed. Usually, the [`AnteHandler`](../basics/gas-fees.md#antehandler) will check that the `gas` provided
|
||||
as `Msg`s are not processed. Usually, the [`AnteHandler`](../basics/gas-fees.md#antehandler) will check that the `gas` provided
|
||||
with the transaction is superior to a minimum reference gas amount based on the raw transaction size,
|
||||
in order to avoid spam with transactions that provide 0 gas.
|
||||
4. Ensure that a [`Route`](#message-routing) exists for each `message`, but do **not** actually
|
||||
process `message`s. `Message`s only need to be processed when the canonical state need to be updated,
|
||||
4. Ensure that each `Msg`'s fully-qualified service method matches on of the routes inside the `msgServiceRouter`, but do **not** actually
|
||||
process `Msg`s. `Msg`s only need to be processed when the canonical state need to be updated,
|
||||
which happens during `DeliverTx`.
|
||||
|
||||
Steps 2. and 3. are performed by the [`AnteHandler`](../basics/gas-fees.md#antehandler) in the [`RunTx()`](#runtx-antehandler-and-runmsgs)
|
||||
@ -257,11 +255,11 @@ is actually included in a block, because `checkState` never gets committed to th
|
||||
`CheckTx` returns a response to the underlying consensus engine of type [`abci.ResponseCheckTx`](https://tendermint.com/docs/spec/abci/abci.html#messages).
|
||||
The response contains:
|
||||
|
||||
- `Code (uint32)`: Response Code. `0` if successful.
|
||||
- `Code (uint32)`: Response Code. `0` if successful.
|
||||
- `Data ([]byte)`: Result bytes, if any.
|
||||
- `Log (string):` The output of the application's logger. May be non-deterministic.
|
||||
- `Info (string):` Additional information. May be non-deterministic.
|
||||
- `GasWanted (int64)`: Amount of gas requested for transaction. It is provided by users when they generate the transaction.
|
||||
- `GasWanted (int64)`: Amount of gas requested for transaction. It is provided by users when they generate the transaction.
|
||||
- `GasUsed (int64)`: Amount of gas consumed by transaction. During `CheckTx`, this value is computed by multiplying the standard cost of a transaction byte by the size of the raw transaction. Next is an example:
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/x/auth/ante/basic.go#L104
|
||||
- `Events ([]cmn.KVPair)`: Key-Value tags for filtering and indexing transactions (eg. by account). See [`event`s](./events.md) for more.
|
||||
@ -280,27 +278,27 @@ This allows certain checks like signature verification can be skipped during `Ch
|
||||
|
||||
When the underlying consensus engine receives a block proposal, each transaction in the block needs to be processed by the application. To that end, the underlying consensus engine sends a `DeliverTx` message to the application for each transaction in a sequential order.
|
||||
|
||||
Before the first transaction of a given block is processed, a [volatile state](#volatile-states) called `deliverState` is intialized during [`BeginBlock`](#beginblock). This state is updated each time a transaction is processed via `DeliverTx`, and committed to the [main state](#main-state) when the block is [committed](#commit), after what is is set to `nil`.
|
||||
Before the first transaction of a given block is processed, a [volatile state](#volatile-states) called `deliverState` is intialized during [`BeginBlock`](#beginblock). This state is updated each time a transaction is processed via `DeliverTx`, and committed to the [main state](#main-state) when the block is [committed](#commit), after what is is set to `nil`.
|
||||
|
||||
`DeliverTx` performs the **exact same steps as `CheckTx`**, with a little caveat at step 3 and the addition of a fifth step:
|
||||
|
||||
1. The `AnteHandler` does **not** check that the transaction's `gas-prices` is sufficient. That is because the `min-gas-prices` value `gas-prices` is checked against is local to the node, and therefore what is enough for one full-node might not be for another. This means that the proposer can potentially include transactions for free, although they are not incentivised to do so, as they earn a bonus on the total fee of the block they propose.
|
||||
2. For each message in the transaction, route to the appropriate module's [`handler`](../building-modules/msg-services.md#handler-type). Additional _stateful_ checks are performed, and the cache-wrapped multistore held in `deliverState`'s `context` is updated by the module's `keeper`. If the `handler` returns successfully, the cache-wrapped multistore held in `context` is written to `deliverState` `CacheMultiStore`.
|
||||
2. For each `Msg` in the transaction, route to the appropriate module's [`Msg` service](../building-modules/msg-services.md). Additional _stateful_ checks are performed, and the cache-wrapped multistore held in `deliverState`'s `context` is updated by the module's `keeper`. If the `Msg` service returns successfully, the cache-wrapped multistore held in `context` is written to `deliverState` `CacheMultiStore`.
|
||||
|
||||
During step 5., each read/write to the store increases the value of `GasConsumed`. You can find the default cost of each operation:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/types/gas.go#L142-L150
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/types/gas.go#L153-L162
|
||||
|
||||
At any point, if `GasConsumed > GasWanted`, the function returns with `Code != 0` and `DeliverTx` fails.
|
||||
At any point, if `GasConsumed > GasWanted`, the function returns with `Code != 0` and `DeliverTx` fails.
|
||||
|
||||
`DeliverTx` returns a response to the underlying consensus engine of type [`abci.ResponseDeliverTx`](https://tendermint.com/docs/spec/abci/abci.html#delivertx). The response contains:
|
||||
|
||||
- `Code (uint32)`: Response Code. `0` if successful.
|
||||
- `Code (uint32)`: Response Code. `0` if successful.
|
||||
- `Data ([]byte)`: Result bytes, if any.
|
||||
- `Log (string):` The output of the application's logger. May be non-deterministic.
|
||||
- `Info (string):` Additional information. May be non-deterministic.
|
||||
- `GasWanted (int64)`: Amount of gas requested for transaction. It is provided by users when they generate the transaction.
|
||||
- `GasUsed (int64)`: Amount of gas consumed by transaction. During `DeliverTx`, this value is computed by multiplying the standard cost of a transaction byte by the size of the raw transaction, and by adding gas each time a read/write to the store occurs.
|
||||
- `GasWanted (int64)`: Amount of gas requested for transaction. It is provided by users when they generate the transaction.
|
||||
- `GasUsed (int64)`: Amount of gas consumed by transaction. During `DeliverTx`, this value is computed by multiplying the standard cost of a transaction byte by the size of the raw transaction, and by adding gas each time a read/write to the store occurs.
|
||||
- `Events ([]cmn.KVPair)`: Key-Value tags for filtering and indexing transactions (eg. by account). See [`event`s](./events.md) for more.
|
||||
- `Codespace (string)`: Namespace for the Code.
|
||||
|
||||
@ -308,41 +306,41 @@ At any point, if `GasConsumed > GasWanted`, the function returns with `Code != 0
|
||||
|
||||
### RunTx
|
||||
|
||||
`RunTx` is called from `CheckTx`/`DeliverTx` to handle the transaction, with `runTxModeCheck` or `runTxModeDeliver` as parameter to differentiate between the two modes of execution. Note that when `RunTx` receives a transaction, it has already been decoded.
|
||||
`RunTx` is called from `CheckTx`/`DeliverTx` to handle the transaction, with `runTxModeCheck` or `runTxModeDeliver` as parameter to differentiate between the two modes of execution. Note that when `RunTx` receives a transaction, it has already been decoded.
|
||||
|
||||
The first thing `RunTx` does upon being called is to retrieve the `context`'s `CacheMultiStore` by calling the `getContextForTx()` function with the appropriate mode (either `runTxModeCheck` or `runTxModeDeliver`). This `CacheMultiStore` is a cached version of the main store instantiated during `BeginBlock` for `DeliverTx` and during the `Commit` of the previous block for `CheckTx`. After that, two `defer func()` are called for [`gas`](../basics/gas-fees.md) management. They are executed when `runTx` returns and make sure `gas` is actually consumed, and will throw errors, if any.
|
||||
The first thing `RunTx` does upon being called is to retrieve the `context`'s `CacheMultiStore` by calling the `getContextForTx()` function with the appropriate mode (either `runTxModeCheck` or `runTxModeDeliver`). This `CacheMultiStore` is a cached version of the main store instantiated during `BeginBlock` for `DeliverTx` and during the `Commit` of the previous block for `CheckTx`. After that, two `defer func()` are called for [`gas`](../basics/gas-fees.md) management. They are executed when `runTx` returns and make sure `gas` is actually consumed, and will throw errors, if any.
|
||||
|
||||
After that, `RunTx()` calls `ValidateBasic()` on each `message`in the `Tx`, which runs preliminary _stateless_ validity checks. If any `message` fails to pass `ValidateBasic()`, `RunTx()` returns with an error.
|
||||
After that, `RunTx()` calls `ValidateBasic()` on each `Msg`in the `Tx`, which runs preliminary _stateless_ validity checks. If any `Msg` fails to pass `ValidateBasic()`, `RunTx()` returns with an error.
|
||||
|
||||
Then, the [`anteHandler`](#antehandler) of the application is run (if it exists). In preparation of this step, both the `checkState`/`deliverState`'s `context` and `context`'s `CacheMultiStore` are cached-wrapped using the `cacheTxContext()` function.
|
||||
Then, the [`anteHandler`](#antehandler) of the application is run (if it exists). In preparation of this step, both the `checkState`/`deliverState`'s `context` and `context`'s `CacheMultiStore` are cached-wrapped using the `cacheTxContext()` function.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/baseapp/baseapp.go#L587
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/baseapp/baseapp.go#L623-L630
|
||||
|
||||
This allows `RunTx` not to commit the changes made to the state during the execution of `anteHandler` if it ends up failing. It also prevents the module implementing the `anteHandler` from writing to state, which is an important part of the [object-capabilities](./ocap.md) of the Cosmos SDK.
|
||||
This allows `RunTx` not to commit the changes made to the state during the execution of `anteHandler` if it ends up failing. It also prevents the module implementing the `anteHandler` from writing to state, which is an important part of the [object-capabilities](./ocap.md) of the Cosmos SDK.
|
||||
|
||||
Finally, the [`RunMsgs()`](#runmsgs) function is called to process the `messages`s in the `Tx`. In preparation of this step, just like with the `anteHandler`, both the `checkState`/`deliverState`'s `context` and `context`'s `CacheMultiStore` are cached-wrapped using the `cacheTxContext()` function.
|
||||
Finally, the [`RunMsgs()`](#runmsgs) function is called to process the `Msg`s in the `Tx`. In preparation of this step, just like with the `anteHandler`, both the `checkState`/`deliverState`'s `context` and `context`'s `CacheMultiStore` are cached-wrapped using the `cacheTxContext()` function.
|
||||
|
||||
### AnteHandler
|
||||
|
||||
The `AnteHandler` is a special handler that implements the `anteHandler` interface and is used to authenticate the transaction before the transaction's internal messages are processed.
|
||||
The `AnteHandler` is a special handler that implements the `AnteHandler` interface and is used to authenticate the transaction before the transaction's internal messages are processed.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/types/handler.go#L8
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/types/handler.go#L6-L8
|
||||
|
||||
The `AnteHandler` is theoretically optional, but still a very important component of public blockchain networks. It serves 3 primary purposes:
|
||||
|
||||
- Be a primary line of defense against spam and second line of defense (the first one being the mempool) against transaction replay with fees deduction and [`sequence`](./transactions.md#transaction-generation) checking.
|
||||
- Perform preliminary *stateful* validity checks like ensuring signatures are valid or that the sender has enough funds to pay for fees.
|
||||
- Play a role in the incentivisation of stakeholders via the collection of transaction fees.
|
||||
- Be a primary line of defense against spam and second line of defense (the first one being the mempool) against transaction replay with fees deduction and [`sequence`](./transactions.md#transaction-generation) checking.
|
||||
- Perform preliminary _stateful_ validity checks like ensuring signatures are valid or that the sender has enough funds to pay for fees.
|
||||
- Play a role in the incentivisation of stakeholders via the collection of transaction fees.
|
||||
|
||||
`baseapp` holds an `anteHandler` as paraemter, which is initialized in the [application's constructor](../basics/app-anatomy.md#application-constructor). The most widely used `anteHandler` today is that of the [`auth` module](https://github.com/cosmos/cosmos-sdk/blob/master/x/auth/ante/ante.go).
|
||||
`BaseApp` holds an `anteHandler` as paraemter, which is initialized in the [application's constructor](../basics/app-anatomy.md#application-constructor). The most widely used `anteHandler` today is that of the [`auth` module](https://github.com/cosmos/cosmos-sdk/blob/master/x/auth/ante/ante.go).
|
||||
|
||||
Click [here](../basics/gas-fees.md#antehandler) for more on the `anteHandler`.
|
||||
Click [here](../basics/gas-fees.md#antehandler) for more on the `anteHandler`.
|
||||
|
||||
### RunMsgs
|
||||
|
||||
`RunMsgs` is called from `RunTx` with `runTxModeCheck` as parameter to check the existence of a route for each message the transaction, and with `runTxModeDeliver` to actually process the `message`s.
|
||||
`RunMsgs` is called from `RunTx` with `runTxModeCheck` as parameter to check the existence of a route for each message the transaction, and with `runTxModeDeliver` to actually process the `Msg`s.
|
||||
|
||||
First, it retreives the message's `route` using the `Msg.Route()` method. Then, using the application's [`router`](#routing) and the `route`, it checks for the existence of a `handler`. At this point, if `mode == runTxModeCheck`, `RunMsgs` returns. If instead `mode == runTxModeDeliver`, the [`handler`](../building-modules/msg-services.md#handler-type) function for the message is executed, before `RunMsgs` returns.
|
||||
First, it retrieves the `Msg`'s fully-qualified service method name, by checking the `type_url` of the Protobuf `Any` representing the service `Msg`. Then, using the application's [`msgServiceRouter`](#msg-service-router), it checks for the existence of this fully-qualified service method. At this point, if `mode == runTxModeCheck`, `RunMsgs` returns. If instead `mode == runTxModeDeliver`, the [`Msg` server](../building-modules/msg-services.md) implementation for the message is executed, before `RunMsgs` returns.
|
||||
|
||||
## Other ABCI Messages
|
||||
|
||||
@ -350,49 +348,49 @@ First, it retreives the message's `route` using the `Msg.Route()` method. Then,
|
||||
|
||||
The [`InitChain` ABCI message](https://tendermint.com/docs/app-dev/abci-spec.html#initchain) is sent from the underlying Tendermint engine when the chain is first started. It is mainly used to **initialize** parameters and state like:
|
||||
|
||||
- [Consensus Parameters](https://tendermint.com/docs/spec/abci/apps.html#consensus-parameters) via `setConsensusParams`.
|
||||
- [Consensus Parameters](https://tendermint.com/docs/spec/abci/apps.html#consensus-parameters) via `setConsensusParams`.
|
||||
- [`checkState` and `deliverState`](#volatile-states) via `setCheckState` and `setDeliverState`.
|
||||
- The [block gas meter](../basics/gas-fees.md#block-gas-meter), with infinite gas to process genesis transactions.
|
||||
- The [block gas meter](../basics/gas-fees.md#block-gas-meter), with infinite gas to process genesis transactions.
|
||||
|
||||
Finally, the `InitChain(req abci.RequestInitChain)` method of `baseapp` calls the [`initChainer()`](../basics/app-anatomy.md#initchainer) of the application in order to initialize the main state of the application from the `genesis file` and, if defined, call the [`InitGenesis`](../building-modules/genesis.md#initgenesis) function of each of the application's modules.
|
||||
Finally, the `InitChain(req abci.RequestInitChain)` method of `BaseApp` calls the [`initChainer()`](../basics/app-anatomy.md#initchainer) of the application in order to initialize the main state of the application from the `genesis file` and, if defined, call the [`InitGenesis`](../building-modules/genesis.md#initgenesis) function of each of the application's modules.
|
||||
|
||||
### BeginBlock
|
||||
|
||||
The [`BeginBlock` ABCI message](#https://tendermint.com/docs/app-dev/abci-spec.html#beginblock) is sent from the underlying Tendermint engine when a block proposal created by the correct proposer is received, before [`DeliverTx`](#delivertx) is run for each transaction in the block. It allows developers to have logic be executed at the beginning of each block. In the Cosmos SDK, the `BeginBlock(req abci.RequestBeginBlock)` method does the following:
|
||||
|
||||
- Initialize [`deliverState`](#volatile-states) with the latest header using the `req abci.RequestBeginBlock` passed as parameter via the `setDeliverState` function.
|
||||
- Initialize [`deliverState`](#volatile-states) with the latest header using the `req abci.RequestBeginBlock` passed as parameter via the `setDeliverState` function.
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/baseapp/baseapp.go#L387-L397
|
||||
This function also resets the [main gas meter](../basics/gas-fees.md#main-gas-meter).
|
||||
- Initialize the [block gas meter](../basics/gas-fees.md#block-gas-meter) with the `maxGas` limit. The `gas` consumed within the block cannot go above `maxGas`. This parameter is defined in the application's consensus parameters.
|
||||
This function also resets the [main gas meter](../basics/gas-fees.md#main-gas-meter).
|
||||
- Initialize the [block gas meter](../basics/gas-fees.md#block-gas-meter) with the `maxGas` limit. The `gas` consumed within the block cannot go above `maxGas`. This parameter is defined in the application's consensus parameters.
|
||||
- Run the application's [`beginBlocker()`](../basics/app-anatomy.md#beginblocker-and-endblock), which mainly runs the [`BeginBlocker()`](../building-modules/beginblock-endblock.md#beginblock) method of each of the application's modules.
|
||||
- Set the [`VoteInfos`](https://tendermint.com/docs/app-dev/abci-spec.html#voteinfo) of the application, i.e. the list of validators whose *precommit* for the previous block was included by the proposer of the current block. This information is carried into the [`Context`](./context.md) so that it can be used during `DeliverTx` and `EndBlock`.
|
||||
- Set the [`VoteInfos`](https://tendermint.com/docs/app-dev/abci-spec.html#voteinfo) of the application, i.e. the list of validators whose _precommit_ for the previous block was included by the proposer of the current block. This information is carried into the [`Context`](./context.md) so that it can be used during `DeliverTx` and `EndBlock`.
|
||||
|
||||
### EndBlock
|
||||
|
||||
The [`EndBlock` ABCI message](#https://tendermint.com/docs/app-dev/abci-spec.html#endblock) is sent from the underlying Tendermint engine after [`DeliverTx`](#delivertx) as been run for each transaction in the block. It allows developers to have logic be executed at the end of each block. In the Cosmos SDK, the bulk `EndBlock(req abci.RequestEndBlock)` method is to run the application's [`EndBlocker()`](../basics/app-anatomy.md#beginblocker-and-endblock), which mainly runs the [`EndBlocker()`](../building-modules/beginblock-endblock.md#beginblock) method of each of the application's modules.
|
||||
The [`EndBlock` ABCI message](#https://tendermint.com/docs/app-dev/abci-spec.html#endblock) is sent from the underlying Tendermint engine after [`DeliverTx`](#delivertx) as been run for each transaction in the block. It allows developers to have logic be executed at the end of each block. In the Cosmos SDK, the bulk `EndBlock(req abci.RequestEndBlock)` method is to run the application's [`EndBlocker()`](../basics/app-anatomy.md#beginblocker-and-endblock), which mainly runs the [`EndBlocker()`](../building-modules/beginblock-endblock.md#beginblock) method of each of the application's modules.
|
||||
|
||||
### Commit
|
||||
|
||||
The [`Commit` ABCI message](https://tendermint.com/docs/app-dev/abci-spec.html#commit) is sent from the underlying Tendermint engine after the full-node has received *precommits* from 2/3+ of validators (weighted by voting power). On the `baseapp` end, the `Commit(res abci.ResponseCommit)` function is implemented to commit all the valid state transitions that occured during `BeginBlock`, `DeliverTx` and `EndBlock` and to reset state for the next block.
|
||||
The [`Commit` ABCI message](https://tendermint.com/docs/app-dev/abci-spec.html#commit) is sent from the underlying Tendermint engine after the full-node has received _precommits_ from 2/3+ of validators (weighted by voting power). On the `BaseApp` end, the `Commit(res abci.ResponseCommit)` function is implemented to commit all the valid state transitions that occured during `BeginBlock`, `DeliverTx` and `EndBlock` and to reset state for the next block.
|
||||
|
||||
To commit state-transitions, the `Commit` function calls the `Write()` function on `deliverState.ms`, where `deliverState.ms` is a cached multistore of the main store `app.cms`. Then, the `Commit` function sets `checkState` to the latest header (obtbained from `deliverState.ctx.BlockHeader`) and `deliverState` to `nil`.
|
||||
|
||||
Finally, `Commit` returns the hash of the commitment of `app.cms` back to the underlying consensus engine. This hash is used as a reference in the header of the next block.
|
||||
Finally, `Commit` returns the hash of the commitment of `app.cms` back to the underlying consensus engine. This hash is used as a reference in the header of the next block.
|
||||
|
||||
### Info
|
||||
|
||||
The [`Info` ABCI message](https://tendermint.com/docs/app-dev/abci-spec.html#info) is a simple query from the underlying consensus engine, notably used to sync the latter with the application during a handshake that happens on startup. When called, the `Info(res abci.ResponseInfo)` function from `baseapp` will return the application's name, version and the hash of the last commit of `app.cms`.
|
||||
The [`Info` ABCI message](https://tendermint.com/docs/app-dev/abci-spec.html#info) is a simple query from the underlying consensus engine, notably used to sync the latter with the application during a handshake that happens on startup. When called, the `Info(res abci.ResponseInfo)` function from `BaseApp` will return the application's name, version and the hash of the last commit of `app.cms`.
|
||||
|
||||
### Query
|
||||
|
||||
The [`Query` ABCI message](https://tendermint.com/docs/app-dev/abci-spec.html#query) is used to serve queries received from the underlying consensus engine, including queries received via RPC like Tendermint RPC. It is the main entrypoint to build interfaces with the application. The application must respect a few rules when implementing the `Query` method, which are outlined [here](https://tendermint.com/docs/app-dev/abci-spec.html#query).
|
||||
The [`Query` ABCI message](https://tendermint.com/docs/app-dev/abci-spec.html#query) is used to serve queries received from the underlying consensus engine, including queries received via RPC like Tendermint RPC. It used to be the main entrypoint to build interfaces with the application, but with the introduction of [gRPC queries](../building-modules/query-services.md) in Cosmos SDK v0.40, its usage is more limited. The application must respect a few rules when implementing the `Query` method, which are outlined [here](https://tendermint.com/docs/app-dev/abci-spec.html#query).
|
||||
|
||||
Each `query` comes with a `path`, which contains multiple `string`s. By convention, the first element of the `path` (`path[0]`) contains the category of `query` (`app`, `p2p`, `store` or `custom`). The `baseapp` implementation of the `Query(req abci.RequestQuery)` method is a simple dispatcher serving these 4 main categories of queries:
|
||||
Each Tendermint `query` comes with a `path`, which is a `string` which denotes what to query. If the `path` matches a gRPC fully-qualified service method, then `BaseApp` will defer the query to the `grpcQueryRouter` and let it handle it like explained [above](#grpc-query-router). Otherwise, the `path` represents a query that is not (yet) handled by the gRPC router. `BaseApp` splits the `path` string with the `/` delimiter. By convention, the first element of the splitted string (`splitted[0]`) contains the category of `query` (`app`, `p2p`, `store` or `custom` ). The `BaseApp` implementation of the `Query(req abci.RequestQuery)` method is a simple dispatcher serving these 4 main categories of queries:
|
||||
|
||||
- Application-related queries like querying the application's version, which are served via the `handleQueryApp` method.
|
||||
- Direct queries to the multistore, which are served by the `handlerQueryStore` method. These direct queryeis are different from custom queries which go through `app.queryRouter`, and are mainly used by third-party service provider like block explorers.
|
||||
- P2P queries, which are served via the `handleQueryP2P` method. These queries return either `app.addrPeerFilter` or `app.ipPeerFilter` that contain the list of peers filtered by address or IP respectively. These lists are first initialized via `options` in `baseapp`'s [constructor](#constructor).
|
||||
- Custom queries, which encompass most queries, are served via the `handleQueryCustom` method. The `handleQueryCustom` cache-wraps the multistore before using the `queryRoute` obtained from [`app.queryRouter`](#query-routing) to map the query to the appropriate module's `querier`.
|
||||
- P2P queries, which are served via the `handleQueryP2P` method. These queries return either `app.addrPeerFilter` or `app.ipPeerFilter` that contain the list of peers filtered by address or IP respectively. These lists are first initialized via `options` in `BaseApp`'s [constructor](#constructor).
|
||||
- Custom queries, which encompass legacy queries (before the introduction of gRPC queries), are served via the `handleQueryCustom` method. The `handleQueryCustom` cache-wraps the multistore before using the `queryRoute` obtained from `app.queryRouter` to map the query to the appropriate module's [legacy `querier`](../building-modules/query-services.md#legacy-queriers).
|
||||
|
||||
## Next {hide}
|
||||
|
||||
|
||||
@ -15,25 +15,9 @@ The `context` is a data structure intended to be passed from function to functio
|
||||
|
||||
The SDK `Context` is a custom data structure that contains Go's stdlib [`context`](https://golang.org/pkg/context) as its base, and has many additional types within its definition that are specific to the Cosmos SDK. he `Context` is integral to transaction processing in that it allows modules to easily access their respective [store](./store.md#base-layer-kvstores) in the [`multistore`](./store.md#multistore) and retrieve transactional context such as the block header and gas meter.
|
||||
|
||||
```go
|
||||
type Context struct {
|
||||
ctx context.Context
|
||||
ms MultiStore
|
||||
header tmproto.Header
|
||||
chainID string
|
||||
txBytes []byte
|
||||
logger log.Logger
|
||||
voteInfo []abci.VoteInfo
|
||||
gasMeter GasMeter
|
||||
blockGasMeter GasMeter
|
||||
checkTx bool
|
||||
minGasPrice DecCoins
|
||||
consParams *abci.ConsensusParams
|
||||
eventManager *EventManager
|
||||
}
|
||||
```
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/types/context.go#L16-L39
|
||||
|
||||
- **Context:** The base type is a Go [Context](https://golang.org/pkg/context), which is explained further in the [Go Context Package](#go-context-package) section below.
|
||||
- **Context:** The base type is a Go [Context](https://golang.org/pkg/context), which is explained further in the [Go Context Package](#go-context-package) section below.
|
||||
- **Multistore:** Every application's `BaseApp` contains a [`CommitMultiStore`](./store.md#multistore) which is provided when a `Context` is created. Calling the `KVStore()` and `TransientStore()` methods allows modules to fetch their respective [`KVStore`](./store.md#base-layer-kvstores) using their unique `StoreKey`.
|
||||
- **ABCI Header:** The [header](https://tendermint.com/docs/spec/abci/abci.html#header) is an ABCI type. It carries important information about the state of the blockchain, such as block height and proposer of the current block.
|
||||
- **Chain ID:** The unique identification number of the blockchain a block pertains to.
|
||||
@ -42,10 +26,10 @@ type Context struct {
|
||||
- **VoteInfo:** A list of the ABCI type [`VoteInfo`](https://tendermint.com/docs/spec/abci/abci.html#voteinfo), which includes the name of a validator and a boolean indicating whether they have signed the block.
|
||||
- **Gas Meters:** Specifically, a [`gasMeter`](../basics/gas-fees.md#main-gas-meter) for the transaction currently being processed using the context and a [`blockGasMeter`](../basics/gas-fees.md#block-gas-meter) for the entire block it belongs to. Users specify how much in fees they wish to pay for the execution of their transaction; these gas meters keep track of how much [gas](../basics/gas-fees.md) has been used in the transaction or block so far. If the gas meter runs out, execution halts.
|
||||
- **CheckTx Mode:** A boolean value indicating whether a transaction should be processed in `CheckTx` or `DeliverTx` mode.
|
||||
- **Min Gas Price:** The minimum [gas](../basics/gas-fees.md) price a node is willing to take in order to include a transaction in its block. This price is a local value configured by each node individually, and should therefore **not be used in any functions used in sequences leading to state-transitions**.
|
||||
- **Min Gas Price:** The minimum [gas](../basics/gas-fees.md) price a node is willing to take in order to include a transaction in its block. This price is a local value configured by each node individually, and should therefore **not be used in any functions used in sequences leading to state-transitions**.
|
||||
- **Consensus Params:** The ABCI type [Consensus Parameters](https://tendermint.com/docs/spec/abci/apps.html#consensus-parameters), which specify certain limits for the blockchain, such as maximum gas for a block.
|
||||
- **Event Manager:** The event manager allows any caller with access to a `Context` to emit [`Events`](./events.md). Modules may define module specific
|
||||
`Events` by defining various `Types` and `Attributes` or use the common definitions found in `types/`. Clients can subscribe or query for these `Events`. These `Events` are collected throughout `DeliverTx`, `BeginBlock`, and `EndBlock` and are returned to Tendermint for indexing. For example:
|
||||
`Events` by defining various `Types` and `Attributes` or use the common definitions found in `types/`. Clients can subscribe or query for these `Events`. These `Events` are collected throughout `DeliverTx`, `BeginBlock`, and `EndBlock` and are returned to Tendermint for indexing. For example:
|
||||
|
||||
```go
|
||||
ctx.EventManager().EmitEvent(sdk.NewEvent(
|
||||
@ -63,7 +47,7 @@ are also designed to enable concurrency and to be used in goroutines.
|
||||
Contexts are intended to be **immutable**; they should never be edited. Instead, the convention is
|
||||
to create a child context from its parent using a `With` function. For example:
|
||||
|
||||
``` go
|
||||
```go
|
||||
childCtx = parentCtx.WithBlockHeader(header)
|
||||
```
|
||||
|
||||
@ -79,12 +63,12 @@ goes wrong. The pattern of usage for a Context is as follows:
|
||||
|
||||
1. A process receives a Context `ctx` from its parent process, which provides information needed to
|
||||
perform the process.
|
||||
2. The `ctx.ms` is **cache wrapped**, i.e. a cached copy of the [multistore](./store.md#multistore) is made so that the process can make changes to the state as it executes, without changing the original`ctx.ms`. This is useful to protect the underlying multistore in case the changes need to be reverted at some point in the execution.
|
||||
2. The `ctx.ms` is **cache wrapped**, i.e. a cached copy of the [multistore](./store.md#multistore) is made so that the process can make changes to the state as it executes, without changing the original`ctx.ms`. This is useful to protect the underlying multistore in case the changes need to be reverted at some point in the execution.
|
||||
3. The process may read and write from `ctx` as it is executing. It may call a subprocess and pass
|
||||
`ctx` to it as needed.
|
||||
`ctx` to it as needed.
|
||||
4. When a subprocess returns, it checks if the result is a success or failure. If a failure, nothing
|
||||
needs to be done - the cache wrapped `ctx` is simply discarded. If successful, the changes made to
|
||||
the cache-wrapped `MultiStore` can be committed to the original `ctx.ms` via `Write()`.
|
||||
needs to be done - the cache wrapped `ctx` is simply discarded. If successful, the changes made to
|
||||
the cache-wrapped `MultiStore` can be committed to the original `ctx.ms` via `Write()`.
|
||||
|
||||
For example, here is a snippet from the [`runTx`](./baseapp.md#runtx-and-runmsgs) function in
|
||||
[`baseapp`](./baseapp.md):
|
||||
@ -106,12 +90,12 @@ if result.IsOK() {
|
||||
Here is the process:
|
||||
|
||||
1. Prior to calling `runMsgs` on the message(s) in the transaction, it uses `app.cacheTxContext()`
|
||||
to cache-wrap the context and multistore.
|
||||
to cache-wrap the context and multistore.
|
||||
2. The cache-wrapped context, `runMsgCtx`, is used in `runMsgs` to return a result.
|
||||
3. If the process is running in [`checkTxMode`](./baseapp.md#checktx), there is no need to write the
|
||||
changes - the result is returned immediately.
|
||||
changes - the result is returned immediately.
|
||||
4. If the process is running in [`deliverTxMode`](./baseapp.md#delivertx) and the result indicates
|
||||
a successful run over all the messages, the cached multistore is written back to the original.
|
||||
a successful run over all the messages, the cached multistore is written back to the original.
|
||||
|
||||
## Next {hide}
|
||||
|
||||
|
||||
@ -12,60 +12,65 @@ The main endpoint of an SDK application is the daemon client, otherwise known as
|
||||
|
||||
## `main` function
|
||||
|
||||
The full-node client of any SDK application is built by running a `main` function. The client is generally named by appending the `-d` suffix to the application name (e.g. `appd` for an application named `app`), and the `main` function is defined in a `./cmd/appd/main.go` file. Running this function creates an executable `.appd` that comes with a set of commands. For an app named `app`, the main command is [`appd start`](#start-command), which starts the full-node.
|
||||
The full-node client of any SDK application is built by running a `main` function. The client is generally named by appending the `-d` suffix to the application name (e.g. `appd` for an application named `app`), and the `main` function is defined in a `./appd/cmd/main.go` file. Running this function creates an executable `appd` that comes with a set of commands. For an app named `app`, the main command is [`appd start`](#start-command), which starts the full-node.
|
||||
|
||||
In general, developers will implement the `main.go` function with the following structure:
|
||||
|
||||
- First, a [`codec`](./encoding.md) is instanciated for the application.
|
||||
- First, an [`appCodec`](./encoding.md) is instanciated for the application.
|
||||
- Then, the `config` is retrieved and config parameters are set. This mainly involves setting the bech32 prefixes for [addresses and pubkeys](../basics/accounts.md#addresses-and-pubkeys).
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/types/config.go#L10-L21
|
||||
- Using [cobra](https://github.com/spf13/cobra), the root command of the full-node client is created. After that, all the custom commands of the application are added using the `AddCommand()` method of `rootCmd`.
|
||||
- Add default server commands to `rootCmd` using the `server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators)` method. These commands are separated from the ones added above since they are standard and defined at SDK level. They should be shared by all SDK-based applications. They include the most important command: the [`start` command](#start-command).
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/types/config.go#L13-L24
|
||||
- Using [cobra](https://github.com/spf13/cobra), the root command of the full-node client is created. After that, all the custom commands of the application are added using the `AddCommand()` method of `rootCmd`.
|
||||
- Add default server commands to `rootCmd` using the `server.AddCommands()` method. These commands are separated from the ones added above since they are standard and defined at SDK level. They should be shared by all SDK-based applications. They include the most important command: the [`start` command](#start-command).
|
||||
- Prepare and execute the `executor`.
|
||||
+++ https://github.com/tendermint/tendermint/blob/bc572217c07b90ad9cee851f193aaa8e9557cbc7/libs/cli/setup.go#L75-L78
|
||||
+++ https://github.com/tendermint/tendermint/blob/v0.34.0-rc6/libs/cli/setup.go#L74-L78
|
||||
|
||||
See an example of `main` function from the [`gaia`](https://github.com/cosmos/gaia) application:
|
||||
See an example of `main` function from the `simapp` application, the SDK's application for demo purposes:
|
||||
|
||||
+++ https://github.com/cosmos/gaia/blob/f41a660cdd5bea173139965ade55bd25d1ee3429/cmd/gaiad/main.go
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/simapp/simd/main.go
|
||||
|
||||
## `start` command
|
||||
|
||||
The `start` command is defined in the `/server` folder of the Cosmos SDK. It is added to the root command of the full-node client in the [`main` function](#main-function) and called by the end-user to start their node:
|
||||
|
||||
```go
|
||||
// For an example app named "app", the following command starts the full-node
|
||||
|
||||
```bash
|
||||
# For an example app named "app", the following command starts the full-node.
|
||||
appd start
|
||||
|
||||
# Using the SDK's own simapp, the following commands start the simapp node.
|
||||
simd start
|
||||
```
|
||||
|
||||
As a reminder, the full-node is composed of three conceptual layers: the networking layer, the consensus layer and the application layer. The first two are generally bundled together in an entity called the consensus engine (Tendermint Core by default), while the third is the state-machine defined with the help of the Cosmos SDK. Currently, the Cosmos SDK uses Tendermint as the default consensus engine, meaning the start command is implemented to boot up a Tendermint node.
|
||||
As a reminder, the full-node is composed of three conceptual layers: the networking layer, the consensus layer and the application layer. The first two are generally bundled together in an entity called the consensus engine (Tendermint Core by default), while the third is the state-machine defined with the help of the Cosmos SDK. Currently, the Cosmos SDK uses Tendermint as the default consensus engine, meaning the start command is implemented to boot up a Tendermint node.
|
||||
|
||||
The flow of the `start` command is pretty straightforward. First, it retrieves the `config` from the `context` in order to open the `db` (a [`leveldb`](https://github.com/syndtr/goleveldb) instance by default). This `db` contains the latest known state of the application (empty if the application is started from the first time.
|
||||
The flow of the `start` command is pretty straightforward. First, it retrieves the `config` from the `context` in order to open the `db` (a [`leveldb`](https://github.com/syndtr/goleveldb) instance by default). This `db` contains the latest known state of the application (empty if the application is started from the first time.
|
||||
|
||||
With the `db`, the `start` command creates a new instance of the application using an `appCreator` function:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/server/start.go#L144
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/server/start.go#L227
|
||||
|
||||
Note that an `appCreator` is a function that fulfills the `AppCreator` signature. In practice, the [constructor the application](../basics/app-anatomy.md#constructor-function) is passed as the `appCreator`.
|
||||
Note that an `appCreator` is a function that fulfills the `AppCreator` signature:
|
||||
+++https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/server/types/app.go#L48-L50
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/server/constructors.go#L17-L25
|
||||
In practice, the [constructor of the application](../basics/app-anatomy.md#constructor-function) is passed as the `appCreator`.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/simapp/simd/cmd/root.go#L170-L215
|
||||
|
||||
Then, the instance of `app` is used to instanciate a new Tendermint node:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/server/start.go#L153-L163
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/server/start.go#L235-L244
|
||||
|
||||
The Tendermint node can be created with `app` because the latter satisfies the [`abci.Application` interface](https://github.com/tendermint/tendermint/blob/bc572217c07b90ad9cee851f193aaa8e9557cbc7/abci/types/application.go#L11-L26) (given that `app` extends [`baseapp`](./baseapp.md)). As part of the `NewNode` method, Tendermint makes sure that the height of the application (i.e. number of blocks since genesis) is equal to the height of the Tendermint node. The difference between these two heights should always be negative or null. If it is strictly negative, `NewNode` will replay blocks until the height of the application reaches the height of the Tendermint node. Finally, if the height of the application is `0`, the Tendermint node will call [`InitChain`](./baseapp.md#initchain) on the application to initialize the state from the genesis file.
|
||||
The Tendermint node can be created with `app` because the latter satisfies the [`abci.Application` interface](https://github.com/tendermint/tendermint/blob/v0.34.0/abci/types/application.go#L7-L32) (given that `app` extends [`baseapp`](./baseapp.md)). As part of the `NewNode` method, Tendermint makes sure that the height of the application (i.e. number of blocks since genesis) is equal to the height of the Tendermint node. The difference between these two heights should always be negative or null. If it is strictly negative, `NewNode` will replay blocks until the height of the application reaches the height of the Tendermint node. Finally, if the height of the application is `0`, the Tendermint node will call [`InitChain`](./baseapp.md#initchain) on the application to initialize the state from the genesis file.
|
||||
|
||||
Once the Tendermint node is instanciated and in sync with the application, the node can be started:
|
||||
|
||||
```go
|
||||
if err := tmNode.Start(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
```
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/server/start.go#L250-L252
|
||||
|
||||
Upon starting, the node will bootstrap its RPC and P2P server and start dialing peers. During handshake with its peers, if the node realizes they are ahead, it will query all the blocks sequentially in order to catch up. Then, it will wait for new block proposals and block signatures from validators in order to make progress.
|
||||
Upon starting, the node will bootstrap its RPC and P2P server and start dialing peers. During handshake with its peers, if the node realizes they are ahead, it will query all the blocks sequentially in order to catch up. Then, it will wait for new block proposals and block signatures from validators in order to make progress.
|
||||
|
||||
## Other commands
|
||||
|
||||
To discover how to concretely run a node and interact with it, please refer to our [Running a Node](../run-node/README.md) guide.
|
||||
|
||||
## Next {hide}
|
||||
|
||||
Learn about the [store](./store.md) {hide}
|
||||
Learn about the [store](./store.md) {hide}
|
||||
|
||||
@ -58,11 +58,11 @@ The Cosmos SDK comes with a large set of stores to persist the state of applicat
|
||||
|
||||
At its very core, a Cosmos SDK `store` is an object that holds a `CacheWrapper` and implements a `GetStoreType()` method:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/types/store.go#L12-L15
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/types/store.go#L15-L18
|
||||
|
||||
The `GetStoreType` is a simple method that returns the type of store, whereas a `CacheWrapper` is a simple interface that specifies cache-wrapping and `Write` methods:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/types/store.go#L217-L238
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/types/store.go#L240-L264
|
||||
|
||||
Cache-wrapping is used ubiquitously in the Cosmos SDK and required to be implemented on every store type. A cache-wrapper creates a light snapshot of a store that can be passed around and updated without affecting the main underlying store. This is used to trigger temporary state-transitions that may be reverted later should an error occur. If a state-transition sequence is performed without issue, the cached store can be committed to the underlying store at the end of the sequence.
|
||||
|
||||
@ -70,11 +70,11 @@ Cache-wrapping is used ubiquitously in the Cosmos SDK and required to be impleme
|
||||
|
||||
A commit store is a store that has the ability to commit changes made to the underlying tree or db. The Cosmos SDK differentiates simple stores from commit stores by extending the basic store interfaces with a `Committer`:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/types/store.go#L24-L28
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/types/store.go#L29-L33
|
||||
|
||||
The `Committer` is an interface that defines methods to persist changes to disk:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/types/store.go#L17-L22
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/types/store.go#L20-L27
|
||||
|
||||
The `CommitID` is a deterministic commit of the state tree. Its hash is returned to the underlying consensus engine and stored in the block header. Note that commit store interfaces exist for various purposes, one of which is to make sure not every object can commit the store. As part of the [object-capabilities model](./ocap.md) of the Cosmos SDK, only `baseapp` should have the ability to commit stores. For example, this is the reason why the `ctx.KVStore()` method by which modules typically access stores returns a `KVStore` and not a `CommitKVStore`.
|
||||
|
||||
@ -86,27 +86,27 @@ The Cosmos SDK comes with many types of stores, the most used being [`CommitMult
|
||||
|
||||
Each Cosmos SDK application holds a multistore at its root to persist its state. The multistore is a store of `KVStores` that follows the `Multistore` interface:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/types/store.go#L83-L112
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/types/store.go#L104-L133
|
||||
|
||||
If tracing is enabled, then cache-wrapping the multistore will wrap all the underlying `KVStore` in [`TraceKv.Store`](#tracekv-store) before caching them.
|
||||
If tracing is enabled, then cache-wrapping the multistore will wrap all the underlying `KVStore` in [`TraceKv.Store`](#tracekv-store) before caching them.
|
||||
|
||||
### CommitMultiStore
|
||||
|
||||
The main type of `Multistore` used in the Cosmos SDK is `CommitMultiStore`, which is an extension of the `Multistore` interface:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/types/store.go#L120-L158
|
||||
+++https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/types/store.go#L141-L184
|
||||
|
||||
As for concrete implementation, the [`rootMulti.Store`] is the go-to implementation of the `CommitMultiStore` interface.
|
||||
As for concrete implementation, the [`rootMulti.Store`] is the go-to implementation of the `CommitMultiStore` interface.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/rootmulti/store.go#L27-L43
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/rootmulti/store.go#L43-L61
|
||||
|
||||
The `rootMulti.Store` is a base-layer multistore built around a `db` on top of which multiple `KVStores` can be mounted, and is the default multistore store used in [`baseapp`](./baseapp.md).
|
||||
|
||||
### CacheMultiStore
|
||||
|
||||
Whenever the `rootMulti.Store` needs to be cached-wrapped, a [`cachemulti.Store`](https://github.com/cosmos/cosmos-sdk/blob/master/store/cachemulti/store.go) is used.
|
||||
Whenever the `rootMulti.Store` needs to be cached-wrapped, a [`cachemulti.Store`](https://github.com/cosmos/cosmos-sdk/blob/master/store/cachemulti/store.go) is used.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/cachemulti/store.go#L17-L28
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/cachemulti/store.go#L17-L28
|
||||
|
||||
`cachemulti.Store` cache wraps all substores in its constructor and hold them in `Store.stores`. `Store.GetKVStore()` returns the store from `Store.stores`, and `Store.Write()` recursively calls `CacheWrap.Write()` on all the substores.
|
||||
|
||||
@ -114,50 +114,37 @@ Whenever the `rootMulti.Store` needs to be cached-wrapped, a [`cachemulti.Store`
|
||||
|
||||
### `KVStore` and `CommitKVStore` Interfaces
|
||||
|
||||
A `KVStore` is a simple key-value store used to store and retrieve data. A `CommitKVStore` is a `KVStore` that also implements a `Committer`. By default, stores mounted in `baseapp`'s main `CommitMultiStore` are `CommitKVStore`s. The `KVStore` interface is primarily used to restrict modules from accessing the committer.
|
||||
A `KVStore` is a simple key-value store used to store and retrieve data. A `CommitKVStore` is a `KVStore` that also implements a `Committer`. By default, stores mounted in `baseapp`'s main `CommitMultiStore` are `CommitKVStore`s. The `KVStore` interface is primarily used to restrict modules from accessing the committer.
|
||||
|
||||
Individual `KVStore`s are used by modules to manage a subset of the global state. `KVStores` can be accessed by objects that hold a specific key. This `key` should only be exposed to the [`keeper`](../building-modules/keeper.md) of the module that defines the store.
|
||||
|
||||
`CommitKVStore`s are declared by proxy of their respective `key` and mounted on the application's [multistore](#multistore) in the [main application file](../basics/app-anatomy.md#core-application-file). In the same file, the `key` is also passed to the module's `keeper` that is responsible for managing the store.
|
||||
`CommitKVStore`s are declared by proxy of their respective `key` and mounted on the application's [multistore](#multistore) in the [main application file](../basics/app-anatomy.md#core-application-file). In the same file, the `key` is also passed to the module's `keeper` that is responsible for managing the store.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/types/store.go#L163-L193
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/types/store.go#L189-L219
|
||||
|
||||
Apart from the traditional `Get` and `Set` methods, a `KVStore` is expected to implement an `Iterator()` method which returns an `Iterator` object. The `Iterator()` method is used to iterate over a domain of keys, typically keys that share a common prefix. Here is a common pattern of using an `Iterator` that might be found in a module's `keeper`:
|
||||
Apart from the traditional `Get` and `Set` methods, a `KVStore` must provide an `Iterator(start, end)` method which returns an `Iterator` object. It is used to iterate over a range of keys, typically keys that share a common prefix. Below is an example from the bank's module keeper, used to iterate over all account balances:
|
||||
|
||||
```go
|
||||
store := ctx.KVStore(keeper.storeKey)
|
||||
iterator := sdk.KVStorePrefixIterator(store, prefix) // proxy for store.Iterator
|
||||
|
||||
defer iterator.Close()
|
||||
for ; iterator.Valid(); iterator.Next() {
|
||||
var object types.Object
|
||||
keeper.cdc.MustUnmarshalBinaryBare(iterator.Value(), &object)
|
||||
|
||||
if cb(object) {
|
||||
break
|
||||
}
|
||||
}
|
||||
```
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/x/bank/keeper/view.go#L115-L134
|
||||
|
||||
### `IAVL` Store
|
||||
|
||||
The default implementation of `KVStore` and `CommitKVStore` used in `baseapp` is the `iavl.Store`.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/iavl/store.go#L32-L47
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/iavl/store.go#L37-L40
|
||||
|
||||
`iavl` stores are based around an [IAVL Tree](https://github.com/tendermint/iavl), a self-balancing binary tree which guarantees that:
|
||||
`iavl` stores are based around an [IAVL Tree](https://github.com/tendermint/iavl), a self-balancing binary tree which guarantees that:
|
||||
|
||||
- `Get` and `Set` operations are O(log n), where n is the number of elements in the tree.
|
||||
- Iteration efficiently returns the sorted elements within the range.
|
||||
- Each tree version is immutable and can be retrieved even after a commit (depending on the pruning settings).
|
||||
- Each tree version is immutable and can be retrieved even after a commit (depending on the pruning settings).
|
||||
|
||||
The documentation on the IAVL Tree is located [here](https://github.com/tendermint/iavl/blob/f9d4b446a226948ed19286354f0d433a887cc4a3/docs/overview.md).
|
||||
The documentation on the IAVL Tree is located [here](https://github.com/cosmos/iavl/blob/v0.15.0-rc5/docs/overview.md).
|
||||
|
||||
### `DbAdapter` Store
|
||||
|
||||
`dbadapter.Store` is a adapter for `dbm.DB` making it fulfilling the `KVStore` interface.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/dbadapter/store.go#L13-L16
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/dbadapter/store.go#L13-L16
|
||||
|
||||
`dbadapter.Store` embeds `dbm.DB`, meaning most of the `KVStore` interface functions are implemented. The other functions (mostly miscellaneous) are manually implemented. This store is primarily used within [Transient Stores](#transient-stores)
|
||||
|
||||
@ -165,17 +152,17 @@ The documentation on the IAVL Tree is located [here](https://github.com/tendermi
|
||||
|
||||
`Transient.Store` is a base-layer `KVStore` which is automatically discarded at the end of the block.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/transient/store.go#L14-L17
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/transient/store.go#L13-L16
|
||||
|
||||
`Transient.Store` is a `dbadapter.Store` with a `dbm.NewMemDB()`. All `KVStore` methods are reused. When `Store.Commit()` is called, a new `dbadapter.Store` is assigned, discarding previous reference and making it garbage collected.
|
||||
|
||||
This type of store is useful to persist information that is only relevant per-block. One example would be to store parameter changes (i.e. a bool set to `true` if a parameter changed in a block).
|
||||
This type of store is useful to persist information that is only relevant per-block. One example would be to store parameter changes (i.e. a bool set to `true` if a parameter changed in a block).
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/x/params/subspace/subspace.go#L24-L32
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/x/params/types/subspace.go#L20-L30
|
||||
|
||||
Transient stores are typically accessed via the [`context`](./context.md) via the `TransientStore()` method:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/types/context.go#L215-L218
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/types/context.go#L232-L235
|
||||
|
||||
## KVStore Wrappers
|
||||
|
||||
@ -183,9 +170,9 @@ Transient stores are typically accessed via the [`context`](./context.md) via th
|
||||
|
||||
`cachekv.Store` is a wrapper `KVStore` which provides buffered writing / cached reading functionalities over the underlying `KVStore`.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/cachekv/store.go#L26-L33
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/cachekv/store.go#L27-L34
|
||||
|
||||
This is the type used whenever an IAVL Store needs to be cache-wrapped (typically when setting value that might be reverted later).
|
||||
This is the type used whenever an IAVL Store needs to be cache-wrapped (typically when setting value that might be reverted later).
|
||||
|
||||
#### `Get`
|
||||
|
||||
@ -201,27 +188,27 @@ This is the type used whenever an IAVL Store needs to be cache-wrapped (typicall
|
||||
|
||||
### `GasKv` Store
|
||||
|
||||
Cosmos SDK applications use [`gas`](../basics/gas-fees.md) to track resources usage and prevent spam. [`GasKv.Store`](https://github.com/cosmos/cosmos-sdk/blob/master/store/gaskv/store.go) is a `KVStore` wrapper that enables automatic gas consumption each time a read or write to the store is made. It is the solution of choice to track storage usage in Cosmos SDK applications.
|
||||
Cosmos SDK applications use [`gas`](../basics/gas-fees.md) to track resources usage and prevent spam. [`GasKv.Store`](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/gaskv/store.go) is a `KVStore` wrapper that enables automatic gas consumption each time a read or write to the store is made. It is the solution of choice to track storage usage in Cosmos SDK applications.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/gaskv/store.go#L11-L17
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/gaskv/store.go#L13-L19
|
||||
|
||||
When methods of the parent `KVStore` are called, `GasKv.Store` automatically consumes appropriate amount of gas depending on the `Store.gasConfig`:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/types/gas.go#L141-L150
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/types/gas.go#L153-L162
|
||||
|
||||
By default, all `KVStores` are wrapped in `GasKv.Stores` when retrieved. This is done in the `KVStore()` method of the [`context`](./context.md):
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/types/context.go#L210-L213
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/types/context.go#L227-L230
|
||||
|
||||
In this case, the default gas configuration is used:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/types/gas.go#L152-L163
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/types/gas.go#L164-L175
|
||||
|
||||
### `TraceKv` Store
|
||||
|
||||
`tracekv.Store` is a wrapper `KVStore` which provides operation tracing functionalities over the underlying `KVStore`. It is applied automatically by the Cosmos SDK on all `KVStore` if tracing is enabled on the parent `MultiStore`.
|
||||
`tracekv.Store` is a wrapper `KVStore` which provides operation tracing functionalities over the underlying `KVStore`. It is applied automatically by the Cosmos SDK on all `KVStore` if tracing is enabled on the parent `MultiStore`.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/tracekv/store.go#L20-L43
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/tracekv/store.go#L20-L43
|
||||
|
||||
When each `KVStore` methods are called, `tracekv.Store` automatically logs `traceOperation` to the `Store.writer`. `traceOperation.Metadata` is filled with `Store.context` when it is not nil. `TraceContext` is a `map[string]interface{}`.
|
||||
|
||||
@ -229,7 +216,7 @@ When each `KVStore` methods are called, `tracekv.Store` automatically logs `trac
|
||||
|
||||
`prefix.Store` is a wrapper `KVStore` which provides automatic key-prefixing functionalities over the underlying `KVStore`.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/store/prefix/store.go#L17-L20
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/store/prefix/store.go#L15-L21
|
||||
|
||||
When `Store.{Get, Set}()` is called, the store forwards the call to its parent, with the key prefixed with the `Store.prefix`.
|
||||
|
||||
|
||||
@ -8,84 +8,146 @@ order: 2
|
||||
|
||||
## Pre-requisite Readings
|
||||
|
||||
* [Anatomy of an SDK Application](../basics/app-anatomy.md) {prereq}
|
||||
- [Anatomy of an SDK Application](../basics/app-anatomy.md) {prereq}
|
||||
|
||||
## Transactions
|
||||
|
||||
Transactions are comprised of metadata held in [contexts](./context.md) and [messages](../building-modules/messages-and-queries.md) that trigger state changes within a module through the module's [`Msg` service](../building-modules/msg-services.md).
|
||||
Transactions are comprised of metadata held in [contexts](./context.md) and [`Msg`s](../building-modules/messages-and-queries.md) that trigger state changes within a module through the module's [`Msg` service](../building-modules/msg-services.md).
|
||||
|
||||
When users want to interact with an application and make state changes (e.g. sending coins), they create transactions. Each of a transaction's `message`s must be signed using the private key associated with the appropriate account(s), before the transaction is broadcasted to the network. A transaction must then be included in a block, validated, and approved by the network through the consensus process. To read more about the lifecycle of a transaction, click [here](../basics/tx-lifecycle.md).
|
||||
When users want to interact with an application and make state changes (e.g. sending coins), they create transactions. Each of a transaction's `Msg`s must be signed using the private key associated with the appropriate account(s), before the transaction is broadcasted to the network. A transaction must then be included in a block, validated, and approved by the network through the consensus process. To read more about the lifecycle of a transaction, click [here](../basics/tx-lifecycle.md).
|
||||
|
||||
## Type Definition
|
||||
|
||||
Transaction objects are SDK types that implement the `Tx` interface
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/types/tx_msg.go#L34-L41
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/types/tx_msg.go#L49-L57
|
||||
|
||||
It contains the following methods:
|
||||
|
||||
* **GetMsgs:** unwraps the transaction and returns a list of its message(s) - one transaction may have one or multiple [messages](../building-modules/messages-and-queries.md#messages), which are defined by module developers.
|
||||
* **ValidateBasic:** includes lightweight, [*stateless*](../basics/tx-lifecycle.md#types-of-checks) checks used by ABCI messages [`CheckTx`](./baseapp.md#checktx) and [`DeliverTx`](./baseapp.md#delivertx) to make sure transactions are not invalid. For example, the [`auth`](https://github.com/cosmos/cosmos-sdk/tree/master/x/auth) module's `StdTx` `ValidateBasic` function checks that its transactions are signed by the correct number of signers and that the fees do not exceed what the user's maximum. Note that this function is to be distinct from the `ValidateBasic` functions for *`messages`*, which perform basic validity checks on messages only. For example, when [`runTx`](./baseapp.md#runtx) is checking a transaction created from the [`auth`](https://github.com/cosmos/cosmos-sdk/tree/master/x/auth/spec) module, it first runs `ValidateBasic` on each message, then runs the `auth` module AnteHandler which calls `ValidateBasic` for the transaction itself.
|
||||
* **TxEncoder:** Nodes running the consensus engine (e.g. Tendermint Core) are responsible for gossiping transactions and ordering them into blocks, but only handle them in the generic `[]byte` form. Transactions are always [marshaled](./encoding.md) (encoded) before they are relayed to nodes, which compacts them to facilitate gossiping and helps maintain the consensus engine's separation from from application logic. The Cosmos SDK allows developers to specify any deterministic encoding format for their applications; the default is Amino.
|
||||
* **TxDecoder:** [ABCI](https://tendermint.com/docs/spec/abci/) calls from the consensus engine to the application, such as `CheckTx` and `DeliverTx`, are used to process transaction data to determine validity and state changes. Since transactions are passed in as `txBytes []byte`, they need to first be unmarshaled (decoded) using `TxDecoder` before any logic is applied.
|
||||
- **GetMsgs:** unwraps the transaction and returns a list of its `Msg`s - one transaction may have one or multiple [`Msg`s](../building-modules/messages-and-queries.md#messages), which are defined by module developers.
|
||||
- **ValidateBasic:** includes lightweight, [_stateless_](../basics/tx-lifecycle.md#types-of-checks) checks used by ABCI messages [`CheckTx`](./baseapp.md#checktx) and [`DeliverTx`](./baseapp.md#delivertx) to make sure transactions are not invalid. For example, the [`auth`](https://github.com/cosmos/cosmos-sdk/tree/master/x/auth) module's `StdTx` `ValidateBasic` function checks that its transactions are signed by the correct number of signers and that the fees do not exceed what the user's maximum. Note that this function is to be distinct from the `ValidateBasic` functions for `Msg`s, which perform basic validity checks on messages only. For example, when [`runTx`](./baseapp.md#runtx) is checking a transaction created from the [`auth`](https://github.com/cosmos/cosmos-sdk/tree/master/x/auth/spec) module, it first runs `ValidateBasic` on each message, then runs the `auth` module AnteHandler which calls `ValidateBasic` for the transaction itself.
|
||||
|
||||
The most used implementation of the `Tx` interface is [`StdTx` from the `auth` module](https://github.com/cosmos/cosmos-sdk/blob/master/x/auth/types/stdtx.go). As a developer, using `StdTx` as your transaction format is as simple as importing the `auth` module in your application (which can be done in the [constructor of the application](../basics/app-anatomy.md#constructor-function))
|
||||
As a developer, you should rarely manipulate `Tx` directly, as `Tx` is really an intermediate type used for transaction generation. Instead, developers should prefer the `TxBuilder` interface, which you can learn more about [below](#transaction-generation).
|
||||
|
||||
### Signing Transactions
|
||||
|
||||
Every message in a transaction must be signed by the addresses specified by its `GetSigners`. The SDK currently allows signing transactions in two different ways.
|
||||
|
||||
#### `SIGN_MODE_DIRECT` (preferred)
|
||||
|
||||
The most used implementation of the `Tx` interface is the Protobuf `Tx` message, which is used in `SIGN_MODE_DIRECT`:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/proto/cosmos/tx/v1beta1/tx.proto#L12-L25
|
||||
|
||||
Because Protobuf serialization is not deterministic, the SDK uses an additional `TxRaw` type to denote the pinned bytes over which a transaction is signed. Any user can generate a valid `body` and `auth_info` for a transaction, and serialize these two messages using Protobuf. `TxRaw` then pins the user's exact binary representation of `body` and `auth_info`, called respectively `body_bytes` and `auth_info_bytes`. The document that is signed by all signers of the transaction is `SignDoc` (deterministically serialized using [ADR-027](../architecture/adr-027-deterministic-protobuf-serialization.md)):
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/proto/cosmos/tx/v1beta1/tx.proto#L47-L64
|
||||
|
||||
Once signed by all signers, the `body_bytes`, `auth_info_bytes` and `signatures` are gathered into `TxRaw`, whose serialized bytes are broadcasted over the network.
|
||||
|
||||
#### `SIGN_MODE_LEGACY_AMINO_JSON`
|
||||
|
||||
The legacy implemention of the `Tx` interface is the `StdTx` struct from `x/auth`:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/x/auth/legacy/legacytx/stdtx.go#L120-L130
|
||||
|
||||
The document signed by all signers is `StdSignDoc`:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/x/auth/legacy/legacytx/stdsign.go#L20-L33
|
||||
|
||||
which is encoded into bytes using Amino JSON. Once all signatures are gathered into `StdTx`, `StdTx` is serialized using Amino JSON, and these bytes are broadcasted over the network.
|
||||
|
||||
#### Other Sign Modes
|
||||
|
||||
Other sign modes, most notably `SIGN_MODE_TEXTUAL`, are being discussed. If you wish to learn more about them, please refer to [ADR-020](../architecture/adr-020-protobuf-transaction-encoding.md).
|
||||
|
||||
## Transaction Process
|
||||
|
||||
A transaction is created by an end-user through one of the possible [interfaces](#interfaces). In the process, two contexts and an array of [messages](#messages) are created, which are then used to [generate](#transaction-generation) the transaction itself. The actual state changes triggered by transactions are enabled by the [handlers](#handlers). The rest of the document will describe each of these components, in this order.
|
||||
The process of an end-user sending a transaction is:
|
||||
|
||||
### CLI and REST Interfaces
|
||||
- decide on the messages to put into the transaction,
|
||||
- generate the transaction using the SDK's `TxBuilder`,
|
||||
- broadcast the transaction using one of the available interfaces.
|
||||
|
||||
Application developers create entrypoints to the application by creating a [command-line interface](../interfaces/cli.md) and/or [REST interface](../interfaces/rest.md), typically found in the application's `./cmd` folder. These interfaces allow users to interact with the application through command-line or through HTTP requests.
|
||||
|
||||
For the [command-line interface](../building-modules/module-interfaces.md#cli), module developers create subcommands to add as children to the application top-level transaction command `TxCmd`. For [HTTP requests](../building-modules/module-interfaces.md#legacy-rest), module developers specify acceptable request types, register REST routes, and create HTTP Request Handlers.
|
||||
|
||||
When users interact with the application's interfaces, they invoke the underlying modules' handlers or command functions, directly creating messages.
|
||||
The next paragraphs will describe each of these components, in this order.
|
||||
|
||||
### Messages
|
||||
|
||||
**`Message`s** are module-specific objects that trigger state transitions within the scope of the module they belong to. Module developers define the messages for their module by implementing the `Msg` interface, and also define a [`Handler`](../building-modules/msg-services.md#handler-type) to process them.
|
||||
::: tip
|
||||
Module `Msg`s are not to be confused with [ABCI Messages](https://tendermint.com/docs/spec/abci/abci.html#messages) which define interactions between the Tendermint and application layers.
|
||||
:::
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/types/tx_msg.go#L8-L29
|
||||
**Messages** (or `Msg`s) are module-specific objects that trigger state transitions within the scope of the module they belong to. Module developers define the messages for their module by adding methods to the Protobuf [`Msg` service](../building-modules/msg-services.md), and also implement the corresponding `MsgServer`.
|
||||
|
||||
`Message`s in a module are typically defined in a `msgs.go` file (though not always), and one handler with multiple functions to handle each of the module's `message`s is defined in a `handler.go` file.
|
||||
`Msg`s in a module are defined as methods in the [`Msg` service] inside each module's `tx.proto` file. Since `Msg`s are module-specific, each module needs a to process all of its message types and trigger state changes within the module's scope. This design puts more responsibility on module developers, allowing application developers to reuse common functionalities without having to implement state transition logic repetitively. To achieve this, Protobuf generates a `MsgServer` interface for each module, and the module developer needs to implement this interface. The methods on the `MsgServer` interface corresponds on how to handle each of the different `Msg`.
|
||||
|
||||
Note: module `messages` are not to be confused with [ABCI Messages](https://tendermint.com/docs/spec/abci/abci.html#messages) which define interactions between the Tendermint and application layers.
|
||||
|
||||
To learn more about `message`s, click [here](../building-modules/messages-and-queries.md#messages).
|
||||
To learn more about `Msg` services and how to implement `MsgServer`, click [here](../building-modules/msg-services.md).
|
||||
|
||||
While messages contain the information for state transition logic, a transaction's other metadata and relevant information are stored in the `TxBuilder` and `Context`.
|
||||
|
||||
### Transaction Generation
|
||||
|
||||
Transactions are first created by end-users through an `appcli tx` command through the command-line or a POST request to an HTTPS server. For details about transaction creation, click [here](../basics/tx-lifecycle.md#transaction-creation).
|
||||
The `TxBuilder` interface contains data closely related with the generation of transactions, which an end-user can freely set to generate the desired transaction:
|
||||
|
||||
[`Contexts`](https://godoc.org/context) are immutable objects that contain all the information needed to process a request. In the process of creating a transaction through the `auth` module (though it is not mandatory to create transactions this way), two contexts are created: the [`Context`](../interfaces/query-lifecycle.md#context) and `TxBuilder`. Both are automatically generated and do not need to be defined by application developers, but do require input from the transaction creator (e.g. using flags through the CLI).
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/client/tx_config.go#L32-L45
|
||||
|
||||
The `TxBuilder` contains data closely related with the processing of transactions.
|
||||
- `Msg`s, the array of [messages](#messages) included in the transaction.
|
||||
- `GasLimit`, option chosen by the users for how to calculate how much gas they will need to pay.
|
||||
- `Memo`, to send with the transaction.
|
||||
- `FeeAmount`, the maximum amount the user is willing to pay in fees.
|
||||
- `TimeoutHeight`, block height until which the transaction is valid.
|
||||
- `Signatures`, the array of signatures from all signers of the transaction.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/7d7821b9af132b0f6131640195326aa02b6751db/x/auth/types/txbuilder.go#L18-L31
|
||||
As there are currently two sign modes for signing transactions, there are also two implementations of `TxBuilder`:
|
||||
|
||||
* `TxEncoder` defined by the developer for this type of transaction. Used to encode messages before being processed by nodes running Tendermint.
|
||||
* `Keybase` that manages the user's keys and is used to perform signing operations.
|
||||
* `AccountNumber` from which this transaction originated.
|
||||
* `Sequence`, the number of transactions that the user has sent out, used to prevent replay attacks.
|
||||
* `Gas` option chosen by the users for how to calculate how much gas they will need to pay. A common option is "auto" which generates an automatic estimate.
|
||||
* `GasAdjustment` to adjust the estimate of gas by a scalar value, used to avoid underestimating the amount of gas required.
|
||||
* `SimulateAndExecute` option to simply simulate the transaction execution without broadcasting.
|
||||
* `ChainID` representing which blockchain this transaction pertains to.
|
||||
* `Memo` to send with the transaction.
|
||||
* `Fees`, the maximum amount the user is willing to pay in fees. Alternative to specifying gas prices.
|
||||
* `GasPrices`, the amount per unit of gas the user is willing to pay in fees. Alternative to specifying fees.
|
||||
- [wrapper](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/x/auth/tx/builder.go#L19-L33) for creating transactions for `SIGN_MODE_DIRECT`,
|
||||
- [StdTxBuilder](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/x/auth/legacy/legacytx/stdtx_builder.go#L14-L20) for `SIGN_MODE_LEGACY_AMINO_JSON`.
|
||||
|
||||
The `Context` is initialized using the application's `codec` and data more closely related to the user interaction with the interface, holding data such as the output to the user and the broadcast mode. Read more about `Context` [here](../interfaces/query-lifecycle.md#context).
|
||||
However, the two implementation of `TxBuilder` should be hidden away from end-users, as they should prefer using the overarching `TxConfig` interface:
|
||||
|
||||
Every message in a transaction must be signed by the addresses specified by `GetSigners`. The signing process must be handled by a module, and the most widely used one is the [`auth`](https://github.com/cosmos/cosmos-sdk/tree/master/x/auth/spec) module. Signing is automatically performed when the transaction is created, unless the user choses to generate and sign separately. The `TxBuilder` (namely, the `KeyBase`) is used to perform the signing operations, and the `Context` is used to broadcast transactions.
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/client/tx_config.go#L21-L30
|
||||
|
||||
### Handlers
|
||||
`TxConfig` is an app-wide configuration for managing transactions. Most importantly, it holds the information about whether to sign each transaction with `SIGN_MODE_DIRECT` or `SIGN_MODE_LEGACY_AMINO_JSON`. By calling `txBuilder := txConfig.NewTxBuilder()`, a new `TxBuilder` will be created with the appropriate sign mode.
|
||||
|
||||
Since messages are module-specific types, each module needs a [`handler`](../building-modules/msg-services.md#handler-type) to process all of its message types and trigger state changes within the module's scope. This design puts more responsibility on module developers, allowing application developers to reuse common functionalities without having to implement state transition logic repetitively. To read more about `handler`s, click [here](../building-modules/msg-services.md#handler-type).
|
||||
Once `TxBuilder` is correctly populated with the setters exposed above, `TxConfig` will also take care of correctly encoding the bytes (again, either using `SIGN_MODE_DIRECT` or `SIGN_MODE_LEGACY_AMINO_JSON`). Here's a pseudo-code snippet of how to generate and encode a transaction, using the `TxEncoder()` method:
|
||||
|
||||
```go
|
||||
txBuilder := txConfig.NewTxBuilder()
|
||||
txBuilder.SetMsgs(...) // and other setters on txBuilder
|
||||
|
||||
bz, err := txConfig.TxEncoder()(txBuilder.GetTx())
|
||||
// bz are bytes to be broadcasted over the network
|
||||
```
|
||||
|
||||
### Broadcasting the Transaction
|
||||
|
||||
Once the transaction bytes are generated, there are currently three ways of broadcasting it.
|
||||
|
||||
#### CLI
|
||||
|
||||
Application developers create entrypoints to the application by creating a [command-line interface](../interfaces/cli.md) and/or [REST interface](../interfaces/rest.md), typically found in the application's `./cmd` folder. These interfaces allow users to interact with the application through command-line.
|
||||
|
||||
For the [command-line interface](../building-modules/module-interfaces.md#cli), module developers create subcommands to add as children to the application top-level transaction command `TxCmd`. CLI commands actually bundle all the steps of transaction processing into one simple command: creating messages, generating transactions and broadcasting. For concrete examples, see the [Interacting with a Node](../run-node/interact-node.md) section. An example transaction made using CLI looks like:
|
||||
|
||||
```bash
|
||||
simd tx send $MY_VALIDATOR_ADDRESS $RECIPIENT 1000stake
|
||||
```
|
||||
|
||||
#### gRPC
|
||||
|
||||
[gRPC](https://grpc.io) is introduced in Cosmos SDK 0.40 as the main component for the SDK's RPC layer. The principal usage of gRPC is in the context of modules' [`Query` services](../building-modules). However, the SDK also exposes a few other module-agnostic gRPC services, one of them being the `Tx` service:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/proto/cosmos/tx/v1beta1/service.proto
|
||||
|
||||
The `Tx` service exposes a handful of utility functions, such as simulating a transaction or querying a transaction, and also one method to broadcast transactions.
|
||||
|
||||
An example of broadcasting a transaction is shown in [TODO](https://github.com/cosmos/cosmos-sdk/issues/7657). Please note that the `BroadcastTx` endpoint takes `TxRaw`, not bytes.
|
||||
|
||||
#### REST
|
||||
|
||||
Each gRPC method has its corresponding REST endpoint, generated using [gRPC-gateway](https://github.com/grpc-ecosystem/grpc-gateway). Therefore, instead of using gRPC, you can also use HTTP to broadcast the same transaction, on the `POST /cosmos/tx/v1beta1/broadcast_tx` endpoint.
|
||||
|
||||
An example can be seen [here TODO](https://github.com/cosmos/cosmos-sdk/issues/7657)
|
||||
|
||||
## Next {hide}
|
||||
|
||||
|
||||
89
docs/migrations/rest.md
Normal file
89
docs/migrations/rest.md
Normal file
@ -0,0 +1,89 @@
|
||||
# REST Endpoints Migration
|
||||
|
||||
Migrate your REST endpoints to the Stargate ones. {synopsis}
|
||||
|
||||
## Deprecation of Legacy REST Endpoints
|
||||
|
||||
The Cosmos SDK versions v0.39 and earlier provided REST endpoints to query the state and broadcast transactions. These endpoints are kept in Cosmos SDK v0.40 (Stargate), but they are marked as deprecated, and will be removed in v0.41. We therefore call these endpoints legacy REST endpoints.
|
||||
|
||||
Some important information concerning all legacy REST endpoints:
|
||||
|
||||
- Most of these endpoints are backwards-comptatible. All breaking changes are described in the next section.
|
||||
- In particular, these endpoints still output Amino JSON. Cosmos v0.40 introduced Protobuf as the default encoding library throughout the codebase, but legacy REST endpoints are one of the few places where the encoding is hardcoded to Amino. For more information about Protobuf and Amino, please read our [encoding guide](../core/encoding.md).
|
||||
- All legacy REST endpoints include a [HTTP deprecation header](https://tools.ietf.org/id/draft-dalal-deprecation-header-01.html) which links to this document.
|
||||
|
||||
## Breaking Changes in Legacy REST Endpoints
|
||||
|
||||
| Legacy REST Endpoint | Description | Breaking Change |
|
||||
| ------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `GET /txs/{hash}` | Query tx by hash | Endpoint will error when trying to output transactions that don't support Amino serialization (e.g. IBC txs)<sup>1</sup>. |
|
||||
| `GET /txs` | Query tx by events | Endpoint will error when trying to output transactions that don't support Amino serialization (e.g. IBC txs)<sup>1</sup>. |
|
||||
| `GET /staking/validators` | Get all validators | BondStatus is now a protobuf enum instead of an int32, and JSON serialized using its protobuf name, so expect query parameters like `?status=BOND_STATUS_{BONDED,UNBONDED,UNBONDING}` as opposed to `?status={bonded,unbonded,unbonding}`. |
|
||||
|
||||
<sup>1</sup>: Transactions that don't support Amino serialization are the ones that contain one or more `Msg`s that are not registered with the Amino codec. Currently in the SDK, only IBC `Msg`s fall into this case.
|
||||
|
||||
## Migrating to New REST Endpoints
|
||||
|
||||
Thanks to the Protocol Buffers migration in v0.40 we are able to take advantage of a vast number of gRPC tools and solutions. For most of the legacy REST endpoints, Cosmos SDK v0.40 provides new REST endpoints generated from [gRPC `Query` services](../building-modules/query-services.md) using [grpc-gateway](https://grpc-ecosystem.github.io/grpc-gateway/). We usually call them _gGPC-gateway REST endpoints_.
|
||||
|
||||
Some modules expose legacy `POST` endpoints to generate unsigned transactions for their `Msg`s. These `POST` endpoints have been removed. We recommend to use [service `Msg`s](../building-modules/msg-services.md) directly, and use Protobuf to do client-side transaction generation. A guide can be found [here (TODO)](https://github.com/cosmos/cosmos-sdk/issues/7657).
|
||||
|
||||
| Legacy REST Endpoint | Description | New gGPC-gateway REST Endpoint |
|
||||
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
||||
| `GET /txs/{hash}` | Query tx by hash | `GET /cosmos/tx/v1beta1/tx/{hash}` |
|
||||
| `GET /txs` | Query tx by events | `GET /cosmos/tx/v1beta1/txs` |
|
||||
| `POST /txs` | Broadcast tx | `POST /cosmos/tx/v1beta1/txs` |
|
||||
| `POST /txs/encode` | Encodes an Amino JSON tx to an Amino binary tx | N/A, use Protobuf directly |
|
||||
| `POST /txs/decode` | Decodes an Amino binary tx into an Amino JSON tx | N/A, use Protobuf directly |
|
||||
| `POST /bank/*` | Create unsigned `Msg`s for bank tx | N/A, use Protobuf directly |
|
||||
| `GET /bank/balances/{address}` | Get the balance of an address | `GET /cosmos/bank/v1beta1/balances/{address}/{denom}` |
|
||||
| `GET /bank/total` | Get the total supply of all coins | `GET /cosmos/bank/v1beta1/supply` |
|
||||
| `GET /bank/total/{denom}` | Get the total supply of one coin | `GET /cosmos/bank/v1beta1/supply/{denom}` |
|
||||
| `POST /distribution/delegators/{delegatorAddr}/rewards` | Withdraw all delegator rewards | N/A, use Protobuf directly |
|
||||
| `POST /distribution/*` | Create unsigned `Msg`s for distribution | N/A, use Protobuf directly |
|
||||
| `GET /distribution/delegators/{delegatorAddr}/rewards` | Get the total rewards balance from all delegations | `GET /cosmos/distribution/v1beta1/v1beta1/delegators/{delegator_address}/rewards` |
|
||||
| `GET /distribution/delegators/{delegatorAddr}/rewards/{validatorAddr}` | Query a delegation reward | `GET /cosmos/distribution/v1beta1/delegators/{delegatorAddr}/rewards/{validatorAddr}` |
|
||||
| `GET /distribution/delegators/{delegatorAddr}/withdraw_address` | Get the rewards withdrawal address | `GET /cosmos/distribution/v1beta1/delegators/{delegatorAddr}/withdraw_address` |
|
||||
| `GET /distribution/validators/{validatorAddr}` | Validator distribution information | `GET /cosmos/distribution/v1beta1/validators/{validatorAddr}` |
|
||||
| `GET /distribution/validators/{validatorAddr}/rewards` | Commission and self-delegation rewards of a single a validator | `GET /cosmos/distribution/v1beta1/validators/{validatorAddr}/rewards` |
|
||||
| `GET /distribution/validators/{validatorAddr}/outstanding_rewards` | Outstanding rewards of a single validator | `GET /cosmos/distribution/v1beta1/validators/{validatorAddr}/outstanding_rewards` |
|
||||
| `GET /distribution/parameters` | Get the current distribution parameter values | `GET /cosmos/distribution/v1beta1/params` |
|
||||
| `GET /distribution/community_pool` | Get the amount held in the community pool | `GET /cosmos/distribution/v1beta1/community_pool` |
|
||||
| `GET /evidence/{evidence-hash}` | Get evidence by hash | `GET /cosmos/evidence/v1beta1/evidence/{evidence_hash}` |
|
||||
| `GET /evidence` | Get all evidence | `GET /cosmos/evidence/v1beta1/evidence` |
|
||||
| `POST /gov/*` | Create unsigned `Msg`s for gov | N/A, use Protobuf directly |
|
||||
| `GET /gov/parameters/{type}` | Get government parameters | `GET /cosmos/gov/v1beta1/params/{type}` |
|
||||
| `GET /gov/proposals` | Get all proposals | `GET /cosmos/gov/v1beta1/proposals` |
|
||||
| `GET /gov/proposals/{proposal-id}` | Get proposal by id | `GET /cosmos/gov/v1beta1/proposals/{proposal-id}` |
|
||||
| `GET /gov/proposals/{proposal-id}/proposer` | Get proposer of a proposal | `GET /cosmos/gov/v1beta1/proposals/{proposal-id}` (Get proposer from `Proposal` struct) |
|
||||
| `GET /gov/proposals/{proposal-id}/deposits` | Get deposits of a proposal | `GET /cosmos/gov/v1beta1/proposals/{proposal-id}/deposits` |
|
||||
| `GET /gov/proposals/{proposal-id}/deposits/{depositor}` | Get depositor a of deposit | `GET /cosmos/gov/v1beta1/proposals/{proposal-id}/deposits/{depositor}` |
|
||||
| `GET /gov/proposals/{proposal-id}/tally` | Get tally of a proposal | `GET /cosmos/gov/v1beta1/proposals/{proposal-id}/tally` |
|
||||
| `GET /gov/proposals/{proposal-id}/votes` | Get votes of a proposal | `GET /cosmos/gov/v1beta1/proposals/{proposal-id}/votes` |
|
||||
| `GET /gov/proposals/{proposal-id}/votes/{vote}` | Get a particular vote | `GET /cosmos/gov/v1beta1/proposals/{proposal-id}/votes/{vote}` |
|
||||
| `GET /minting/parameters` | Get parameters for minting | `GET /cosmos/minting/v1beta1/params` |
|
||||
| `GET /minting/inflation` | Get minting inflation | `GET /cosmos/minting/v1beta1/inflation` |
|
||||
| `GET /minting/annual-provisions` | Get minting annual provisions | `GET /cosmos/minting/v1beta1/annual_provisions` |
|
||||
| `POST /slashing/*` | Create unsigned `Msg`s for slashing | N/A, use Protobuf directly |
|
||||
| `GET /slashing/validators/{validatorPubKey}/signing_info` | Get validator signing info | `GET /cosmos/slashing/v1beta1/signing_infos/{cons_address}` (Use consensus address instead of pubkey) |
|
||||
| `GET /slashing/signing_infos` | Get all signing infos | `GET /cosmos/slashing/v1beta1/signing_infos` |
|
||||
| `GET /slashing/parameters` | Get slashing parameters | `GET /cosmos/slashing/v1beta1/params` |
|
||||
| `POST /staking/*` | Create unsigned `Msg`s for staking | N/A, use Protobuf directly |
|
||||
| `GET /staking/delegators/{delegatorAddr}/delegations` | Get all delegations from a delegator | `GET /cosmos/staking/v1beta1/delegators/{delegatorAddr}/delegations` |
|
||||
| `GET /staking/delegators/{delegatorAddr}/unbonding_delegations` | Get all unbonding delegations from a delegator | `GET /cosmos/staking/v1beta1/delegators/{delegatorAddr}/unbonding_delegations` |
|
||||
| `GET /staking/delegators/{delegatorAddr}/txs` | Get all staking txs (i.e msgs) from a delegator | Removed |
|
||||
| `GET /staking/delegators/{delegatorAddr}/validators` | Query all validators that a delegator is bonded to | `GET /cosmos/staking/v1beta1/delegators/{delegatorAddr}/validators` |
|
||||
| `GET /staking/delegators/{delegatorAddr}/validators/{validatorAddr}` | Query a validator that a delegator is bonded to | `GET /cosmos/staking/v1beta1/delegators/{delegatorAddr}/validators/{validatorAddr}` |
|
||||
| `GET /staking/delegators/{delegatorAddr}/delegations/{validatorAddr}` | Query a delegation between a delegator and a validator | `GET /cosmos/staking/v1beta1/delegators/{delegatorAddr}/delegations/{validatorAddr}` |
|
||||
| `GET /staking/delegators/{delegatorAddr}/unbonding_delegations/{validatorAddr}` | Query all unbonding delegations between a delegator and a validator | `GET /cosmos/staking/v1beta1/delegators/{delegatorAddr}/unbonding_delegations/{validatorAddr}` |
|
||||
| `GET /staking/redelegations` | Query redelegations | `GET /cosmos/staking/v1beta1/v1beta1/delegators/{delegator_addr}/redelegations` |
|
||||
| `GET /staking/validators` | Get all validators | `GET /cosmos/staking/v1beta1/validators` |
|
||||
| `GET /staking/validators/{validatorAddr}` | Get a single validator info | `GET /cosmos/staking/v1beta1/validators/{validatorAddr}` |
|
||||
| `GET /staking/validators/{validatorAddr}/delegations` | Get all delegations to a validator | `GET /cosmos/staking/v1beta1/validators/{validatorAddr}/delegations` |
|
||||
| `GET /staking/validators/{validatorAddr}/unbonding_delegations` | Get all unbonding delegations from a validator | `GET /cosmos/staking/v1beta1/validators/{validatorAddr}/unbonding_delegations` |
|
||||
| `GET /staking/historical_info/{height}` | Get HistoricalInfo at a given height | `GET /cosmos/staking/v1beta1/historical_info/{height}` |
|
||||
| `GET /staking/pool` | Get the current state of the staking pool | `GET /cosmos/staking/v1beta1/pool` |
|
||||
| `GET /staking/parameters` | Get the current staking parameter values | `GET /cosmos/staking/v1beta1/params` |
|
||||
| `POST /upgrade/*` | Create unsigned `Msg`s for upgrade | N/A, use Protobuf directly |
|
||||
| `GET /upgrade/current` | Get the current plan | `GET /cosmos/upgrade/v1beta1/current_plan` |
|
||||
| `GET /upgrade/applied_plan/{name}` | Get a previously applied plan | `GET /cosmos/upgrade/v1beta1/applied/{name}` |
|
||||
@ -101,7 +101,7 @@ information.
|
||||
Make sure you can build your own binary, and replace `simd` with the name of your binary in the snippets.
|
||||
:::
|
||||
|
||||
Applications developed using the Cosmos SDK come with the `keys` subcommand. For the purpose of this tutorial, we're running the `simd` CLI, which is an application built using the Cosmos SDK for testing and educational purposes. For more information, see [`simapp`](https://github.com/cosmos/cosmos-sdk/tree/v0.40.0-rc2/simapp).
|
||||
Applications developed using the Cosmos SDK come with the `keys` subcommand. For the purpose of this tutorial, we're running the `simd` CLI, which is an application built using the Cosmos SDK for testing and educational purposes. For more information, see [`simapp`](https://github.com/cosmos/cosmos-sdk/tree/v0.40.0-rc3/simapp).
|
||||
|
||||
You can use `simd keys` for help about the keys command and `simd keys [command] --help` for more information about a particular subcommand.
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ order: 2
|
||||
|
||||
# Running a Node
|
||||
|
||||
Now that the application is ready and the keyring populated, it's time to see how to run the blockchain node. In this section, the application we are running is called [`simapp`](https://github.com/cosmos/cosmos-sdk/tree/v0.40.0-rc2/simapp), and its corresponding CLI binary `simd`. {synopsis}
|
||||
Now that the application is ready and the keyring populated, it's time to see how to run the blockchain node. In this section, the application we are running is called [`simapp`](https://github.com/cosmos/cosmos-sdk/tree/v0.40.0-rc3/simapp), and its corresponding CLI binary `simd`. {synopsis}
|
||||
|
||||
## Pre-requisite Readings
|
||||
|
||||
@ -47,7 +47,7 @@ Now that you have created a local account, go ahead and grant it some `stake` to
|
||||
simd add-genesis-account $MY_VALIDATOR_ADDRESS 100000000stake
|
||||
```
|
||||
|
||||
Recall that `$MY_VALIDATOR_ADDRESS` is a variable that holds the address of the `my_validator` key in the [keyring](./keyring.md#adding-keys-to-the-keyring). Also note that the tokens in the SDK have the `{amount}{denom}` format: `amount` is is a 18-digit-precision decimal number, and `denom` is the unique token identifier with its denomination key (e.g. `atom` or `uatom`). Here, we are granting `stake` tokens, as `stake` is the token identifier used for staking in [`simapp`](https://github.com/cosmos/cosmos-sdk/tree/v0.40.0-rc2/simapp). For your own chain with its own staking denom, that token identifier should be used instead.
|
||||
Recall that `$MY_VALIDATOR_ADDRESS` is a variable that holds the address of the `my_validator` key in the [keyring](./keyring.md#adding-keys-to-the-keyring). Also note that the tokens in the SDK have the `{amount}{denom}` format: `amount` is is a 18-digit-precision decimal number, and `denom` is the unique token identifier with its denomination key (e.g. `atom` or `uatom`). Here, we are granting `stake` tokens, as `stake` is the token identifier used for staking in [`simapp`](https://github.com/cosmos/cosmos-sdk/tree/v0.40.0-rc3/simapp). For your own chain with its own staking denom, that token identifier should be used instead.
|
||||
|
||||
Now that your account has some tokens, you need to add a validator to your chain. Validators are special full-nodes that participate in the consensus process (implemented in the [underlying consensus engine](../intro/sdk-app-architecture.md#tendermint)) in order to add new blocks to the chain. Any account can declare its intention to become a validator operator, but only those with sufficient delegation get to enter the active set (for example, only the top 125 validator candidates with the most delegation get to be validators in the Cosmos Hub). For this guide, you will add your local node (created via the `init` command above) as a validator of your chain. Validators can be declared before a chain is first started via a special transaction included in the genesis file called a `gentx`:
|
||||
|
||||
@ -83,7 +83,7 @@ You should see blocks come in.
|
||||
|
||||
The previous command allow you to run a single node. This is enough for the next section on interacting with this node, but you may wish to run multiple nodes at the same time, and see how consensus happens between them.
|
||||
|
||||
The naive way would be to run the same commands again in separate terminal windows. This is possible, however in the SDK, we leverage the power of [Docker Compose](https://docs.docker.com/compose/) to run a localnet. If you need inspiration on how to set up your own localnet with Docker Compose, you can have a look at the SDK's [`docker-compose.yml`](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc2/docker-compose.yml).
|
||||
The naive way would be to run the same commands again in separate terminal windows. This is possible, however in the SDK, we leverage the power of [Docker Compose](https://docs.docker.com/compose/) to run a localnet. If you need inspiration on how to set up your own localnet with Docker Compose, you can have a look at the SDK's [`docker-compose.yml`](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc3/docker-compose.yml).
|
||||
|
||||
## Next {hide}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.upgrade.v1beta1;
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "cosmos/upgrade/v1beta1/upgrade.proto";
|
||||
|
||||
@ -17,6 +18,14 @@ service Query {
|
||||
rpc AppliedPlan(QueryAppliedPlanRequest) returns (QueryAppliedPlanResponse) {
|
||||
option (google.api.http).get = "/cosmos/upgrade/v1beta1/applied_plan/{name}";
|
||||
}
|
||||
|
||||
// UpgradedConsensusState queries the consensus state that will serve
|
||||
// as a trusted kernel for the next version of this chain. It will only be
|
||||
// stored at the last height of this chain.
|
||||
// UpgradedConsensusState RPC not supported with legacy querier
|
||||
rpc UpgradedConsensusState(QueryUpgradedConsensusStateRequest) returns (QueryUpgradedConsensusStateResponse) {
|
||||
option (google.api.http).get = "/cosmos/upgrade/v1beta1/upgraded_consensus_state/{last_height}";
|
||||
}
|
||||
}
|
||||
|
||||
// QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC
|
||||
@ -43,3 +52,17 @@ message QueryAppliedPlanResponse {
|
||||
// height is the block height at which the plan was applied.
|
||||
int64 height = 1;
|
||||
}
|
||||
|
||||
// QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState
|
||||
// RPC method.
|
||||
message QueryUpgradedConsensusStateRequest {
|
||||
// last height of the current chain must be sent in request
|
||||
// as this is the height under which next consensus state is stored
|
||||
int64 last_height = 1;
|
||||
}
|
||||
|
||||
// QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState
|
||||
// RPC method.
|
||||
message QueryUpgradedConsensusStateResponse {
|
||||
google.protobuf.Any upgraded_consensus_state = 1;
|
||||
}
|
||||
|
||||
@ -18,6 +18,8 @@ message GenesisState {
|
||||
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"recv_sequences\""];
|
||||
repeated PacketSequence ack_sequences = 7
|
||||
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"ack_sequences\""];
|
||||
// the sequence for the next generated channel identifier
|
||||
uint64 next_channel_sequence = 8 [(gogoproto.moretags) = "yaml:\"next_channel_sequence\""];
|
||||
}
|
||||
|
||||
// PacketSequence defines the genesis type necessary to retrieve and store
|
||||
|
||||
@ -38,8 +38,8 @@ service Query {
|
||||
// associated with the provided channel identifiers.
|
||||
rpc ChannelConsensusState(QueryChannelConsensusStateRequest) returns (QueryChannelConsensusStateResponse) {
|
||||
option (google.api.http).get =
|
||||
"/ibc/core/channel/v1beta1/channels/{channel_id}/ports/{port_id}/consensus_state/version/"
|
||||
"{version_number}/height/{version_height}";
|
||||
"/ibc/core/channel/v1beta1/channels/{channel_id}/ports/{port_id}/consensus_state/revision/"
|
||||
"{revision_number}/height/{revision_height}";
|
||||
}
|
||||
|
||||
// PacketCommitment queries a stored packet commitment hash.
|
||||
@ -176,10 +176,10 @@ message QueryChannelConsensusStateRequest {
|
||||
string port_id = 1;
|
||||
// channel unique identifier
|
||||
string channel_id = 2;
|
||||
// version number of the consensus state
|
||||
uint64 version_number = 3;
|
||||
// version height of the consensus state
|
||||
uint64 version_height = 4;
|
||||
// revision number of the consensus state
|
||||
uint64 revision_number = 3;
|
||||
// revision height of the consensus state
|
||||
uint64 revision_height = 4;
|
||||
}
|
||||
|
||||
// QueryChannelClientStateResponse is the Response type for the
|
||||
|
||||
@ -46,10 +46,9 @@ message MsgChannelOpenInit {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
|
||||
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
|
||||
Channel channel = 3 [(gogoproto.nullable) = false];
|
||||
string signer = 4;
|
||||
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
|
||||
Channel channel = 2 [(gogoproto.nullable) = false];
|
||||
string signer = 3;
|
||||
}
|
||||
|
||||
// MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type.
|
||||
@ -61,15 +60,16 @@ message MsgChannelOpenTry {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
|
||||
string desired_channel_id = 2 [(gogoproto.moretags) = "yaml:\"desired_channel_id\""];
|
||||
string counterparty_chosen_channel_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_chosen_channel_id\""];
|
||||
Channel channel = 4 [(gogoproto.nullable) = false];
|
||||
string counterparty_version = 5 [(gogoproto.moretags) = "yaml:\"counterparty_version\""];
|
||||
bytes proof_init = 6 [(gogoproto.moretags) = "yaml:\"proof_init\""];
|
||||
ibc.core.client.v1.Height proof_height = 7
|
||||
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
|
||||
// in the case of crossing hello's, when both chains call OpenInit, we need the channel identifier
|
||||
// of the previous channel in state INIT
|
||||
string previous_channel_id = 2 [(gogoproto.moretags) = "yaml:\"previous_channel_id\""];
|
||||
Channel channel = 3 [(gogoproto.nullable) = false];
|
||||
string counterparty_version = 4 [(gogoproto.moretags) = "yaml:\"counterparty_version\""];
|
||||
bytes proof_init = 5 [(gogoproto.moretags) = "yaml:\"proof_init\""];
|
||||
ibc.core.client.v1.Height proof_height = 6
|
||||
[(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false];
|
||||
string signer = 8;
|
||||
string signer = 7;
|
||||
}
|
||||
|
||||
// MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type.
|
||||
@ -147,9 +147,9 @@ message MsgRecvPacket {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
Packet packet = 1 [(gogoproto.nullable) = false];
|
||||
bytes proof_commitment = 2 [(gogoproto.moretags) = "yaml:\"proof_commitment\""];
|
||||
ibc.core.client.v1.Height proof_height = 3
|
||||
Packet packet = 1 [(gogoproto.nullable) = false];
|
||||
bytes proof_commitment = 2 [(gogoproto.moretags) = "yaml:\"proof_commitment\""];
|
||||
ibc.core.client.v1.Height proof_height = 3
|
||||
[(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false];
|
||||
string signer = 4;
|
||||
}
|
||||
@ -162,9 +162,9 @@ message MsgTimeout {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
Packet packet = 1 [(gogoproto.nullable) = false];
|
||||
bytes proof_unreceived = 2 [(gogoproto.moretags) = "yaml:\"proof_unreceived\""];
|
||||
ibc.core.client.v1.Height proof_height = 3
|
||||
Packet packet = 1 [(gogoproto.nullable) = false];
|
||||
bytes proof_unreceived = 2 [(gogoproto.moretags) = "yaml:\"proof_unreceived\""];
|
||||
ibc.core.client.v1.Height proof_height = 3
|
||||
[(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false];
|
||||
uint64 next_sequence_recv = 4 [(gogoproto.moretags) = "yaml:\"next_sequence_recv\""];
|
||||
string signer = 5;
|
||||
@ -178,10 +178,10 @@ message MsgTimeoutOnClose {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
Packet packet = 1 [(gogoproto.nullable) = false];
|
||||
bytes proof_unreceived = 2 [(gogoproto.moretags) = "yaml:\"proof_unreceived\""];
|
||||
bytes proof_close = 3 [(gogoproto.moretags) = "yaml:\"proof_close\""];
|
||||
ibc.core.client.v1.Height proof_height = 4
|
||||
Packet packet = 1 [(gogoproto.nullable) = false];
|
||||
bytes proof_unreceived = 2 [(gogoproto.moretags) = "yaml:\"proof_unreceived\""];
|
||||
bytes proof_close = 3 [(gogoproto.moretags) = "yaml:\"proof_close\""];
|
||||
ibc.core.client.v1.Height proof_height = 4
|
||||
[(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false];
|
||||
uint64 next_sequence_recv = 5 [(gogoproto.moretags) = "yaml:\"next_sequence_recv\""];
|
||||
string signer = 6;
|
||||
@ -197,7 +197,7 @@ message MsgAcknowledgement {
|
||||
|
||||
Packet packet = 1 [(gogoproto.nullable) = false];
|
||||
bytes acknowledgement = 2;
|
||||
bytes proof_acked = 3 [(gogoproto.moretags) = "yaml:\"proof_acked\""];
|
||||
bytes proof_acked = 3 [(gogoproto.moretags) = "yaml:\"proof_acked\""];
|
||||
ibc.core.client.v1.Height proof_height = 4
|
||||
[(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false];
|
||||
string signer = 5;
|
||||
|
||||
@ -52,19 +52,19 @@ message ClientUpdateProposal {
|
||||
// that can be compared against another Height for the purposes of updating and
|
||||
// freezing clients
|
||||
//
|
||||
// Normally the VersionHeight is incremented at each height while keeping version
|
||||
// number the same However some consensus algorithms may choose to reset the
|
||||
// Normally the RevisionHeight is incremented at each height while keeping RevisionNumber
|
||||
// the same. However some consensus algorithms may choose to reset the
|
||||
// height in certain conditions e.g. hard forks, state-machine breaking changes
|
||||
// In these cases, the version number is incremented so that height continues to
|
||||
// be monitonically increasing even as the VersionHeight gets reset
|
||||
// In these cases, the RevisionNumber is incremented so that height continues to
|
||||
// be monitonically increasing even as the RevisionHeight gets reset
|
||||
message Height {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
|
||||
// the version that the client is currently on
|
||||
uint64 version_number = 1 [(gogoproto.moretags) = "yaml:\"version_number\""];
|
||||
// the height within the given version
|
||||
uint64 version_height = 2 [(gogoproto.moretags) = "yaml:\"version_height\""];
|
||||
// the revision that the client is currently on
|
||||
uint64 revision_number = 1 [(gogoproto.moretags) = "yaml:\"revision_number\""];
|
||||
// the height within the given revision
|
||||
uint64 revision_height = 2 [(gogoproto.moretags) = "yaml:\"revision_height\""];
|
||||
}
|
||||
|
||||
// Params defines the set of IBC light client parameters.
|
||||
|
||||
@ -24,8 +24,8 @@ service Query {
|
||||
// ConsensusState queries a consensus state associated with a client state at
|
||||
// a given height.
|
||||
rpc ConsensusState(QueryConsensusStateRequest) returns (QueryConsensusStateResponse) {
|
||||
option (google.api.http).get = "/ibc/core/client/v1beta1/consensus_states/{client_id}/version/{version_number}/"
|
||||
"height/{version_height}";
|
||||
option (google.api.http).get = "/ibc/core/client/v1beta1/consensus_states/{client_id}/revision/{revision_number}/"
|
||||
"height/{revision_height}";
|
||||
}
|
||||
|
||||
// ConsensusStates queries all the consensus state associated with a given
|
||||
@ -82,10 +82,10 @@ message QueryClientStatesResponse {
|
||||
message QueryConsensusStateRequest {
|
||||
// client identifier
|
||||
string client_id = 1;
|
||||
// consensus state version number
|
||||
uint64 version_number = 2;
|
||||
// consensus state version height
|
||||
uint64 version_height = 3;
|
||||
// consensus state revision number
|
||||
uint64 revision_number = 2;
|
||||
// consensus state revision height
|
||||
uint64 revision_height = 3;
|
||||
// latest_height overrrides the height field and queries the latest stored
|
||||
// ConsensusState
|
||||
bool latest_height = 4;
|
||||
|
||||
@ -60,16 +60,21 @@ message MsgUpdateClientResponse {}
|
||||
|
||||
// MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client state
|
||||
message MsgUpgradeClient {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// client unique identifier
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
// upgraded client state
|
||||
google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""];
|
||||
// height at which old chain halts and upgrades (i.e last block executed)
|
||||
Height upgrade_height = 3 [(gogoproto.moretags) = "yaml:\"upgrade_height\""];
|
||||
// upgraded consensus state, only contains enough information to serve as a basis of trust in update logic
|
||||
google.protobuf.Any consensus_state = 3 [(gogoproto.moretags) = "yaml:\"consensus_state\""];
|
||||
// proof that old chain committed to new client
|
||||
bytes proof_upgrade = 4 [(gogoproto.moretags) = "yaml:\"proof_upgrade\""];
|
||||
bytes proof_upgrade_client = 4 [(gogoproto.moretags) = "yaml:\"proof_upgrade_client\""];
|
||||
// proof that old chain committed to new consensus state
|
||||
bytes proof_upgrade_consensus_state = 5 [(gogoproto.moretags) = "yaml:\"proof_upgrade_consensus_state\""];
|
||||
// signer address
|
||||
string signer = 5;
|
||||
string signer = 6;
|
||||
}
|
||||
|
||||
// MsgUpgradeClientResponse defines the Msg/UpgradeClient response type.
|
||||
|
||||
@ -11,4 +11,6 @@ message GenesisState {
|
||||
repeated IdentifiedConnection connections = 1 [(gogoproto.nullable) = false];
|
||||
repeated ConnectionPaths client_connection_paths = 2
|
||||
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"client_connection_paths\""];
|
||||
// the sequence for the next generated connection identifier
|
||||
uint64 next_connection_sequence = 3 [(gogoproto.moretags) = "yaml:\"next_connection_sequence\""];
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ service Query {
|
||||
// connection.
|
||||
rpc ConnectionConsensusState(QueryConnectionConsensusStateRequest) returns (QueryConnectionConsensusStateResponse) {
|
||||
option (google.api.http).get = "/ibc/core/connection/v1beta1/connections/{connection_id}/consensus_state/"
|
||||
"version/{version_number}/height/{version_height}";
|
||||
"revision/{revision_number}/height/{revision_height}";
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,9 +118,9 @@ message QueryConnectionClientStateResponse {
|
||||
// Query/ConnectionConsensusState RPC method
|
||||
message QueryConnectionConsensusStateRequest {
|
||||
// connection identifier
|
||||
string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""];
|
||||
uint64 version_number = 2;
|
||||
uint64 version_height = 3;
|
||||
string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""];
|
||||
uint64 revision_number = 2;
|
||||
uint64 revision_height = 3;
|
||||
}
|
||||
|
||||
// QueryConnectionConsensusStateResponse is the response type for the
|
||||
|
||||
@ -29,11 +29,10 @@ message MsgConnectionOpenInit {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""];
|
||||
Counterparty counterparty = 3 [(gogoproto.nullable) = false];
|
||||
Version version = 4;
|
||||
string signer = 5;
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
Counterparty counterparty = 2 [(gogoproto.nullable) = false];
|
||||
Version version = 3;
|
||||
string signer = 4;
|
||||
}
|
||||
|
||||
// MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response type.
|
||||
@ -45,24 +44,25 @@ message MsgConnectionOpenTry {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
string desired_connection_id = 2 [(gogoproto.moretags) = "yaml:\"desired_connection_id\""];
|
||||
string counterparty_chosen_connection_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_chosen_connection_id\""];
|
||||
google.protobuf.Any client_state = 4 [(gogoproto.moretags) = "yaml:\"client_state\""];
|
||||
Counterparty counterparty = 5 [(gogoproto.nullable) = false];
|
||||
repeated Version counterparty_versions = 6 [(gogoproto.moretags) = "yaml:\"counterparty_versions\""];
|
||||
ibc.core.client.v1.Height proof_height = 7
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
// in the case of crossing hello's, when both chains call OpenInit, we need the connection identifier
|
||||
// of the previous connection in state INIT
|
||||
string previous_connection_id = 2 [(gogoproto.moretags) = "yaml:\"previous_connection_id\""];
|
||||
google.protobuf.Any client_state = 3 [(gogoproto.moretags) = "yaml:\"client_state\""];
|
||||
Counterparty counterparty = 4 [(gogoproto.nullable) = false];
|
||||
repeated Version counterparty_versions = 5 [(gogoproto.moretags) = "yaml:\"counterparty_versions\""];
|
||||
ibc.core.client.v1.Height proof_height = 6
|
||||
[(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false];
|
||||
// proof of the initialization the connection on Chain A: `UNITIALIZED ->
|
||||
// INIT`
|
||||
bytes proof_init = 8 [(gogoproto.moretags) = "yaml:\"proof_init\""];
|
||||
bytes proof_init = 7 [(gogoproto.moretags) = "yaml:\"proof_init\""];
|
||||
// proof of client state included in message
|
||||
bytes proof_client = 9 [(gogoproto.moretags) = "yaml:\"proof_client\""];
|
||||
bytes proof_client = 8 [(gogoproto.moretags) = "yaml:\"proof_client\""];
|
||||
// proof of client consensus state
|
||||
bytes proof_consensus = 10 [(gogoproto.moretags) = "yaml:\"proof_consensus\""];
|
||||
ibc.core.client.v1.Height consensus_height = 11
|
||||
bytes proof_consensus = 9 [(gogoproto.moretags) = "yaml:\"proof_consensus\""];
|
||||
ibc.core.client.v1.Height consensus_height = 10
|
||||
[(gogoproto.moretags) = "yaml:\"consensus_height\"", (gogoproto.nullable) = false];
|
||||
string signer = 12;
|
||||
string signer = 11;
|
||||
}
|
||||
|
||||
// MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type.
|
||||
|
||||
@ -48,11 +48,11 @@ message Header {
|
||||
// Misbehaviour defines misbehaviour for a solo machine which consists
|
||||
// of a sequence and two signatures over different messages at that sequence.
|
||||
message Misbehaviour {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
uint64 sequence = 2;
|
||||
SignatureAndData signature_one = 3 [(gogoproto.moretags) = "yaml:\"signature_one\""];
|
||||
SignatureAndData signature_two = 4 [(gogoproto.moretags) = "yaml:\"signature_two\""];
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
uint64 sequence = 2;
|
||||
SignatureAndData signature_one = 3 [(gogoproto.moretags) = "yaml:\"signature_one\""];
|
||||
SignatureAndData signature_two = 4 [(gogoproto.moretags) = "yaml:\"signature_two\""];
|
||||
}
|
||||
|
||||
// SignatureAndData contains a signature and the data signed over to create that
|
||||
|
||||
@ -42,8 +42,12 @@ message ClientState {
|
||||
// Proof specifications used in verifying counterparty state
|
||||
repeated ics23.ProofSpec proof_specs = 8 [(gogoproto.moretags) = "yaml:\"proof_specs\""];
|
||||
|
||||
// Path at which next upgraded client will be committed
|
||||
string upgrade_path = 9 [(gogoproto.moretags) = "yaml:\"upgrade_path\""];
|
||||
// Path at which next upgraded client will be committed.
|
||||
// Each element corresponds to the key for a single CommitmentProof in the chained proof.
|
||||
// NOTE: ClientState must stored under `{upgradePath}/{upgradeHeight}/clientState`
|
||||
// ConsensusState must be stored under `{upgradepath}/{upgradeHeight}/consensusState`
|
||||
// For SDK chains using the default upgrade module, upgrade_path should be []string{"upgrade", "upgradedIBCState"}`
|
||||
repeated string upgrade_path = 9 [(gogoproto.moretags) = "yaml:\"upgrade_path\""];
|
||||
|
||||
// This flag, when set to true, will allow governance to recover a client
|
||||
// which has expired
|
||||
@ -71,7 +75,7 @@ message ConsensusState {
|
||||
// Misbehaviour is a wrapper over two conflicting Headers
|
||||
// that implements Misbehaviour interface expected by ICS-02
|
||||
message Misbehaviour {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
Header header_1 = 2 [(gogoproto.customname) = "Header1", (gogoproto.moretags) = "yaml:\"header_1\""];
|
||||
|
||||
@ -167,6 +167,7 @@ func txCommand() *cobra.Command {
|
||||
return cmd
|
||||
}
|
||||
|
||||
// newApp is an AppCreator
|
||||
func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application {
|
||||
var cache sdk.MultiStorePersistentCache
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
clientrest "github.com/cosmos/cosmos-sdk/client/rest"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
@ -19,7 +20,7 @@ import (
|
||||
|
||||
const unRegisteredConcreteTypeErr = "unregistered concrete type"
|
||||
|
||||
// query accountREST Handler
|
||||
// QueryAccountRequestHandlerFn is the query accountREST Handler.
|
||||
func QueryAccountRequestHandlerFn(storeName string, clientCtx client.Context) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
@ -206,7 +207,8 @@ func checkSignModeError(w http.ResponseWriter, ctx client.Context, resp interfac
|
||||
rest.WriteErrorResponse(w, http.StatusInternalServerError,
|
||||
"This transaction was created with the new SIGN_MODE_DIRECT signing method, and therefore cannot be displayed"+
|
||||
" via legacy REST handlers, please use CLI or directly query the Tendermint RPC endpoint to query"+
|
||||
" this transaction. gRPC gateway endpoint is "+grpcEndPoint)
|
||||
" this transaction. gRPC gateway endpoint is "+grpcEndPoint+". Please also see the REST endpoints migration"+
|
||||
" guide at "+clientrest.DeprecationURL+".")
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@ -307,8 +307,8 @@ func (s *IntegrationTestSuite) TestLegacyRestErrMessages() {
|
||||
val := s.network.Validators[0]
|
||||
|
||||
args := []string{
|
||||
"121", // dummy port-id
|
||||
"21212121212", // dummy channel-id
|
||||
"121", // dummy port-id
|
||||
"channel-0", // dummy channel-id
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
|
||||
|
||||
@ -29,7 +29,7 @@ func (s *IntegrationTestSuite) SetupSuite() {
|
||||
s.cfg = cfg
|
||||
s.network = network.New(s.T(), cfg)
|
||||
|
||||
_, err := s.network.WaitForHeight(1)
|
||||
_, err := s.network.WaitForHeight(2)
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
@ -43,14 +43,26 @@ func (s *IntegrationTestSuite) TestQueryBalancesRequestHandlerFn() {
|
||||
baseURL := val.APIAddress
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
respType fmt.Stringer
|
||||
expected fmt.Stringer
|
||||
name string
|
||||
url string
|
||||
expHeight int64
|
||||
respType fmt.Stringer
|
||||
expected fmt.Stringer
|
||||
}{
|
||||
{
|
||||
"total account balance",
|
||||
fmt.Sprintf("%s/bank/balances/%s", baseURL, val.Address),
|
||||
-1,
|
||||
&sdk.Coins{},
|
||||
sdk.NewCoins(
|
||||
sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens),
|
||||
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Sub(s.cfg.BondedTokens)),
|
||||
),
|
||||
},
|
||||
{
|
||||
"total account balance with height",
|
||||
fmt.Sprintf("%s/bank/balances/%s?height=1", baseURL, val.Address),
|
||||
1,
|
||||
&sdk.Coins{},
|
||||
sdk.NewCoins(
|
||||
sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens),
|
||||
@ -59,13 +71,15 @@ func (s *IntegrationTestSuite) TestQueryBalancesRequestHandlerFn() {
|
||||
},
|
||||
{
|
||||
"total account balance of a specific denom",
|
||||
fmt.Sprintf("%s/bank/balances/%s?height=1&denom=%s", baseURL, val.Address, s.cfg.BondDenom),
|
||||
fmt.Sprintf("%s/bank/balances/%s?denom=%s", baseURL, val.Address, s.cfg.BondDenom),
|
||||
-1,
|
||||
&sdk.Coin{},
|
||||
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Sub(s.cfg.BondedTokens)),
|
||||
},
|
||||
{
|
||||
"total account balance of a bogus denom",
|
||||
fmt.Sprintf("%s/bank/balances/%s?height=1&denom=foobar", baseURL, val.Address),
|
||||
fmt.Sprintf("%s/bank/balances/%s?denom=foobar", baseURL, val.Address),
|
||||
-1,
|
||||
&sdk.Coin{},
|
||||
sdk.NewCoin("foobar", sdk.ZeroInt()),
|
||||
},
|
||||
@ -74,12 +88,23 @@ func (s *IntegrationTestSuite) TestQueryBalancesRequestHandlerFn() {
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
respJSON, err := rest.GetRequest(tc.url)
|
||||
s.Require().NoError(err)
|
||||
|
||||
bz, err := rest.ParseResponseWithHeight(val.ClientCtx.LegacyAmino, resp)
|
||||
var resp = rest.ResponseWithHeight{}
|
||||
err = val.ClientCtx.LegacyAmino.UnmarshalJSON(respJSON, &resp)
|
||||
s.Require().NoError(err)
|
||||
s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(bz, tc.respType))
|
||||
|
||||
// Check height.
|
||||
if tc.expHeight >= 0 {
|
||||
s.Require().Equal(resp.Height, tc.expHeight)
|
||||
} else {
|
||||
// To avoid flakiness, just test that height is positive.
|
||||
s.Require().Greater(resp.Height, int64(0))
|
||||
}
|
||||
|
||||
// Check result.
|
||||
s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(resp.Result, tc.respType))
|
||||
s.Require().Equal(tc.expected.String(), tc.respType.String())
|
||||
})
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ func NewTransferTxCmd() *cobra.Command {
|
||||
Short: "Transfer a fungible token through IBC",
|
||||
Long: strings.TrimSpace(`Transfer a fungible token through IBC. Timeouts can be specified
|
||||
as absolute or relative using the "absolute-timeouts" flag. Timeout height can be set by passing in the height string
|
||||
in the form {version}-{height} using the "packet-timeout-height" flag. Relative timeouts are added to
|
||||
in the form {revision}-{height} using the "packet-timeout-height" flag. Relative timeouts are added to
|
||||
the block height and block timestamp queried from the latest consensus state corresponding
|
||||
to the counterparty channel. Any timeout set to 0 is disabled.`),
|
||||
Example: fmt.Sprintf("%s tx ibc-transfer transfer [src-port] [src-channel] [receiver] [amount]", version.AppName),
|
||||
@ -85,8 +85,8 @@ to the counterparty channel. Any timeout set to 0 is disabled.`),
|
||||
|
||||
if !timeoutHeight.IsZero() {
|
||||
absoluteHeight := height
|
||||
absoluteHeight.VersionNumber += timeoutHeight.VersionNumber
|
||||
absoluteHeight.VersionHeight += timeoutHeight.VersionHeight
|
||||
absoluteHeight.RevisionNumber += timeoutHeight.RevisionNumber
|
||||
absoluteHeight.RevisionHeight += timeoutHeight.RevisionHeight
|
||||
timeoutHeight = absoluteHeight
|
||||
}
|
||||
|
||||
|
||||
@ -51,8 +51,8 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
|
||||
{"next seq send not found",
|
||||
func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA = connA.NextTestChannel(ibctesting.TransferPort)
|
||||
channelB = connB.NextTestChannel(ibctesting.TransferPort)
|
||||
channelA = suite.chainA.NextTestChannel(connA, ibctesting.TransferPort)
|
||||
channelB = suite.chainB.NextTestChannel(connB, ibctesting.TransferPort)
|
||||
// manually create channel so next seq send is never set
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(
|
||||
suite.chainA.GetContext(),
|
||||
|
||||
@ -33,7 +33,7 @@ func (suite *TransferTestSuite) TestOnChanOpenInit() {
|
||||
},
|
||||
{
|
||||
"invalid port ID", func() {
|
||||
testChannel = connA.NextTestChannel(ibctesting.MockPort)
|
||||
testChannel = suite.chainA.NextTestChannel(connA, ibctesting.MockPort)
|
||||
}, false,
|
||||
},
|
||||
{
|
||||
@ -56,7 +56,7 @@ func (suite *TransferTestSuite) TestOnChanOpenInit() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
_, _, connA, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
testChannel = connA.NextTestChannel(ibctesting.TransferPort)
|
||||
testChannel = suite.chainA.NextTestChannel(connA, ibctesting.TransferPort)
|
||||
counterparty := channeltypes.NewCounterparty(testChannel.PortID, testChannel.ID)
|
||||
channel = &channeltypes.Channel{
|
||||
State: channeltypes.INIT,
|
||||
@ -122,7 +122,7 @@ func (suite *TransferTestSuite) TestOnChanOpenTry() {
|
||||
},
|
||||
{
|
||||
"invalid port ID", func() {
|
||||
testChannel = connA.NextTestChannel(ibctesting.MockPort)
|
||||
testChannel = suite.chainA.NextTestChannel(connA, ibctesting.MockPort)
|
||||
}, false,
|
||||
},
|
||||
{
|
||||
@ -144,7 +144,7 @@ func (suite *TransferTestSuite) TestOnChanOpenTry() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
_, _, connA, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
testChannel = connA.NextTestChannel(ibctesting.TransferPort)
|
||||
testChannel = suite.chainA.NextTestChannel(connA, ibctesting.TransferPort)
|
||||
counterparty := channeltypes.NewCounterparty(testChannel.PortID, testChannel.ID)
|
||||
channel = &channeltypes.Channel{
|
||||
State: channeltypes.TRYOPEN,
|
||||
@ -210,7 +210,7 @@ func (suite *TransferTestSuite) TestOnChanOpenAck() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
_, _, connA, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
testChannel = connA.NextTestChannel(ibctesting.TransferPort)
|
||||
testChannel = suite.chainA.NextTestChannel(connA, ibctesting.TransferPort)
|
||||
counterpartyVersion = types.Version
|
||||
|
||||
module, _, err := suite.chainA.App.IBCKeeper.PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.TransferPort)
|
||||
|
||||
@ -19,7 +19,7 @@ const (
|
||||
|
||||
validChannel = "testchannel"
|
||||
invalidChannel = "(invalidchannel1)"
|
||||
invalidShortChannel = "invalidch"
|
||||
invalidShortChannel = "invalid"
|
||||
invalidLongChannel = "invalidlongchannelinvalidlongchannelinvalidlongchannelinvalidlongchannel"
|
||||
)
|
||||
|
||||
|
||||
@ -28,9 +28,9 @@ func (suite *ClientTestSuite) SetupTest() {
|
||||
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
|
||||
|
||||
// set localhost client
|
||||
version := types.ParseChainID(suite.chainA.GetContext().ChainID())
|
||||
revision := types.ParseChainID(suite.chainA.GetContext().ChainID())
|
||||
localHostClient := localhosttypes.NewClientState(
|
||||
suite.chainA.GetContext().ChainID(), types.NewHeight(version, uint64(suite.chainA.GetContext().BlockHeight())),
|
||||
suite.chainA.GetContext().ChainID(), types.NewHeight(revision, uint64(suite.chainA.GetContext().BlockHeight())),
|
||||
)
|
||||
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainA.GetContext(), exported.Localhost, localHostClient)
|
||||
}
|
||||
|
||||
@ -77,10 +77,10 @@ func QueryConsensusState(
|
||||
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
req := &types.QueryConsensusStateRequest{
|
||||
ClientId: clientID,
|
||||
VersionNumber: height.GetVersionNumber(),
|
||||
VersionHeight: height.GetVersionHeight(),
|
||||
LatestHeight: latestHeight,
|
||||
ClientId: clientID,
|
||||
RevisionNumber: height.GetRevisionNumber(),
|
||||
RevisionHeight: height.GetRevisionHeight(),
|
||||
LatestHeight: latestHeight,
|
||||
}
|
||||
|
||||
return queryClient.ConsensusState(context.Background(), req)
|
||||
|
||||
@ -50,9 +50,9 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) {
|
||||
}
|
||||
|
||||
// client id is always "localhost"
|
||||
version := types.ParseChainID(ctx.ChainID())
|
||||
revision := types.ParseChainID(ctx.ChainID())
|
||||
clientState := localhosttypes.NewClientState(
|
||||
ctx.ChainID(), types.NewHeight(version, uint64(ctx.BlockHeight())),
|
||||
ctx.ChainID(), types.NewHeight(revision, uint64(ctx.BlockHeight())),
|
||||
)
|
||||
|
||||
if err := clientState.Validate(); err != nil {
|
||||
|
||||
@ -107,7 +107,8 @@ func (k Keeper) UpdateClient(ctx sdk.Context, clientID string, header exported.H
|
||||
|
||||
// UpgradeClient upgrades the client to a new client state if this new client was committed to
|
||||
// by the old client at the specified upgrade height
|
||||
func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient exported.ClientState, upgradeHeight exported.Height, proofUpgrade []byte) error {
|
||||
func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient exported.ClientState, upgradedConsState exported.ConsensusState,
|
||||
proofUpgradeClient, proofUpgradeConsState []byte) error {
|
||||
clientState, found := k.GetClientState(ctx, clientID)
|
||||
if !found {
|
||||
return sdkerrors.Wrapf(types.ErrClientNotFound, "cannot update client with ID %s", clientID)
|
||||
@ -118,13 +119,14 @@ func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient e
|
||||
return sdkerrors.Wrapf(types.ErrClientFrozen, "cannot update client with ID %s", clientID)
|
||||
}
|
||||
|
||||
updatedClientState, updatedConsensusState, err := clientState.VerifyUpgradeAndUpdateState(ctx, k.cdc, k.ClientStore(ctx, clientID), upgradedClient, upgradeHeight, proofUpgrade)
|
||||
updatedClientState, updatedConsState, err := clientState.VerifyUpgradeAndUpdateState(ctx, k.cdc, k.ClientStore(ctx, clientID),
|
||||
upgradedClient, upgradedConsState, proofUpgradeClient, proofUpgradeConsState)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrapf(err, "cannot upgrade client with ID %s", clientID)
|
||||
}
|
||||
|
||||
k.SetClientState(ctx, clientID, updatedClientState)
|
||||
k.SetClientConsensusState(ctx, clientID, updatedClientState.GetLatestHeight(), updatedConsensusState)
|
||||
k.SetClientConsensusState(ctx, clientID, updatedClientState.GetLatestHeight(), updatedConsState)
|
||||
|
||||
k.Logger(ctx).Info("client state upgraded", "client-id", clientID, "height", updatedClientState.GetLatestHeight().String())
|
||||
|
||||
|
||||
@ -56,17 +56,17 @@ func (suite *KeeperTestSuite) TestCreateClient() {
|
||||
func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
|
||||
// Must create header creation functions since suite.header gets recreated on each test case
|
||||
createFutureUpdateFn := func(s *KeeperTestSuite) *ibctmtypes.Header {
|
||||
heightPlus3 := clienttypes.NewHeight(suite.header.GetHeight().GetVersionNumber(), suite.header.GetHeight().GetVersionHeight()+3)
|
||||
heightPlus3 := clienttypes.NewHeight(suite.header.GetHeight().GetRevisionNumber(), suite.header.GetHeight().GetRevisionHeight()+3)
|
||||
height := suite.header.GetHeight().(clienttypes.Height)
|
||||
|
||||
return suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus3.VersionHeight), height, suite.header.Header.Time.Add(time.Hour),
|
||||
return suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus3.RevisionHeight), height, suite.header.Header.Time.Add(time.Hour),
|
||||
suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
|
||||
}
|
||||
createPastUpdateFn := func(s *KeeperTestSuite) *ibctmtypes.Header {
|
||||
heightMinus2 := clienttypes.NewHeight(suite.header.GetHeight().GetVersionNumber(), suite.header.GetHeight().GetVersionHeight()-2)
|
||||
heightMinus4 := clienttypes.NewHeight(suite.header.GetHeight().GetVersionNumber(), suite.header.GetHeight().GetVersionHeight()-4)
|
||||
heightMinus2 := clienttypes.NewHeight(suite.header.GetHeight().GetRevisionNumber(), suite.header.GetHeight().GetRevisionHeight()-2)
|
||||
heightMinus4 := clienttypes.NewHeight(suite.header.GetHeight().GetRevisionNumber(), suite.header.GetHeight().GetRevisionHeight()-4)
|
||||
|
||||
return suite.chainA.CreateTMClientHeader(testChainID, int64(heightMinus2.VersionHeight), heightMinus4, suite.header.Header.Time,
|
||||
return suite.chainA.CreateTMClientHeader(testChainID, int64(heightMinus2.RevisionHeight), heightMinus4, suite.header.Header.Time,
|
||||
suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
|
||||
}
|
||||
var (
|
||||
@ -146,7 +146,7 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
|
||||
}, false},
|
||||
{"valid past update before client was frozen", func() error {
|
||||
clientState = ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState.FrozenHeight = types.NewHeight(0, testClientHeight.VersionHeight-1)
|
||||
clientState.FrozenHeight = types.NewHeight(0, testClientHeight.RevisionHeight-1)
|
||||
err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -221,8 +221,8 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestUpdateClientLocalhost() {
|
||||
version := types.ParseChainID(suite.chainA.ChainID)
|
||||
var localhostClient exported.ClientState = localhosttypes.NewClientState(suite.chainA.ChainID, types.NewHeight(version, uint64(suite.chainA.GetContext().BlockHeight())))
|
||||
revision := types.ParseChainID(suite.chainA.ChainID)
|
||||
var localhostClient exported.ClientState = localhosttypes.NewClientState(suite.chainA.ChainID, types.NewHeight(revision, uint64(suite.chainA.GetContext().BlockHeight())))
|
||||
|
||||
ctx := suite.chainA.GetContext().WithBlockHeight(suite.chainA.GetContext().BlockHeight() + 1)
|
||||
err := suite.chainA.App.IBCKeeper.ClientKeeper.UpdateClient(ctx, exported.Localhost, nil)
|
||||
@ -235,10 +235,11 @@ func (suite *KeeperTestSuite) TestUpdateClientLocalhost() {
|
||||
|
||||
func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
var (
|
||||
upgradedClient exported.ClientState
|
||||
upgradeHeight exported.Height
|
||||
clientA string
|
||||
proofUpgrade []byte
|
||||
upgradedClient exported.ClientState
|
||||
upgradedConsState exported.ConsensusState
|
||||
lastHeight exported.Height
|
||||
clientA string
|
||||
proofUpgradedClient, proofUpgradedConsState []byte
|
||||
)
|
||||
|
||||
testCases := []struct {
|
||||
@ -251,12 +252,16 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
upgradedConsState = &ibctmtypes.ConsensusState{
|
||||
NextValidatorsHash: []byte("nextValsHash"),
|
||||
}
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
// last Height is at next block
|
||||
lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
|
||||
// zero custom fields and store in upgrade store
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(upgradeHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
@ -267,7 +272,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgrade, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(upgradeHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: true,
|
||||
},
|
||||
@ -276,12 +282,16 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
upgradedConsState = &ibctmtypes.ConsensusState{
|
||||
NextValidatorsHash: []byte("nextValsHash"),
|
||||
}
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
// last Height is at next block
|
||||
lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
|
||||
// zero custom fields and store in upgrade store
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(upgradeHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
@ -292,7 +302,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgrade, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(upgradeHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
|
||||
clientA = "wrongclientid"
|
||||
},
|
||||
@ -303,12 +314,16 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
upgradedConsState = &ibctmtypes.ConsensusState{
|
||||
NextValidatorsHash: []byte("nextValsHash"),
|
||||
}
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
// last Height is at next block
|
||||
lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
|
||||
// zero custom fields and store in upgrade store
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(upgradeHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
@ -319,7 +334,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgrade, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(upgradeHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
|
||||
// set frozen client in store
|
||||
tmClient, ok := cs.(*ibctmtypes.ClientState)
|
||||
@ -334,12 +350,16 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
upgradedConsState = &ibctmtypes.ConsensusState{
|
||||
NextValidatorsHash: []byte("nextValsHash"),
|
||||
}
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
// last Height is at next block
|
||||
lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
|
||||
// zero custom fields and store in upgrade store
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(upgradeHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// change upgradedClient client-specified parameters
|
||||
upgradedClient = ibctmtypes.NewClientState("wrongchainID", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, true, true)
|
||||
@ -351,7 +371,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgrade, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(upgradeHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
@ -363,7 +384,10 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
|
||||
tc.setup()
|
||||
|
||||
err := suite.chainA.App.IBCKeeper.ClientKeeper.UpgradeClient(suite.chainA.GetContext(), clientA, upgradedClient, upgradeHeight, proofUpgrade)
|
||||
// Call ZeroCustomFields on upgraded clients to clear any client-chosen parameters in test-case upgradedClient
|
||||
upgradedClient = upgradedClient.ZeroCustomFields()
|
||||
|
||||
err := suite.chainA.App.IBCKeeper.ClientKeeper.UpgradeClient(suite.chainA.GetContext(), clientA, upgradedClient, upgradedConsState, proofUpgradedClient, proofUpgradedConsState)
|
||||
|
||||
if tc.expPass {
|
||||
suite.Require().NoError(err, "verify upgrade failed on valid case: %s", tc.name)
|
||||
@ -411,8 +435,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
{
|
||||
"trusting period misbehavior should pass",
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeight, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
@ -427,8 +451,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
{
|
||||
"misbehavior at later height should pass",
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothSigners),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
@ -453,8 +477,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
{
|
||||
"misbehavior at later height with different trusted heights should pass",
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), heightPlus3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), heightPlus3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
@ -479,8 +503,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
{
|
||||
"trusted ConsensusState1 not found",
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), heightPlus3, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothSigners),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), heightPlus3, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
@ -495,8 +519,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
{
|
||||
"trusted ConsensusState2 not found",
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), heightPlus3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), heightPlus3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
@ -517,8 +541,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
{
|
||||
"client already frozen at earlier height",
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeight, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
@ -536,8 +560,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
{
|
||||
"misbehaviour check failed",
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeight, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeight, suite.ctx.BlockTime(), altValSet, bothValSet, altSigners),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, suite.ctx.BlockTime(), altValSet, bothValSet, altSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
|
||||
@ -112,11 +112,11 @@ func (q Keeper) ConsensusState(c context.Context, req *types.QueryConsensusState
|
||||
found bool
|
||||
)
|
||||
|
||||
height := types.NewHeight(req.VersionNumber, req.VersionHeight)
|
||||
height := types.NewHeight(req.RevisionNumber, req.RevisionHeight)
|
||||
if req.LatestHeight {
|
||||
consensusState, found = q.GetLatestClientConsensusState(ctx, req.ClientId)
|
||||
} else {
|
||||
if req.VersionHeight == 0 {
|
||||
if req.RevisionHeight == 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "consensus state height cannot be 0")
|
||||
}
|
||||
|
||||
|
||||
@ -184,8 +184,8 @@ func (suite *KeeperTestSuite) TestQueryConsensusState() {
|
||||
func() {
|
||||
req = &types.QueryConsensusStateRequest{
|
||||
ClientId: testClientID,
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 0,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 0,
|
||||
LatestHeight: false,
|
||||
}
|
||||
},
|
||||
@ -236,8 +236,8 @@ func (suite *KeeperTestSuite) TestQueryConsensusState() {
|
||||
|
||||
req = &types.QueryConsensusStateRequest{
|
||||
ClientId: testClientID,
|
||||
VersionNumber: 0,
|
||||
VersionHeight: height,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: height,
|
||||
}
|
||||
},
|
||||
true,
|
||||
|
||||
@ -2,7 +2,6 @@ package keeper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
@ -168,18 +167,18 @@ func (k Keeper) GetLatestClientConsensusState(ctx sdk.Context, clientID string)
|
||||
|
||||
// GetSelfConsensusState introspects the (self) past historical info at a given height
|
||||
// and returns the expected consensus state at that height.
|
||||
// For now, can only retrieve self consensus states for the current version
|
||||
// For now, can only retrieve self consensus states for the current revision
|
||||
func (k Keeper) GetSelfConsensusState(ctx sdk.Context, height exported.Height) (exported.ConsensusState, bool) {
|
||||
selfHeight, ok := height.(types.Height)
|
||||
if !ok {
|
||||
return nil, false
|
||||
}
|
||||
// check that height version matches chainID version
|
||||
version := types.ParseChainID(ctx.ChainID())
|
||||
if version != height.GetVersionNumber() {
|
||||
// check that height revision matches chainID revision
|
||||
revision := types.ParseChainID(ctx.ChainID())
|
||||
if revision != height.GetRevisionNumber() {
|
||||
return nil, false
|
||||
}
|
||||
histInfo, found := k.stakingKeeper.GetHistoricalInfo(ctx, int64(selfHeight.VersionHeight))
|
||||
histInfo, found := k.stakingKeeper.GetHistoricalInfo(ctx, int64(selfHeight.RevisionHeight))
|
||||
if !found {
|
||||
return nil, false
|
||||
}
|
||||
@ -194,7 +193,7 @@ func (k Keeper) GetSelfConsensusState(ctx sdk.Context, height exported.Height) (
|
||||
|
||||
// ValidateSelfClient validates the client parameters for a client of the running chain
|
||||
// This function is only used to validate the client state the counterparty stores for this chain
|
||||
// Client must be in same version as the executing chain
|
||||
// Client must be in same revision as the executing chain
|
||||
func (k Keeper) ValidateSelfClient(ctx sdk.Context, clientState exported.ClientState) error {
|
||||
tmClient, ok := clientState.(*ibctmtypes.ClientState)
|
||||
if !ok {
|
||||
@ -211,15 +210,15 @@ func (k Keeper) ValidateSelfClient(ctx sdk.Context, clientState exported.ClientS
|
||||
ctx.ChainID(), tmClient.ChainId)
|
||||
}
|
||||
|
||||
version := types.ParseChainID(ctx.ChainID())
|
||||
revision := types.ParseChainID(ctx.ChainID())
|
||||
|
||||
// client must be in the same version as executing chain
|
||||
if tmClient.LatestHeight.VersionNumber != version {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidClient, "client is not in the same version as the chain. expected version: %d, got: %d",
|
||||
tmClient.LatestHeight.VersionNumber, version)
|
||||
// client must be in the same revision as executing chain
|
||||
if tmClient.LatestHeight.RevisionNumber != revision {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidClient, "client is not in the same revision as the chain. expected revision: %d, got: %d",
|
||||
tmClient.LatestHeight.RevisionNumber, revision)
|
||||
}
|
||||
|
||||
selfHeight := types.NewHeight(version, uint64(ctx.BlockHeight()))
|
||||
selfHeight := types.NewHeight(revision, uint64(ctx.BlockHeight()))
|
||||
if tmClient.LatestHeight.GTE(selfHeight) {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidClient, "client has LatestHeight %d greater than or equal to chain height %d",
|
||||
tmClient.LatestHeight, selfHeight)
|
||||
@ -246,13 +245,11 @@ func (k Keeper) ValidateSelfClient(ctx sdk.Context, clientState exported.ClientS
|
||||
tmClient.UnbondingPeriod, tmClient.TrustingPeriod)
|
||||
}
|
||||
|
||||
if tmClient.UpgradePath != "" {
|
||||
if len(tmClient.UpgradePath) != 0 {
|
||||
// For now, SDK IBC implementation assumes that upgrade path (if defined) is defined by SDK upgrade module
|
||||
// Must escape any merkle key before adding it to upgrade path
|
||||
upgradeKey := url.PathEscape(upgradetypes.KeyUpgradedClient)
|
||||
expectedUpgradePath := fmt.Sprintf("%s/%s", upgradetypes.StoreKey, upgradeKey)
|
||||
if tmClient.UpgradePath != expectedUpgradePath {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidClient, "upgrade path must be the upgrade path defined by upgrade module. expected %s, got %s",
|
||||
expectedUpgradePath := []string{upgradetypes.StoreKey, upgradetypes.KeyUpgradedIBCState}
|
||||
if !reflect.DeepEqual(expectedUpgradePath, tmClient.UpgradePath) {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidClient, "upgrade path must be the upgrade path defined by upgrade module. expected %v, got %v",
|
||||
expectedUpgradePath, tmClient.UpgradePath)
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,8 +27,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
testChainID = "gaiahub-0"
|
||||
testChainIDVersion1 = "gaiahub-1"
|
||||
testChainID = "gaiahub-0"
|
||||
testChainIDRevision1 = "gaiahub-1"
|
||||
|
||||
testClientID = "gaiachain"
|
||||
testClientID2 = "ethbridge"
|
||||
@ -42,9 +42,9 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
testClientHeight = types.NewHeight(0, 5)
|
||||
testClientHeightVersion1 = types.NewHeight(1, 5)
|
||||
newClientHeight = types.NewHeight(1, 1)
|
||||
testClientHeight = types.NewHeight(0, 5)
|
||||
testClientHeightRevision1 = types.NewHeight(1, 5)
|
||||
newClientHeight = types.NewHeight(1, 1)
|
||||
)
|
||||
|
||||
type KeeperTestSuite struct {
|
||||
@ -94,7 +94,7 @@ func (suite *KeeperTestSuite) SetupTest() {
|
||||
validator := tmtypes.NewValidator(pubKey, 1)
|
||||
suite.valSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{validator})
|
||||
suite.valSetHash = suite.valSet.Hash()
|
||||
suite.header = suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeightMinus1, now2, suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
|
||||
suite.header = suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeightMinus1, now2, suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
|
||||
suite.consensusState = ibctmtypes.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot([]byte("hash")), suite.valSetHash)
|
||||
|
||||
var validators stakingtypes.Validators
|
||||
@ -116,9 +116,9 @@ func (suite *KeeperTestSuite) SetupTest() {
|
||||
}
|
||||
|
||||
// add localhost client
|
||||
version := types.ParseChainID(suite.chainA.ChainID)
|
||||
revision := types.ParseChainID(suite.chainA.ChainID)
|
||||
localHostClient := localhosttypes.NewClientState(
|
||||
suite.chainA.ChainID, types.NewHeight(version, uint64(suite.chainA.GetContext().BlockHeight())),
|
||||
suite.chainA.ChainID, types.NewHeight(revision, uint64(suite.chainA.GetContext().BlockHeight())),
|
||||
)
|
||||
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainA.GetContext(), exported.Localhost, localHostClient)
|
||||
|
||||
@ -166,7 +166,7 @@ func (suite *KeeperTestSuite) TestValidateSelfClient() {
|
||||
},
|
||||
{
|
||||
"success with nil UpgradePath",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), "", false, false),
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), nil, false, false),
|
||||
true,
|
||||
},
|
||||
{
|
||||
@ -190,8 +190,8 @@ func (suite *KeeperTestSuite) TestValidateSelfClient() {
|
||||
false,
|
||||
},
|
||||
{
|
||||
"invalid client version",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeightVersion1, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
"invalid client revision",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeightRevision1, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
false,
|
||||
},
|
||||
{
|
||||
@ -216,7 +216,7 @@ func (suite *KeeperTestSuite) TestValidateSelfClient() {
|
||||
},
|
||||
{
|
||||
"invalid upgrade path",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), "bad/upgrade/path", false, false),
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), []string{"bad", "upgrade", "path"}, false, false),
|
||||
false,
|
||||
},
|
||||
}
|
||||
@ -295,7 +295,7 @@ func (suite KeeperTestSuite) TestConsensusStateHelpers() {
|
||||
|
||||
testClientHeightPlus5 := types.NewHeight(0, height+5)
|
||||
|
||||
header := suite.chainA.CreateTMClientHeader(testClientID, int64(testClientHeightPlus5.VersionHeight), testClientHeight, suite.header.Header.Time.Add(time.Minute),
|
||||
header := suite.chainA.CreateTMClientHeader(testClientID, int64(testClientHeightPlus5.RevisionHeight), testClientHeight, suite.header.Header.Time.Add(time.Minute),
|
||||
suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
|
||||
|
||||
// mock update functionality
|
||||
|
||||
@ -242,16 +242,16 @@ var xxx_messageInfo_ClientUpdateProposal proto.InternalMessageInfo
|
||||
// that can be compared against another Height for the purposes of updating and
|
||||
// freezing clients
|
||||
//
|
||||
// Normally the VersionHeight is incremented at each height while keeping version
|
||||
// number the same However some consensus algorithms may choose to reset the
|
||||
// Normally the RevisionHeight is incremented at each height while keeping RevisionNumber
|
||||
// the same. However some consensus algorithms may choose to reset the
|
||||
// height in certain conditions e.g. hard forks, state-machine breaking changes
|
||||
// In these cases, the version number is incremented so that height continues to
|
||||
// be monitonically increasing even as the VersionHeight gets reset
|
||||
// In these cases, the RevisionNumber is incremented so that height continues to
|
||||
// be monitonically increasing even as the RevisionHeight gets reset
|
||||
type Height struct {
|
||||
// the version that the client is currently on
|
||||
VersionNumber uint64 `protobuf:"varint,1,opt,name=version_number,json=versionNumber,proto3" json:"version_number,omitempty" yaml:"version_number"`
|
||||
// the height within the given version
|
||||
VersionHeight uint64 `protobuf:"varint,2,opt,name=version_height,json=versionHeight,proto3" json:"version_height,omitempty" yaml:"version_height"`
|
||||
// the revision that the client is currently on
|
||||
RevisionNumber uint64 `protobuf:"varint,1,opt,name=revision_number,json=revisionNumber,proto3" json:"revision_number,omitempty" yaml:"revision_number"`
|
||||
// the height within the given revision
|
||||
RevisionHeight uint64 `protobuf:"varint,2,opt,name=revision_height,json=revisionHeight,proto3" json:"revision_height,omitempty" yaml:"revision_height"`
|
||||
}
|
||||
|
||||
func (m *Height) Reset() { *m = Height{} }
|
||||
@ -344,44 +344,43 @@ func init() {
|
||||
func init() { proto.RegisterFile("ibc/core/client/v1/client.proto", fileDescriptor_b6bc4c8185546947) }
|
||||
|
||||
var fileDescriptor_b6bc4c8185546947 = []byte{
|
||||
// 579 bytes of a gzipped FileDescriptorProto
|
||||
// 574 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xbd, 0x8e, 0xd3, 0x4c,
|
||||
0x14, 0xcd, 0x6c, 0xf2, 0x45, 0x9b, 0xc9, 0x47, 0xb2, 0x32, 0x09, 0xeb, 0x4d, 0x61, 0x47, 0x53,
|
||||
0xa5, 0xd8, 0xb5, 0x49, 0x28, 0x40, 0xa9, 0xc0, 0x69, 0xd8, 0x02, 0x14, 0x8c, 0x10, 0x88, 0x26,
|
||||
0xf2, 0xcf, 0xac, 0x33, 0xc2, 0xf1, 0x44, 0x9e, 0x49, 0xd8, 0xbc, 0x01, 0x25, 0x15, 0xa2, 0xa0,
|
||||
0xe0, 0x09, 0xe8, 0x78, 0x03, 0x8a, 0x2d, 0xb7, 0xa4, 0xb2, 0x50, 0xf2, 0x06, 0x79, 0x02, 0x64,
|
||||
0xcf, 0xec, 0x66, 0x1d, 0x88, 0xb4, 0xa2, 0xf2, 0x9d, 0x7b, 0xaf, 0xcf, 0x3d, 0xe7, 0xdc, 0xd1,
|
||||
0x40, 0x9d, 0xb8, 0x9e, 0xe9, 0xd1, 0x18, 0x9b, 0x5e, 0x48, 0x70, 0xc4, 0xcd, 0x79, 0x57, 0x46,
|
||||
0xc6, 0x34, 0xa6, 0x9c, 0x2a, 0x0a, 0x71, 0x3d, 0x23, 0x6d, 0x30, 0x64, 0x7a, 0xde, 0x6d, 0x35,
|
||||
0x02, 0x1a, 0xd0, 0xac, 0x6c, 0xa6, 0x91, 0xe8, 0x6c, 0x1d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0, 0x5d, 0xec, 0x54, 0xac, 0xd6, 0x3a, 0xd1, 0xef, 0x09, 0xd8,
|
||||
0xad, 0x06, 0x64, 0xd7, 0x64, 0x46, 0xec, 0x84, 0x59, 0x2f, 0x2e, 0x96, 0x1a, 0xb8, 0x5c, 0x6a,
|
||||
0xe0, 0xd7, 0x52, 0x03, 0x1f, 0x57, 0x5a, 0xe1, 0x72, 0xa5, 0x15, 0x7e, 0xae, 0xb4, 0xc2, 0xdb,
|
||||
0x87, 0x01, 0xe1, 0xe3, 0x99, 0x6b, 0x78, 0x74, 0x62, 0x7a, 0x94, 0x4d, 0x28, 0x93, 0x9f, 0x13,
|
||||
0xe6, 0xbf, 0x33, 0xcf, 0xcd, 0xeb, 0x57, 0xe5, 0x7e, 0xef, 0x44, 0x3e, 0x2c, 0x7c, 0x31, 0xc5,
|
||||
0xcc, 0x2d, 0x67, 0xb6, 0x3e, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x91, 0xd2, 0x2f, 0x3f, 0x78,
|
||||
0x04, 0x00, 0x00,
|
||||
0x14, 0x8d, 0x93, 0x7c, 0xd1, 0x66, 0xf2, 0x29, 0x59, 0x99, 0x84, 0xf5, 0xa6, 0xb0, 0xa3, 0xa9,
|
||||
0x52, 0xec, 0xda, 0x24, 0x14, 0xa0, 0x74, 0x38, 0x0d, 0x5b, 0x80, 0x82, 0x11, 0x02, 0xd1, 0x44,
|
||||
0xfe, 0x99, 0x75, 0x46, 0x38, 0x9e, 0xc8, 0x33, 0x09, 0x9b, 0x37, 0xa0, 0xa4, 0xa4, 0xa0, 0xe0,
|
||||
0x09, 0xe8, 0x78, 0x03, 0x8a, 0x2d, 0xb7, 0xa4, 0xb2, 0x50, 0xf2, 0x06, 0x79, 0x02, 0xe4, 0x99,
|
||||
0xc9, 0x12, 0x07, 0x22, 0xad, 0xa8, 0x7c, 0x7d, 0xe6, 0xcc, 0xb9, 0xe7, 0xdc, 0x19, 0x0d, 0x30,
|
||||
0xb0, 0xe7, 0x5b, 0x3e, 0x49, 0x90, 0xe5, 0x47, 0x18, 0xc5, 0xcc, 0x5a, 0xf4, 0x64, 0x65, 0xce,
|
||||
0x12, 0xc2, 0x88, 0xaa, 0x62, 0xcf, 0x37, 0x33, 0x82, 0x29, 0xe1, 0x45, 0xaf, 0xdd, 0x0c, 0x49,
|
||||
0x48, 0xf8, 0xb2, 0x95, 0x55, 0x82, 0xd9, 0x3e, 0x0d, 0x09, 0x09, 0x23, 0x64, 0xf1, 0x3f, 0x6f,
|
||||
0x7e, 0x69, 0xb9, 0xf1, 0x52, 0x2c, 0xc1, 0xcf, 0x0a, 0x68, 0x5d, 0x04, 0x28, 0x66, 0xf8, 0x12,
|
||||
0xa3, 0x60, 0xc8, 0x85, 0x5e, 0x32, 0x97, 0x21, 0xb5, 0x07, 0xaa, 0x42, 0x77, 0x8c, 0x03, 0x4d,
|
||||
0xe9, 0x28, 0xdd, 0xaa, 0xdd, 0xdc, 0xa4, 0xc6, 0xf1, 0xd2, 0x9d, 0x46, 0x03, 0x78, 0xbb, 0x04,
|
||||
0x9d, 0x23, 0x51, 0x5f, 0x04, 0xea, 0x08, 0xfc, 0x2f, 0x71, 0x9a, 0x49, 0x68, 0xc5, 0x8e, 0xd2,
|
||||
0xad, 0xf5, 0x9b, 0xa6, 0x68, 0x6f, 0x6e, 0xdb, 0x9b, 0x4f, 0xe2, 0xa5, 0x7d, 0xb2, 0x49, 0x8d,
|
||||
0x7b, 0x39, 0x2d, 0xbe, 0x07, 0x3a, 0x35, 0xff, 0xb7, 0x09, 0xf8, 0x55, 0x01, 0xda, 0x90, 0xc4,
|
||||
0x14, 0xc5, 0x74, 0x4e, 0x39, 0xf4, 0x1a, 0xb3, 0xc9, 0x53, 0x84, 0xc3, 0x09, 0x53, 0x1f, 0x83,
|
||||
0xca, 0x84, 0x57, 0xdc, 0x5e, 0xad, 0xdf, 0x36, 0xff, 0x9c, 0x88, 0x29, 0xb8, 0x76, 0xf9, 0x3a,
|
||||
0x35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0x90, 0x13,
|
||||
0x91, 0x77, 0xad, 0x78, 0x50, 0x44, 0x10, 0x76, 0x44, 0x84, 0x93, 0xc1, 0x51, 0x66, 0xed, 0x53,
|
||||
0x66, 0xef, 0x19, 0xa8, 0x8c, 0xdc, 0xc4, 0x9d, 0xd2, 0x4c, 0xd8, 0x8d, 0x22, 0xf2, 0x1e, 0x05,
|
||||
0x63, 0x11, 0x98, 0x6a, 0x4a, 0xa7, 0xd4, 0xad, 0xee, 0x0a, 0xef, 0x11, 0xa0, 0x53, 0x97, 0x88,
|
||||
0x38, 0x19, 0x6a, 0xbf, 0xb8, 0x5e, 0xe9, 0xca, 0xcd, 0x4a, 0x57, 0x7e, 0xae, 0x74, 0xe5, 0xe3,
|
||||
0x5a, 0x2f, 0xdc, 0xac, 0xf5, 0xc2, 0x8f, 0xb5, 0x5e, 0x78, 0xfb, 0x28, 0xc4, 0x6c, 0x32, 0xf7,
|
||||
0x4c, 0x9f, 0x4c, 0x2d, 0x9f, 0xd0, 0x29, 0xa1, 0xf2, 0x73, 0x4e, 0x83, 0x77, 0xd6, 0x95, 0x75,
|
||||
0xfb, 0xb6, 0x3c, 0xe8, 0x9f, 0xcb, 0xe7, 0x85, 0x2d, 0x67, 0x88, 0x7a, 0x15, 0x3e, 0xdc, 0x87,
|
||||
0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x39, 0xbe, 0xfd, 0x04, 0x7e, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *IdentifiedClientState) Marshal() (dAtA []byte, err error) {
|
||||
@ -591,13 +590,13 @@ func (m *Height) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.VersionHeight != 0 {
|
||||
i = encodeVarintClient(dAtA, i, uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
i = encodeVarintClient(dAtA, i, uint64(m.RevisionHeight))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
i = encodeVarintClient(dAtA, i, uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
i = encodeVarintClient(dAtA, i, uint64(m.RevisionNumber))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
}
|
||||
@ -729,11 +728,11 @@ func (m *Height) Size() (n int) {
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.VersionNumber != 0 {
|
||||
n += 1 + sovClient(uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
n += 1 + sovClient(uint64(m.RevisionNumber))
|
||||
}
|
||||
if m.VersionHeight != 0 {
|
||||
n += 1 + sovClient(uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
n += 1 + sovClient(uint64(m.RevisionHeight))
|
||||
}
|
||||
return n
|
||||
}
|
||||
@ -1337,9 +1336,9 @@ func (m *Height) Unmarshal(dAtA []byte) error {
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionNumber", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionNumber", wireType)
|
||||
}
|
||||
m.VersionNumber = 0
|
||||
m.RevisionNumber = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowClient
|
||||
@ -1349,16 +1348,16 @@ func (m *Height) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionNumber |= uint64(b&0x7F) << shift
|
||||
m.RevisionNumber |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionHeight", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionHeight", wireType)
|
||||
}
|
||||
m.VersionHeight = 0
|
||||
m.RevisionHeight = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowClient
|
||||
@ -1368,7 +1367,7 @@ func (m *Height) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionHeight |= uint64(b&0x7F) << shift
|
||||
m.RevisionHeight |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
|
||||
@ -37,6 +37,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||
(*sdk.Msg)(nil),
|
||||
&MsgCreateClient{},
|
||||
&MsgUpdateClient{},
|
||||
&MsgUpgradeClient{},
|
||||
&MsgSubmitMisbehaviour{},
|
||||
)
|
||||
|
||||
|
||||
@ -101,6 +101,12 @@ func (gs GenesisState) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
// Validate performs basic genesis state validation returning an error upon any
|
||||
// failure.
|
||||
func (gs GenesisState) Validate() error {
|
||||
if err := gs.Params.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
validClients := make(map[string]bool)
|
||||
|
||||
for i, client := range gs.Clients {
|
||||
if err := host.ClientIdentifierValidator(client.ClientId); err != nil {
|
||||
return fmt.Errorf("invalid client consensus state identifier %s index %d: %w", client.ClientId, i, err)
|
||||
@ -110,14 +116,22 @@ func (gs GenesisState) Validate() error {
|
||||
if !ok {
|
||||
return fmt.Errorf("invalid client state with ID %s", client.ClientId)
|
||||
}
|
||||
|
||||
if !gs.Params.IsAllowedClient(clientState.ClientType()) {
|
||||
return fmt.Errorf("client type %s not allowed by genesis params", clientState.ClientType())
|
||||
}
|
||||
if err := clientState.Validate(); err != nil {
|
||||
return fmt.Errorf("invalid client %v index %d: %w", client, i, err)
|
||||
}
|
||||
|
||||
// add client id to validClients map
|
||||
validClients[client.ClientId] = true
|
||||
}
|
||||
|
||||
for i, cc := range gs.ClientsConsensus {
|
||||
if err := host.ClientIdentifierValidator(cc.ClientId); err != nil {
|
||||
return fmt.Errorf("invalid client consensus state identifier %s index %d: %w", cc.ClientId, i, err)
|
||||
// check that consensus state is for a client in the genesis clients list
|
||||
if !validClients[cc.ClientId] {
|
||||
return fmt.Errorf("consensus state in genesis has a client id %s that does not map to a genesis client", cc.ClientId)
|
||||
}
|
||||
|
||||
for _, consensusState := range cc.ConsensusStates {
|
||||
@ -136,10 +150,6 @@ func (gs GenesisState) Validate() error {
|
||||
}
|
||||
}
|
||||
|
||||
if err := gs.Params.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if gs.CreateLocalhost && !gs.Params.IsAllowedClient(exported.Localhost) {
|
||||
return fmt.Errorf("localhost client is not registered on the allowlist")
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{val})
|
||||
|
||||
heightMinus1 := types.NewHeight(0, height-1)
|
||||
header := suite.chainA.CreateTMClientHeader(chainID, int64(clientHeight.VersionHeight), heightMinus1, now, valSet, valSet, []tmtypes.PrivValidator{privVal})
|
||||
header := suite.chainA.CreateTMClientHeader(chainID, int64(clientHeight.RevisionHeight), heightMinus1, now, valSet, valSet, []tmtypes.PrivValidator{privVal})
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
@ -88,7 +88,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
},
|
||||
),
|
||||
},
|
||||
types.NewParams(exported.Tendermint),
|
||||
types.NewParams(exported.Tendermint, exported.Localhost),
|
||||
false,
|
||||
),
|
||||
expPass: true,
|
||||
@ -106,7 +106,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
},
|
||||
[]types.ClientConsensusStates{
|
||||
types.NewClientConsensusStates(
|
||||
clientID,
|
||||
"/~@$*",
|
||||
[]types.ConsensusStateWithHeight{
|
||||
types.NewConsensusStateWithHeight(
|
||||
header.GetHeight().(types.Height),
|
||||
@ -138,7 +138,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid consensus state client id",
|
||||
name: "consensus state client id does not match client id in genesis clients",
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
@ -150,7 +150,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
},
|
||||
[]types.ClientConsensusStates{
|
||||
types.NewClientConsensusStates(
|
||||
"(CLIENTID2)",
|
||||
"wrongclientid",
|
||||
[]types.ConsensusStateWithHeight{
|
||||
types.NewConsensusStateWithHeight(
|
||||
types.ZeroHeight(),
|
||||
@ -224,6 +224,35 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "client in genesis clients is disallowed by params",
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chainID", clientHeight),
|
||||
),
|
||||
},
|
||||
[]types.ClientConsensusStates{
|
||||
types.NewClientConsensusStates(
|
||||
clientID,
|
||||
[]types.ConsensusStateWithHeight{
|
||||
types.NewConsensusStateWithHeight(
|
||||
header.GetHeight().(types.Height),
|
||||
ibctmtypes.NewConsensusState(
|
||||
header.GetTime(), commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()), header.Header.NextValidatorsHash,
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
types.NewParams(exported.Solomachine),
|
||||
false,
|
||||
),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid params",
|
||||
genState: types.NewGenesisState(
|
||||
|
||||
@ -14,10 +14,10 @@ import (
|
||||
|
||||
var _ exported.Height = (*Height)(nil)
|
||||
|
||||
// IsVersionFormat checks if a chainID is in the format required for parsing versions
|
||||
// The chainID must be in the form: `{chainID}-{version}
|
||||
// IsRevisionFormat checks if a chainID is in the format required for parsing revisions
|
||||
// The chainID must be in the form: `{chainID}-{revision}
|
||||
// 24-host may enforce stricter checks on chainID
|
||||
var IsVersionFormat = regexp.MustCompile(`^.+[^-]-{1}[1-9][0-9]*$`).MatchString
|
||||
var IsRevisionFormat = regexp.MustCompile(`^.+[^-]-{1}[1-9][0-9]*$`).MatchString
|
||||
|
||||
// ZeroHeight is a helper function which returns an uninitialized height.
|
||||
func ZeroHeight() Height {
|
||||
@ -25,21 +25,21 @@ func ZeroHeight() Height {
|
||||
}
|
||||
|
||||
// NewHeight is a constructor for the IBC height type
|
||||
func NewHeight(versionNumber, versionHeight uint64) Height {
|
||||
func NewHeight(revisionNumber, revisionHeight uint64) Height {
|
||||
return Height{
|
||||
VersionNumber: versionNumber,
|
||||
VersionHeight: versionHeight,
|
||||
RevisionNumber: revisionNumber,
|
||||
RevisionHeight: revisionHeight,
|
||||
}
|
||||
}
|
||||
|
||||
// GetVersionNumber returns the version-number of the height
|
||||
func (h Height) GetVersionNumber() uint64 {
|
||||
return h.VersionNumber
|
||||
// GetRevisionNumber returns the revision-number of the height
|
||||
func (h Height) GetRevisionNumber() uint64 {
|
||||
return h.RevisionNumber
|
||||
}
|
||||
|
||||
// GetVersionHeight returns the version-height of the height
|
||||
func (h Height) GetVersionHeight() uint64 {
|
||||
return h.VersionHeight
|
||||
// GetRevisionHeight returns the revision-height of the height
|
||||
func (h Height) GetRevisionHeight() uint64 {
|
||||
return h.RevisionHeight
|
||||
}
|
||||
|
||||
// Compare implements a method to compare two heights. When comparing two heights a, b
|
||||
@ -48,20 +48,20 @@ func (h Height) GetVersionHeight() uint64 {
|
||||
// 0 if a = b
|
||||
// 1 if a > b
|
||||
//
|
||||
// It first compares based on version numbers, whichever has the higher version number is the higher height
|
||||
// If version number is the same, then the version height is compared
|
||||
// It first compares based on revision numbers, whichever has the higher revision number is the higher height
|
||||
// If revision number is the same, then the revision height is compared
|
||||
func (h Height) Compare(other exported.Height) int64 {
|
||||
height, ok := other.(Height)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("cannot compare against invalid height type: %T. expected height type: %T", other, h))
|
||||
}
|
||||
var a, b big.Int
|
||||
if h.VersionNumber != height.VersionNumber {
|
||||
a.SetUint64(h.VersionNumber)
|
||||
b.SetUint64(height.VersionNumber)
|
||||
if h.RevisionNumber != height.RevisionNumber {
|
||||
a.SetUint64(h.RevisionNumber)
|
||||
b.SetUint64(height.RevisionNumber)
|
||||
} else {
|
||||
a.SetUint64(h.VersionHeight)
|
||||
b.SetUint64(height.VersionHeight)
|
||||
a.SetUint64(h.RevisionHeight)
|
||||
b.SetUint64(height.RevisionHeight)
|
||||
}
|
||||
return int64(a.Cmp(&b))
|
||||
}
|
||||
@ -95,27 +95,27 @@ func (h Height) EQ(other exported.Height) bool {
|
||||
|
||||
// String returns a string representation of Height
|
||||
func (h Height) String() string {
|
||||
return fmt.Sprintf("%d-%d", h.VersionNumber, h.VersionHeight)
|
||||
return fmt.Sprintf("%d-%d", h.RevisionNumber, h.RevisionHeight)
|
||||
}
|
||||
|
||||
// Decrement will return a new height with the VersionHeight decremented
|
||||
// If the VersionHeight is already at lowest value (1), then false success flag is returend
|
||||
// Decrement will return a new height with the RevisionHeight decremented
|
||||
// If the RevisionHeight is already at lowest value (1), then false success flag is returend
|
||||
func (h Height) Decrement() (decremented exported.Height, success bool) {
|
||||
if h.VersionHeight == 0 {
|
||||
if h.RevisionHeight == 0 {
|
||||
return Height{}, false
|
||||
}
|
||||
return NewHeight(h.VersionNumber, h.VersionHeight-1), true
|
||||
return NewHeight(h.RevisionNumber, h.RevisionHeight-1), true
|
||||
}
|
||||
|
||||
// Increment will return a height with the same version number but an
|
||||
// incremented version height
|
||||
// Increment will return a height with the same revision number but an
|
||||
// incremented revision height
|
||||
func (h Height) Increment() Height {
|
||||
return NewHeight(h.VersionNumber, h.VersionHeight+1)
|
||||
return NewHeight(h.RevisionNumber, h.RevisionHeight+1)
|
||||
}
|
||||
|
||||
// IsZero returns true if height version and version-height are both 0
|
||||
// IsZero returns true if height revision and revision-height are both 0
|
||||
func (h Height) IsZero() bool {
|
||||
return h.VersionNumber == 0 && h.VersionHeight == 0
|
||||
return h.RevisionNumber == 0 && h.RevisionHeight == 0
|
||||
}
|
||||
|
||||
// MustParseHeight will attempt to parse a string representation of a height and panic if
|
||||
@ -134,55 +134,55 @@ func MustParseHeight(heightStr string) Height {
|
||||
func ParseHeight(heightStr string) (Height, error) {
|
||||
splitStr := strings.Split(heightStr, "-")
|
||||
if len(splitStr) != 2 {
|
||||
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "expected height string format: {version}-{height}. Got: %s", heightStr)
|
||||
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "expected height string format: {revision}-{height}. Got: %s", heightStr)
|
||||
}
|
||||
versionNumber, err := strconv.ParseUint(splitStr[0], 10, 64)
|
||||
revisionNumber, err := strconv.ParseUint(splitStr[0], 10, 64)
|
||||
if err != nil {
|
||||
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "invalid version number. parse err: %s", err)
|
||||
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "invalid revision number. parse err: %s", err)
|
||||
}
|
||||
versionHeight, err := strconv.ParseUint(splitStr[1], 10, 64)
|
||||
revisionHeight, err := strconv.ParseUint(splitStr[1], 10, 64)
|
||||
if err != nil {
|
||||
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "invalid version height. parse err: %s", err)
|
||||
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "invalid revision height. parse err: %s", err)
|
||||
}
|
||||
return NewHeight(versionNumber, versionHeight), nil
|
||||
return NewHeight(revisionNumber, revisionHeight), nil
|
||||
}
|
||||
|
||||
// SetVersionNumber takes a chainID in valid version format and swaps the version number
|
||||
// in the chainID with the given version number.
|
||||
func SetVersionNumber(chainID string, version uint64) (string, error) {
|
||||
if !IsVersionFormat(chainID) {
|
||||
// SetRevisionNumber takes a chainID in valid revision format and swaps the revision number
|
||||
// in the chainID with the given revision number.
|
||||
func SetRevisionNumber(chainID string, revision uint64) (string, error) {
|
||||
if !IsRevisionFormat(chainID) {
|
||||
return "", sdkerrors.Wrapf(
|
||||
sdkerrors.ErrInvalidChainID, "chainID is not in version format: %s", chainID,
|
||||
sdkerrors.ErrInvalidChainID, "chainID is not in revision format: %s", chainID,
|
||||
)
|
||||
}
|
||||
|
||||
splitStr := strings.Split(chainID, "-")
|
||||
// swap out version number with given version
|
||||
splitStr[len(splitStr)-1] = strconv.Itoa(int(version))
|
||||
// swap out revision number with given revision
|
||||
splitStr[len(splitStr)-1] = strconv.Itoa(int(revision))
|
||||
return strings.Join(splitStr, "-"), nil
|
||||
}
|
||||
|
||||
// ParseChainID is a utility function that returns an version number from the given ChainID.
|
||||
// ParseChainID attempts to parse a chain id in the format: `{chainID}-{version}`
|
||||
// and return the versionnumber as a uint64.
|
||||
// If the chainID is not in the expected format, a default version value of 0 is returned.
|
||||
// ParseChainID is a utility function that returns an revision number from the given ChainID.
|
||||
// ParseChainID attempts to parse a chain id in the format: `{chainID}-{revision}`
|
||||
// and return the revisionnumber as a uint64.
|
||||
// If the chainID is not in the expected format, a default revision value of 0 is returned.
|
||||
func ParseChainID(chainID string) uint64 {
|
||||
if !IsVersionFormat(chainID) {
|
||||
// chainID is not in version format, return 0 as default
|
||||
if !IsRevisionFormat(chainID) {
|
||||
// chainID is not in revision format, return 0 as default
|
||||
return 0
|
||||
}
|
||||
splitStr := strings.Split(chainID, "-")
|
||||
version, err := strconv.ParseUint(splitStr[len(splitStr)-1], 10, 64)
|
||||
revision, err := strconv.ParseUint(splitStr[len(splitStr)-1], 10, 64)
|
||||
// sanity check: error should always be nil since regex only allows numbers in last element
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("regex allowed non-number value as last split element for chainID: %s", chainID))
|
||||
}
|
||||
return version
|
||||
return revision
|
||||
}
|
||||
|
||||
// GetSelfHeight is a utility function that returns self height given context
|
||||
// Version number is retrieved from ctx.ChainID()
|
||||
// Revision number is retrieved from ctx.ChainID()
|
||||
func GetSelfHeight(ctx sdk.Context) Height {
|
||||
version := ParseChainID(ctx.ChainID())
|
||||
return NewHeight(version, uint64(ctx.BlockHeight()))
|
||||
revision := ParseChainID(ctx.ChainID())
|
||||
return NewHeight(revision, uint64(ctx.BlockHeight()))
|
||||
}
|
||||
|
||||
@ -20,12 +20,12 @@ func TestCompareHeights(t *testing.T) {
|
||||
height2 types.Height
|
||||
compareSign int64
|
||||
}{
|
||||
{"version number 1 is lesser", types.NewHeight(1, 3), types.NewHeight(3, 4), -1},
|
||||
{"version number 1 is greater", types.NewHeight(7, 5), types.NewHeight(4, 5), 1},
|
||||
{"version height 1 is lesser", types.NewHeight(3, 4), types.NewHeight(3, 9), -1},
|
||||
{"version height 1 is greater", types.NewHeight(3, 8), types.NewHeight(3, 3), 1},
|
||||
{"version number is MaxUint64", types.NewHeight(math.MaxUint64, 1), types.NewHeight(0, 1), 1},
|
||||
{"version height is MaxUint64", types.NewHeight(1, math.MaxUint64), types.NewHeight(1, 0), 1},
|
||||
{"revision number 1 is lesser", types.NewHeight(1, 3), types.NewHeight(3, 4), -1},
|
||||
{"revision number 1 is greater", types.NewHeight(7, 5), types.NewHeight(4, 5), 1},
|
||||
{"revision height 1 is lesser", types.NewHeight(3, 4), types.NewHeight(3, 9), -1},
|
||||
{"revision height 1 is greater", types.NewHeight(3, 8), types.NewHeight(3, 3), 1},
|
||||
{"revision number is MaxUint64", types.NewHeight(math.MaxUint64, 1), types.NewHeight(0, 1), 1},
|
||||
{"revision height is MaxUint64", types.NewHeight(1, math.MaxUint64), types.NewHeight(1, 0), 1},
|
||||
{"height is equal", types.NewHeight(4, 4), types.NewHeight(4, 4), 0},
|
||||
}
|
||||
|
||||
@ -66,11 +66,11 @@ func TestString(t *testing.T) {
|
||||
_, err := types.ParseHeight("height")
|
||||
require.Error(t, err, "invalid height string passed")
|
||||
|
||||
_, err = types.ParseHeight("version-10")
|
||||
require.Error(t, err, "invalid version string passed")
|
||||
_, err = types.ParseHeight("revision-10")
|
||||
require.Error(t, err, "invalid revision string passed")
|
||||
|
||||
_, err = types.ParseHeight("3-height")
|
||||
require.Error(t, err, "invalid version-height string passed")
|
||||
require.Error(t, err, "invalid revision-height string passed")
|
||||
|
||||
height := types.NewHeight(3, 4)
|
||||
recovered, err := types.ParseHeight(height.String())
|
||||
@ -100,7 +100,7 @@ func (suite *TypesTestSuite) TestMustParseHeight() {
|
||||
func TestParseChainID(t *testing.T) {
|
||||
cases := []struct {
|
||||
chainID string
|
||||
version uint64
|
||||
revision uint64
|
||||
formatted bool
|
||||
}{
|
||||
{"gaiamainnet-3", 3, true},
|
||||
@ -114,36 +114,36 @@ func TestParseChainID(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, tc := range cases {
|
||||
require.Equal(t, tc.formatted, types.IsVersionFormat(tc.chainID), "case %d does not match expected format", i)
|
||||
require.Equal(t, tc.formatted, types.IsRevisionFormat(tc.chainID), "case %d does not match expected format", i)
|
||||
|
||||
version := types.ParseChainID(tc.chainID)
|
||||
require.Equal(t, tc.version, version, "case %d returns incorrect version", i)
|
||||
revision := types.ParseChainID(tc.chainID)
|
||||
require.Equal(t, tc.revision, revision, "case %d returns incorrect revision", i)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestSetVersionNumber(t *testing.T) {
|
||||
// Test SetVersionNumber
|
||||
chainID, err := types.SetVersionNumber("gaiamainnet", 3)
|
||||
require.Error(t, err, "invalid version format passed SetVersionNumber")
|
||||
require.Equal(t, "", chainID, "invalid version format returned non-empty string on SetVersionNumber")
|
||||
func TestSetRevisionNumber(t *testing.T) {
|
||||
// Test SetRevisionNumber
|
||||
chainID, err := types.SetRevisionNumber("gaiamainnet", 3)
|
||||
require.Error(t, err, "invalid revision format passed SetRevisionNumber")
|
||||
require.Equal(t, "", chainID, "invalid revision format returned non-empty string on SetRevisionNumber")
|
||||
chainID = "gaiamainnet-3"
|
||||
|
||||
chainID, err = types.SetVersionNumber(chainID, 4)
|
||||
require.NoError(t, err, "valid version format failed SetVersionNumber")
|
||||
require.Equal(t, "gaiamainnet-4", chainID, "valid version format returned incorrect string on SetVersionNumber")
|
||||
chainID, err = types.SetRevisionNumber(chainID, 4)
|
||||
require.NoError(t, err, "valid revision format failed SetRevisionNumber")
|
||||
require.Equal(t, "gaiamainnet-4", chainID, "valid revision format returned incorrect string on SetRevisionNumber")
|
||||
}
|
||||
|
||||
func (suite *TypesTestSuite) TestSelfHeight() {
|
||||
ctx := suite.chainA.GetContext()
|
||||
|
||||
// Test default version
|
||||
// Test default revision
|
||||
ctx = ctx.WithChainID("gaiamainnet")
|
||||
ctx = ctx.WithBlockHeight(10)
|
||||
height := types.GetSelfHeight(ctx)
|
||||
suite.Require().Equal(types.NewHeight(0, 10), height, "default self height failed")
|
||||
|
||||
// Test successful version format
|
||||
// Test successful revision format
|
||||
ctx = ctx.WithChainID("gaiamainnet-3")
|
||||
ctx = ctx.WithBlockHeight(18)
|
||||
height = types.GetSelfHeight(ctx)
|
||||
|
||||
@ -182,23 +182,24 @@ func (msg MsgUpdateClient) UnpackInterfaces(unpacker codectypes.AnyUnpacker) err
|
||||
|
||||
// NewMsgUpgradeClient creates a new MsgUpgradeClient instance
|
||||
// nolint: interfacer
|
||||
func NewMsgUpgradeClient(clientID string, clientState exported.ClientState, upgradeHeight exported.Height, proofUpgrade []byte, signer sdk.AccAddress) (*MsgUpgradeClient, error) {
|
||||
func NewMsgUpgradeClient(clientID string, clientState exported.ClientState, consState exported.ConsensusState,
|
||||
proofUpgradeClient, proofUpgradeConsState []byte, signer sdk.AccAddress) (*MsgUpgradeClient, error) {
|
||||
anyClient, err := PackClientState(clientState)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
height, ok := upgradeHeight.(Height)
|
||||
if !ok {
|
||||
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "invalid height type. expected: %T, got: %T", &Height{}, upgradeHeight)
|
||||
anyConsState, err := PackConsensusState(consState)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &MsgUpgradeClient{
|
||||
ClientId: clientID,
|
||||
ClientState: anyClient,
|
||||
ProofUpgrade: proofUpgrade,
|
||||
UpgradeHeight: &height,
|
||||
Signer: signer.String(),
|
||||
ClientId: clientID,
|
||||
ClientState: anyClient,
|
||||
ConsensusState: anyConsState,
|
||||
ProofUpgradeClient: proofUpgradeClient,
|
||||
ProofUpgradeConsensusState: proofUpgradeConsState,
|
||||
Signer: signer.String(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -214,21 +215,28 @@ func (msg MsgUpgradeClient) Type() string {
|
||||
|
||||
// ValidateBasic implements sdk.Msg
|
||||
func (msg MsgUpgradeClient) ValidateBasic() error {
|
||||
// will not validate client state as committed client may not form a valid client state.
|
||||
// client implementations are responsible for ensuring final upgraded client is valid.
|
||||
clientState, err := UnpackClientState(msg.ClientState)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := clientState.Validate(); err != nil {
|
||||
// will not validate consensus state here since the trusted kernel may not form a valid consenus state.
|
||||
// client implementations are responsible for ensuring client can submit new headers against this consensus state.
|
||||
consensusState, err := UnpackConsensusState(msg.ConsensusState)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(msg.ProofUpgrade) == 0 {
|
||||
return sdkerrors.Wrap(ErrInvalidUpgradeClient, "proof of upgrade cannot be empty")
|
||||
|
||||
if clientState.ClientType() != consensusState.ClientType() {
|
||||
return sdkerrors.Wrapf(ErrInvalidUpgradeClient, "consensus state's client-type does not match client. expected: %s, got: %s",
|
||||
clientState.ClientType(), consensusState.ClientType())
|
||||
}
|
||||
if msg.UpgradeHeight == nil {
|
||||
return sdkerrors.Wrap(ErrInvalidUpgradeClient, "upgrade height cannot be nil")
|
||||
if len(msg.ProofUpgradeClient) == 0 {
|
||||
return sdkerrors.Wrap(ErrInvalidUpgradeClient, "proof of upgrade client cannot be empty")
|
||||
}
|
||||
if msg.UpgradeHeight.IsZero() {
|
||||
return sdkerrors.Wrap(ErrInvalidUpgradeClient, "upgrade height cannot be zero")
|
||||
if len(msg.ProofUpgradeConsensusState) == 0 {
|
||||
return sdkerrors.Wrap(ErrInvalidUpgradeClient, "proof of upgrade consensus state cannot be empty")
|
||||
}
|
||||
_, err = sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
@ -254,8 +262,14 @@ func (msg MsgUpgradeClient) GetSigners() []sdk.AccAddress {
|
||||
|
||||
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
|
||||
func (msg MsgUpgradeClient) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
var clientState exported.ClientState
|
||||
return unpacker.UnpackAny(msg.ClientState, &clientState)
|
||||
var (
|
||||
clientState exported.ClientState
|
||||
consState exported.ConsensusState
|
||||
)
|
||||
if err := unpacker.UnpackAny(msg.ClientState, &clientState); err != nil {
|
||||
return err
|
||||
}
|
||||
return unpacker.UnpackAny(msg.ConsensusState, &consState)
|
||||
}
|
||||
|
||||
// NewMsgSubmitMisbehaviour creates a new MsgSubmitMisbehaviour instance.
|
||||
|
||||
@ -339,8 +339,6 @@ func (suite *TypesTestSuite) TestMarshalMsgUpgradeClient() {
|
||||
err error
|
||||
)
|
||||
|
||||
newClientHeight := types.NewHeight(1, 1)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
malleate func()
|
||||
@ -349,7 +347,8 @@ func (suite *TypesTestSuite) TestMarshalMsgUpgradeClient() {
|
||||
"client upgrades to new tendermint client",
|
||||
func() {
|
||||
tendermintClient := ibctmtypes.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
msg, err = types.NewMsgUpgradeClient("clientid", tendermintClient, newClientHeight, []byte("proofUpgrade"), suite.chainA.SenderAccount.GetAddress())
|
||||
tendermintConsState := &ibctmtypes.ConsensusState{NextValidatorsHash: []byte("nextValsHash")}
|
||||
msg, err = types.NewMsgUpgradeClient("clientid", tendermintClient, tendermintConsState, []byte("proofUpgradeClient"), []byte("proofUpgradeConsState"), suite.chainA.SenderAccount.GetAddress())
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
},
|
||||
@ -357,7 +356,7 @@ func (suite *TypesTestSuite) TestMarshalMsgUpgradeClient() {
|
||||
"client upgrades to new solomachine client",
|
||||
func() {
|
||||
soloMachine := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachine", "", 1)
|
||||
msg, err = types.NewMsgUpgradeClient("clientid", soloMachine.ClientState(), newClientHeight, []byte("proofUpgrade"), suite.chainA.SenderAccount.GetAddress())
|
||||
msg, err = types.NewMsgUpgradeClient("clientid", soloMachine.ClientState(), soloMachine.ConsensusState(), []byte("proofUpgradeClient"), []byte("proofUpgradeConsState"), suite.chainA.SenderAccount.GetAddress())
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
},
|
||||
@ -381,8 +380,6 @@ func (suite *TypesTestSuite) TestMarshalMsgUpgradeClient() {
|
||||
newMsg := &types.MsgUpgradeClient{}
|
||||
err = cdc.UnmarshalJSON(bz, newMsg)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
suite.Require().True(proto.Equal(msg, newMsg))
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -412,20 +409,6 @@ func (suite *TypesTestSuite) TestMsgUpgradeClient_ValidateBasic() {
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "upgrade height is nil",
|
||||
malleate: func(msg *types.MsgUpgradeClient) {
|
||||
msg.UpgradeHeight = nil
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "upgrade height is zero",
|
||||
malleate: func(msg *types.MsgUpgradeClient) {
|
||||
msg.UpgradeHeight = &types.Height{}
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "unpacking clientstate fails",
|
||||
malleate: func(msg *types.MsgUpgradeClient) {
|
||||
@ -434,19 +417,33 @@ func (suite *TypesTestSuite) TestMsgUpgradeClient_ValidateBasic() {
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid client state",
|
||||
name: "unpacking consensus state fails",
|
||||
malleate: func(msg *types.MsgUpgradeClient) {
|
||||
cs := &ibctmtypes.ClientState{}
|
||||
var err error
|
||||
msg.ClientState, err = types.PackClientState(cs)
|
||||
suite.Require().NoError(err)
|
||||
msg.ConsensusState = nil
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "empty proof",
|
||||
name: "client and consensus type does not match",
|
||||
malleate: func(msg *types.MsgUpgradeClient) {
|
||||
msg.ProofUpgrade = nil
|
||||
soloMachine := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachine", "", 2)
|
||||
soloConsensus, err := types.PackConsensusState(soloMachine.ConsensusState())
|
||||
suite.Require().NoError(err)
|
||||
msg.ConsensusState = soloConsensus
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "empty client proof",
|
||||
malleate: func(msg *types.MsgUpgradeClient) {
|
||||
msg.ProofUpgradeClient = nil
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "empty consensus state proof",
|
||||
malleate: func(msg *types.MsgUpgradeClient) {
|
||||
msg.ProofUpgradeConsensusState = nil
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
@ -463,18 +460,18 @@ func (suite *TypesTestSuite) TestMsgUpgradeClient_ValidateBasic() {
|
||||
tc := tc
|
||||
|
||||
clientState := ibctmtypes.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
newClientHeight := types.NewHeight(1, 1)
|
||||
msg, _ := types.NewMsgUpgradeClient("testclientid", clientState, newClientHeight, []byte("proofUpgrade"), suite.chainA.SenderAccount.GetAddress())
|
||||
consState := &ibctmtypes.ConsensusState{NextValidatorsHash: []byte("nextValsHash")}
|
||||
msg, err := types.NewMsgUpgradeClient("testclientid", clientState, consState, []byte("proofUpgradeClient"), []byte("proofUpgradeConsState"), suite.chainA.SenderAccount.GetAddress())
|
||||
suite.Require().NoError(err)
|
||||
|
||||
tc.malleate(msg)
|
||||
err := msg.ValidateBasic()
|
||||
err = msg.ValidateBasic()
|
||||
if tc.expPass {
|
||||
suite.Require().NoError(err, "valid case %s failed", tc.name)
|
||||
} else {
|
||||
suite.Require().Error(err, "invalid case %s passed", tc.name)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// tests that different misbehaviours within MsgSubmitMisbehaviour can be marshaled
|
||||
@ -500,8 +497,8 @@ func (suite *TypesTestSuite) TestMarshalMsgSubmitMisbehaviour() {
|
||||
"tendermint client", func() {
|
||||
height := types.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height))
|
||||
heightMinus1 := types.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height)-1)
|
||||
header1 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.VersionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
header2 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.VersionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
header1 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
header2 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
|
||||
misbehaviour := ibctmtypes.NewMisbehaviour("tendermint", header1, header2)
|
||||
msg, err = types.NewMsgSubmitMisbehaviour("tendermint", misbehaviour, suite.chainA.SenderAccount.GetAddress())
|
||||
@ -558,8 +555,8 @@ func (suite *TypesTestSuite) TestMsgSubmitMisbehaviour_ValidateBasic() {
|
||||
func() {
|
||||
height := types.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height))
|
||||
heightMinus1 := types.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height)-1)
|
||||
header1 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.VersionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
header2 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.VersionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
header1 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
header2 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
|
||||
misbehaviour := ibctmtypes.NewMisbehaviour("tendermint", header1, header2)
|
||||
msg, err = types.NewMsgSubmitMisbehaviour("tendermint", misbehaviour, suite.chainA.SenderAccount.GetAddress())
|
||||
|
||||
@ -253,10 +253,10 @@ func (m *QueryClientStatesResponse) GetPagination() *query.PageResponse {
|
||||
type QueryConsensusStateRequest struct {
|
||||
// client identifier
|
||||
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
|
||||
// consensus state version number
|
||||
VersionNumber uint64 `protobuf:"varint,2,opt,name=version_number,json=versionNumber,proto3" json:"version_number,omitempty"`
|
||||
// consensus state version height
|
||||
VersionHeight uint64 `protobuf:"varint,3,opt,name=version_height,json=versionHeight,proto3" json:"version_height,omitempty"`
|
||||
// consensus state revision number
|
||||
RevisionNumber uint64 `protobuf:"varint,2,opt,name=revision_number,json=revisionNumber,proto3" json:"revision_number,omitempty"`
|
||||
// consensus state revision height
|
||||
RevisionHeight uint64 `protobuf:"varint,3,opt,name=revision_height,json=revisionHeight,proto3" json:"revision_height,omitempty"`
|
||||
// latest_height overrrides the height field and queries the latest stored
|
||||
// ConsensusState
|
||||
LatestHeight bool `protobuf:"varint,4,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height,omitempty"`
|
||||
@ -302,16 +302,16 @@ func (m *QueryConsensusStateRequest) GetClientId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *QueryConsensusStateRequest) GetVersionNumber() uint64 {
|
||||
func (m *QueryConsensusStateRequest) GetRevisionNumber() uint64 {
|
||||
if m != nil {
|
||||
return m.VersionNumber
|
||||
return m.RevisionNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryConsensusStateRequest) GetVersionHeight() uint64 {
|
||||
func (m *QueryConsensusStateRequest) GetRevisionHeight() uint64 {
|
||||
if m != nil {
|
||||
return m.VersionHeight
|
||||
return m.RevisionHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
@ -599,59 +599,59 @@ func init() {
|
||||
func init() { proto.RegisterFile("ibc/core/client/v1/query.proto", fileDescriptor_dc42cdfd1d52d76e) }
|
||||
|
||||
var fileDescriptor_dc42cdfd1d52d76e = []byte{
|
||||
// 823 bytes of a gzipped FileDescriptorProto
|
||||
// 824 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x4f, 0xdb, 0x48,
|
||||
0x18, 0xce, 0xf0, 0x25, 0x98, 0x04, 0x58, 0x8d, 0xd0, 0x6e, 0x30, 0xc8, 0x44, 0x5e, 0x2d, 0x9b,
|
||||
0xdd, 0x85, 0x19, 0x92, 0xdd, 0x2d, 0x52, 0x25, 0x0e, 0x05, 0x89, 0x96, 0x4b, 0x0b, 0xee, 0xa1,
|
||||
0x52, 0xa5, 0x0a, 0xd9, 0xce, 0xc4, 0xb1, 0x4a, 0x3c, 0x21, 0xe3, 0x44, 0x45, 0x88, 0x0b, 0x7f,
|
||||
0xa0, 0x95, 0x7a, 0xec, 0xb5, 0xa7, 0xaa, 0xea, 0xa5, 0x87, 0xfe, 0x83, 0x8a, 0x23, 0x52, 0x7b,
|
||||
0xe8, 0xa9, 0x1f, 0xd0, 0x1f, 0xd1, 0x63, 0xe5, 0x99, 0x31, 0xb1, 0x89, 0x11, 0x16, 0x6a, 0x4f,
|
||||
0xb1, 0xdf, 0xaf, 0x79, 0x9e, 0xe7, 0x7d, 0xdf, 0x71, 0xa0, 0xee, 0xd9, 0x0e, 0x71, 0x58, 0x9b,
|
||||
0x12, 0x67, 0xc7, 0xa3, 0x7e, 0x40, 0xba, 0x15, 0xb2, 0xdb, 0xa1, 0xed, 0x3d, 0xdc, 0x6a, 0xb3,
|
||||
0x80, 0x21, 0xe4, 0xd9, 0x0e, 0x0e, 0xfd, 0x58, 0xfa, 0x71, 0xb7, 0xa2, 0xfd, 0xed, 0x30, 0xde,
|
||||
0x64, 0x9c, 0xd8, 0x16, 0xa7, 0x32, 0x98, 0x74, 0x2b, 0x36, 0x0d, 0xac, 0x0a, 0x69, 0x59, 0xae,
|
||||
0xe7, 0x5b, 0x81, 0xc7, 0x7c, 0x99, 0xaf, 0xcd, 0xa5, 0xd4, 0x57, 0x95, 0x64, 0xc0, 0xb4, 0xcb,
|
||||
0x98, 0xbb, 0x43, 0x89, 0x78, 0xb3, 0x3b, 0x75, 0x62, 0xf9, 0xea, 0x6c, 0x6d, 0x56, 0xb9, 0xac,
|
||||
0x96, 0x47, 0x2c, 0xdf, 0x67, 0x81, 0x28, 0xcc, 0x95, 0x77, 0xca, 0x65, 0x2e, 0x13, 0x8f, 0x24,
|
||||
0x7c, 0x92, 0x56, 0xe3, 0x1a, 0xfc, 0x6d, 0x2b, 0x44, 0xb4, 0x26, 0xce, 0xb8, 0x1b, 0x58, 0x01,
|
||||
0x35, 0xe9, 0x6e, 0x87, 0xf2, 0x00, 0xcd, 0xc0, 0x31, 0x79, 0xf2, 0xb6, 0x57, 0x2b, 0x82, 0x12,
|
||||
0x28, 0x8f, 0x99, 0xa3, 0xd2, 0xb0, 0x51, 0x33, 0x5e, 0x01, 0x58, 0xec, 0x4f, 0xe4, 0x2d, 0xe6,
|
||||
0x73, 0x8a, 0x96, 0x61, 0x41, 0x65, 0xf2, 0xd0, 0x2e, 0x92, 0xf3, 0xd5, 0x29, 0x2c, 0xf1, 0xe1,
|
||||
0x08, 0x3a, 0xbe, 0xe1, 0xef, 0x99, 0x79, 0xa7, 0x57, 0x00, 0x4d, 0xc1, 0xe1, 0x56, 0x9b, 0xb1,
|
||||
0x7a, 0x71, 0xa0, 0x04, 0xca, 0x05, 0x53, 0xbe, 0xa0, 0x35, 0x58, 0x10, 0x0f, 0xdb, 0x0d, 0xea,
|
||||
0xb9, 0x8d, 0xa0, 0x38, 0x28, 0xca, 0x69, 0xb8, 0x5f, 0x6a, 0x7c, 0x4b, 0x44, 0xac, 0x0e, 0x1d,
|
||||
0x7d, 0x9c, 0xcb, 0x99, 0x79, 0x91, 0x25, 0x4d, 0x86, 0xdd, 0x8f, 0x97, 0x47, 0x4c, 0xd7, 0x21,
|
||||
0xec, 0x35, 0x42, 0xa1, 0x9d, 0xc7, 0xb2, 0x6b, 0x38, 0xec, 0x1a, 0x96, 0x2d, 0x56, 0x5d, 0xc3,
|
||||
0x9b, 0x96, 0x1b, 0xa9, 0x64, 0xc6, 0x32, 0x8d, 0xf7, 0x00, 0x4e, 0xa7, 0x1c, 0xa2, 0x54, 0xf1,
|
||||
0xe1, 0x78, 0x5c, 0x15, 0x5e, 0x04, 0xa5, 0xc1, 0x72, 0xbe, 0xfa, 0x57, 0x1a, 0x8f, 0x8d, 0x1a,
|
||||
0xf5, 0x03, 0xaf, 0xee, 0xd1, 0x5a, 0xac, 0xd4, 0xaa, 0x1e, 0xd2, 0x7a, 0xf1, 0x69, 0xee, 0xd7,
|
||||
0x54, 0x37, 0x37, 0x0b, 0x31, 0x2d, 0x39, 0xba, 0x99, 0x60, 0x35, 0x20, 0x58, 0xfd, 0x79, 0x29,
|
||||
0x2b, 0x09, 0x36, 0x41, 0xeb, 0x25, 0x80, 0x9a, 0xa4, 0x15, 0xba, 0x7c, 0xde, 0xe1, 0x99, 0xe7,
|
||||
0x04, 0xfd, 0x01, 0x27, 0xba, 0xb4, 0xcd, 0x3d, 0xe6, 0x6f, 0xfb, 0x9d, 0xa6, 0x4d, 0xdb, 0x02,
|
||||
0xc8, 0x90, 0x39, 0xae, 0xac, 0xb7, 0x85, 0x31, 0x1e, 0x16, 0x6b, 0x72, 0x2f, 0x4c, 0x36, 0x11,
|
||||
0xfd, 0x0e, 0xc7, 0x77, 0x42, 0x6e, 0x41, 0x14, 0x35, 0x54, 0x02, 0xe5, 0x51, 0xb3, 0x20, 0x8d,
|
||||
0xaa, 0xd3, 0x6f, 0x00, 0x9c, 0x49, 0x85, 0xab, 0xfa, 0xb0, 0x02, 0x27, 0x9d, 0xc8, 0x93, 0x61,
|
||||
0x40, 0x27, 0x9c, 0x44, 0x99, 0x9f, 0x39, 0xa3, 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, 0x70, 0xa4, 0x25, 0x2c, 0x6a, 0x2e, 0x52, 0xbb, 0xa8,
|
||||
0x72, 0x54, 0x64, 0xed, 0xeb, 0x08, 0x1c, 0x16, 0x15, 0xd1, 0x0b, 0x00, 0xf3, 0xb1, 0xcd, 0x44,
|
||||
0x7f, 0xa4, 0x65, 0x5f, 0x73, 0xef, 0x6a, 0x0b, 0xd9, 0x82, 0x25, 0x50, 0xe3, 0xdf, 0xe3, 0xf7,
|
||||
0x17, 0xcf, 0x06, 0xfe, 0x42, 0x35, 0xd2, 0xff, 0xe5, 0x90, 0xdf, 0x98, 0xc4, 0xa5, 0x43, 0x0e,
|
||||
0x2f, 0xa7, 0xe7, 0x08, 0x3d, 0x07, 0xb0, 0x10, 0xbf, 0x40, 0x50, 0xa6, 0xa3, 0x23, 0x01, 0xb5,
|
||||
0xc5, 0x8c, 0xd1, 0x0a, 0x29, 0x16, 0x48, 0x2b, 0x68, 0x2e, 0x1b, 0x52, 0x74, 0x01, 0xe0, 0x44,
|
||||
0x72, 0x70, 0x10, 0xbe, 0xfe, 0xc4, 0xb4, 0xab, 0x49, 0x23, 0x99, 0xe3, 0x15, 0xc6, 0x7d, 0x81,
|
||||
0x71, 0x17, 0x79, 0xd7, 0x63, 0xec, 0x19, 0xfb, 0xb8, 0xa0, 0x24, 0xba, 0xaa, 0xc8, 0x61, 0xcf,
|
||||
0xa5, 0x77, 0x44, 0xe4, 0x9d, 0x10, 0x73, 0x48, 0xc3, 0x11, 0x7a, 0x03, 0x60, 0xb1, 0x67, 0xcd,
|
||||
0x50, 0x56, 0xdc, 0x97, 0xad, 0x58, 0xca, 0x9e, 0xa0, 0x98, 0xae, 0x08, 0xa6, 0xcb, 0xe8, 0xef,
|
||||
0x5b, 0x31, 0x45, 0x4f, 0x2e, 0x47, 0x47, 0x2e, 0xc1, 0x8d, 0xa3, 0x93, 0xd8, 0xbd, 0x1b, 0x47,
|
||||
0x27, 0xb9, 0x8d, 0x86, 0x21, 0xc0, 0xce, 0x20, 0x4d, 0x82, 0x4d, 0xe2, 0x94, 0xdb, 0xb7, 0xba,
|
||||
0x75, 0x72, 0xa6, 0x83, 0xd3, 0x33, 0x1d, 0x7c, 0x39, 0xd3, 0xc1, 0xd3, 0x73, 0x3d, 0x77, 0x7a,
|
||||
0xae, 0xe7, 0x3e, 0x9e, 0xeb, 0xb9, 0x87, 0xcb, 0xae, 0x17, 0x34, 0x3a, 0x36, 0x76, 0x58, 0x93,
|
||||
0xa8, 0xbf, 0x62, 0xf2, 0x67, 0x91, 0xd7, 0x77, 0xc9, 0xe3, 0x2b, 0x01, 0x96, 0x6a, 0x8b, 0xaa,
|
||||
0x76, 0x70, 0xd0, 0xa2, 0xdc, 0x1e, 0x11, 0x1f, 0x81, 0x3f, 0xbf, 0x05, 0x00, 0x00, 0xff, 0xff,
|
||||
0xa7, 0x0d, 0x7c, 0x62, 0xf5, 0x09, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -1088,13 +1088,13 @@ func (m *QueryConsensusStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, err
|
||||
i--
|
||||
dAtA[i] = 0x20
|
||||
}
|
||||
if m.VersionHeight != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.RevisionHeight))
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.RevisionNumber))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
@ -1394,11 +1394,11 @@ func (m *QueryConsensusStateRequest) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
n += 1 + sovQuery(uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
n += 1 + sovQuery(uint64(m.RevisionNumber))
|
||||
}
|
||||
if m.VersionHeight != 0 {
|
||||
n += 1 + sovQuery(uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
n += 1 + sovQuery(uint64(m.RevisionHeight))
|
||||
}
|
||||
if m.LatestHeight {
|
||||
n += 2
|
||||
@ -2005,9 +2005,9 @@ func (m *QueryConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionNumber", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionNumber", wireType)
|
||||
}
|
||||
m.VersionNumber = 0
|
||||
m.RevisionNumber = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
@ -2017,16 +2017,16 @@ func (m *QueryConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionNumber |= uint64(b&0x7F) << shift
|
||||
m.RevisionNumber |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionHeight", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionHeight", wireType)
|
||||
}
|
||||
m.VersionHeight = 0
|
||||
m.RevisionHeight = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
@ -2036,7 +2036,7 @@ func (m *QueryConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionHeight |= uint64(b&0x7F) << shift
|
||||
m.RevisionHeight |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ func local_request_Query_ClientStates_0(ctx context.Context, marshaler runtime.M
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_ConsensusState_0 = &utilities.DoubleArray{Encoding: map[string]int{"client_id": 0, "version_number": 1, "version_height": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}}
|
||||
filter_Query_ConsensusState_0 = &utilities.DoubleArray{Encoding: map[string]int{"client_id": 0, "revision_number": 1, "revision_height": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}}
|
||||
)
|
||||
|
||||
func request_Query_ConsensusState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
@ -147,26 +147,26 @@ func request_Query_ConsensusState_0(ctx context.Context, marshaler runtime.Marsh
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_number"]
|
||||
val, ok = pathParams["revision_number"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_number")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_number")
|
||||
}
|
||||
|
||||
protoReq.VersionNumber, err = runtime.Uint64(val)
|
||||
protoReq.RevisionNumber, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_number", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_number", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_height"]
|
||||
val, ok = pathParams["revision_height"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_height")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_height")
|
||||
}
|
||||
|
||||
protoReq.VersionHeight, err = runtime.Uint64(val)
|
||||
protoReq.RevisionHeight, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_height", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_height", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
@ -203,26 +203,26 @@ func local_request_Query_ConsensusState_0(ctx context.Context, marshaler runtime
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_number"]
|
||||
val, ok = pathParams["revision_number"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_number")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_number")
|
||||
}
|
||||
|
||||
protoReq.VersionNumber, err = runtime.Uint64(val)
|
||||
protoReq.RevisionNumber, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_number", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_number", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_height"]
|
||||
val, ok = pathParams["revision_height"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_height")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_height")
|
||||
}
|
||||
|
||||
protoReq.VersionHeight, err = runtime.Uint64(val)
|
||||
protoReq.RevisionHeight, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_height", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_height", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
@ -582,7 +582,7 @@ var (
|
||||
|
||||
pattern_Query_ClientStates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "core", "client", "v1beta1", "client_states"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9}, []string{"ibc", "core", "client", "v1beta1", "consensus_states", "client_id", "version", "version_number", "height", "version_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_ConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9}, []string{"ibc", "core", "client", "v1beta1", "consensus_states", "client_id", "revision", "revision_number", "height", "revision_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ConsensusStates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"ibc", "core", "client", "v1beta1", "consensus_states", "client_id"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
|
||||
@ -199,12 +199,14 @@ type MsgUpgradeClient struct {
|
||||
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"`
|
||||
// upgraded client state
|
||||
ClientState *types.Any `protobuf:"bytes,2,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty" yaml:"client_state"`
|
||||
// height at which old chain halts and upgrades (i.e last block executed)
|
||||
UpgradeHeight *Height `protobuf:"bytes,3,opt,name=upgrade_height,json=upgradeHeight,proto3" json:"upgrade_height,omitempty" yaml:"upgrade_height"`
|
||||
// upgraded consensus state, only contains enough information to serve as a basis of trust in update logic
|
||||
ConsensusState *types.Any `protobuf:"bytes,3,opt,name=consensus_state,json=consensusState,proto3" json:"consensus_state,omitempty" yaml:"consensus_state"`
|
||||
// proof that old chain committed to new client
|
||||
ProofUpgrade []byte `protobuf:"bytes,4,opt,name=proof_upgrade,json=proofUpgrade,proto3" json:"proof_upgrade,omitempty" yaml:"proof_upgrade"`
|
||||
ProofUpgradeClient []byte `protobuf:"bytes,4,opt,name=proof_upgrade_client,json=proofUpgradeClient,proto3" json:"proof_upgrade_client,omitempty" yaml:"proof_upgrade_client"`
|
||||
// proof that old chain committed to new consensus state
|
||||
ProofUpgradeConsensusState []byte `protobuf:"bytes,5,opt,name=proof_upgrade_consensus_state,json=proofUpgradeConsensusState,proto3" json:"proof_upgrade_consensus_state,omitempty" yaml:"proof_upgrade_consensus_state"`
|
||||
// signer address
|
||||
Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"`
|
||||
Signer string `protobuf:"bytes,6,opt,name=signer,proto3" json:"signer,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgUpgradeClient) Reset() { *m = MsgUpgradeClient{} }
|
||||
@ -240,41 +242,6 @@ func (m *MsgUpgradeClient) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_MsgUpgradeClient proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgUpgradeClient) GetClientId() string {
|
||||
if m != nil {
|
||||
return m.ClientId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgUpgradeClient) GetClientState() *types.Any {
|
||||
if m != nil {
|
||||
return m.ClientState
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MsgUpgradeClient) GetUpgradeHeight() *Height {
|
||||
if m != nil {
|
||||
return m.UpgradeHeight
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MsgUpgradeClient) GetProofUpgrade() []byte {
|
||||
if m != nil {
|
||||
return m.ProofUpgrade
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MsgUpgradeClient) GetSigner() string {
|
||||
if m != nil {
|
||||
return m.Signer
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// MsgUpgradeClientResponse defines the Msg/UpgradeClient response type.
|
||||
type MsgUpgradeClientResponse struct {
|
||||
}
|
||||
@ -407,45 +374,45 @@ func init() {
|
||||
func init() { proto.RegisterFile("ibc/core/client/v1/tx.proto", fileDescriptor_cb5dc4651eb49a04) }
|
||||
|
||||
var fileDescriptor_cb5dc4651eb49a04 = []byte{
|
||||
// 608 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x3f, 0x6f, 0xd3, 0x40,
|
||||
0x14, 0x8f, 0x1b, 0x88, 0xda, 0x6b, 0xd2, 0x56, 0x26, 0x6d, 0x13, 0x23, 0xec, 0xca, 0x30, 0x14,
|
||||
0xd1, 0xda, 0x24, 0x0c, 0xa0, 0x4a, 0x0c, 0xa4, 0x0b, 0x0c, 0x91, 0xc0, 0x15, 0x03, 0x08, 0x29,
|
||||
0xf8, 0xcf, 0xf5, 0x62, 0x91, 0xf8, 0x22, 0xdf, 0x39, 0x6a, 0xbe, 0x01, 0x23, 0x12, 0x7c, 0x80,
|
||||
0x8a, 0x81, 0xcf, 0xc2, 0xc0, 0xd0, 0x91, 0x29, 0x42, 0xc9, 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b, 0x03, 0x02, 0x03, 0x12, 0x11, 0x41, 0x9a,
|
||||
0x5f, 0x42, 0xaa, 0x4c, 0x86, 0xda, 0x9e, 0x20, 0xcd, 0x96, 0xe9, 0xd6, 0x56, 0x72, 0xc2, 0xa9,
|
||||
0xf7, 0x40, 0x81, 0xf8, 0x28, 0x80, 0x61, 0xe5, 0x46, 0xfc, 0x72, 0x96, 0x88, 0x4e, 0xd6, 0x3f,
|
||||
0x5e, 0x6a, 0xb9, 0xdf, 0x97, 0x5a, 0x4e, 0xaf, 0x82, 0xfd, 0x19, 0x53, 0x2c, 0x48, 0x7a, 0x31,
|
||||
0x8b, 0xfe, 0x45, 0x62, 0x86, 0xbd, 0xee, 0x79, 0xff, 0x64, 0xd8, 0x11, 0x28, 0xb4, 0xa1, 0xed,
|
||||
0xc1, 0x70, 0x99, 0x55, 0x96, 0xc0, 0xa4, 0x14, 0xe7, 0x97, 0x2a, 0x4e, 0xab, 0x4a, 0x14, 0xff,
|
||||
0x58, 0x03, 0x3b, 0x2c, 0x87, 0x42, 0xdb, 0xfb, 0xaf, 0x66, 0xfc, 0x0e, 0x6c, 0x45, 0x5c, 0x55,
|
||||
0xab, 0x0d, 0x7d, 0xd4, 0xa6, 0x62, 0xc4, 0x8a, 0x71, 0x7d, 0xf7, 0x8d, 0xe7, 0x0c, 0xd1, 0xa8,
|
||||
0x4e, 0x86, 0xda, 0x2e, 0x67, 0xce, 0xd6, 0xea, 0x56, 0x49, 0x1c, 0x70, 0xa4, 0xfc, 0x14, 0x94,
|
||||
0x7a, 0x21, 0xc6, 0xe7, 0x2d, 0x71, 0xcc, 0xa6, 0x5d, 0x6c, 0x54, 0x26, 0x43, 0xad, 0xcc, 0x09,
|
||||
0x32, 0x69, 0xdd, 0x2a, 0xb2, 0x58, 0xf8, 0x94, 0xf2, 0xfc, 0x66, 0xda, 0x73, 0x5d, 0x01, 0x95,
|
||||
0x59, 0x37, 0x13, 0xab, 0xbf, 0x49, 0x60, 0xb7, 0x49, 0xd0, 0x59, 0xe4, 0x74, 0x7d, 0xda, 0xf4,
|
||||
0x89, 0x03, 0xdb, 0x76, 0xdf, 0xc7, 0x51, 0xf8, 0x37, 0x7e, 0x3f, 0x01, 0xc5, 0x6e, 0x8a, 0x62,
|
||||
0xe9, 0xa2, 0x64, 0x90, 0x2b, 0xac, 0x8b, 0x06, 0xee, 0xcc, 0xd5, 0x39, 0x7d, 0x93, 0xfa, 0xd7,
|
||||
0x3c, 0xc8, 0x37, 0x09, 0x92, 0xdf, 0x83, 0x62, 0xe6, 0xbf, 0xe1, 0xee, 0xbc, 0xd1, 0xcc, 0xdc,
|
||||
0x15, 0xe5, 0xc1, 0x0a, 0xa0, 0x69, 0xa7, 0xb8, 0x43, 0xe6, 0x32, 0x2d, 0xea, 0x90, 0x06, 0x2d,
|
||||
0xec, 0x30, 0xef, 0x02, 0xc8, 0x2e, 0x28, 0x65, 0x97, 0xff, 0xde, 0xc2, 0xea, 0x14, 0x4a, 0x39,
|
||||
0x5a, 0x05, 0x95, 0x34, 0x09, 0x81, 0x3c, 0x67, 0xec, 0xf7, 0x17, 0x70, 0x5c, 0x87, 0x2a, 0xb5,
|
||||
0x95, 0xa1, 0xd3, 0x9e, 0x8d, 0x57, 0xdf, 0x47, 0xaa, 0x74, 0x35, 0x52, 0xa5, 0x5f, 0x23, 0x55,
|
||||
0xfa, 0x34, 0x56, 0x73, 0x57, 0x63, 0x35, 0xf7, 0x73, 0xac, 0xe6, 0xde, 0x3e, 0x46, 0x3e, 0x6d,
|
||||
0x47, 0x8e, 0xe1, 0xe2, 0xae, 0xe9, 0x62, 0xd2, 0xc5, 0x44, 0xfc, 0x1c, 0x13, 0xef, 0x83, 0x79,
|
||||
0x61, 0x26, 0x9f, 0x85, 0x87, 0xf5, 0x63, 0xf1, 0x65, 0xa0, 0x83, 0x1e, 0x24, 0x4e, 0x81, 0xad,
|
||||
0xd5, 0xa3, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb1, 0x03, 0x55, 0x1e, 0x9b, 0x06, 0x00, 0x00,
|
||||
// 598 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x55, 0x3f, 0x6f, 0xd3, 0x4e,
|
||||
0x18, 0x8e, 0x9b, 0xdf, 0x2f, 0x6a, 0xaf, 0x81, 0x56, 0x26, 0xb4, 0xa9, 0xab, 0xda, 0x95, 0xe9,
|
||||
0x10, 0x44, 0xeb, 0x23, 0x61, 0x00, 0x75, 0x23, 0x9d, 0x18, 0x22, 0x51, 0x57, 0x0c, 0xb0, 0x04,
|
||||
0xff, 0xb9, 0x5e, 0xac, 0x26, 0xbe, 0xc8, 0x67, 0x47, 0xcd, 0x37, 0x60, 0x44, 0x82, 0x0f, 0x50,
|
||||
0x31, 0xf0, 0x59, 0x18, 0x3b, 0x30, 0x30, 0x45, 0x28, 0x59, 0x98, 0xf3, 0x09, 0x90, 0xef, 0x1c,
|
||||
0xcb, 0x76, 0xed, 0x28, 0x82, 0x91, 0xc9, 0x7e, 0xef, 0x7d, 0xee, 0x79, 0x9e, 0x7b, 0xdf, 0xf7,
|
||||
0x6c, 0xb0, 0xef, 0x98, 0x16, 0xb4, 0x88, 0x87, 0xa0, 0xd5, 0x77, 0x90, 0xeb, 0xc3, 0x51, 0x13,
|
||||
0xfa, 0xd7, 0xda, 0xd0, 0x23, 0x3e, 0x11, 0x45, 0xc7, 0xb4, 0xb4, 0x30, 0xa9, 0xf1, 0xa4, 0x36,
|
||||
0x6a, 0x4a, 0x35, 0x4c, 0x30, 0x61, 0x69, 0x18, 0xbe, 0x71, 0xa4, 0xb4, 0x87, 0x09, 0xc1, 0x7d,
|
||||
0x04, 0x59, 0x64, 0x06, 0x97, 0xd0, 0x70, 0xc7, 0x51, 0x4a, 0xc9, 0x51, 0x88, 0xe8, 0x18, 0x40,
|
||||
0xfd, 0xb4, 0x06, 0xb6, 0x3a, 0x14, 0x9f, 0x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xe3, 0x2e, 0x54, 0x6a, 0xae, 0x0c, 0x5d, 0x68, 0xb6, 0xcf, 0xbf, 0x4d, 0x65, 0xe1,
|
||||
0x76, 0x2a, 0x0b, 0x3f, 0xa7, 0xb2, 0xf0, 0x71, 0x26, 0x97, 0x6e, 0x67, 0x72, 0xe9, 0xc7, 0x4c,
|
||||
0x2e, 0xbd, 0x7b, 0x8e, 0x1d, 0xbf, 0x17, 0x98, 0x9a, 0x45, 0x06, 0xd0, 0x22, 0x74, 0x40, 0x68,
|
||||
0xf4, 0x38, 0xa1, 0xf6, 0x15, 0xbc, 0x86, 0xf1, 0xef, 0xe9, 0x69, 0xeb, 0x24, 0xfa, 0x43, 0xf9,
|
||||
0xe3, 0x21, 0xa2, 0x66, 0x85, 0x8d, 0xd5, 0xb3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x19,
|
||||
0x59, 0x52, 0x23, 0x07, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -825,18 +792,25 @@ func (m *MsgUpgradeClient) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
copy(dAtA[i:], m.Signer)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Signer)))
|
||||
i--
|
||||
dAtA[i] = 0x32
|
||||
}
|
||||
if len(m.ProofUpgradeConsensusState) > 0 {
|
||||
i -= len(m.ProofUpgradeConsensusState)
|
||||
copy(dAtA[i:], m.ProofUpgradeConsensusState)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.ProofUpgradeConsensusState)))
|
||||
i--
|
||||
dAtA[i] = 0x2a
|
||||
}
|
||||
if len(m.ProofUpgrade) > 0 {
|
||||
i -= len(m.ProofUpgrade)
|
||||
copy(dAtA[i:], m.ProofUpgrade)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.ProofUpgrade)))
|
||||
if len(m.ProofUpgradeClient) > 0 {
|
||||
i -= len(m.ProofUpgradeClient)
|
||||
copy(dAtA[i:], m.ProofUpgradeClient)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.ProofUpgradeClient)))
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
if m.UpgradeHeight != nil {
|
||||
if m.ConsensusState != nil {
|
||||
{
|
||||
size, err := m.UpgradeHeight.MarshalToSizedBuffer(dAtA[:i])
|
||||
size, err := m.ConsensusState.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@ -1052,11 +1026,15 @@ func (m *MsgUpgradeClient) Size() (n int) {
|
||||
l = m.ClientState.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
if m.UpgradeHeight != nil {
|
||||
l = m.UpgradeHeight.Size()
|
||||
if m.ConsensusState != nil {
|
||||
l = m.ConsensusState.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.ProofUpgrade)
|
||||
l = len(m.ProofUpgradeClient)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.ProofUpgradeConsensusState)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
@ -1659,7 +1637,7 @@ func (m *MsgUpgradeClient) Unmarshal(dAtA []byte) error {
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field UpgradeHeight", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ConsensusState", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@ -1686,16 +1664,16 @@ func (m *MsgUpgradeClient) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.UpgradeHeight == nil {
|
||||
m.UpgradeHeight = &Height{}
|
||||
if m.ConsensusState == nil {
|
||||
m.ConsensusState = &types.Any{}
|
||||
}
|
||||
if err := m.UpgradeHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
if err := m.ConsensusState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ProofUpgrade", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ProofUpgradeClient", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@ -1722,12 +1700,46 @@ func (m *MsgUpgradeClient) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ProofUpgrade = append(m.ProofUpgrade[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.ProofUpgrade == nil {
|
||||
m.ProofUpgrade = []byte{}
|
||||
m.ProofUpgradeClient = append(m.ProofUpgradeClient[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.ProofUpgradeClient == nil {
|
||||
m.ProofUpgradeClient = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 5:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ProofUpgradeConsensusState", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ProofUpgradeConsensusState = append(m.ProofUpgradeConsensusState[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.ProofUpgradeConsensusState == nil {
|
||||
m.ProofUpgradeConsensusState = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 6:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ func GetCmdQueryConnection() *cobra.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
clientCtx = clientCtx.WithHeight(int64(connRes.ProofHeight.VersionHeight))
|
||||
clientCtx = clientCtx.WithHeight(int64(connRes.ProofHeight.RevisionHeight))
|
||||
return clientCtx.PrintOutput(connRes)
|
||||
},
|
||||
}
|
||||
@ -113,7 +113,7 @@ func GetCmdQueryClientConnections() *cobra.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
clientCtx = clientCtx.WithHeight(int64(connPathsRes.ProofHeight.VersionHeight))
|
||||
clientCtx = clientCtx.WithHeight(int64(connPathsRes.ProofHeight.RevisionHeight))
|
||||
return clientCtx.PrintOutput(connPathsRes)
|
||||
},
|
||||
}
|
||||
|
||||
@ -22,23 +22,22 @@ import (
|
||||
const (
|
||||
flagVersionIdentifier = "version-identifier"
|
||||
flagVersionFeatures = "version-features"
|
||||
flagProvedID = "proved-id"
|
||||
)
|
||||
|
||||
// NewConnectionOpenInitCmd defines the command to initialize a connection on
|
||||
// chain A with a given counterparty chain B
|
||||
func NewConnectionOpenInitCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "open-init [connection-id] [client-id] [counterparty-connection-id] [counterparty-client-id] [path/to/counterparty_prefix.json]",
|
||||
Use: "open-init [client-id] [counterparty-client-id] [path/to/counterparty_prefix.json]",
|
||||
Short: "Initialize connection on chain A",
|
||||
Long: `Initialize a connection on chain A with a given counterparty chain B.
|
||||
- 'version-identifier' flag can be a single pre-selected version identifier to be used in the handshake.
|
||||
- 'version-features' flag can be a list of features separated by commas to accompany the version identifier.`,
|
||||
Example: fmt.Sprintf(
|
||||
"%s tx %s %s open-init [connection-id] [client-id] [counterparty-connection-id] [counterparty-client-id] [path/to/counterparty_prefix.json] --version-identifier=\"1.0\" --version-features=\"ORDER_UNORDERED\"",
|
||||
"%s tx %s %s open-init [client-id] [counterparty-client-id] [path/to/counterparty_prefix.json] --version-identifier=\"1.0\" --version-features=\"ORDER_UNORDERED\"",
|
||||
version.AppName, host.ModuleName, types.SubModuleName,
|
||||
),
|
||||
Args: cobra.ExactArgs(5),
|
||||
Args: cobra.ExactArgs(3),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx := client.GetClientContextFromCmd(cmd)
|
||||
clientCtx, err := client.ReadTxCommandFlags(clientCtx, cmd.Flags())
|
||||
@ -46,12 +45,10 @@ func NewConnectionOpenInitCmd() *cobra.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
connectionID := args[0]
|
||||
clientID := args[1]
|
||||
counterpartyConnectionID := args[2]
|
||||
counterpartyClientID := args[3]
|
||||
clientID := args[0]
|
||||
counterpartyClientID := args[1]
|
||||
|
||||
counterpartyPrefix, err := utils.ParsePrefix(clientCtx.LegacyAmino, args[4])
|
||||
counterpartyPrefix, err := utils.ParsePrefix(clientCtx.LegacyAmino, args[2])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -71,7 +68,7 @@ func NewConnectionOpenInitCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
msg := types.NewMsgConnectionOpenInit(
|
||||
connectionID, clientID, counterpartyConnectionID, counterpartyClientID,
|
||||
clientID, counterpartyClientID,
|
||||
counterpartyPrefix, version, clientCtx.GetFromAddress(),
|
||||
)
|
||||
|
||||
@ -116,7 +113,6 @@ func NewConnectionOpenTryCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
connectionID := args[0]
|
||||
provedID, _ := cmd.Flags().GetString(flagProvedID)
|
||||
clientID := args[1]
|
||||
counterpartyConnectionID := args[2]
|
||||
counterpartyClientID := args[3]
|
||||
@ -179,7 +175,7 @@ func NewConnectionOpenTryCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
msg := types.NewMsgConnectionOpenTry(
|
||||
connectionID, provedID, clientID, counterpartyConnectionID, counterpartyClientID,
|
||||
connectionID, clientID, counterpartyConnectionID, counterpartyClientID,
|
||||
counterpartyClient, counterpartyPrefix, counterpartyVersions,
|
||||
proofInit, proofClient, proofConsensus, proofHeight,
|
||||
consensusHeight, clientCtx.GetFromAddress(),
|
||||
@ -193,7 +189,6 @@ func NewConnectionOpenTryCmd() *cobra.Command {
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().String(flagProvedID, "", "identifier set by the counterparty chain")
|
||||
flags.AddTxFlagsToCmd(cmd)
|
||||
|
||||
return cmd
|
||||
|
||||
@ -143,9 +143,9 @@ func QueryConnectionConsensusState(
|
||||
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
req := &types.QueryConnectionConsensusStateRequest{
|
||||
ConnectionId: connectionID,
|
||||
VersionNumber: height.VersionNumber,
|
||||
VersionHeight: height.VersionHeight,
|
||||
ConnectionId: connectionID,
|
||||
RevisionNumber: height.RevisionNumber,
|
||||
RevisionHeight: height.RevisionHeight,
|
||||
}
|
||||
|
||||
res, err := queryClient.ConnectionConsensusState(context.Background(), req)
|
||||
|
||||
@ -16,6 +16,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) {
|
||||
for _, connPaths := range gs.ClientConnectionPaths {
|
||||
k.SetClientConnectionPaths(ctx, connPaths.ClientId, connPaths.Paths)
|
||||
}
|
||||
k.SetNextConnectionSequence(ctx, gs.NextConnectionSequence)
|
||||
}
|
||||
|
||||
// ExportGenesis returns the ibc connection submodule's exported genesis.
|
||||
|
||||
@ -160,7 +160,7 @@ func (q Keeper) ConnectionConsensusState(c context.Context, req *types.QueryConn
|
||||
)
|
||||
}
|
||||
|
||||
height := clienttypes.NewHeight(req.VersionNumber, req.VersionHeight)
|
||||
height := clienttypes.NewHeight(req.RevisionNumber, req.RevisionHeight)
|
||||
consensusState, found := q.clientKeeper.GetClientConsensusState(ctx, connection.ClientId, height)
|
||||
if !found {
|
||||
return nil, status.Error(
|
||||
|
||||
@ -112,18 +112,18 @@ func (suite *KeeperTestSuite) TestQueryConnections() {
|
||||
"success",
|
||||
func() {
|
||||
clientA, clientB, connA0, connB0 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA1, connB1, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
clientA1, clientB1, connA1, connB1 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA2, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
clientA1, clientB1, connA2, connB2 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
counterparty1 := types.NewCounterparty(clientB, connB0.ID, suite.chainB.GetPrefix())
|
||||
counterparty2 := types.NewCounterparty(clientB, connB1.ID, suite.chainB.GetPrefix())
|
||||
counterparty3 := types.NewCounterparty(clientB1, connB2.ID, suite.chainB.GetPrefix())
|
||||
counterparty2 := types.NewCounterparty(clientB1, connB1.ID, suite.chainB.GetPrefix())
|
||||
// counterparty connection id is blank after open init
|
||||
counterparty3 := types.NewCounterparty(clientB, "", suite.chainB.GetPrefix())
|
||||
|
||||
conn1 := types.NewConnectionEnd(types.OPEN, clientA, counterparty1, types.ExportedVersionsToProto(types.GetCompatibleVersions()))
|
||||
conn2 := types.NewConnectionEnd(types.INIT, clientA, counterparty2, types.ExportedVersionsToProto(types.GetCompatibleVersions()))
|
||||
conn3 := types.NewConnectionEnd(types.OPEN, clientA1, counterparty3, types.ExportedVersionsToProto(types.GetCompatibleVersions()))
|
||||
conn2 := types.NewConnectionEnd(types.OPEN, clientA1, counterparty2, types.ExportedVersionsToProto(types.GetCompatibleVersions()))
|
||||
conn3 := types.NewConnectionEnd(types.INIT, clientA, counterparty3, types.ExportedVersionsToProto(types.GetCompatibleVersions()))
|
||||
|
||||
iconn1 := types.NewIdentifiedConnection(connA0.ID, conn1)
|
||||
iconn2 := types.NewIdentifiedConnection(connA1.ID, conn2)
|
||||
@ -339,8 +339,8 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
|
||||
func() {
|
||||
req = &types.QueryConnectionConsensusStateRequest{
|
||||
ConnectionId: "",
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 1,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 1,
|
||||
}
|
||||
},
|
||||
false,
|
||||
@ -350,8 +350,8 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
|
||||
func() {
|
||||
req = &types.QueryConnectionConsensusStateRequest{
|
||||
ConnectionId: "test-connection-id",
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 1,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 1,
|
||||
}
|
||||
},
|
||||
false,
|
||||
@ -363,8 +363,8 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
|
||||
|
||||
req = &types.QueryConnectionConsensusStateRequest{
|
||||
ConnectionId: connA.ID,
|
||||
VersionNumber: 0,
|
||||
VersionHeight: uint64(suite.chainA.GetContext().BlockHeight()), // use current height
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: uint64(suite.chainA.GetContext().BlockHeight()), // use current height
|
||||
}
|
||||
}, false,
|
||||
},
|
||||
@ -380,8 +380,8 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
|
||||
|
||||
req = &types.QueryConnectionConsensusStateRequest{
|
||||
ConnectionId: connA.ID,
|
||||
VersionNumber: clientState.GetLatestHeight().GetVersionNumber(),
|
||||
VersionHeight: clientState.GetLatestHeight().GetVersionHeight(),
|
||||
RevisionNumber: clientState.GetLatestHeight().GetRevisionNumber(),
|
||||
RevisionHeight: clientState.GetLatestHeight().GetRevisionHeight(),
|
||||
}
|
||||
},
|
||||
true,
|
||||
|
||||
@ -14,36 +14,33 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
)
|
||||
|
||||
// ConnOpenInit initialises a connection attempt on chain A.
|
||||
// ConnOpenInit initialises a connection attempt on chain A. The generated connection identifier
|
||||
// is returned.
|
||||
//
|
||||
// NOTE: Identifiers are checked on msg validation.
|
||||
// NOTE: Msg validation verifies the supplied identifiers and ensures that the counterparty
|
||||
// connection identifier is empty.
|
||||
func (k Keeper) ConnOpenInit(
|
||||
ctx sdk.Context,
|
||||
connectionID, // identifier
|
||||
clientID string,
|
||||
counterparty types.Counterparty, // desiredCounterpartyConnectionIdentifier, counterpartyPrefix, counterpartyClientIdentifier
|
||||
counterparty types.Counterparty, // counterpartyPrefix, counterpartyClientIdentifier
|
||||
version *types.Version,
|
||||
) error {
|
||||
_, found := k.GetConnection(ctx, connectionID)
|
||||
if found {
|
||||
return sdkerrors.Wrap(types.ErrConnectionExists, connectionID)
|
||||
}
|
||||
|
||||
) (string, error) {
|
||||
versions := types.GetCompatibleVersions()
|
||||
if version != nil {
|
||||
if !types.IsSupportedVersion(version) {
|
||||
return sdkerrors.Wrap(types.ErrInvalidVersion, "version is not supported")
|
||||
return "", sdkerrors.Wrap(types.ErrInvalidVersion, "version is not supported")
|
||||
}
|
||||
|
||||
versions = []exported.Version{version}
|
||||
}
|
||||
|
||||
// connection defines chain A's ConnectionEnd
|
||||
connectionID := k.GenerateConnectionIdentifier(ctx)
|
||||
connection := types.NewConnectionEnd(types.INIT, clientID, counterparty, types.ExportedVersionsToProto(versions))
|
||||
k.SetConnection(ctx, connectionID, connection)
|
||||
|
||||
if err := k.addConnectionToClient(ctx, clientID, connectionID); err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
|
||||
k.Logger(ctx).Info("connection state updated", "connection-id", connectionID, "previous-state", "NONE", "new-state", "INIT")
|
||||
@ -52,7 +49,7 @@ func (k Keeper) ConnOpenInit(
|
||||
telemetry.IncrCounter(1, "ibc", "connection", "open-init")
|
||||
}()
|
||||
|
||||
return nil
|
||||
return connectionID, nil
|
||||
}
|
||||
|
||||
// ConnOpenTry relays notice of a connection attempt on chain A to chain B (this
|
||||
@ -63,8 +60,7 @@ func (k Keeper) ConnOpenInit(
|
||||
// - Identifiers are checked on msg validation
|
||||
func (k Keeper) ConnOpenTry(
|
||||
ctx sdk.Context,
|
||||
desiredConnectionID, // desiredIdentifier
|
||||
counterpartyChosenConnectionID string, // counterparty used this identifier in proof
|
||||
previousConnectionID string, // previousIdentifier
|
||||
counterparty types.Counterparty, // counterpartyConnectionIdentifier, counterpartyPrefix and counterpartyClientIdentifier
|
||||
clientID string, // clientID of chainA
|
||||
clientState exported.ClientState, // clientState that chainA has for chainB
|
||||
@ -74,10 +70,47 @@ func (k Keeper) ConnOpenTry(
|
||||
proofConsensus []byte, // proof that chainA stored chainB's consensus state at consensus height
|
||||
proofHeight exported.Height, // height at which relayer constructs proof of A storing connectionEnd in state
|
||||
consensusHeight exported.Height, // latest height of chain B which chain A has stored in its chain B client
|
||||
) error {
|
||||
) (string, error) {
|
||||
var (
|
||||
connectionID string
|
||||
previousConnection types.ConnectionEnd
|
||||
found bool
|
||||
)
|
||||
|
||||
// empty connection identifier indicates continuing a previous connection handshake
|
||||
if previousConnectionID != "" {
|
||||
// ensure that the previous connection exists
|
||||
previousConnection, found = k.GetConnection(ctx, previousConnectionID)
|
||||
if !found {
|
||||
return "", sdkerrors.Wrapf(types.ErrConnectionNotFound, "previous connection does not exist for supplied previous connectionID %s", previousConnectionID)
|
||||
}
|
||||
|
||||
// ensure that the existing connection's
|
||||
// counterparty is chainA and connection is on INIT stage.
|
||||
// Check that existing connection versions for initialized connection is equal to compatible
|
||||
// versions for this chain.
|
||||
if !(previousConnection.Counterparty.ConnectionId == "" &&
|
||||
bytes.Equal(previousConnection.Counterparty.Prefix.Bytes(), counterparty.Prefix.Bytes()) &&
|
||||
previousConnection.ClientId == clientID &&
|
||||
previousConnection.Counterparty.ClientId == counterparty.ClientId) {
|
||||
return "", sdkerrors.Wrap(types.ErrInvalidConnection, "connection fields mismatch previous connection fields")
|
||||
}
|
||||
|
||||
if !(previousConnection.State == types.INIT) {
|
||||
return "", sdkerrors.Wrapf(types.ErrInvalidConnectionState, "previous connection state is in state %s, expected INIT", previousConnection.State)
|
||||
}
|
||||
|
||||
// continue with previous connection
|
||||
connectionID = previousConnectionID
|
||||
|
||||
} else {
|
||||
// generate a new connection
|
||||
connectionID = k.GenerateConnectionIdentifier(ctx)
|
||||
}
|
||||
|
||||
selfHeight := clienttypes.GetSelfHeight(ctx)
|
||||
if consensusHeight.GTE(selfHeight) {
|
||||
return sdkerrors.Wrapf(
|
||||
return "", sdkerrors.Wrapf(
|
||||
sdkerrors.ErrInvalidHeight,
|
||||
"consensus height is greater than or equal to the current block height (%s >= %s)", consensusHeight, selfHeight,
|
||||
)
|
||||
@ -85,43 +118,20 @@ func (k Keeper) ConnOpenTry(
|
||||
|
||||
// validate client parameters of a chainB client stored on chainA
|
||||
if err := k.clientKeeper.ValidateSelfClient(ctx, clientState); err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
|
||||
expectedConsensusState, found := k.clientKeeper.GetSelfConsensusState(ctx, consensusHeight)
|
||||
if !found {
|
||||
return sdkerrors.Wrap(clienttypes.ErrSelfConsensusStateNotFound, consensusHeight.String())
|
||||
}
|
||||
|
||||
// If the connection id chosen for this connection end by the counterparty is empty then
|
||||
// flexible connection identifier selection is allowed by using the desired connection id.
|
||||
// Otherwise the desiredConnectionID must match the counterpartyChosenConnectionID.
|
||||
if counterpartyChosenConnectionID != "" && counterpartyChosenConnectionID != desiredConnectionID {
|
||||
return sdkerrors.Wrapf(
|
||||
types.ErrInvalidConnectionIdentifier,
|
||||
"counterparty chosen connection ID (%s) must be empty or equal to the desired connection ID (%s)", counterpartyChosenConnectionID, desiredConnectionID,
|
||||
)
|
||||
return "", sdkerrors.Wrap(clienttypes.ErrSelfConsensusStateNotFound, consensusHeight.String())
|
||||
}
|
||||
|
||||
// expectedConnection defines Chain A's ConnectionEnd
|
||||
// NOTE: chain A's counterparty is chain B (i.e where this code is executed)
|
||||
prefix := k.GetCommitmentPrefix()
|
||||
expectedCounterparty := types.NewCounterparty(clientID, counterpartyChosenConnectionID, commitmenttypes.NewMerklePrefix(prefix.Bytes()))
|
||||
expectedCounterparty := types.NewCounterparty(clientID, "", commitmenttypes.NewMerklePrefix(prefix.Bytes()))
|
||||
expectedConnection := types.NewConnectionEnd(types.INIT, counterparty.ClientId, expectedCounterparty, types.ExportedVersionsToProto(counterpartyVersions))
|
||||
|
||||
// If connection already exists for desiredConnectionID, ensure that the existing connection's
|
||||
// counterparty is chainA and connection is on INIT stage.
|
||||
// Check that existing connection versions for initialized connection is equal to compatible
|
||||
// versions for this chain.
|
||||
previousConnection, found := k.GetConnection(ctx, desiredConnectionID)
|
||||
if found && !(previousConnection.State == types.INIT &&
|
||||
previousConnection.Counterparty.ConnectionId == counterparty.ConnectionId &&
|
||||
bytes.Equal(previousConnection.Counterparty.Prefix.Bytes(), counterparty.Prefix.Bytes()) &&
|
||||
previousConnection.ClientId == clientID &&
|
||||
previousConnection.Counterparty.ClientId == counterparty.ClientId) {
|
||||
return sdkerrors.Wrap(types.ErrInvalidConnection, "cannot relay connection attempt")
|
||||
}
|
||||
|
||||
supportedVersions := types.GetCompatibleVersions()
|
||||
if len(previousConnection.Versions) != 0 {
|
||||
supportedVersions = previousConnection.GetVersions()
|
||||
@ -132,7 +142,7 @@ func (k Keeper) ConnOpenTry(
|
||||
// of the supported versions and the counterparty versions.
|
||||
version, err := types.PickVersion(supportedVersions, counterpartyVersions)
|
||||
if err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
|
||||
// connection defines chain B's ConnectionEnd
|
||||
@ -143,34 +153,34 @@ func (k Keeper) ConnOpenTry(
|
||||
ctx, connection, proofHeight, proofInit, counterparty.ConnectionId,
|
||||
expectedConnection,
|
||||
); err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Check that ChainA stored the clientState provided in the msg
|
||||
if err := k.VerifyClientState(ctx, connection, proofHeight, proofClient, clientState); err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Check that ChainA stored the correct ConsensusState of chainB at the given consensusHeight
|
||||
if err := k.VerifyClientConsensusState(
|
||||
ctx, connection, proofHeight, consensusHeight, proofConsensus, expectedConsensusState,
|
||||
); err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
|
||||
// store connection in chainB state
|
||||
if err := k.addConnectionToClient(ctx, clientID, desiredConnectionID); err != nil {
|
||||
return sdkerrors.Wrapf(err, "failed to add connection with ID %s to client with ID %s", desiredConnectionID, clientID)
|
||||
if err := k.addConnectionToClient(ctx, clientID, connectionID); err != nil {
|
||||
return "", sdkerrors.Wrapf(err, "failed to add connection with ID %s to client with ID %s", connectionID, clientID)
|
||||
}
|
||||
|
||||
k.SetConnection(ctx, desiredConnectionID, connection)
|
||||
k.Logger(ctx).Info("connection state updated", "connection-id", desiredConnectionID, "previous-state", previousConnection.State.String(), "new-state", "TRYOPEN")
|
||||
k.SetConnection(ctx, connectionID, connection)
|
||||
k.Logger(ctx).Info("connection state updated", "connection-id", connectionID, "previous-state", previousConnection.State.String(), "new-state", "TRYOPEN")
|
||||
|
||||
defer func() {
|
||||
telemetry.IncrCounter(1, "ibc", "connection", "open-try")
|
||||
}()
|
||||
|
||||
return nil
|
||||
return connectionID, nil
|
||||
}
|
||||
|
||||
// ConnOpenAck relays acceptance of a connection open attempt from chain B back
|
||||
@ -204,16 +214,6 @@ func (k Keeper) ConnOpenAck(
|
||||
return sdkerrors.Wrap(types.ErrConnectionNotFound, connectionID)
|
||||
}
|
||||
|
||||
// If the previously set connection end allowed for the counterparty to select its own
|
||||
// connection identifier then we use the counterpartyConnectionID. Otherwise the
|
||||
// counterpartyConnectionID must match the previously set counterparty connection ID.
|
||||
if connection.Counterparty.ConnectionId != "" && counterpartyConnectionID != connection.Counterparty.ConnectionId {
|
||||
return sdkerrors.Wrapf(
|
||||
types.ErrInvalidConnectionIdentifier,
|
||||
"counterparty connection identifier (%s) must be equal to stored connection ID for counterparty (%s)", counterpartyConnectionID, connection.Counterparty.ConnectionId,
|
||||
)
|
||||
}
|
||||
|
||||
// Verify the provided version against the previously set connection state
|
||||
switch {
|
||||
// connection on ChainA must be in INIT or TRYOPEN
|
||||
|
||||
@ -36,9 +36,6 @@ func (suite *KeeperTestSuite) TestConnOpenInit() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
version = types.ExportedVersionsToProto(types.GetCompatibleVersions())[0]
|
||||
}, true},
|
||||
{"connection already exists", func() {
|
||||
clientA, clientB, _, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
}, false},
|
||||
{"invalid version", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
version = &types.Version{}
|
||||
@ -58,19 +55,20 @@ func (suite *KeeperTestSuite) TestConnOpenInit() {
|
||||
|
||||
tc.malleate()
|
||||
|
||||
connA := suite.chainA.GetFirstTestConnection(clientA, clientB)
|
||||
connB := suite.chainB.GetFirstTestConnection(clientB, clientA)
|
||||
if emptyConnBID {
|
||||
connB.ID = ""
|
||||
}
|
||||
counterparty := types.NewCounterparty(clientB, connB.ID, suite.chainB.GetPrefix())
|
||||
|
||||
err := suite.chainA.App.IBCKeeper.ConnectionKeeper.ConnOpenInit(suite.chainA.GetContext(), connA.ID, clientA, counterparty, version)
|
||||
connectionID, err := suite.chainA.App.IBCKeeper.ConnectionKeeper.ConnOpenInit(suite.chainA.GetContext(), clientA, counterparty, version)
|
||||
|
||||
if tc.expPass {
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().Equal(types.FormatConnectionIdentifier(0), connectionID)
|
||||
} else {
|
||||
suite.Require().Error(err)
|
||||
suite.Require().Equal("", connectionID)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -80,11 +78,12 @@ func (suite *KeeperTestSuite) TestConnOpenInit() {
|
||||
// connection on chainA is INIT
|
||||
func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
var (
|
||||
clientA string
|
||||
clientB string
|
||||
versions []exported.Version
|
||||
consensusHeight exported.Height
|
||||
counterpartyClient exported.ClientState
|
||||
clientA string
|
||||
clientB string
|
||||
previousConnectionID string
|
||||
versions []exported.Version
|
||||
consensusHeight exported.Height
|
||||
counterpartyClient exported.ClientState
|
||||
)
|
||||
|
||||
testCases := []struct {
|
||||
@ -100,50 +99,16 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
// retrieve client state of chainA to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||
}, true},
|
||||
{"success with empty counterpartyChosenConnectionID", func() {
|
||||
{"success with crossing hellos", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// modify connA to set counterparty connection identifier to empty string
|
||||
connection, found := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetConnection(suite.chainA.GetContext(), connA.ID)
|
||||
suite.Require().True(found)
|
||||
|
||||
connection.Counterparty.ConnectionId = ""
|
||||
|
||||
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connA.ID, connection)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
_, connB, err := suite.coordinator.ConnOpenInitOnBothChains(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// retrieve client state of chainA to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||
|
||||
previousConnectionID = connB.ID
|
||||
}, true},
|
||||
{"counterpartyChosenConnectionID does not match desiredConnectionID", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// modify connA to set counterparty connection identifier to invalid identifier
|
||||
connection, found := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetConnection(suite.chainA.GetContext(), connA.ID)
|
||||
suite.Require().True(found)
|
||||
|
||||
connection.Counterparty.ConnectionId = "badidentifier"
|
||||
|
||||
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connA.ID, connection)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// retrieve client state of chainA to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||
}, false},
|
||||
{"invalid counterparty client", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
@ -255,6 +220,8 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
|
||||
// retrieve client state of chainA to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||
|
||||
previousConnectionID = connB.ID
|
||||
}, false},
|
||||
{"invalid previous connection has invalid versions", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
@ -281,6 +248,8 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
|
||||
// retrieve client state of chainA to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||
|
||||
previousConnectionID = connB.ID
|
||||
}, false},
|
||||
}
|
||||
|
||||
@ -291,20 +260,13 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
suite.SetupTest() // reset
|
||||
consensusHeight = clienttypes.ZeroHeight() // must be explicitly changed in malleate
|
||||
versions = types.GetCompatibleVersions() // must be explicitly changed in malleate
|
||||
previousConnectionID = ""
|
||||
|
||||
tc.malleate()
|
||||
|
||||
connA := suite.chainA.GetFirstTestConnection(clientA, clientB)
|
||||
connB := suite.chainB.GetFirstTestConnection(clientB, clientA)
|
||||
counterparty := types.NewCounterparty(clientA, connA.ID, suite.chainA.GetPrefix())
|
||||
|
||||
// get counterpartyChosenConnectionID
|
||||
var counterpartyChosenConnectionID string
|
||||
connection, found := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetConnection(suite.chainA.GetContext(), connA.ID)
|
||||
if found {
|
||||
counterpartyChosenConnectionID = connection.Counterparty.ConnectionId
|
||||
}
|
||||
|
||||
connectionKey := host.ConnectionKey(connA.ID)
|
||||
proofInit, proofHeight := suite.chainA.QueryProof(connectionKey)
|
||||
|
||||
@ -319,16 +281,18 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
clientKey := host.FullClientStateKey(clientA)
|
||||
proofClient, _ := suite.chainA.QueryProof(clientKey)
|
||||
|
||||
err := suite.chainB.App.IBCKeeper.ConnectionKeeper.ConnOpenTry(
|
||||
suite.chainB.GetContext(), connB.ID, counterpartyChosenConnectionID, counterparty, clientB, counterpartyClient,
|
||||
connectionID, err := suite.chainB.App.IBCKeeper.ConnectionKeeper.ConnOpenTry(
|
||||
suite.chainB.GetContext(), previousConnectionID, counterparty, clientB, counterpartyClient,
|
||||
versions, proofInit, proofClient, proofConsensus,
|
||||
proofHeight, consensusHeight,
|
||||
)
|
||||
|
||||
if tc.expPass {
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().Equal(types.FormatConnectionIdentifier(0), connectionID)
|
||||
} else {
|
||||
suite.Require().Error(err)
|
||||
suite.Require().Equal("", connectionID)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -338,12 +302,11 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
// the initialization (TRYINIT) of the connection on Chain B (ID #2).
|
||||
func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
var (
|
||||
clientA string
|
||||
clientB string
|
||||
counterpartyConnectionID string
|
||||
consensusHeight exported.Height
|
||||
version *types.Version
|
||||
counterpartyClient exported.ClientState
|
||||
clientA string
|
||||
clientB string
|
||||
consensusHeight exported.Height
|
||||
version *types.Version
|
||||
counterpartyClient exported.ClientState
|
||||
)
|
||||
|
||||
testCases := []struct {
|
||||
@ -362,33 +325,6 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
// retrieve client state of chainB to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||
}, true},
|
||||
{"success with empty stored counterparty connection ID", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.ConnOpenTry(suite.chainB, suite.chainA, connB, connA)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// modify connA to set counterparty connection identifier to empty string
|
||||
connection, found := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetConnection(suite.chainA.GetContext(), connA.ID)
|
||||
suite.Require().True(found)
|
||||
|
||||
connection.Counterparty.ConnectionId = ""
|
||||
// use some other identifier
|
||||
counterpartyConnectionID = connB.ID
|
||||
|
||||
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connA.ID, connection)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// retrieve client state of chainB to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||
}, true},
|
||||
{"success from tryopen", func() {
|
||||
// chainA is in TRYOPEN, chainB is in TRYOPEN
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
@ -401,6 +337,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
// set chainB to TRYOPEN
|
||||
connection := suite.chainB.GetConnection(connB)
|
||||
connection.State = types.TRYOPEN
|
||||
connection.Counterparty.ConnectionId = connA.ID
|
||||
suite.chainB.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainB.GetContext(), connB.ID, connection)
|
||||
// update clientB so state change is committed
|
||||
suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
@ -410,37 +347,6 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
// retrieve client state of chainB to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||
}, true},
|
||||
{"success from tryopen with empty stored connection id", func() {
|
||||
// chainA is in TRYOPEN, chainB is in TRYOPEN
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connB, connA, err := suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.ConnOpenTry(suite.chainA, suite.chainB, connA, connB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// set chainB to TRYOPEN
|
||||
connection := suite.chainB.GetConnection(connB)
|
||||
connection.State = types.TRYOPEN
|
||||
|
||||
suite.chainB.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainB.GetContext(), connB.ID, connection)
|
||||
|
||||
// set connA to use empty string
|
||||
connection = suite.chainA.GetConnection(connA)
|
||||
|
||||
// set counterparty connection identifier to empty string
|
||||
connection.Counterparty.ConnectionId = ""
|
||||
|
||||
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connA.ID, connection)
|
||||
|
||||
// update clientB so state change is committed
|
||||
suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
// retrieve client state of chainB to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||
}, true},
|
||||
{"invalid counterparty client", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
@ -663,17 +569,12 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
suite.SetupTest() // reset
|
||||
version = types.ExportedVersionsToProto(types.GetCompatibleVersions())[0] // must be explicitly changed in malleate
|
||||
consensusHeight = clienttypes.ZeroHeight() // must be explicitly changed in malleate
|
||||
counterpartyConnectionID = "" // must be explicitly changed in malleate
|
||||
|
||||
tc.malleate()
|
||||
|
||||
connA := suite.chainA.GetFirstTestConnection(clientA, clientB)
|
||||
connB := suite.chainB.GetFirstTestConnection(clientB, clientA)
|
||||
|
||||
if counterpartyConnectionID == "" {
|
||||
counterpartyConnectionID = connB.ID
|
||||
}
|
||||
|
||||
connectionKey := host.ConnectionKey(connB.ID)
|
||||
proofTry, proofHeight := suite.chainB.QueryProof(connectionKey)
|
||||
|
||||
@ -690,7 +591,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
proofClient, _ := suite.chainB.QueryProof(clientKey)
|
||||
|
||||
err := suite.chainA.App.IBCKeeper.ConnectionKeeper.ConnOpenAck(
|
||||
suite.chainA.GetContext(), connA.ID, counterpartyClient, version, counterpartyConnectionID,
|
||||
suite.chainA.GetContext(), connA.ID, counterpartyClient, version, connB.ID,
|
||||
proofTry, proofClient, proofConsensus, proofHeight, consensusHeight,
|
||||
)
|
||||
|
||||
|
||||
@ -45,6 +45,16 @@ func (k Keeper) GetCommitmentPrefix() exported.Prefix {
|
||||
return commitmenttypes.NewMerklePrefix([]byte(k.storeKey.Name()))
|
||||
}
|
||||
|
||||
// GenerateConnectionIdentifier returns the next connection identifier.
|
||||
func (k Keeper) GenerateConnectionIdentifier(ctx sdk.Context) string {
|
||||
nextConnSeq := k.GetNextConnectionSequence(ctx)
|
||||
connectionID := types.FormatConnectionIdentifier(nextConnSeq)
|
||||
|
||||
nextConnSeq++
|
||||
k.SetNextConnectionSequence(ctx, nextConnSeq)
|
||||
return connectionID
|
||||
}
|
||||
|
||||
// GetConnection returns a connection with a particular identifier
|
||||
func (k Keeper) GetConnection(ctx sdk.Context, connectionID string) (types.ConnectionEnd, bool) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
@ -105,6 +115,24 @@ func (k Keeper) SetClientConnectionPaths(ctx sdk.Context, clientID string, paths
|
||||
store.Set(host.ClientConnectionsKey(clientID), bz)
|
||||
}
|
||||
|
||||
// GetNextConnectionSequence gets the next connection sequence from the store.
|
||||
func (k Keeper) GetNextConnectionSequence(ctx sdk.Context) uint64 {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
bz := store.Get([]byte(types.KeyNextConnectionSequence))
|
||||
if bz == nil {
|
||||
panic("next connection sequence is nil")
|
||||
}
|
||||
|
||||
return sdk.BigEndianToUint64(bz)
|
||||
}
|
||||
|
||||
// SetNextConnectionSequence sets the next connection sequence to the store.
|
||||
func (k Keeper) SetNextConnectionSequence(ctx sdk.Context, sequence uint64) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
bz := sdk.Uint64ToBigEndian(sequence)
|
||||
store.Set([]byte(types.KeyNextConnectionSequence), bz)
|
||||
}
|
||||
|
||||
// GetAllClientConnectionPaths returns all stored clients connection id paths. It
|
||||
// will ignore the clients that haven't initialized a connection handshake since
|
||||
// no paths are stored.
|
||||
|
||||
@ -478,5 +478,5 @@ func (suite *KeeperTestSuite) TestVerifyNextSequenceRecv() {
|
||||
}
|
||||
|
||||
func malleateHeight(height exported.Height, diff uint64) exported.Height {
|
||||
return clienttypes.NewHeight(height.GetVersionNumber(), height.GetVersionHeight()+diff)
|
||||
return clienttypes.NewHeight(height.GetRevisionNumber(), height.GetRevisionHeight()+diff)
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ import (
|
||||
|
||||
var (
|
||||
chainID = "gaiamainnet"
|
||||
connectionID = "connectionidone"
|
||||
connectionID = "connection-0"
|
||||
clientID = "clientidone"
|
||||
connectionID2 = "connectionidtwo"
|
||||
clientID2 = "clientidtwo"
|
||||
|
||||
@ -17,18 +17,21 @@ func NewConnectionPaths(id string, paths []string) ConnectionPaths {
|
||||
// NewGenesisState creates a GenesisState instance.
|
||||
func NewGenesisState(
|
||||
connections []IdentifiedConnection, connPaths []ConnectionPaths,
|
||||
nextConnectionSequence uint64,
|
||||
) GenesisState {
|
||||
return GenesisState{
|
||||
Connections: connections,
|
||||
ClientConnectionPaths: connPaths,
|
||||
Connections: connections,
|
||||
ClientConnectionPaths: connPaths,
|
||||
NextConnectionSequence: nextConnectionSequence,
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultGenesisState returns the ibc connection submodule's default genesis state.
|
||||
func DefaultGenesisState() GenesisState {
|
||||
return GenesisState{
|
||||
Connections: []IdentifiedConnection{},
|
||||
ClientConnectionPaths: []ConnectionPaths{},
|
||||
Connections: []IdentifiedConnection{},
|
||||
ClientConnectionPaths: []ConnectionPaths{},
|
||||
NextConnectionSequence: 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +27,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
type GenesisState struct {
|
||||
Connections []IdentifiedConnection `protobuf:"bytes,1,rep,name=connections,proto3" json:"connections"`
|
||||
ClientConnectionPaths []ConnectionPaths `protobuf:"bytes,2,rep,name=client_connection_paths,json=clientConnectionPaths,proto3" json:"client_connection_paths" yaml:"client_connection_paths"`
|
||||
// the sequence for the next generated connection identifier
|
||||
NextConnectionSequence uint64 `protobuf:"varint,3,opt,name=next_connection_sequence,json=nextConnectionSequence,proto3" json:"next_connection_sequence,omitempty" yaml:"next_connection_sequence"`
|
||||
}
|
||||
|
||||
func (m *GenesisState) Reset() { *m = GenesisState{} }
|
||||
@ -76,6 +78,13 @@ func (m *GenesisState) GetClientConnectionPaths() []ConnectionPaths {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GenesisState) GetNextConnectionSequence() uint64 {
|
||||
if m != nil {
|
||||
return m.NextConnectionSequence
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*GenesisState)(nil), "ibc.core.connection.v1.GenesisState")
|
||||
}
|
||||
@ -85,25 +94,28 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_1879d34bc6ac3cd7 = []byte{
|
||||
// 281 bytes of a gzipped FileDescriptorProto
|
||||
// 326 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc9, 0x4c, 0x4a, 0xd6,
|
||||
0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xce, 0xcf, 0xcb, 0x4b, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3,
|
||||
0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9,
|
||||
0x17, 0x12, 0xcb, 0x4c, 0x4a, 0xd6, 0x03, 0xa9, 0xd2, 0x43, 0xa8, 0xd2, 0x2b, 0x33, 0x94, 0x12,
|
||||
0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd1, 0x07, 0xb1, 0x20, 0xaa, 0xa5, 0xd4, 0x71, 0x98, 0x89,
|
||||
0xa4, 0x17, 0xac, 0x50, 0xe9, 0x1d, 0x23, 0x17, 0x8f, 0x3b, 0xc4, 0xa2, 0xe0, 0x92, 0xc4, 0x92,
|
||||
0xa4, 0x17, 0xac, 0x50, 0xe9, 0x2c, 0x13, 0x17, 0x8f, 0x3b, 0xc4, 0xa2, 0xe0, 0x92, 0xc4, 0x92,
|
||||
0x54, 0xa1, 0x10, 0x2e, 0x6e, 0x84, 0xa2, 0x62, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x1d,
|
||||
0x3d, 0xec, 0xb6, 0xeb, 0x79, 0xa6, 0xa4, 0xe6, 0x95, 0x64, 0xa6, 0x65, 0xa6, 0xa6, 0x38, 0xc3,
|
||||
0xc5, 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x42, 0x36, 0x46, 0xa8, 0x9d, 0x91, 0x4b, 0x3c,
|
||||
0x39, 0x27, 0x33, 0x35, 0xaf, 0x24, 0x1e, 0x21, 0x1c, 0x5f, 0x90, 0x58, 0x92, 0x51, 0x2c, 0xc1,
|
||||
0x04, 0xb6, 0x42, 0x1d, 0x97, 0x15, 0x08, 0x83, 0x03, 0x40, 0xca, 0x9d, 0xd4, 0x40, 0xa6, 0x7f,
|
||||
0xba, 0x27, 0x2f, 0x57, 0x99, 0x98, 0x9b, 0x63, 0xa5, 0x84, 0xc3, 0x54, 0xa5, 0x20, 0x51, 0x88,
|
||||
0x0c, 0xba, 0xf6, 0xd0, 0x13, 0x8f, 0xe4, 0x18,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, 0x50, 0x4a, 0xb7,
|
||||
0x38, 0x25, 0x5b, 0xbf, 0x42, 0x1f, 0x1e, 0x63, 0x06, 0xc6, 0xba, 0x48, 0x91, 0x56, 0x52, 0x59,
|
||||
0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x8e, 0x2d, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0xad,
|
||||
0x14, 0x09, 0x2c, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
||||
@ -126,6 +138,11 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.NextConnectionSequence != 0 {
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(m.NextConnectionSequence))
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
if len(m.ClientConnectionPaths) > 0 {
|
||||
for iNdEx := len(m.ClientConnectionPaths) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
@ -186,6 +203,9 @@ func (m *GenesisState) Size() (n int) {
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.NextConnectionSequence != 0 {
|
||||
n += 1 + sovGenesis(uint64(m.NextConnectionSequence))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
@ -292,6 +312,25 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field NextConnectionSequence", wireType)
|
||||
}
|
||||
m.NextConnectionSequence = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.NextConnectionSequence |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenesis(dAtA[iNdEx:])
|
||||
|
||||
@ -31,6 +31,7 @@ func TestValidateGenesis(t *testing.T) {
|
||||
[]types.ConnectionPaths{
|
||||
{clientID, []string{connectionID}},
|
||||
},
|
||||
0,
|
||||
),
|
||||
expPass: true,
|
||||
},
|
||||
@ -43,6 +44,7 @@ func TestValidateGenesis(t *testing.T) {
|
||||
[]types.ConnectionPaths{
|
||||
{clientID, []string{connectionID}},
|
||||
},
|
||||
0,
|
||||
),
|
||||
expPass: false,
|
||||
},
|
||||
@ -55,6 +57,7 @@ func TestValidateGenesis(t *testing.T) {
|
||||
[]types.ConnectionPaths{
|
||||
{"(CLIENTIDONE)", []string{connectionID}},
|
||||
},
|
||||
0,
|
||||
),
|
||||
expPass: false,
|
||||
},
|
||||
@ -67,6 +70,7 @@ func TestValidateGenesis(t *testing.T) {
|
||||
[]types.ConnectionPaths{
|
||||
{clientID, []string{invalidConnectionID}},
|
||||
},
|
||||
0,
|
||||
),
|
||||
expPass: false,
|
||||
},
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
// SubModuleName defines the IBC connection name
|
||||
SubModuleName = "connection"
|
||||
@ -12,4 +20,40 @@ const (
|
||||
|
||||
// QuerierRoute is the querier route for IBC connections
|
||||
QuerierRoute = SubModuleName
|
||||
|
||||
// KeyNextConnectionSequence is the key used to store the next connection sequence in
|
||||
// the keeper.
|
||||
KeyNextConnectionSequence = "nextConnectionSequence"
|
||||
|
||||
// ConnectionPrefix is the prefix used when creating a connection identifier
|
||||
ConnectionPrefix = "connection-"
|
||||
)
|
||||
|
||||
// FormatConnectionIdentifier returns the connection identifier with the sequence appended.
|
||||
func FormatConnectionIdentifier(sequence uint64) string {
|
||||
return fmt.Sprintf("%s%d", ConnectionPrefix, sequence)
|
||||
}
|
||||
|
||||
// IsValidConnectionID return true if the connection identifier is valid.
|
||||
func IsValidConnectionID(connectionID string) bool {
|
||||
_, err := ParseConnectionSequence(connectionID)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// ParseConnectionSequence parses the connection sequence from the connection identifier.
|
||||
func ParseConnectionSequence(connectionID string) (uint64, error) {
|
||||
if !strings.HasPrefix(connectionID, ConnectionPrefix) {
|
||||
return 0, sdkerrors.Wrapf(ErrInvalidConnectionIdentifier, "doesn't contain prefix `%s`", ConnectionPrefix)
|
||||
}
|
||||
|
||||
splitStr := strings.Split(connectionID, ConnectionPrefix)
|
||||
if len(splitStr) != 2 {
|
||||
return 0, sdkerrors.Wrap(ErrInvalidConnectionIdentifier, "connection identifier must be in format: `connection-{N}`")
|
||||
}
|
||||
|
||||
sequence, err := strconv.ParseUint(splitStr[1], 10, 64)
|
||||
if err != nil {
|
||||
return 0, sdkerrors.Wrap(err, "failed to parse connection identifier sequence")
|
||||
}
|
||||
return sequence, nil
|
||||
}
|
||||
|
||||
44
x/ibc/core/03-connection/types/keys_test.go
Normal file
44
x/ibc/core/03-connection/types/keys_test.go
Normal file
@ -0,0 +1,44 @@
|
||||
package types_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/03-connection/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// tests ParseConnectionSequence and IsValidConnectionID
|
||||
func TestParseConnectionSequence(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
connectionID string
|
||||
expSeq uint64
|
||||
expPass bool
|
||||
}{
|
||||
{"valid 0", "connection-0", 0, true},
|
||||
{"valid 1", "connection-1", 1, true},
|
||||
{"valid large sequence", "connection-234568219356718293", 234568219356718293, true},
|
||||
// uint64 == 20 characters
|
||||
{"invalid large sequence", "connection-2345682193567182931243", 0, false},
|
||||
{"capital prefix", "Connection-0", 0, false},
|
||||
{"missing dash", "connection0", 0, false},
|
||||
{"blank id", " ", 0, false},
|
||||
{"empty id", "", 0, false},
|
||||
{"negative sequence", "connection--1", 0, false},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
seq, err := types.ParseConnectionSequence(tc.connectionID)
|
||||
valid := types.IsValidConnectionID(tc.connectionID)
|
||||
require.Equal(t, tc.expSeq, seq)
|
||||
|
||||
if tc.expPass {
|
||||
require.NoError(t, err, tc.name)
|
||||
require.True(t, valid)
|
||||
} else {
|
||||
require.Error(t, err, tc.name)
|
||||
require.False(t, valid)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,16 +12,16 @@ import (
|
||||
|
||||
var _ sdk.Msg = &MsgConnectionOpenInit{}
|
||||
|
||||
// NewMsgConnectionOpenInit creates a new MsgConnectionOpenInit instance
|
||||
// NewMsgConnectionOpenInit creates a new MsgConnectionOpenInit instance. It sets the
|
||||
// counterparty connection identifier to be empty.
|
||||
//nolint:interfacer
|
||||
func NewMsgConnectionOpenInit(
|
||||
connectionID, clientID, counterpartyConnectionID,
|
||||
counterpartyClientID string, counterpartyPrefix commitmenttypes.MerklePrefix,
|
||||
clientID, counterpartyClientID string,
|
||||
counterpartyPrefix commitmenttypes.MerklePrefix,
|
||||
version *Version, signer sdk.AccAddress,
|
||||
) *MsgConnectionOpenInit {
|
||||
counterparty := NewCounterparty(counterpartyClientID, counterpartyConnectionID, counterpartyPrefix)
|
||||
counterparty := NewCounterparty(counterpartyClientID, "", counterpartyPrefix)
|
||||
return &MsgConnectionOpenInit{
|
||||
ConnectionId: connectionID,
|
||||
ClientId: clientID,
|
||||
Counterparty: counterparty,
|
||||
Version: version,
|
||||
@ -41,12 +41,13 @@ func (msg MsgConnectionOpenInit) Type() string {
|
||||
|
||||
// ValidateBasic implements sdk.Msg.
|
||||
func (msg MsgConnectionOpenInit) ValidateBasic() error {
|
||||
if err := host.ConnectionIdentifierValidator(msg.ConnectionId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid connection ID")
|
||||
}
|
||||
if err := host.ClientIdentifierValidator(msg.ClientId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid client ID")
|
||||
}
|
||||
if msg.Counterparty.ConnectionId != "" {
|
||||
return sdkerrors.Wrap(ErrInvalidCounterparty, "counterparty connection identifier must be empty")
|
||||
}
|
||||
|
||||
// NOTE: Version can be nil on MsgConnectionOpenInit
|
||||
if msg.Version != nil {
|
||||
if err := ValidateVersion(msg.Version); err != nil {
|
||||
@ -80,7 +81,7 @@ var _ sdk.Msg = &MsgConnectionOpenTry{}
|
||||
// NewMsgConnectionOpenTry creates a new MsgConnectionOpenTry instance
|
||||
//nolint:interfacer
|
||||
func NewMsgConnectionOpenTry(
|
||||
desiredConnectionID, counterpartyChosenConnectionID, clientID, counterpartyConnectionID,
|
||||
previousConnectionID, clientID, counterpartyConnectionID,
|
||||
counterpartyClientID string, counterpartyClient exported.ClientState,
|
||||
counterpartyPrefix commitmenttypes.MerklePrefix, counterpartyVersions []*Version,
|
||||
proofInit, proofClient, proofConsensus []byte,
|
||||
@ -89,18 +90,17 @@ func NewMsgConnectionOpenTry(
|
||||
counterparty := NewCounterparty(counterpartyClientID, counterpartyConnectionID, counterpartyPrefix)
|
||||
csAny, _ := clienttypes.PackClientState(counterpartyClient)
|
||||
return &MsgConnectionOpenTry{
|
||||
DesiredConnectionId: desiredConnectionID,
|
||||
CounterpartyChosenConnectionId: counterpartyChosenConnectionID,
|
||||
ClientId: clientID,
|
||||
ClientState: csAny,
|
||||
Counterparty: counterparty,
|
||||
CounterpartyVersions: counterpartyVersions,
|
||||
ProofInit: proofInit,
|
||||
ProofClient: proofClient,
|
||||
ProofConsensus: proofConsensus,
|
||||
ProofHeight: proofHeight,
|
||||
ConsensusHeight: consensusHeight,
|
||||
Signer: signer.String(),
|
||||
PreviousConnectionId: previousConnectionID,
|
||||
ClientId: clientID,
|
||||
ClientState: csAny,
|
||||
Counterparty: counterparty,
|
||||
CounterpartyVersions: counterpartyVersions,
|
||||
ProofInit: proofInit,
|
||||
ProofClient: proofClient,
|
||||
ProofConsensus: proofConsensus,
|
||||
ProofHeight: proofHeight,
|
||||
ConsensusHeight: consensusHeight,
|
||||
Signer: signer.String(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,15 +116,19 @@ func (msg MsgConnectionOpenTry) Type() string {
|
||||
|
||||
// ValidateBasic implements sdk.Msg
|
||||
func (msg MsgConnectionOpenTry) ValidateBasic() error {
|
||||
if err := host.ConnectionIdentifierValidator(msg.DesiredConnectionId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid desired connection ID")
|
||||
}
|
||||
if msg.CounterpartyChosenConnectionId != "" && msg.CounterpartyChosenConnectionId != msg.DesiredConnectionId {
|
||||
return sdkerrors.Wrap(ErrInvalidConnectionIdentifier, "counterparty chosen connection identifier must be empty or equal to desired connection identifier")
|
||||
// an empty connection identifier indicates that a connection identifier should be generated
|
||||
if msg.PreviousConnectionId != "" {
|
||||
if !IsValidConnectionID(msg.PreviousConnectionId) {
|
||||
return sdkerrors.Wrap(ErrInvalidConnectionIdentifier, "invalid previous connection ID")
|
||||
}
|
||||
}
|
||||
if err := host.ClientIdentifierValidator(msg.ClientId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid client ID")
|
||||
}
|
||||
// counterparty validate basic allows empty counterparty connection identifiers
|
||||
if err := host.ConnectionIdentifierValidator(msg.Counterparty.ConnectionId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid counterparty connection ID")
|
||||
}
|
||||
if msg.ClientState == nil {
|
||||
return sdkerrors.Wrap(clienttypes.ErrInvalidClient, "counterparty client is nil")
|
||||
}
|
||||
@ -234,8 +238,8 @@ func (msg MsgConnectionOpenAck) Type() string {
|
||||
|
||||
// ValidateBasic implements sdk.Msg
|
||||
func (msg MsgConnectionOpenAck) ValidateBasic() error {
|
||||
if err := host.ConnectionIdentifierValidator(msg.ConnectionId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid connection ID")
|
||||
if !IsValidConnectionID(msg.ConnectionId) {
|
||||
return ErrInvalidConnectionIdentifier
|
||||
}
|
||||
if err := host.ConnectionIdentifierValidator(msg.CounterpartyConnectionId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid counterparty connection ID")
|
||||
@ -318,8 +322,8 @@ func (msg MsgConnectionOpenConfirm) Type() string {
|
||||
|
||||
// ValidateBasic implements sdk.Msg
|
||||
func (msg MsgConnectionOpenConfirm) ValidateBasic() error {
|
||||
if err := host.ConnectionIdentifierValidator(msg.ConnectionId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid connection ID")
|
||||
if !IsValidConnectionID(msg.ConnectionId) {
|
||||
return ErrInvalidConnectionIdentifier
|
||||
}
|
||||
if len(msg.ProofAck) == 0 {
|
||||
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof ack")
|
||||
|
||||
@ -87,14 +87,13 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenInit() {
|
||||
msg *types.MsgConnectionOpenInit
|
||||
expPass bool
|
||||
}{
|
||||
{"invalid connection ID", types.NewMsgConnectionOpenInit("test/conn1", "clienttotesta", "connectiontotest", "clienttotest", prefix, version, signer), false},
|
||||
{"invalid client ID", types.NewMsgConnectionOpenInit("ibcconntest", "test/iris", "connectiontotest", "clienttotest", prefix, version, signer), false},
|
||||
{"invalid counterparty client ID", types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "test/conn1", "clienttotest", prefix, version, signer), false},
|
||||
{"invalid counterparty connection ID", types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "test/conn1", prefix, version, signer), false},
|
||||
{"empty counterparty prefix", types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", emptyPrefix, version, signer), false},
|
||||
{"supplied version fails basic validation", types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", prefix, &types.Version{}, signer), false},
|
||||
{"empty singer", types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", prefix, version, nil), false},
|
||||
{"success", types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", prefix, version, signer), true},
|
||||
{"invalid client ID", types.NewMsgConnectionOpenInit("test/iris", "clienttotest", prefix, version, signer), false},
|
||||
{"invalid counterparty client ID", types.NewMsgConnectionOpenInit("clienttotest", "(clienttotest)", prefix, version, signer), false},
|
||||
{"invalid counterparty connection ID", &types.MsgConnectionOpenInit{connectionID, types.NewCounterparty("clienttotest", "connectiontotest", prefix), version, signer.String()}, false},
|
||||
{"empty counterparty prefix", types.NewMsgConnectionOpenInit("clienttotest", "clienttotest", emptyPrefix, version, signer), false},
|
||||
{"supplied version fails basic validation", types.NewMsgConnectionOpenInit("clienttotest", "clienttotest", prefix, &types.Version{}, signer), false},
|
||||
{"empty singer", types.NewMsgConnectionOpenInit("clienttotest", "clienttotest", prefix, version, nil), false},
|
||||
{"success", types.NewMsgConnectionOpenInit("clienttotest", "clienttotest", prefix, version, signer), true},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
@ -112,7 +111,7 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenTry() {
|
||||
signer, _ := sdk.AccAddressFromBech32("cosmos1ckgw5d7jfj7wwxjzs9fdrdev9vc8dzcw3n2lht")
|
||||
|
||||
clientState := ibctmtypes.NewClientState(
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
)
|
||||
|
||||
// Pack consensus state into any to test unpacking error
|
||||
@ -124,33 +123,32 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenTry() {
|
||||
|
||||
// invalidClientState fails validateBasic
|
||||
invalidClient := ibctmtypes.NewClientState(
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clienttypes.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clienttypes.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
)
|
||||
provedID := ""
|
||||
|
||||
var testCases = []struct {
|
||||
name string
|
||||
msg *types.MsgConnectionOpenTry
|
||||
expPass bool
|
||||
}{
|
||||
{"invalid connection ID", types.NewMsgConnectionOpenTry("test/conn1", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid connection ID", types.NewMsgConnectionOpenTry("ibcconntest", "test/conn1", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid client ID", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "test/iris", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid counterparty connection ID", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "ibc/test", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid counterparty client ID", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "test/conn1", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid nil counterparty client", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", nil, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid client unpacking", &types.MsgConnectionOpenTry{"ibcconntest", provedID, "clienttotesta", invalidAny, counterparty, []*types.Version{ibctesting.ConnectionVersion}, clientHeight, suite.proof, suite.proof, suite.proof, clientHeight, signer.String()}, false},
|
||||
{"counterparty failed Validate", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", invalidClient, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"empty counterparty prefix", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, emptyPrefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"empty counterpartyVersions", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"empty proofInit", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, emptyProof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"empty proofClient", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, emptyProof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"empty proofConsensus", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, emptyProof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid proofHeight", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clienttypes.ZeroHeight(), clientHeight, signer), false},
|
||||
{"invalid consensusHeight", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clienttypes.ZeroHeight(), signer), false},
|
||||
{"empty singer", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, nil), false},
|
||||
{"success", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), true},
|
||||
{"invalid version", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{{}}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid connection ID", types.NewMsgConnectionOpenTry("test/conn1", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid connection ID", types.NewMsgConnectionOpenTry("(invalidconnection)", "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid client ID", types.NewMsgConnectionOpenTry(connectionID, "test/iris", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid counterparty connection ID", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "ibc/test", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid counterparty client ID", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "test/conn1", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid nil counterparty client", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "clienttotest", nil, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid client unpacking", &types.MsgConnectionOpenTry{connectionID, "clienttotesta", invalidAny, counterparty, []*types.Version{ibctesting.ConnectionVersion}, clientHeight, suite.proof, suite.proof, suite.proof, clientHeight, signer.String()}, false},
|
||||
{"counterparty failed Validate", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "clienttotest", invalidClient, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"empty counterparty prefix", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "clienttotest", clientState, emptyPrefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"empty counterpartyVersions", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"empty proofInit", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, emptyProof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"empty proofClient", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, emptyProof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"empty proofConsensus", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, emptyProof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid proofHeight", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clienttypes.ZeroHeight(), clientHeight, signer), false},
|
||||
{"invalid consensusHeight", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clienttypes.ZeroHeight(), signer), false},
|
||||
{"empty singer", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, nil), false},
|
||||
{"success", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), true},
|
||||
{"invalid version", types.NewMsgConnectionOpenTry(connectionID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{{}}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
@ -166,7 +164,7 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenTry() {
|
||||
func (suite *MsgTestSuite) TestNewMsgConnectionOpenAck() {
|
||||
signer, _ := sdk.AccAddressFromBech32("cosmos1ckgw5d7jfj7wwxjzs9fdrdev9vc8dzcw3n2lht")
|
||||
clientState := ibctmtypes.NewClientState(
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
)
|
||||
|
||||
// Pack consensus state into any to test unpacking error
|
||||
@ -177,9 +175,9 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenAck() {
|
||||
|
||||
// invalidClientState fails validateBasic
|
||||
invalidClient := ibctmtypes.NewClientState(
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clienttypes.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clienttypes.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
)
|
||||
connectionID := "ibcconntest"
|
||||
connectionID := "connection-0"
|
||||
|
||||
var testCases = []struct {
|
||||
name string
|
||||
@ -216,10 +214,10 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenConfirm() {
|
||||
|
||||
testMsgs := []*types.MsgConnectionOpenConfirm{
|
||||
types.NewMsgConnectionOpenConfirm("test/conn1", suite.proof, clientHeight, signer),
|
||||
types.NewMsgConnectionOpenConfirm("ibcconntest", emptyProof, clientHeight, signer),
|
||||
types.NewMsgConnectionOpenConfirm("ibcconntest", suite.proof, clienttypes.ZeroHeight(), signer),
|
||||
types.NewMsgConnectionOpenConfirm("ibcconntest", suite.proof, clientHeight, nil),
|
||||
types.NewMsgConnectionOpenConfirm("ibcconntest", suite.proof, clientHeight, signer),
|
||||
types.NewMsgConnectionOpenConfirm(connectionID, emptyProof, clientHeight, signer),
|
||||
types.NewMsgConnectionOpenConfirm(connectionID, suite.proof, clienttypes.ZeroHeight(), signer),
|
||||
types.NewMsgConnectionOpenConfirm(connectionID, suite.proof, clientHeight, nil),
|
||||
types.NewMsgConnectionOpenConfirm(connectionID, suite.proof, clientHeight, signer),
|
||||
}
|
||||
|
||||
var testCases = []struct {
|
||||
|
||||
@ -484,9 +484,9 @@ func (m *QueryConnectionClientStateResponse) GetProofHeight() types.Height {
|
||||
// Query/ConnectionConsensusState RPC method
|
||||
type QueryConnectionConsensusStateRequest struct {
|
||||
// connection identifier
|
||||
ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"`
|
||||
VersionNumber uint64 `protobuf:"varint,2,opt,name=version_number,json=versionNumber,proto3" json:"version_number,omitempty"`
|
||||
VersionHeight uint64 `protobuf:"varint,3,opt,name=version_height,json=versionHeight,proto3" json:"version_height,omitempty"`
|
||||
ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"`
|
||||
RevisionNumber uint64 `protobuf:"varint,2,opt,name=revision_number,json=revisionNumber,proto3" json:"revision_number,omitempty"`
|
||||
RevisionHeight uint64 `protobuf:"varint,3,opt,name=revision_height,json=revisionHeight,proto3" json:"revision_height,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryConnectionConsensusStateRequest) Reset() { *m = QueryConnectionConsensusStateRequest{} }
|
||||
@ -529,16 +529,16 @@ func (m *QueryConnectionConsensusStateRequest) GetConnectionId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *QueryConnectionConsensusStateRequest) GetVersionNumber() uint64 {
|
||||
func (m *QueryConnectionConsensusStateRequest) GetRevisionNumber() uint64 {
|
||||
if m != nil {
|
||||
return m.VersionNumber
|
||||
return m.RevisionNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryConnectionConsensusStateRequest) GetVersionHeight() uint64 {
|
||||
func (m *QueryConnectionConsensusStateRequest) GetRevisionHeight() uint64 {
|
||||
if m != nil {
|
||||
return m.VersionHeight
|
||||
return m.RevisionHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
@ -635,63 +635,63 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_cd8d529f8c7cd06b = []byte{
|
||||
// 887 bytes of a gzipped FileDescriptorProto
|
||||
// 892 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x41, 0x4f, 0x33, 0x45,
|
||||
0x18, 0xee, 0x14, 0xbe, 0x2f, 0x1f, 0x53, 0x40, 0x9d, 0x14, 0xa8, 0xab, 0x16, 0x5c, 0x45, 0x0a,
|
||||
0x91, 0x19, 0x0a, 0xd1, 0x20, 0xd0, 0x44, 0x21, 0x88, 0x1c, 0x24, 0xb8, 0xc6, 0x8b, 0x17, 0xb2,
|
||||
0xbb, 0x1d, 0xb6, 0x1b, 0xe9, 0x4e, 0xe9, 0x6e, 0x1b, 0x1b, 0xd2, 0x83, 0xfe, 0x02, 0x13, 0x8f,
|
||||
0xde, 0x3c, 0x70, 0xf5, 0xe0, 0xd1, 0x1f, 0x20, 0x47, 0x12, 0x2f, 0x5e, 0x24, 0xa6, 0x78, 0xf5,
|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 0x93, 0x51, 0xf0,
|
||||
0xb0, 0xac, 0xff, 0x06, 0xe0, 0x5c, 0x4f, 0xbd, 0x5f, 0x63, 0x9e, 0x4f, 0xd1, 0x3e, 0x84, 0x51,
|
||||
0x2e, 0xaf, 0xce, 0xac, 0x2f, 0xe2, 0x64, 0x31, 0x71, 0x54, 0xbf, 0xef, 0x95, 0x0d, 0xa5, 0x10,
|
||||
0x65, 0xe1, 0xb3, 0x5a, 0x9d, 0xb1, 0xd3, 0x5c, 0x7a, 0x01, 0x14, 0x26, 0x0d, 0xf1, 0x82, 0xf6,
|
||||
0xe0, 0x24, 0x7f, 0x38, 0xa9, 0x50, 0xd7, 0xa9, 0x04, 0xb9, 0x31, 0xbe, 0xbd, 0xa6, 0x6c, 0x2f,
|
||||
0x74, 0x6c, 0x16, 0xf1, 0x67, 0x3c, 0x63, 0x77, 0xfc, 0xea, 0x66, 0x3e, 0x65, 0x64, 0x78, 0x95,
|
||||
0x08, 0xe9, 0x66, 0x0f, 0x78, 0xbf, 0xcb, 0xfe, 0x53, 0x08, 0xa3, 0x76, 0x49, 0xf0, 0xef, 0x61,
|
||||
0xd1, 0x5b, 0x1c, 0xf6, 0x16, 0x8b, 0x11, 0x91, 0xbd, 0xc5, 0xc7, 0xa6, 0x43, 0x65, 0xad, 0xa1,
|
||||
0x54, 0xea, 0xff, 0x02, 0x98, 0xeb, 0x3d, 0x43, 0x2a, 0x74, 0x04, 0x33, 0x11, 0x51, 0x3f, 0x07,
|
||||
0x16, 0xc6, 0x0a, 0x99, 0xf5, 0xf7, 0xfb, 0x49, 0x74, 0x58, 0xa6, 0x5e, 0xe0, 0x9e, 0xba, 0xb4,
|
||||
0xac, 0x88, 0xad, 0x6e, 0x80, 0x0e, 0x62, 0xa0, 0xd3, 0x1c, 0xf4, 0xd2, 0x83, 0xa0, 0x05, 0x18,
|
||||
0x15, 0x35, 0xda, 0x84, 0xcf, 0x1f, 0xa9, 0xab, 0xcc, 0xd7, 0x77, 0xe0, 0x5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xe6, 0xeb, 0x3b, 0xf0, 0x35,
|
||||
0x41, 0x97, 0xa7, 0x25, 0x08, 0xfb, 0x0a, 0x9c, 0x12, 0x5b, 0x44, 0x23, 0xf5, 0x44, 0x04, 0x0e,
|
||||
0xcb, 0xfa, 0x4f, 0x00, 0xe6, 0x07, 0x95, 0x4b, 0xcd, 0x96, 0xe1, 0x8b, 0xca, 0x58, 0xd6, 0xcc,
|
||||
0xa0, 0x22, 0x84, 0x9b, 0x32, 0x9e, 0x45, 0xf1, 0xe3, 0x30, 0xfc, 0x90, 0x93, 0x63, 0xc1, 0xd7,
|
||||
0x7b, 0xba, 0x2a, 0x10, 0x7f, 0x1a, 0x98, 0x41, 0x77, 0x0e, 0x50, 0x29, 0xf1, 0x06, 0xed, 0xe6,
|
||||
0xfe, 0xbb, 0x9e, 0xcf, 0xb6, 0xcc, 0xea, 0xd9, 0x96, 0x1e, 0x5b, 0xd6, 0x7b, 0xee, 0x56, 0x07,
|
||||
0x40, 0x7d, 0xd8, 0x21, 0x52, 0x10, 0x13, 0xce, 0xb9, 0xb7, 0x93, 0x71, 0x22, 0xb5, 0xf5, 0xc3,
|
||||
0x14, 0x39, 0xb6, 0xcb, 0x49, 0xd4, 0x94, 0x61, 0x52, 0xf6, 0x9c, 0x71, 0x93, 0xc2, 0x0f, 0x29,
|
||||
0xe4, 0xaf, 0x00, 0xbe, 0xd9, 0x4b, 0x32, 0xa4, 0xe5, 0xf9, 0x0d, 0xff, 0x39, 0x8a, 0x89, 0x96,
|
||||
0xe0, 0xb3, 0x3a, 0x6d, 0xba, 0x7e, 0xb8, 0xea, 0x35, 0xaa, 0x16, 0xad, 0x73, 0x32, 0x93, 0xc6,
|
||||
0xd3, 0x6e, 0xf8, 0x88, 0x47, 0x63, 0x89, 0x0a, 0x31, 0x25, 0x51, 0x22, 0xbf, 0x06, 0x70, 0xf1,
|
||||
0x0e, 0xe4, 0xb2, 0x43, 0x25, 0x18, 0x8e, 0xa6, 0x58, 0x89, 0x75, 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xe8, 0x9a, 0xa3, 0x9d, 0x51, 0x71, 0x26,
|
||||
0xf9, 0x9a, 0x56, 0x1a, 0xb3, 0x5a, 0x12, 0xfd, 0x16, 0x70, 0xa6, 0x5f, 0xa3, 0xaf, 0xc6, 0x67,
|
||||
0x1a, 0xf7, 0x26, 0xd2, 0xf5, 0x39, 0x72, 0xd1, 0xe3, 0x98, 0x6d, 0x22, 0xec, 0x44, 0x59, 0x10,
|
||||
0x81, 0xf6, 0xee, 0x67, 0x97, 0x9d, 0x3c, 0xb8, 0xea, 0xe4, 0xc1, 0xdf, 0x9d, 0x3c, 0xf8, 0xee,
|
||||
0x26, 0x9f, 0xba, 0xba, 0xc9, 0xa7, 0xfe, 0xbc, 0xc9, 0xa7, 0x3e, 0xdf, 0x76, 0xdc, 0xa0, 0xd2,
|
||||
0xb0, 0xb0, 0xcd, 0xaa, 0x44, 0xfe, 0x35, 0x16, 0x3f, 0xab, 0x7e, 0xf9, 0x0b, 0xf2, 0x65, 0x84,
|
||||
0x7a, 0x6d, 0x63, 0x55, 0x01, 0x1e, 0xb4, 0x6a, 0xd4, 0xb7, 0x1e, 0x73, 0x63, 0xdc, 0xf8, 0x3f,
|
||||
0x00, 0x00, 0xff, 0xff, 0x7c, 0x35, 0x91, 0xa4, 0xa7, 0x0b, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -1291,13 +1291,13 @@ func (m *QueryConnectionConsensusStateRequest) MarshalToSizedBuffer(dAtA []byte)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.VersionHeight != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.RevisionHeight))
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.RevisionNumber))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
@ -1523,11 +1523,11 @@ func (m *QueryConnectionConsensusStateRequest) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
n += 1 + sovQuery(uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
n += 1 + sovQuery(uint64(m.RevisionNumber))
|
||||
}
|
||||
if m.VersionHeight != 0 {
|
||||
n += 1 + sovQuery(uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
n += 1 + sovQuery(uint64(m.RevisionHeight))
|
||||
}
|
||||
return n
|
||||
}
|
||||
@ -2588,9 +2588,9 @@ func (m *QueryConnectionConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionNumber", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionNumber", wireType)
|
||||
}
|
||||
m.VersionNumber = 0
|
||||
m.RevisionNumber = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
@ -2600,16 +2600,16 @@ func (m *QueryConnectionConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionNumber |= uint64(b&0x7F) << shift
|
||||
m.RevisionNumber |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionHeight", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionHeight", wireType)
|
||||
}
|
||||
m.VersionHeight = 0
|
||||
m.RevisionHeight = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
@ -2619,7 +2619,7 @@ func (m *QueryConnectionConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionHeight |= uint64(b&0x7F) << shift
|
||||
m.RevisionHeight |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
|
||||
@ -251,26 +251,26 @@ func request_Query_ConnectionConsensusState_0(ctx context.Context, marshaler run
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "connection_id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_number"]
|
||||
val, ok = pathParams["revision_number"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_number")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_number")
|
||||
}
|
||||
|
||||
protoReq.VersionNumber, err = runtime.Uint64(val)
|
||||
protoReq.RevisionNumber, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_number", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_number", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_height"]
|
||||
val, ok = pathParams["revision_height"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_height")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_height")
|
||||
}
|
||||
|
||||
protoReq.VersionHeight, err = runtime.Uint64(val)
|
||||
protoReq.RevisionHeight, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_height", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_height", err)
|
||||
}
|
||||
|
||||
msg, err := client.ConnectionConsensusState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
@ -300,26 +300,26 @@ func local_request_Query_ConnectionConsensusState_0(ctx context.Context, marshal
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "connection_id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_number"]
|
||||
val, ok = pathParams["revision_number"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_number")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_number")
|
||||
}
|
||||
|
||||
protoReq.VersionNumber, err = runtime.Uint64(val)
|
||||
protoReq.RevisionNumber, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_number", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_number", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_height"]
|
||||
val, ok = pathParams["revision_height"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_height")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_height")
|
||||
}
|
||||
|
||||
protoReq.VersionHeight, err = runtime.Uint64(val)
|
||||
protoReq.RevisionHeight, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_height", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_height", err)
|
||||
}
|
||||
|
||||
msg, err := server.ConnectionConsensusState(ctx, &protoReq)
|
||||
@ -586,7 +586,7 @@ var (
|
||||
|
||||
pattern_Query_ConnectionClientState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ibc", "core", "connection", "v1beta1", "connections", "connection_id", "client_state"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ConnectionConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9, 1, 0, 4, 1, 5, 10}, []string{"ibc", "core", "connection", "v1beta1", "connections", "connection_id", "consensus_state", "version", "version_number", "height", "version_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_ConnectionConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9, 1, 0, 4, 1, 5, 10}, []string{"ibc", "core", "connection", "v1beta1", "connections", "connection_id", "consensus_state", "revision", "revision_number", "height", "revision_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@ -34,10 +34,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
// initialize a connection with Chain B.
|
||||
type MsgConnectionOpenInit struct {
|
||||
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"`
|
||||
ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"`
|
||||
Counterparty Counterparty `protobuf:"bytes,3,opt,name=counterparty,proto3" json:"counterparty"`
|
||||
Version *Version `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"`
|
||||
Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"`
|
||||
Counterparty Counterparty `protobuf:"bytes,2,opt,name=counterparty,proto3" json:"counterparty"`
|
||||
Version *Version `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
|
||||
Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgConnectionOpenInit) Reset() { *m = MsgConnectionOpenInit{} }
|
||||
@ -113,22 +112,23 @@ var xxx_messageInfo_MsgConnectionOpenInitResponse proto.InternalMessageInfo
|
||||
// MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a
|
||||
// connection on Chain B.
|
||||
type MsgConnectionOpenTry struct {
|
||||
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"`
|
||||
DesiredConnectionId string `protobuf:"bytes,2,opt,name=desired_connection_id,json=desiredConnectionId,proto3" json:"desired_connection_id,omitempty" yaml:"desired_connection_id"`
|
||||
CounterpartyChosenConnectionId string `protobuf:"bytes,3,opt,name=counterparty_chosen_connection_id,json=counterpartyChosenConnectionId,proto3" json:"counterparty_chosen_connection_id,omitempty" yaml:"counterparty_chosen_connection_id"`
|
||||
ClientState *types.Any `protobuf:"bytes,4,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty" yaml:"client_state"`
|
||||
Counterparty Counterparty `protobuf:"bytes,5,opt,name=counterparty,proto3" json:"counterparty"`
|
||||
CounterpartyVersions []*Version `protobuf:"bytes,6,rep,name=counterparty_versions,json=counterpartyVersions,proto3" json:"counterparty_versions,omitempty" yaml:"counterparty_versions"`
|
||||
ProofHeight types1.Height `protobuf:"bytes,7,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
|
||||
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"`
|
||||
// in the case of crossing hello's, when both chains call OpenInit, we need the connection identifier
|
||||
// of the previous connection in state INIT
|
||||
PreviousConnectionId string `protobuf:"bytes,2,opt,name=previous_connection_id,json=previousConnectionId,proto3" json:"previous_connection_id,omitempty" yaml:"previous_connection_id"`
|
||||
ClientState *types.Any `protobuf:"bytes,3,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty" yaml:"client_state"`
|
||||
Counterparty Counterparty `protobuf:"bytes,4,opt,name=counterparty,proto3" json:"counterparty"`
|
||||
CounterpartyVersions []*Version `protobuf:"bytes,5,rep,name=counterparty_versions,json=counterpartyVersions,proto3" json:"counterparty_versions,omitempty" yaml:"counterparty_versions"`
|
||||
ProofHeight types1.Height `protobuf:"bytes,6,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
|
||||
// proof of the initialization the connection on Chain A: `UNITIALIZED ->
|
||||
// INIT`
|
||||
ProofInit []byte `protobuf:"bytes,8,opt,name=proof_init,json=proofInit,proto3" json:"proof_init,omitempty" yaml:"proof_init"`
|
||||
ProofInit []byte `protobuf:"bytes,7,opt,name=proof_init,json=proofInit,proto3" json:"proof_init,omitempty" yaml:"proof_init"`
|
||||
// proof of client state included in message
|
||||
ProofClient []byte `protobuf:"bytes,9,opt,name=proof_client,json=proofClient,proto3" json:"proof_client,omitempty" yaml:"proof_client"`
|
||||
ProofClient []byte `protobuf:"bytes,8,opt,name=proof_client,json=proofClient,proto3" json:"proof_client,omitempty" yaml:"proof_client"`
|
||||
// proof of client consensus state
|
||||
ProofConsensus []byte `protobuf:"bytes,10,opt,name=proof_consensus,json=proofConsensus,proto3" json:"proof_consensus,omitempty" yaml:"proof_consensus"`
|
||||
ConsensusHeight types1.Height `protobuf:"bytes,11,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height" yaml:"consensus_height"`
|
||||
Signer string `protobuf:"bytes,12,opt,name=signer,proto3" json:"signer,omitempty"`
|
||||
ProofConsensus []byte `protobuf:"bytes,9,opt,name=proof_consensus,json=proofConsensus,proto3" json:"proof_consensus,omitempty" yaml:"proof_consensus"`
|
||||
ConsensusHeight types1.Height `protobuf:"bytes,10,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height" yaml:"consensus_height"`
|
||||
Signer string `protobuf:"bytes,11,opt,name=signer,proto3" json:"signer,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgConnectionOpenTry) Reset() { *m = MsgConnectionOpenTry{} }
|
||||
@ -384,65 +384,62 @@ func init() {
|
||||
func init() { proto.RegisterFile("ibc/core/connection/v1/tx.proto", fileDescriptor_5d00fde5fc97399e) }
|
||||
|
||||
var fileDescriptor_5d00fde5fc97399e = []byte{
|
||||
// 917 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x3f, 0x93, 0xdb, 0x44,
|
||||
0x14, 0xb7, 0xce, 0xf7, 0xc7, 0xde, 0x33, 0x24, 0x51, 0xec, 0x3b, 0x21, 0x82, 0xe4, 0xec, 0xc0,
|
||||
0x70, 0x45, 0x4e, 0x8a, 0x93, 0x30, 0x03, 0xc7, 0x50, 0xd8, 0x6e, 0xb8, 0x22, 0xc0, 0x88, 0x83,
|
||||
0x22, 0x8d, 0xc7, 0x96, 0xd7, 0xb2, 0xc6, 0xe7, 0x5d, 0x8f, 0x56, 0x76, 0x22, 0x5a, 0x1a, 0x86,
|
||||
0x8a, 0x8f, 0x90, 0x4f, 0xc1, 0x67, 0x48, 0x47, 0x4a, 0x2a, 0x0d, 0xdc, 0x35, 0xd4, 0xea, 0xe8,
|
||||
0x18, 0xad, 0xfe, 0x78, 0x65, 0xcb, 0x73, 0x36, 0xe7, 0x54, 0xd2, 0xdb, 0xf7, 0x7b, 0xef, 0xed,
|
||||
0xfe, 0xf6, 0xfd, 0xde, 0x2c, 0x50, 0xed, 0x9e, 0xa9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c, 0xd3, 0x1c, 0x2d, 0xcf, 0x45, 0x61, 0xa3, 0xb9, 0x68, 0x02, 0x39, 0x2b,
|
||||
0xba, 0x9c, 0x11, 0xf0, 0x49, 0xe0, 0xab, 0x0f, 0xf3, 0x04, 0x9a, 0x4d, 0x2c, 0x65, 0x94, 0xc9,
|
||||
0x17, 0xe1, 0x86, 0x65, 0x71, 0xc3, 0x61, 0xb9, 0x7d, 0x39, 0x2f, 0xca, 0x60, 0x6f, 0x8b, 0x32,
|
||||
0x68, 0x80, 0xa8, 0xbb, 0x3b, 0xae, 0xe3, 0x49, 0xfb, 0xac, 0x1d, 0xb9, 0xf1, 0x9b, 0xba, 0xa0,
|
||||
0x51, 0x62, 0xff, 0xe1, 0xc4, 0x5e, 0xd4, 0xc0, 0xc1, 0xed, 0x34, 0x50, 0xda, 0x8a, 0x06, 0xca,
|
||||
0xef, 0x54, 0x03, 0x60, 0x03, 0x0d, 0x34, 0xcd, 0x51, 0xaa, 0x81, 0x5f, 0x77, 0x80, 0xb4, 0x04,
|
||||
0x68, 0x13, 0x3c, 0xb0, 0x9d, 0xf1, 0x6d, 0x75, 0x90, 0xde, 0x5c, 0xd7, 0x1c, 0xb1, 0xb6, 0xcf,
|
||||
0xb9, 0xb9, 0xae, 0x39, 0x4a, 0x6e, 0x2e, 0x54, 0xde, 0x62, 0x23, 0x15, 0xb7, 0xd8, 0x48, 0x73,
|
||||
0xb2, 0x76, 0x57, 0x90, 0x05, 0x41, 0x7d, 0x15, 0x17, 0x09, 0x61, 0x4f, 0xfe, 0x2d, 0x82, 0xe2,
|
||||
0x73, 0x6a, 0x89, 0x3f, 0x01, 0x31, 0xe7, 0x11, 0x76, 0xba, 0x4a, 0x84, 0xb9, 0x6f, 0x0f, 0xf9,
|
||||
0xb3, 0x8d, 0xe0, 0xc9, 0x1e, 0xc4, 0x97, 0xe0, 0xde, 0xf2, 0x33, 0xe5, 0xd1, 0xda, 0xb9, 0x2e,
|
||||
0x1c, 0x4f, 0x7e, 0xb6, 0x09, 0x7a, 0x75, 0xe1, 0xf0, 0xce, 0xd6, 0x2f, 0xdc, 0x34, 0x47, 0x1b,
|
||||
0x14, 0xe6, 0xda, 0x54, 0xfc, 0x59, 0x00, 0xb5, 0xfc, 0x1e, 0x7d, 0xbc, 0x76, 0xbe, 0x38, 0x42,
|
||||
0xfe, 0x7c, 0xd3, 0x88, 0x64, 0x17, 0xad, 0x1f, 0xde, 0x5c, 0x29, 0xc2, 0xdb, 0x2b, 0x45, 0xf8,
|
||||
0xeb, 0x4a, 0x11, 0x7e, 0xbb, 0x56, 0x0a, 0x6f, 0xaf, 0x95, 0xc2, 0x9f, 0xd7, 0x4a, 0xe1, 0xc5,
|
||||
0x97, 0x96, 0xed, 0x0e, 0xa7, 0x3d, 0xcd, 0x24, 0x63, 0xdd, 0x24, 0x74, 0x4c, 0x68, 0xfc, 0x39,
|
||||
0xa5, 0xfd, 0x91, 0xfe, 0x4a, 0x4f, 0x9f, 0xf7, 0x8f, 0x9f, 0x9e, 0x72, 0x2f, 0x7c, 0xd7, 0x9b,
|
||||
0x20, 0xda, 0xdb, 0x67, 0x13, 0xf7, 0xe9, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x86, 0xcf, 0x23,
|
||||
0x2c, 0x90, 0x0c, 0x00, 0x00,
|
||||
// 880 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x31, 0x73, 0xda, 0x58,
|
||||
0x10, 0x46, 0x06, 0x63, 0x78, 0x70, 0x67, 0x5b, 0x07, 0x58, 0xa7, 0xb3, 0x11, 0xd6, 0xdc, 0xcd,
|
||||
0xb9, 0x38, 0x4b, 0xc6, 0xf6, 0xcd, 0xdc, 0xf9, 0xe6, 0x0a, 0xa0, 0x39, 0x17, 0xbe, 0x64, 0x14,
|
||||
0x27, 0x99, 0x71, 0xc3, 0x80, 0x10, 0xb2, 0x06, 0xa3, 0xc7, 0xe8, 0x09, 0x62, 0xa5, 0x4d, 0x93,
|
||||
0x49, 0x95, 0x9f, 0xe0, 0x9f, 0xe3, 0xd2, 0x65, 0xd2, 0x68, 0x12, 0xbb, 0x49, 0xad, 0x26, 0x93,
|
||||
0x2e, 0xa3, 0xf7, 0x24, 0x21, 0x40, 0x8c, 0x21, 0x38, 0x15, 0x5a, 0xed, 0xf7, 0xed, 0xae, 0x76,
|
||||
0xf7, 0x7b, 0x3c, 0xc0, 0x69, 0x4d, 0x59, 0x94, 0xa1, 0xa1, 0x88, 0x32, 0xd4, 0x75, 0x45, 0x36,
|
||||
0x35, 0xa8, 0x8b, 0x83, 0xb2, 0x68, 0x5e, 0x0a, 0x3d, 0x03, 0x9a, 0x90, 0x2e, 0x68, 0x4d, 0x59,
|
||||
0x70, 0x01, 0xc2, 0x10, 0x20, 0x0c, 0xca, 0x6c, 0x4e, 0x85, 0x2a, 0xc4, 0x10, 0xd1, 0x7d, 0x22,
|
||||
0x68, 0xf6, 0x67, 0x15, 0x42, 0xf5, 0x42, 0x11, 0xb1, 0xd5, 0xec, 0xb7, 0xc5, 0x86, 0x6e, 0x79,
|
||||
0xae, 0x50, 0xa6, 0x0b, 0x4d, 0xd1, 0x4d, 0x37, 0x0b, 0x79, 0xf2, 0x00, 0xbf, 0x4f, 0x29, 0x25,
|
||||
0x94, 0x17, 0x03, 0xf9, 0xcf, 0x14, 0xc8, 0x9f, 0x20, 0xb5, 0x16, 0xbc, 0x7f, 0xd4, 0x53, 0xf4,
|
||||
0x63, 0x5d, 0x33, 0xe9, 0x32, 0x48, 0x93, 0x90, 0x75, 0xad, 0xc5, 0x50, 0x25, 0x6a, 0x27, 0x5d,
|
||||
0xcd, 0x39, 0x36, 0xb7, 0x66, 0x35, 0xba, 0x17, 0x47, 0x7c, 0xe0, 0xe2, 0xa5, 0x14, 0x79, 0x3e,
|
||||
0x6e, 0xd1, 0xff, 0x83, 0xac, 0x0c, 0xfb, 0xba, 0xa9, 0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 0xe5, 0x52, 0x7c, 0x86, 0x91, 0x56, 0x4b, 0x8e,
|
||||
0xcd, 0x6d, 0x7a, 0x55, 0x47, 0xc5, 0xe1, 0xa5, 0x5c, 0xf8, 0xbd, 0x47, 0x43, 0xf4, 0x19, 0xc8,
|
||||
0xf6, 0x0c, 0x08, 0xdb, 0xf5, 0x73, 0x45, 0x53, 0xcf, 0x4d, 0x26, 0x89, 0xbf, 0x83, 0x0d, 0xa5,
|
||||
0x23, 0x82, 0x19, 0x94, 0x85, 0xff, 0x30, 0xa2, 0xfa, 0x8b, 0x5b, 0xfd, 0xb0, 0x47, 0x61, 0x36,
|
||||
0x2f, 0x65, 0xb0, 0x49, 0x90, 0xf4, 0x21, 0x00, 0xc4, 0xab, 0xe9, 0x9a, 0xc9, 0xac, 0x94, 0xa8,
|
||||
0x9d, 0x6c, 0x35, 0xef, 0xd8, 0xdc, 0x7a, 0x98, 0xe9, 0xfa, 0x78, 0x29, 0x8d, 0x0d, 0xac, 0xa8,
|
||||
0x23, 0xbf, 0x22, 0x92, 0x99, 0x49, 0x61, 0xde, 0xc6, 0x78, 0x46, 0xe2, 0xf5, 0x33, 0xd6, 0xb0,
|
||||
0x45, 0xd7, 0xc0, 0xaa, 0xe7, 0x75, 0x77, 0x53, 0x47, 0x7d, 0xc4, 0xa4, 0x31, 0x9d, 0x75, 0x6c,
|
||||
0xae, 0x30, 0x42, 0xf7, 0x01, 0xbc, 0xf4, 0x23, 0x89, 0xe0, 0xbf, 0xa0, 0xdb, 0x60, 0x2d, 0xf0,
|
||||
0xfa, 0x6d, 0x01, 0xf7, 0xb6, 0x85, 0xf3, 0xda, 0xb2, 0xe1, 0x0f, 0x61, 0x34, 0x02, 0x2f, 0xad,
|
||||
0x06, 0xaf, 0xbc, 0xf6, 0x0c, 0xc5, 0x97, 0x99, 0x22, 0xbe, 0x22, 0xd8, 0x8c, 0x92, 0x56, 0xa0,
|
||||
0xbd, 0x8f, 0xcb, 0x11, 0xda, 0xab, 0xc8, 0x1d, 0xfa, 0x5f, 0xf0, 0xc3, 0xa8, 0x7e, 0x88, 0xfe,
|
||||
0x18, 0xc7, 0xe6, 0x72, 0x41, 0x7d, 0x61, 0xd9, 0x64, 0xe5, 0xb0, 0x5c, 0x64, 0xc0, 0x8e, 0x2c,
|
||||
0x51, 0x94, 0x16, 0x7f, 0x73, 0x6c, 0x6e, 0x3b, 0x62, 0xe1, 0xc6, 0x02, 0x33, 0x61, 0xe7, 0x88,
|
||||
0x26, 0x17, 0x38, 0xb6, 0xc6, 0xe5, 0x9c, 0x58, 0x58, 0xce, 0xe3, 0x32, 0x58, 0x7e, 0x40, 0x19,
|
||||
0x94, 0x01, 0xd9, 0xee, 0xba, 0x69, 0x58, 0x58, 0x5f, 0xd9, 0xf0, 0x41, 0x18, 0xb8, 0x78, 0x29,
|
||||
0x85, 0x9f, 0xdd, 0xb3, 0x73, 0x5c, 0x03, 0x2b, 0x8b, 0x69, 0x20, 0xf5, 0x20, 0x1a, 0x48, 0x7f,
|
||||
0x57, 0x0d, 0x80, 0x39, 0x34, 0x50, 0x91, 0x3b, 0x81, 0x06, 0xde, 0x2c, 0x01, 0x66, 0x02, 0x50,
|
||||
0x83, 0x7a, 0x5b, 0x33, 0xba, 0x8b, 0xea, 0x20, 0x98, 0x5c, 0x43, 0xee, 0xe0, 0xb5, 0x8f, 0x98,
|
||||
0x5c, 0x43, 0xee, 0xf8, 0x93, 0x73, 0x95, 0x37, 0xbe, 0x48, 0xf1, 0x07, 0x5c, 0xa4, 0xfb, 0xff,
|
||||
0xad, 0x79, 0x50, 0x9a, 0xd6, 0x0b, 0xbf, 0x61, 0xfb, 0x5f, 0xe2, 0x20, 0x7e, 0x82, 0x54, 0xfa,
|
||||
0x25, 0xa0, 0x23, 0xee, 0x33, 0xbb, 0xd3, 0x44, 0x18, 0x79, 0x0b, 0x60, 0xff, 0x9c, 0x0b, 0xee,
|
||||
0xd7, 0x40, 0xbf, 0x00, 0xeb, 0x93, 0x17, 0x86, 0x3f, 0x66, 0x8e, 0x75, 0x6a, 0x58, 0xec, 0xe1,
|
||||
0x3c, 0xe8, 0xe9, 0x89, 0xdd, 0x99, 0xcd, 0x9e, 0xb8, 0x22, 0x77, 0xe6, 0x48, 0x1c, 0x5a, 0x53,
|
||||
0xfa, 0x15, 0x05, 0xf2, 0xd1, 0x3b, 0xba, 0x37, 0x73, 0x3c, 0x8f, 0xc1, 0xfe, 0x35, 0x2f, 0xc3,
|
||||
0xaf, 0xa2, 0xfa, 0xf4, 0xfa, 0xb6, 0x48, 0xdd, 0xdc, 0x16, 0xa9, 0x0f, 0xb7, 0x45, 0xea, 0xed,
|
||||
0x5d, 0x31, 0x76, 0x73, 0x57, 0x8c, 0xbd, 0xbb, 0x2b, 0xc6, 0xce, 0xfe, 0x51, 0x35, 0xf3, 0xbc,
|
||||
0xdf, 0x14, 0x64, 0xd8, 0x15, 0x65, 0x88, 0xba, 0x10, 0x79, 0x3f, 0xbb, 0xa8, 0xd5, 0x11, 0x2f,
|
||||
0xc5, 0xe0, 0xa6, 0xbc, 0x77, 0xb0, 0x1b, 0xba, 0x2c, 0x9b, 0x56, 0x4f, 0x41, 0xcd, 0x24, 0x3e,
|
||||
0x71, 0x0f, 0xbe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x4a, 0xeb, 0x3e, 0xdb, 0x0b, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -666,7 +663,7 @@ func (m *MsgConnectionOpenInit) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
copy(dAtA[i:], m.Signer)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Signer)))
|
||||
i--
|
||||
dAtA[i] = 0x2a
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
if m.Version != nil {
|
||||
{
|
||||
@ -678,7 +675,7 @@ func (m *MsgConnectionOpenInit) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
{
|
||||
size, err := m.Counterparty.MarshalToSizedBuffer(dAtA[:i])
|
||||
@ -689,14 +686,7 @@ func (m *MsgConnectionOpenInit) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
if len(m.ConnectionId) > 0 {
|
||||
i -= len(m.ConnectionId)
|
||||
copy(dAtA[i:], m.ConnectionId)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.ConnectionId)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
dAtA[i] = 0x12
|
||||
if len(m.ClientId) > 0 {
|
||||
i -= len(m.ClientId)
|
||||
copy(dAtA[i:], m.ClientId)
|
||||
@ -755,7 +745,7 @@ func (m *MsgConnectionOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
copy(dAtA[i:], m.Signer)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Signer)))
|
||||
i--
|
||||
dAtA[i] = 0x62
|
||||
dAtA[i] = 0x5a
|
||||
}
|
||||
{
|
||||
size, err := m.ConsensusHeight.MarshalToSizedBuffer(dAtA[:i])
|
||||
@ -766,27 +756,27 @@ func (m *MsgConnectionOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x5a
|
||||
dAtA[i] = 0x52
|
||||
if len(m.ProofConsensus) > 0 {
|
||||
i -= len(m.ProofConsensus)
|
||||
copy(dAtA[i:], m.ProofConsensus)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.ProofConsensus)))
|
||||
i--
|
||||
dAtA[i] = 0x52
|
||||
dAtA[i] = 0x4a
|
||||
}
|
||||
if len(m.ProofClient) > 0 {
|
||||
i -= len(m.ProofClient)
|
||||
copy(dAtA[i:], m.ProofClient)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.ProofClient)))
|
||||
i--
|
||||
dAtA[i] = 0x4a
|
||||
dAtA[i] = 0x42
|
||||
}
|
||||
if len(m.ProofInit) > 0 {
|
||||
i -= len(m.ProofInit)
|
||||
copy(dAtA[i:], m.ProofInit)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.ProofInit)))
|
||||
i--
|
||||
dAtA[i] = 0x42
|
||||
dAtA[i] = 0x3a
|
||||
}
|
||||
{
|
||||
size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i])
|
||||
@ -797,7 +787,7 @@ func (m *MsgConnectionOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x3a
|
||||
dAtA[i] = 0x32
|
||||
if len(m.CounterpartyVersions) > 0 {
|
||||
for iNdEx := len(m.CounterpartyVersions) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
@ -809,7 +799,7 @@ func (m *MsgConnectionOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x32
|
||||
dAtA[i] = 0x2a
|
||||
}
|
||||
}
|
||||
{
|
||||
@ -821,7 +811,7 @@ func (m *MsgConnectionOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x2a
|
||||
dAtA[i] = 0x22
|
||||
if m.ClientState != nil {
|
||||
{
|
||||
size, err := m.ClientState.MarshalToSizedBuffer(dAtA[:i])
|
||||
@ -832,19 +822,12 @@ func (m *MsgConnectionOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
if len(m.CounterpartyChosenConnectionId) > 0 {
|
||||
i -= len(m.CounterpartyChosenConnectionId)
|
||||
copy(dAtA[i:], m.CounterpartyChosenConnectionId)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.CounterpartyChosenConnectionId)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.DesiredConnectionId) > 0 {
|
||||
i -= len(m.DesiredConnectionId)
|
||||
copy(dAtA[i:], m.DesiredConnectionId)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.DesiredConnectionId)))
|
||||
if len(m.PreviousConnectionId) > 0 {
|
||||
i -= len(m.PreviousConnectionId)
|
||||
copy(dAtA[i:], m.PreviousConnectionId)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.PreviousConnectionId)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
@ -1111,10 +1094,6 @@ func (m *MsgConnectionOpenInit) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.ConnectionId)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = m.Counterparty.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
if m.Version != nil {
|
||||
@ -1147,11 +1126,7 @@ func (m *MsgConnectionOpenTry) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.DesiredConnectionId)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.CounterpartyChosenConnectionId)
|
||||
l = len(m.PreviousConnectionId)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
@ -1353,38 +1328,6 @@ func (m *MsgConnectionOpenInit) Unmarshal(dAtA []byte) error {
|
||||
m.ClientId = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ConnectionId", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ConnectionId = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Counterparty", wireType)
|
||||
}
|
||||
@ -1417,7 +1360,7 @@ func (m *MsgConnectionOpenInit) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
|
||||
}
|
||||
@ -1453,7 +1396,7 @@ func (m *MsgConnectionOpenInit) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 5:
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
|
||||
}
|
||||
@ -1625,7 +1568,7 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field DesiredConnectionId", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field PreviousConnectionId", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@ -1653,41 +1596,9 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.DesiredConnectionId = string(dAtA[iNdEx:postIndex])
|
||||
m.PreviousConnectionId = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyChosenConnectionId", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.CounterpartyChosenConnectionId = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ClientState", wireType)
|
||||
}
|
||||
@ -1723,7 +1634,7 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 5:
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Counterparty", wireType)
|
||||
}
|
||||
@ -1756,7 +1667,7 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 6:
|
||||
case 5:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyVersions", wireType)
|
||||
}
|
||||
@ -1790,7 +1701,7 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 7:
|
||||
case 6:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType)
|
||||
}
|
||||
@ -1823,7 +1734,7 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 8:
|
||||
case 7:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ProofInit", wireType)
|
||||
}
|
||||
@ -1857,7 +1768,7 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
|
||||
m.ProofInit = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 9:
|
||||
case 8:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ProofClient", wireType)
|
||||
}
|
||||
@ -1891,7 +1802,7 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
|
||||
m.ProofClient = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 10:
|
||||
case 9:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ProofConsensus", wireType)
|
||||
}
|
||||
@ -1925,7 +1836,7 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
|
||||
m.ProofConsensus = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 11:
|
||||
case 10:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ConsensusHeight", wireType)
|
||||
}
|
||||
@ -1958,7 +1869,7 @@ func (m *MsgConnectionOpenTry) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 12:
|
||||
case 11:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
|
||||
}
|
||||
|
||||
@ -463,7 +463,7 @@ func GetCmdQueryNextSequenceReceive() *cobra.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
clientCtx = clientCtx.WithHeight(int64(sequenceRes.ProofHeight.VersionHeight))
|
||||
clientCtx = clientCtx.WithHeight(int64(sequenceRes.ProofHeight.RevisionHeight))
|
||||
return clientCtx.PrintOutput(sequenceRes)
|
||||
},
|
||||
}
|
||||
|
||||
@ -24,9 +24,9 @@ const (
|
||||
// NewChannelOpenInitCmd returns the command to create a MsgChannelOpenInit transaction
|
||||
func NewChannelOpenInitCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "open-init [port-id] [channel-id] [counterparty-port-id] [counterparty-channel-id] [connection-hops]",
|
||||
Use: "open-init [port-id] [counterparty-port-id] [connection-hops]",
|
||||
Short: "Creates and sends a ChannelOpenInit message",
|
||||
Args: cobra.ExactArgs(5),
|
||||
Args: cobra.ExactArgs(3),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx := client.GetClientContextFromCmd(cmd)
|
||||
clientCtx, err := client.ReadTxCommandFlags(clientCtx, cmd.Flags())
|
||||
@ -35,16 +35,14 @@ func NewChannelOpenInitCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
portID := args[0]
|
||||
channelID := args[1]
|
||||
counterpartyPortID := args[2]
|
||||
counterpartyChannelID := args[3]
|
||||
hops := strings.Split(args[4], "/")
|
||||
counterpartyPortID := args[1]
|
||||
hops := strings.Split(args[2], "/")
|
||||
order := channelOrder(cmd.Flags())
|
||||
version, _ := cmd.Flags().GetString(FlagIBCVersion)
|
||||
|
||||
msg := types.NewMsgChannelOpenInit(
|
||||
portID, channelID, version, order, hops,
|
||||
counterpartyPortID, counterpartyChannelID, clientCtx.GetFromAddress(),
|
||||
portID, version, order, hops,
|
||||
counterpartyPortID, clientCtx.GetFromAddress(),
|
||||
)
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
return err
|
||||
@ -64,9 +62,9 @@ func NewChannelOpenInitCmd() *cobra.Command {
|
||||
// NewChannelOpenTryCmd returns the command to create a MsgChannelOpenTry transaction
|
||||
func NewChannelOpenTryCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "open-try [port-id] [channel-id] [proved-channel-id] [counterparty-port-id] [counterparty-channel-id] [connection-hops] [/path/to/proof_init.json] [proof-height]",
|
||||
Use: "open-try [port-id] [channel-id] [counterparty-port-id] [counterparty-channel-id] [connection-hops] [/path/to/proof_init.json] [proof-height]",
|
||||
Short: "Creates and sends a ChannelOpenTry message",
|
||||
Args: cobra.ExactArgs(8),
|
||||
Args: cobra.ExactArgs(7),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx := client.GetClientContextFromCmd(cmd)
|
||||
clientCtx, err := client.ReadTxCommandFlags(clientCtx, cmd.Flags())
|
||||
@ -76,27 +74,26 @@ func NewChannelOpenTryCmd() *cobra.Command {
|
||||
|
||||
portID := args[0]
|
||||
channelID := args[1]
|
||||
provedChannelID := args[2]
|
||||
counterpartyPortID := args[3]
|
||||
counterpartyChannelID := args[4]
|
||||
hops := strings.Split(args[5], "/")
|
||||
counterpartyPortID := args[2]
|
||||
counterpartyChannelID := args[3]
|
||||
hops := strings.Split(args[4], "/")
|
||||
order := channelOrder(cmd.Flags())
|
||||
|
||||
// TODO: Differentiate between channel and counterparty versions.
|
||||
version, _ := cmd.Flags().GetString(FlagIBCVersion)
|
||||
|
||||
proofInit, err := connectionutils.ParseProof(clientCtx.LegacyAmino, args[6])
|
||||
proofInit, err := connectionutils.ParseProof(clientCtx.LegacyAmino, args[5])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
proofHeight, err := clienttypes.ParseHeight(args[7])
|
||||
proofHeight, err := clienttypes.ParseHeight(args[6])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
msg := types.NewMsgChannelOpenTry(
|
||||
portID, channelID, provedChannelID, version, order, hops,
|
||||
portID, channelID, version, order, hops,
|
||||
counterpartyPortID, counterpartyChannelID, version,
|
||||
proofInit, proofHeight, clientCtx.GetFromAddress(),
|
||||
)
|
||||
|
||||
@ -101,10 +101,10 @@ func QueryChannelConsensusState(
|
||||
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
req := &types.QueryChannelConsensusStateRequest{
|
||||
PortId: portID,
|
||||
ChannelId: channelID,
|
||||
VersionNumber: height.VersionNumber,
|
||||
VersionHeight: height.VersionHeight,
|
||||
PortId: portID,
|
||||
ChannelId: channelID,
|
||||
RevisionNumber: height.RevisionNumber,
|
||||
RevisionHeight: height.RevisionHeight,
|
||||
}
|
||||
|
||||
res, err := queryClient.ChannelConsensusState(context.Background(), req)
|
||||
|
||||
@ -31,6 +31,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) {
|
||||
for _, as := range gs.AckSequences {
|
||||
k.SetNextSequenceAck(ctx, as.PortId, as.ChannelId, as.Sequence)
|
||||
}
|
||||
k.SetNextChannelSequence(ctx, gs.NextChannelSequence)
|
||||
}
|
||||
|
||||
// ExportGenesis returns the ibc channel submodule's exported genesis.
|
||||
|
||||
@ -9,20 +9,20 @@ import (
|
||||
)
|
||||
|
||||
// HandleMsgChannelOpenInit defines the sdk.Handler for MsgChannelOpenInit
|
||||
func HandleMsgChannelOpenInit(ctx sdk.Context, k keeper.Keeper, portCap *capabilitytypes.Capability, msg *types.MsgChannelOpenInit) (*sdk.Result, *capabilitytypes.Capability, error) {
|
||||
capKey, err := k.ChanOpenInit(
|
||||
ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, msg.ChannelId,
|
||||
func HandleMsgChannelOpenInit(ctx sdk.Context, k keeper.Keeper, portCap *capabilitytypes.Capability, msg *types.MsgChannelOpenInit) (*sdk.Result, string, *capabilitytypes.Capability, error) {
|
||||
channelID, capKey, err := k.ChanOpenInit(
|
||||
ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId,
|
||||
portCap, msg.Channel.Counterparty, msg.Channel.Version,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, sdkerrors.Wrap(err, "channel handshake open init failed")
|
||||
return nil, "", nil, sdkerrors.Wrap(err, "channel handshake open init failed")
|
||||
}
|
||||
|
||||
ctx.EventManager().EmitEvents(sdk.Events{
|
||||
sdk.NewEvent(
|
||||
types.EventTypeChannelOpenInit,
|
||||
sdk.NewAttribute(types.AttributeKeyPortID, msg.PortId),
|
||||
sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelId),
|
||||
sdk.NewAttribute(types.AttributeKeyChannelID, channelID),
|
||||
sdk.NewAttribute(types.AttributeCounterpartyPortID, msg.Channel.Counterparty.PortId),
|
||||
sdk.NewAttribute(types.AttributeCounterpartyChannelID, msg.Channel.Counterparty.ChannelId),
|
||||
sdk.NewAttribute(types.AttributeKeyConnectionID, msg.Channel.ConnectionHops[0]),
|
||||
@ -35,23 +35,23 @@ func HandleMsgChannelOpenInit(ctx sdk.Context, k keeper.Keeper, portCap *capabil
|
||||
|
||||
return &sdk.Result{
|
||||
Events: ctx.EventManager().Events().ToABCIEvents(),
|
||||
}, capKey, nil
|
||||
}, channelID, capKey, nil
|
||||
}
|
||||
|
||||
// HandleMsgChannelOpenTry defines the sdk.Handler for MsgChannelOpenTry
|
||||
func HandleMsgChannelOpenTry(ctx sdk.Context, k keeper.Keeper, portCap *capabilitytypes.Capability, msg *types.MsgChannelOpenTry) (*sdk.Result, *capabilitytypes.Capability, error) {
|
||||
capKey, err := k.ChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, msg.DesiredChannelId, msg.CounterpartyChosenChannelId,
|
||||
func HandleMsgChannelOpenTry(ctx sdk.Context, k keeper.Keeper, portCap *capabilitytypes.Capability, msg *types.MsgChannelOpenTry) (*sdk.Result, string, *capabilitytypes.Capability, error) {
|
||||
channelID, capKey, err := k.ChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, msg.PreviousChannelId,
|
||||
portCap, msg.Channel.Counterparty, msg.Channel.Version, msg.CounterpartyVersion, msg.ProofInit, msg.ProofHeight,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, sdkerrors.Wrap(err, "channel handshake open try failed")
|
||||
return nil, "", nil, sdkerrors.Wrap(err, "channel handshake open try failed")
|
||||
}
|
||||
|
||||
ctx.EventManager().EmitEvents(sdk.Events{
|
||||
sdk.NewEvent(
|
||||
types.EventTypeChannelOpenTry,
|
||||
sdk.NewAttribute(types.AttributeKeyPortID, msg.PortId),
|
||||
sdk.NewAttribute(types.AttributeKeyChannelID, msg.DesiredChannelId),
|
||||
sdk.NewAttribute(types.AttributeKeyChannelID, channelID),
|
||||
sdk.NewAttribute(types.AttributeCounterpartyPortID, msg.Channel.Counterparty.PortId),
|
||||
sdk.NewAttribute(types.AttributeCounterpartyChannelID, msg.Channel.Counterparty.ChannelId),
|
||||
sdk.NewAttribute(types.AttributeKeyConnectionID, msg.Channel.ConnectionHops[0]),
|
||||
@ -64,7 +64,7 @@ func HandleMsgChannelOpenTry(ctx sdk.Context, k keeper.Keeper, portCap *capabili
|
||||
|
||||
return &sdk.Result{
|
||||
Events: ctx.EventManager().Events().ToABCIEvents(),
|
||||
}, capKey, nil
|
||||
}, channelID, capKey, nil
|
||||
}
|
||||
|
||||
// HandleMsgChannelOpenAck defines the sdk.Handler for MsgChannelOpenAck
|
||||
|
||||
@ -182,7 +182,7 @@ func (q Keeper) ChannelConsensusState(c context.Context, req *types.QueryChannel
|
||||
)
|
||||
}
|
||||
|
||||
consHeight := clienttypes.NewHeight(req.VersionNumber, req.VersionHeight)
|
||||
consHeight := clienttypes.NewHeight(req.RevisionNumber, req.RevisionHeight)
|
||||
consensusState, found := q.clientKeeper.GetClientConsensusState(ctx, connection.ClientId, consHeight)
|
||||
if !found {
|
||||
return nil, status.Error(
|
||||
|
||||
@ -439,8 +439,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
||||
req = &types.QueryChannelConsensusStateRequest{
|
||||
PortId: "",
|
||||
ChannelId: "test-channel-id",
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 1,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 1,
|
||||
}
|
||||
},
|
||||
false,
|
||||
@ -451,8 +451,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
||||
req = &types.QueryChannelConsensusStateRequest{
|
||||
PortId: "test-port-id",
|
||||
ChannelId: "",
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 1,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 1,
|
||||
}
|
||||
},
|
||||
false,
|
||||
@ -463,8 +463,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
||||
req = &types.QueryChannelConsensusStateRequest{
|
||||
PortId: "test-port-id",
|
||||
ChannelId: "test-channel-id",
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 1,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 1,
|
||||
}
|
||||
},
|
||||
false,
|
||||
@ -484,8 +484,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
||||
req = &types.QueryChannelConsensusStateRequest{
|
||||
PortId: channelA.PortID,
|
||||
ChannelId: channelA.ID,
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 1,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 1,
|
||||
}
|
||||
}, false,
|
||||
},
|
||||
@ -497,8 +497,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
||||
req = &types.QueryChannelConsensusStateRequest{
|
||||
PortId: channelA.PortID,
|
||||
ChannelId: channelA.ID,
|
||||
VersionNumber: 0,
|
||||
VersionHeight: uint64(suite.chainA.GetContext().BlockHeight()), // use current height
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: uint64(suite.chainA.GetContext().BlockHeight()), // use current height
|
||||
}
|
||||
}, false,
|
||||
},
|
||||
@ -518,8 +518,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
||||
req = &types.QueryChannelConsensusStateRequest{
|
||||
PortId: channelA.PortID,
|
||||
ChannelId: channelA.ID,
|
||||
VersionNumber: clientState.GetLatestHeight().GetVersionNumber(),
|
||||
VersionHeight: clientState.GetLatestHeight().GetVersionHeight(),
|
||||
RevisionNumber: clientState.GetLatestHeight().GetRevisionNumber(),
|
||||
RevisionHeight: clientState.GetLatestHeight().GetRevisionHeight(),
|
||||
}
|
||||
},
|
||||
true,
|
||||
|
||||
@ -34,30 +34,25 @@ func (k Keeper) CounterpartyHops(ctx sdk.Context, ch types.Channel) ([]string, b
|
||||
}
|
||||
|
||||
// ChanOpenInit is called by a module to initiate a channel opening handshake with
|
||||
// a module on another chain.
|
||||
// a module on another chain. The counterparty channel identifier is validated to be
|
||||
// empty in msg validation.
|
||||
func (k Keeper) ChanOpenInit(
|
||||
ctx sdk.Context,
|
||||
order types.Order,
|
||||
connectionHops []string,
|
||||
portID,
|
||||
channelID string,
|
||||
portID string,
|
||||
portCap *capabilitytypes.Capability,
|
||||
counterparty types.Counterparty,
|
||||
version string,
|
||||
) (*capabilitytypes.Capability, error) {
|
||||
// channel identifier and connection hop length checked on msg.ValidateBasic()
|
||||
_, found := k.GetChannel(ctx, portID, channelID)
|
||||
if found {
|
||||
return nil, sdkerrors.Wrapf(types.ErrChannelExists, "port ID (%s) channel ID (%s)", portID, channelID)
|
||||
}
|
||||
|
||||
) (string, *capabilitytypes.Capability, error) {
|
||||
// connection hop length checked on msg.ValidateBasic()
|
||||
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, connectionHops[0])
|
||||
if !found {
|
||||
return nil, sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, connectionHops[0])
|
||||
return "", nil, sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, connectionHops[0])
|
||||
}
|
||||
|
||||
if len(connectionEnd.GetVersions()) != 1 {
|
||||
return nil, sdkerrors.Wrapf(
|
||||
return "", nil, sdkerrors.Wrapf(
|
||||
connectiontypes.ErrInvalidVersion,
|
||||
"single version must be negotiated on connection before opening channel, got: %v",
|
||||
connectionEnd.GetVersions(),
|
||||
@ -65,7 +60,7 @@ func (k Keeper) ChanOpenInit(
|
||||
}
|
||||
|
||||
if !connectiontypes.VerifySupportedFeature(connectionEnd.GetVersions()[0], order.String()) {
|
||||
return nil, sdkerrors.Wrapf(
|
||||
return "", nil, sdkerrors.Wrapf(
|
||||
connectiontypes.ErrInvalidVersion,
|
||||
"connection version %s does not support channel ordering: %s",
|
||||
connectionEnd.GetVersions()[0], order.String(),
|
||||
@ -73,15 +68,16 @@ func (k Keeper) ChanOpenInit(
|
||||
}
|
||||
|
||||
if !k.portKeeper.Authenticate(ctx, portCap, portID) {
|
||||
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidPort, "caller does not own port capability for port ID %s", portID)
|
||||
return "", nil, sdkerrors.Wrapf(porttypes.ErrInvalidPort, "caller does not own port capability for port ID %s", portID)
|
||||
}
|
||||
|
||||
channelID := k.GenerateChannelIdentifier(ctx)
|
||||
channel := types.NewChannel(types.INIT, order, counterparty, connectionHops, version)
|
||||
k.SetChannel(ctx, portID, channelID, channel)
|
||||
|
||||
capKey, err := k.scopedKeeper.NewCapability(ctx, host.ChannelCapabilityPath(portID, channelID))
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrapf(err, "could not create channel capability for port ID %s and channel ID %s", portID, channelID)
|
||||
return "", nil, sdkerrors.Wrapf(err, "could not create channel capability for port ID %s and channel ID %s", portID, channelID)
|
||||
}
|
||||
|
||||
k.SetNextSequenceSend(ctx, portID, channelID, 1)
|
||||
@ -94,7 +90,7 @@ func (k Keeper) ChanOpenInit(
|
||||
telemetry.IncrCounter(1, "ibc", "channel", "open-init")
|
||||
}()
|
||||
|
||||
return capKey, nil
|
||||
return channelID, capKey, nil
|
||||
}
|
||||
|
||||
// ChanOpenTry is called by a module to accept the first step of a channel opening
|
||||
@ -104,44 +100,65 @@ func (k Keeper) ChanOpenTry(
|
||||
order types.Order,
|
||||
connectionHops []string,
|
||||
portID,
|
||||
desiredChannelID,
|
||||
counterpartyChosenChannelID string,
|
||||
previousChannelID string,
|
||||
portCap *capabilitytypes.Capability,
|
||||
counterparty types.Counterparty,
|
||||
version,
|
||||
counterpartyVersion string,
|
||||
proofInit []byte,
|
||||
proofHeight exported.Height,
|
||||
) (*capabilitytypes.Capability, error) {
|
||||
// channel identifier and connection hop length checked on msg.ValidateBasic()
|
||||
previousChannel, found := k.GetChannel(ctx, portID, desiredChannelID)
|
||||
if found && !(previousChannel.State == types.INIT &&
|
||||
previousChannel.Ordering == order &&
|
||||
previousChannel.Counterparty.PortId == counterparty.PortId &&
|
||||
previousChannel.Counterparty.ChannelId == counterparty.ChannelId &&
|
||||
previousChannel.ConnectionHops[0] == connectionHops[0] &&
|
||||
previousChannel.Version == version) {
|
||||
return nil, sdkerrors.Wrap(types.ErrInvalidChannel, "cannot relay connection attempt")
|
||||
) (string, *capabilitytypes.Capability, error) {
|
||||
var (
|
||||
previousChannel types.Channel
|
||||
previousChannelFound bool
|
||||
)
|
||||
|
||||
channelID := previousChannelID
|
||||
|
||||
// empty channel identifier indicates continuing a previous channel handshake
|
||||
if previousChannelID != "" {
|
||||
// channel identifier and connection hop length checked on msg.ValidateBasic()
|
||||
// ensure that the previous channel exists
|
||||
previousChannel, previousChannelFound = k.GetChannel(ctx, portID, previousChannelID)
|
||||
if !previousChannelFound {
|
||||
return "", nil, sdkerrors.Wrapf(types.ErrInvalidChannel, "previous channel does not exist for supplied previous channelID %s", previousChannelID)
|
||||
}
|
||||
// previous channel must use the same fields
|
||||
if !(previousChannel.Ordering == order &&
|
||||
previousChannel.Counterparty.PortId == counterparty.PortId &&
|
||||
previousChannel.Counterparty.ChannelId == "" &&
|
||||
previousChannel.ConnectionHops[0] == connectionHops[0] &&
|
||||
previousChannel.Version == version) {
|
||||
return "", nil, sdkerrors.Wrap(types.ErrInvalidChannel, "channel fields mismatch previous channel fields")
|
||||
}
|
||||
|
||||
if previousChannel.State != types.INIT {
|
||||
return "", nil, sdkerrors.Wrapf(types.ErrInvalidChannelState, "previous channel state is in %s, expected INIT", previousChannel.State)
|
||||
}
|
||||
|
||||
} else {
|
||||
// generate a new channel
|
||||
channelID = k.GenerateChannelIdentifier(ctx)
|
||||
}
|
||||
|
||||
if !k.portKeeper.Authenticate(ctx, portCap, portID) {
|
||||
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidPort, "caller does not own port capability for port ID %s", portID)
|
||||
return "", nil, sdkerrors.Wrapf(porttypes.ErrInvalidPort, "caller does not own port capability for port ID %s", portID)
|
||||
}
|
||||
|
||||
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, connectionHops[0])
|
||||
if !found {
|
||||
return nil, sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, connectionHops[0])
|
||||
return "", nil, sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, connectionHops[0])
|
||||
}
|
||||
|
||||
if connectionEnd.GetState() != int32(connectiontypes.OPEN) {
|
||||
return nil, sdkerrors.Wrapf(
|
||||
return "", nil, sdkerrors.Wrapf(
|
||||
connectiontypes.ErrInvalidConnectionState,
|
||||
"connection state is not OPEN (got %s)", connectiontypes.State(connectionEnd.GetState()).String(),
|
||||
)
|
||||
}
|
||||
|
||||
if len(connectionEnd.GetVersions()) != 1 {
|
||||
return nil, sdkerrors.Wrapf(
|
||||
return "", nil, sdkerrors.Wrapf(
|
||||
connectiontypes.ErrInvalidVersion,
|
||||
"single version must be negotiated on connection before opening channel, got: %v",
|
||||
connectionEnd.GetVersions(),
|
||||
@ -149,23 +166,13 @@ func (k Keeper) ChanOpenTry(
|
||||
}
|
||||
|
||||
if !connectiontypes.VerifySupportedFeature(connectionEnd.GetVersions()[0], order.String()) {
|
||||
return nil, sdkerrors.Wrapf(
|
||||
return "", nil, sdkerrors.Wrapf(
|
||||
connectiontypes.ErrInvalidVersion,
|
||||
"connection version %s does not support channel ordering: %s",
|
||||
connectionEnd.GetVersions()[0], order.String(),
|
||||
)
|
||||
}
|
||||
|
||||
// If the channel id chosen for this channel end by the counterparty is empty then
|
||||
// flexible channel identifier selection is allowed by using the desired channel id.
|
||||
// Otherwise the desiredChannelID must match the counterpartyChosenChannelID.
|
||||
if counterpartyChosenChannelID != "" && counterpartyChosenChannelID != desiredChannelID {
|
||||
return nil, sdkerrors.Wrapf(
|
||||
types.ErrInvalidChannelIdentifier,
|
||||
"counterparty chosen channel ID (%s) must be empty or equal to the desired channel ID (%s)", counterpartyChosenChannelID, desiredChannelID,
|
||||
)
|
||||
}
|
||||
|
||||
// NOTE: this step has been switched with the one below to reverse the connection
|
||||
// hops
|
||||
channel := types.NewChannel(types.TRYOPEN, order, counterparty, connectionHops, version)
|
||||
@ -178,7 +185,7 @@ func (k Keeper) ChanOpenTry(
|
||||
|
||||
// expectedCounterpaty is the counterparty of the counterparty's channel end
|
||||
// (i.e self)
|
||||
expectedCounterparty := types.NewCounterparty(portID, counterpartyChosenChannelID)
|
||||
expectedCounterparty := types.NewCounterparty(portID, "")
|
||||
expectedChannel := types.NewChannel(
|
||||
types.INIT, channel.Ordering, expectedCounterparty,
|
||||
counterpartyHops, counterpartyVersion,
|
||||
@ -188,7 +195,7 @@ func (k Keeper) ChanOpenTry(
|
||||
ctx, connectionEnd, proofHeight, proofInit,
|
||||
counterparty.PortId, counterparty.ChannelId, expectedChannel,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
var (
|
||||
@ -196,36 +203,34 @@ func (k Keeper) ChanOpenTry(
|
||||
err error
|
||||
)
|
||||
|
||||
// Only create a capability and set the sequences if the previous channel does not exist
|
||||
_, found = k.GetChannel(ctx, portID, desiredChannelID)
|
||||
if !found {
|
||||
capKey, err = k.scopedKeeper.NewCapability(ctx, host.ChannelCapabilityPath(portID, desiredChannelID))
|
||||
if !previousChannelFound {
|
||||
capKey, err = k.scopedKeeper.NewCapability(ctx, host.ChannelCapabilityPath(portID, channelID))
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrapf(err, "could not create channel capability for port ID %s and channel ID %s", portID, desiredChannelID)
|
||||
return "", nil, sdkerrors.Wrapf(err, "could not create channel capability for port ID %s and channel ID %s", portID, channelID)
|
||||
}
|
||||
|
||||
k.SetNextSequenceSend(ctx, portID, desiredChannelID, 1)
|
||||
k.SetNextSequenceRecv(ctx, portID, desiredChannelID, 1)
|
||||
k.SetNextSequenceAck(ctx, portID, desiredChannelID, 1)
|
||||
k.SetNextSequenceSend(ctx, portID, channelID, 1)
|
||||
k.SetNextSequenceRecv(ctx, portID, channelID, 1)
|
||||
k.SetNextSequenceAck(ctx, portID, channelID, 1)
|
||||
} else {
|
||||
// capability initialized in ChanOpenInit
|
||||
capKey, found = k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(portID, desiredChannelID))
|
||||
capKey, found = k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(portID, channelID))
|
||||
if !found {
|
||||
return nil, sdkerrors.Wrapf(types.ErrChannelCapabilityNotFound,
|
||||
"capability not found for existing channel, portID (%s) channelID (%s)", portID, desiredChannelID,
|
||||
return "", nil, sdkerrors.Wrapf(types.ErrChannelCapabilityNotFound,
|
||||
"capability not found for existing channel, portID (%s) channelID (%s)", portID, channelID,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
k.SetChannel(ctx, portID, desiredChannelID, channel)
|
||||
k.SetChannel(ctx, portID, channelID, channel)
|
||||
|
||||
k.Logger(ctx).Info("channel state updated", "port-id", portID, "channel-id", desiredChannelID, "previous-state", previousChannel.State.String(), "new-state", "TRYOPEN")
|
||||
k.Logger(ctx).Info("channel state updated", "port-id", portID, "channel-id", channelID, "previous-state", previousChannel.State.String(), "new-state", "TRYOPEN")
|
||||
|
||||
defer func() {
|
||||
telemetry.IncrCounter(1, "ibc", "channel", "open-try")
|
||||
}()
|
||||
|
||||
return capKey, nil
|
||||
return channelID, capKey, nil
|
||||
}
|
||||
|
||||
// ChanOpenAck is called by the handshake-originating module to acknowledge the
|
||||
@ -256,16 +261,6 @@ func (k Keeper) ChanOpenAck(
|
||||
return sdkerrors.Wrapf(types.ErrChannelCapabilityNotFound, "caller does not own capability for channel, port ID (%s) channel ID (%s)", portID, channelID)
|
||||
}
|
||||
|
||||
// If the previously set channel end allowed for the counterparty to select its own
|
||||
// channel identifier then we use the counterpartyChannelID. Otherwise the
|
||||
// counterpartyChannelID must match the previously set counterparty channel ID.
|
||||
if channel.Counterparty.ChannelId != "" && counterpartyChannelID != channel.Counterparty.ChannelId {
|
||||
return sdkerrors.Wrapf(
|
||||
types.ErrInvalidChannelIdentifier,
|
||||
"counterparty channel identifier (%s) must be equal to stored channel ID for counterparty (%s)", counterpartyChannelID, channel.Counterparty.ChannelId,
|
||||
)
|
||||
}
|
||||
|
||||
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])
|
||||
if !found {
|
||||
return sdkerrors.Wrap(connectiontypes.ErrConnectionNotFound, channel.ConnectionHops[0])
|
||||
|
||||
@ -34,8 +34,8 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||
{"success", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"}
|
||||
suite.chainA.CreatePortCapability(connA.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainA.GetPortCapability(connA.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
suite.chainA.CreatePortCapability(suite.chainA.NextTestChannel(connA, ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainA.GetPortCapability(suite.chainA.NextTestChannel(connA, ibctesting.MockPort).PortID)
|
||||
}, true},
|
||||
{"channel already exists", func() {
|
||||
_, _, connA, connB, _, _ = suite.coordinator.Setup(suite.chainA, suite.chainB, types.UNORDERED)
|
||||
@ -64,8 +64,8 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||
connA.ID, conn,
|
||||
)
|
||||
features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"}
|
||||
suite.chainA.CreatePortCapability(connA.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainA.GetPortCapability(connA.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
suite.chainA.CreatePortCapability(suite.chainA.NextTestChannel(connA, ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainA.GetPortCapability(suite.chainA.NextTestChannel(connA, ibctesting.MockPort).PortID)
|
||||
}, false},
|
||||
{"connection does not support ORDERED channels", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
@ -82,8 +82,8 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||
)
|
||||
// NOTE: Opening UNORDERED channels is still expected to pass but ORDERED channels should fail
|
||||
features = []string{"ORDER_UNORDERED"}
|
||||
suite.chainA.CreatePortCapability(connA.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainA.GetPortCapability(connA.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
suite.chainA.CreatePortCapability(suite.chainA.NextTestChannel(connA, ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainA.GetPortCapability(suite.chainA.NextTestChannel(connA, ibctesting.MockPort).PortID)
|
||||
}, true},
|
||||
}
|
||||
|
||||
@ -98,9 +98,9 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||
counterparty := types.NewCounterparty(connB.FirstOrNextTestChannel(ibctesting.MockPort).PortID, connB.FirstOrNextTestChannel(ibctesting.MockPort).ID)
|
||||
channelA := connA.FirstOrNextTestChannel(ibctesting.MockPort)
|
||||
|
||||
cap, err := suite.chainA.App.IBCKeeper.ChannelKeeper.ChanOpenInit(
|
||||
channelID, cap, err := suite.chainA.App.IBCKeeper.ChannelKeeper.ChanOpenInit(
|
||||
suite.chainA.GetContext(), order, []string{connA.ID},
|
||||
channelA.PortID, channelA.ID, portCap, counterparty, channelA.Version,
|
||||
channelA.PortID, portCap, counterparty, channelA.Version,
|
||||
)
|
||||
|
||||
// check if order is supported by channel to determine expected behaviour
|
||||
@ -116,6 +116,7 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||
if tc.expPass && orderSupported {
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().NotNil(cap)
|
||||
suite.Require().Equal(types.FormatChannelIdentifier(0), channelID)
|
||||
|
||||
chanCap, ok := suite.chainA.App.ScopedIBCKeeper.GetCapability(
|
||||
suite.chainA.GetContext(),
|
||||
@ -125,6 +126,8 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||
suite.Require().Equal(chanCap.String(), cap.String(), "channel capability is not correct")
|
||||
} else {
|
||||
suite.Require().Error(err)
|
||||
suite.Require().Nil(cap)
|
||||
suite.Require().Equal("", channelID)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -137,10 +140,11 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||
// ChanOpenTry can succeed.
|
||||
func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
var (
|
||||
connA *ibctesting.TestConnection
|
||||
connB *ibctesting.TestConnection
|
||||
portCap *capabilitytypes.Capability
|
||||
heightDiff uint64
|
||||
connA *ibctesting.TestConnection
|
||||
connB *ibctesting.TestConnection
|
||||
previousChannelID string
|
||||
portCap *capabilitytypes.Capability
|
||||
heightDiff uint64
|
||||
)
|
||||
|
||||
testCases := []testCase{
|
||||
@ -148,34 +152,16 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
|
||||
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
suite.chainB.CreatePortCapability(suite.chainB.NextTestChannel(connB, ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainB.GetPortCapability(suite.chainB.NextTestChannel(connB, ibctesting.MockPort).PortID)
|
||||
}, true},
|
||||
{"success with crossing hello", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
suite.coordinator.ChanOpenInitOnBothChains(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
|
||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
}, true},
|
||||
{"success with empty counterparty chosen channel id", func() {
|
||||
var clientA, clientB string
|
||||
clientA, clientB, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
_, channelB, err := suite.coordinator.ChanOpenInitOnBothChains(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// set the channel's counterparty channel identifier to empty string
|
||||
channel := suite.chainA.GetChannel(channelA)
|
||||
channel.Counterparty.ChannelId = ""
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID, channel)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
previousChannelID = channelB.ID
|
||||
portCap = suite.chainB.GetPortCapability(suite.chainB.NextTestChannel(connB, ibctesting.MockPort).PortID)
|
||||
}, true},
|
||||
{"previous channel with invalid state", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
@ -206,28 +192,15 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
|
||||
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
suite.chainB.CreatePortCapability(suite.chainB.NextTestChannel(connB, ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainB.GetPortCapability(suite.chainB.NextTestChannel(connB, ibctesting.MockPort).PortID)
|
||||
|
||||
heightDiff = 3 // consensus state doesn't exist at this height
|
||||
}, false},
|
||||
{"counterparty chosen channel id does not match desired channel id", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// set the channel's counterparty channel identifier to empty string
|
||||
channel := suite.chainA.GetChannel(channelA)
|
||||
channel.Counterparty.ChannelId = "otherchannel"
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID, channel)
|
||||
|
||||
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
}, false},
|
||||
{"channel verification failed", func() {
|
||||
// not creating a channel on chainA will result in an invalid proof of existence
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainB.GetPortCapability(suite.chainB.NextTestChannel(connB, ibctesting.MockPort).PortID)
|
||||
}, false},
|
||||
{"port capability not found", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
@ -249,8 +222,8 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
suite.chainB.GetContext(),
|
||||
connB.ID, conn,
|
||||
)
|
||||
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
suite.chainB.CreatePortCapability(suite.chainB.NextTestChannel(connB, ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainB.GetPortCapability(suite.chainB.NextTestChannel(connB, ibctesting.MockPort).PortID)
|
||||
}, false},
|
||||
{"connection does not support ORDERED channels", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
@ -266,8 +239,8 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
suite.chainA.GetContext(),
|
||||
connA.ID, conn,
|
||||
)
|
||||
suite.chainA.CreatePortCapability(connA.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainA.GetPortCapability(connA.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
suite.chainA.CreatePortCapability(suite.chainA.NextTestChannel(connA, ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainA.GetPortCapability(suite.chainA.NextTestChannel(connA, ibctesting.MockPort).PortID)
|
||||
}, false},
|
||||
}
|
||||
|
||||
@ -276,25 +249,19 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
suite.SetupTest() // reset
|
||||
heightDiff = 0 // must be explicitly changed in malleate
|
||||
previousChannelID = ""
|
||||
|
||||
tc.malleate()
|
||||
channelA := connA.FirstOrNextTestChannel(ibctesting.MockPort)
|
||||
channelB := connB.FirstOrNextTestChannel(ibctesting.MockPort)
|
||||
counterparty := types.NewCounterparty(channelA.PortID, channelA.ID)
|
||||
|
||||
// get counterpartyChosenChannelID
|
||||
var counterpartyChosenChannelID string
|
||||
channel, found := suite.chainA.App.IBCKeeper.ChannelKeeper.GetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID)
|
||||
if found {
|
||||
counterpartyChosenChannelID = channel.Counterparty.ChannelId
|
||||
}
|
||||
|
||||
channelKey := host.ChannelKey(counterparty.PortId, counterparty.ChannelId)
|
||||
proof, proofHeight := suite.chainA.QueryProof(channelKey)
|
||||
|
||||
cap, err := suite.chainB.App.IBCKeeper.ChannelKeeper.ChanOpenTry(
|
||||
channelID, cap, err := suite.chainB.App.IBCKeeper.ChannelKeeper.ChanOpenTry(
|
||||
suite.chainB.GetContext(), types.ORDERED, []string{connB.ID},
|
||||
channelB.PortID, channelB.ID, counterpartyChosenChannelID, portCap, counterparty, channelB.Version, connA.FirstOrNextTestChannel(ibctesting.MockPort).Version,
|
||||
channelB.PortID, previousChannelID, portCap, counterparty, channelB.Version, connA.FirstOrNextTestChannel(ibctesting.MockPort).Version,
|
||||
proof, malleateHeight(proofHeight, heightDiff),
|
||||
)
|
||||
|
||||
@ -304,7 +271,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
|
||||
chanCap, ok := suite.chainB.App.ScopedIBCKeeper.GetCapability(
|
||||
suite.chainB.GetContext(),
|
||||
host.ChannelCapabilityPath(channelB.PortID, channelB.ID),
|
||||
host.ChannelCapabilityPath(channelB.PortID, channelID),
|
||||
)
|
||||
suite.Require().True(ok, "could not retrieve channel capapbility after successful ChanOpenTry")
|
||||
suite.Require().Equal(chanCap.String(), cap.String(), "channel capability is not correct")
|
||||
@ -802,5 +769,5 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() {
|
||||
}
|
||||
|
||||
func malleateHeight(height exported.Height, diff uint64) exported.Height {
|
||||
return clienttypes.NewHeight(height.GetVersionNumber(), height.GetVersionHeight()+diff)
|
||||
return clienttypes.NewHeight(height.GetRevisionNumber(), height.GetRevisionHeight()+diff)
|
||||
}
|
||||
|
||||
@ -55,6 +55,16 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
||||
return ctx.Logger().With("module", fmt.Sprintf("x/%s/%s", host.ModuleName, types.SubModuleName))
|
||||
}
|
||||
|
||||
// GenerateChannelIdentifier returns the next channel identifier.
|
||||
func (k Keeper) GenerateChannelIdentifier(ctx sdk.Context) string {
|
||||
nextChannelSeq := k.GetNextChannelSequence(ctx)
|
||||
channelID := types.FormatChannelIdentifier(nextChannelSeq)
|
||||
|
||||
nextChannelSeq++
|
||||
k.SetNextChannelSequence(ctx, nextChannelSeq)
|
||||
return channelID
|
||||
}
|
||||
|
||||
// GetChannel returns a channel with a particular identifier binded to a specific port
|
||||
func (k Keeper) GetChannel(ctx sdk.Context, portID, channelID string) (types.Channel, bool) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
@ -75,6 +85,24 @@ func (k Keeper) SetChannel(ctx sdk.Context, portID, channelID string, channel ty
|
||||
store.Set(host.ChannelKey(portID, channelID), bz)
|
||||
}
|
||||
|
||||
// GetNextChannelSequence gets the next channel sequence from the store.
|
||||
func (k Keeper) GetNextChannelSequence(ctx sdk.Context) uint64 {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
bz := store.Get([]byte(types.KeyNextChannelSequence))
|
||||
if bz == nil {
|
||||
panic("next channel sequence is nil")
|
||||
}
|
||||
|
||||
return sdk.BigEndianToUint64(bz)
|
||||
}
|
||||
|
||||
// SetNextChannelSequence sets the next channel sequence to the store.
|
||||
func (k Keeper) SetNextChannelSequence(ctx sdk.Context, sequence uint64) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
bz := sdk.Uint64ToBigEndian(sequence)
|
||||
store.Set([]byte(types.KeyNextChannelSequence), bz)
|
||||
}
|
||||
|
||||
// GetNextSequenceSend gets a channel's next send sequence from the store
|
||||
func (k Keeper) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
|
||||
@ -42,8 +42,8 @@ func (suite *KeeperTestSuite) TestSetChannel() {
|
||||
// create client and connections on both chains
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
// check for channel to be created on chainB
|
||||
channelA := connA.NextTestChannel(ibctesting.MockPort)
|
||||
// check for channel to be created on chainA
|
||||
channelA := suite.chainA.NextTestChannel(connA, ibctesting.MockPort)
|
||||
_, found := suite.chainA.App.IBCKeeper.ChannelKeeper.GetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID)
|
||||
suite.False(found)
|
||||
|
||||
@ -52,7 +52,8 @@ func (suite *KeeperTestSuite) TestSetChannel() {
|
||||
suite.NoError(err)
|
||||
|
||||
storedChannel, found := suite.chainA.App.IBCKeeper.ChannelKeeper.GetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID)
|
||||
expectedCounterparty := types.NewCounterparty(channelB.PortID, channelB.ID)
|
||||
// counterparty channel id is empty after open init
|
||||
expectedCounterparty := types.NewCounterparty(channelB.PortID, "")
|
||||
|
||||
suite.True(found)
|
||||
suite.Equal(types.INIT, storedChannel.State)
|
||||
@ -83,9 +84,10 @@ func (suite KeeperTestSuite) TestGetAllChannels() {
|
||||
testchannel2, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA1, connB1, ibctesting.MockPort, ibctesting.MockPort, types.UNORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// counterparty channel id is empty after open init
|
||||
counterparty2 := types.Counterparty{
|
||||
PortId: connB1.Channels[0].PortID,
|
||||
ChannelId: connB1.Channels[0].ID,
|
||||
ChannelId: "",
|
||||
}
|
||||
|
||||
channel0 := types.NewChannel(
|
||||
|
||||
@ -148,8 +148,8 @@ func (suite *KeeperTestSuite) TestSendPacket() {
|
||||
}, false},
|
||||
{"next sequence send not found", func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
||||
channelA := suite.chainA.NextTestChannel(connA, ibctesting.TransferPort)
|
||||
channelB := suite.chainB.NextTestChannel(connB, ibctesting.TransferPort)
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
|
||||
// manually creating channel prevents next sequence from being set
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(
|
||||
@ -298,8 +298,8 @@ func (suite *KeeperTestSuite) TestRecvPacket() {
|
||||
connB, connA, err := suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
||||
channelA := suite.chainA.NextTestChannel(connA, ibctesting.TransferPort)
|
||||
channelB := suite.chainB.NextTestChannel(connB, ibctesting.TransferPort)
|
||||
// pass channel check
|
||||
suite.chainB.App.IBCKeeper.ChannelKeeper.SetChannel(
|
||||
suite.chainB.GetContext(),
|
||||
@ -322,8 +322,8 @@ func (suite *KeeperTestSuite) TestRecvPacket() {
|
||||
}, false},
|
||||
{"next receive sequence is not found", func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
||||
channelA := suite.chainA.NextTestChannel(connA, ibctesting.TransferPort)
|
||||
channelB := suite.chainB.NextTestChannel(connB, ibctesting.TransferPort)
|
||||
|
||||
// manually creating channel prevents next recv sequence from being set
|
||||
suite.chainB.App.IBCKeeper.ChannelKeeper.SetChannel(
|
||||
@ -570,8 +570,8 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() {
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
||||
channelA := suite.chainA.NextTestChannel(connA, ibctesting.TransferPort)
|
||||
channelB := suite.chainB.NextTestChannel(connB, ibctesting.TransferPort)
|
||||
// pass channel check
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(
|
||||
suite.chainA.GetContext(),
|
||||
@ -599,8 +599,8 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() {
|
||||
}, false},
|
||||
{"next ack sequence not found", func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
||||
channelA := suite.chainA.NextTestChannel(connA, ibctesting.TransferPort)
|
||||
channelB := suite.chainB.NextTestChannel(connB, ibctesting.TransferPort)
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
|
||||
// manually creating channel prevents next sequence acknowledgement from being set
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(
|
||||
|
||||
@ -44,28 +44,30 @@ func (ps PacketSequence) Validate() error {
|
||||
// NewGenesisState creates a GenesisState instance.
|
||||
func NewGenesisState(
|
||||
channels []IdentifiedChannel, acks, receipts, commitments []PacketState,
|
||||
sendSeqs, recvSeqs, ackSeqs []PacketSequence,
|
||||
sendSeqs, recvSeqs, ackSeqs []PacketSequence, nextChannelSequence uint64,
|
||||
) GenesisState {
|
||||
return GenesisState{
|
||||
Channels: channels,
|
||||
Acknowledgements: acks,
|
||||
Commitments: commitments,
|
||||
SendSequences: sendSeqs,
|
||||
RecvSequences: recvSeqs,
|
||||
AckSequences: ackSeqs,
|
||||
Channels: channels,
|
||||
Acknowledgements: acks,
|
||||
Commitments: commitments,
|
||||
SendSequences: sendSeqs,
|
||||
RecvSequences: recvSeqs,
|
||||
AckSequences: ackSeqs,
|
||||
NextChannelSequence: nextChannelSequence,
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultGenesisState returns the ibc channel submodule's default genesis state.
|
||||
func DefaultGenesisState() GenesisState {
|
||||
return GenesisState{
|
||||
Channels: []IdentifiedChannel{},
|
||||
Acknowledgements: []PacketState{},
|
||||
Receipts: []PacketState{},
|
||||
Commitments: []PacketState{},
|
||||
SendSequences: []PacketSequence{},
|
||||
RecvSequences: []PacketSequence{},
|
||||
AckSequences: []PacketSequence{},
|
||||
Channels: []IdentifiedChannel{},
|
||||
Acknowledgements: []PacketState{},
|
||||
Receipts: []PacketState{},
|
||||
Commitments: []PacketState{},
|
||||
SendSequences: []PacketSequence{},
|
||||
RecvSequences: []PacketSequence{},
|
||||
AckSequences: []PacketSequence{},
|
||||
NextChannelSequence: 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -32,6 +32,8 @@ type GenesisState struct {
|
||||
SendSequences []PacketSequence `protobuf:"bytes,5,rep,name=send_sequences,json=sendSequences,proto3" json:"send_sequences" yaml:"send_sequences"`
|
||||
RecvSequences []PacketSequence `protobuf:"bytes,6,rep,name=recv_sequences,json=recvSequences,proto3" json:"recv_sequences" yaml:"recv_sequences"`
|
||||
AckSequences []PacketSequence `protobuf:"bytes,7,rep,name=ack_sequences,json=ackSequences,proto3" json:"ack_sequences" yaml:"ack_sequences"`
|
||||
// the sequence for the next generated channel identifier
|
||||
NextChannelSequence uint64 `protobuf:"varint,8,opt,name=next_channel_sequence,json=nextChannelSequence,proto3" json:"next_channel_sequence,omitempty" yaml:"next_channel_sequence"`
|
||||
}
|
||||
|
||||
func (m *GenesisState) Reset() { *m = GenesisState{} }
|
||||
@ -116,6 +118,13 @@ func (m *GenesisState) GetAckSequences() []PacketSequence {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GenesisState) GetNextChannelSequence() uint64 {
|
||||
if m != nil {
|
||||
return m.NextChannelSequence
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// PacketSequence defines the genesis type necessary to retrieve and store
|
||||
// next send and receive sequences.
|
||||
type PacketSequence struct {
|
||||
@ -186,37 +195,39 @@ func init() {
|
||||
func init() { proto.RegisterFile("ibc/core/channel/v1/genesis.proto", fileDescriptor_cb06ec201f452595) }
|
||||
|
||||
var fileDescriptor_cb06ec201f452595 = []byte{
|
||||
// 471 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x31, 0x6f, 0xd3, 0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 0x09, 0xba, 0x17,
|
||||
0xd0, 0x38, 0xe5, 0x5f, 0x46, 0x10, 0x46, 0x90, 0x40, 0x2a, 0x85, 0xb9, 0xa5, 0x34, 0xbd, 0xb5,
|
||||
0x9a, 0xf7, 0x01, 0x8d, 0x41, 0xaa, 0xd5, 0xfc, 0x46, 0x21, 0x20, 0x77, 0xe6, 0xf1, 0x3b, 0xb4,
|
||||
0x47, 0x79, 0x92, 0x30, 0x59, 0xe2, 0xea, 0x1b, 0xe1, 0x96, 0x47, 0xb1, 0x8f, 0x5a, 0x19, 0x50,
|
||||
0x60, 0x63, 0x29, 0xcc, 0xc6, 0x46, 0x98, 0x6a, 0x0e, 0x33, 0xd4, 0x11, 0x90, 0x86, 0x67, 0x02,
|
||||
0x3e, 0x5f, 0x42, 0x4a, 0x41, 0x98, 0xdb, 0x8a, 0xf4, 0xe4, 0x6f, 0x24, 0x9d, 0xf5, 0x1f, 0x15,
|
||||
0xb0, 0x79, 0x6e, 0x1f, 0x5d, 0x05, 0xc9, 0xe8, 0xb5, 0xb3, 0x0a, 0x72, 0x48, 0xbb, 0x28, 0x2c,
|
||||
0xc2, 0x4a, 0x95, 0x01, 0x9d, 0x2c, 0xa9, 0x9a, 0xff, 0xad, 0x5a, 0x05, 0x39, 0xa4, 0x5d, 0x14,
|
||||
0x6e, 0x55, 0xe7, 0xa8, 0x1d, 0xd0, 0x78, 0xc9, 0xb4, 0xf3, 0xef, 0xa6, 0x87, 0xda, 0x74, 0x58,
|
||||
0x9a, 0x56, 0x38, 0x0e, 0xd9, 0x0f, 0x68, 0x5c, 0x79, 0x9c, 0xef, 0x06, 0xea, 0xac, 0x8e, 0xe3,
|
||||
0x67, 0x68, 0x67, 0xcc, 0x33, 0x79, 0xc6, 0x42, 0xd3, 0xe8, 0x19, 0xfd, 0x5d, 0x1f, 0xcf, 0x73,
|
||||
0xbb, 0x53, 0xb2, 0x74, 0xc3, 0x21, 0xcd, 0xe2, 0x6f, 0x10, 0xe2, 0x53, 0x84, 0xf4, 0x22, 0x45,
|
||||
0x7e, 0x4b, 0xe5, 0x8f, 0xe6, 0xb9, 0x7d, 0x50, 0xe6, 0x6f, 0x7b, 0x0e, 0xd9, 0xd5, 0x8f, 0x41,
|
||||
0x88, 0xbb, 0xa8, 0xb5, 0xd8, 0xc8, 0xac, 0xf7, 0x8c, 0x7e, 0x83, 0x54, 0x6f, 0x9f, 0x5c, 0x4f,
|
||||
0x2d, 0xe3, 0x66, 0x6a, 0x19, 0xbf, 0xa6, 0x96, 0xf1, 0x63, 0x66, 0xd5, 0x6e, 0x66, 0x56, 0xed,
|
||||
0xe7, 0xcc, 0xaa, 0x7d, 0x7c, 0x15, 0x31, 0x79, 0x71, 0x39, 0x74, 0x29, 0x4f, 0x3c, 0xca, 0x45,
|
||||
0xc2, 0x85, 0xfe, 0x1c, 0x8b, 0x30, 0xf6, 0xbe, 0x7a, 0xd5, 0xf5, 0x3d, 0x3f, 0x3d, 0x5e, 0x1c,
|
||||
0xa0, 0xbc, 0x1a, 0x83, 0x18, 0x36, 0xd5, 0xf1, 0xbd, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0x70,
|
||||
0xac, 0x09, 0x09, 0xef, 0x03, 0x00, 0x00,
|
||||
// 501 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xcf, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0x87, 0xe3, 0x26, 0x4d, 0xd3, 0x6d, 0x13, 0xd1, 0x6d, 0x23, 0x99, 0xa8, 0xd8, 0xc6, 0x48,
|
||||
0x28, 0x12, 0xaa, 0x4d, 0xa1, 0x07, 0xc4, 0xd1, 0x1c, 0x20, 0x37, 0xb4, 0x70, 0x42, 0x42, 0x91,
|
||||
0xb3, 0x9e, 0xba, 0x2b, 0xc7, 0xde, 0xe0, 0xdd, 0x86, 0xf6, 0x29, 0xe0, 0xb1, 0x7a, 0x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0xa0, 0x56, 0x0c, 0x14,
|
||||
0xd8, 0x44, 0x0a, 0xb5, 0x71, 0x2f, 0x4c, 0x35, 0x87, 0x19, 0xea, 0x08, 0x88, 0xbc, 0xa1, 0x80,
|
||||
0x6f, 0x97, 0x10, 0x51, 0x10, 0xea, 0x76, 0x46, 0x7a, 0xf6, 0x2f, 0x52, 0x91, 0x75, 0x9e, 0xa4,
|
||||
0xb0, 0x45, 0xa2, 0x77, 0xaf, 0xdd, 0x70, 0xfc, 0xd6, 0x5c, 0x07, 0x99, 0xa4, 0x9d, 0x16, 0xca,
|
||||
0x70, 0xa6, 0x8a, 0x81, 0x4e, 0x57, 0x54, 0xcd, 0x07, 0xab, 0xd6, 0x41, 0x26, 0x69, 0xa7, 0x85,
|
||||
0xa5, 0xea, 0x1c, 0xb5, 0x5d, 0x1a, 0xac, 0x98, 0x76, 0xfe, 0xdf, 0x74, 0x5c, 0x98, 0x8e, 0x72,
|
||||
0xd3, 0x1a, 0xc7, 0x24, 0xfb, 0x2e, 0x0d, 0x96, 0x9e, 0xcf, 0xa8, 0x1b, 0xc1, 0x95, 0x1c, 0x16,
|
||||
0xb4, 0x2a, 0xa8, 0xb6, 0x0c, 0xa5, 0xdf, 0x70, 0x8c, 0x45, 0xa2, 0x1f, 0xe7, 0x98, 0x8d, 0x31,
|
||||
0x93, 0x1c, 0xa6, 0xf5, 0xe2, 0xbf, 0x2b, 0xb1, 0xe6, 0x0f, 0x05, 0x75, 0xd6, 0x97, 0xc2, 0x2f,
|
||||
0xd0, 0xce, 0x84, 0xc7, 0x72, 0xc8, 0x3c, 0x55, 0x31, 0x94, 0xfe, 0xae, 0x83, 0x17, 0x89, 0xde,
|
||||
0xc9, 0xd1, 0x45, 0xc3, 0x24, 0xcd, 0xf4, 0x34, 0xf0, 0xf0, 0x19, 0x42, 0xa5, 0x89, 0x79, 0xea,
|
||||
0x56, 0x96, 0xef, 0x2e, 0x12, 0xfd, 0x20, 0xcf, 0x2f, 0x7b, 0x26, 0xd9, 0x2d, 0x2e, 0x03, 0x0f,
|
||||
0xf7, 0x50, 0xab, 0x5a, 0xbf, 0x9e, 0xae, 0x4f, 0xaa, 0xbb, 0x43, 0x6e, 0x66, 0x9a, 0x72, 0x3b,
|
||||
0xd3, 0x94, 0xdf, 0x33, 0x4d, 0xf9, 0x39, 0xd7, 0x6a, 0xb7, 0x73, 0xad, 0xf6, 0x6b, 0xae, 0xd5,
|
||||
0xbe, 0xbc, 0xf1, 0x99, 0xbc, 0xb8, 0x1c, 0x59, 0x94, 0x87, 0x36, 0xe5, 0x22, 0xe4, 0xa2, 0xf8,
|
||||
0x9c, 0x08, 0x2f, 0xb0, 0xaf, 0xec, 0xea, 0x4d, 0xbf, 0x3c, 0x3b, 0x29, 0x9f, 0xb5, 0xbc, 0x9e,
|
||||
0x80, 0x18, 0x35, 0xb3, 0x27, 0xfd, 0xfa, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x42, 0xc2,
|
||||
0x18, 0x45, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
||||
@ -239,6 +250,11 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.NextChannelSequence != 0 {
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(m.NextChannelSequence))
|
||||
i--
|
||||
dAtA[i] = 0x40
|
||||
}
|
||||
if len(m.AckSequences) > 0 {
|
||||
for iNdEx := len(m.AckSequences) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
@ -441,6 +457,9 @@ func (m *GenesisState) Size() (n int) {
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.NextChannelSequence != 0 {
|
||||
n += 1 + sovGenesis(uint64(m.NextChannelSequence))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
@ -737,6 +756,25 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 8:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field NextChannelSequence", wireType)
|
||||
}
|
||||
m.NextChannelSequence = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.NextChannelSequence |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenesis(dAtA[iNdEx:])
|
||||
|
||||
@ -66,6 +66,7 @@ func TestValidateGenesis(t *testing.T) {
|
||||
[]types.PacketSequence{
|
||||
types.NewPacketSequence(testPort2, testChannel2, 1),
|
||||
},
|
||||
0,
|
||||
),
|
||||
expPass: true,
|
||||
},
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
// SubModuleName defines the IBC channels name
|
||||
SubModuleName = "channel"
|
||||
@ -12,4 +20,40 @@ const (
|
||||
|
||||
// QuerierRoute is the querier route for IBC channels
|
||||
QuerierRoute = SubModuleName
|
||||
|
||||
// KeyNextChannelSequence is the key used to store the next channel sequence in
|
||||
// the keeper.
|
||||
KeyNextChannelSequence = "nextChannelSequence"
|
||||
|
||||
// ChannelPrefix is the prefix used when creating a channel identifier
|
||||
ChannelPrefix = "channel-"
|
||||
)
|
||||
|
||||
// FormatChannelIdentifier returns the channel identifier with the sequence appended.
|
||||
func FormatChannelIdentifier(sequence uint64) string {
|
||||
return fmt.Sprintf("%s%d", ChannelPrefix, sequence)
|
||||
}
|
||||
|
||||
// IsValidChannelID return true if the channel identifier is valid.
|
||||
func IsValidChannelID(channelID string) bool {
|
||||
_, err := ParseChannelSequence(channelID)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// ParseChannelSequence parses the channel sequence from the channel identifier.
|
||||
func ParseChannelSequence(channelID string) (uint64, error) {
|
||||
if !strings.HasPrefix(channelID, ChannelPrefix) {
|
||||
return 0, sdkerrors.Wrapf(ErrInvalidChannelIdentifier, "doesn't contain prefix `%s`", ChannelPrefix)
|
||||
}
|
||||
|
||||
splitStr := strings.Split(channelID, ChannelPrefix)
|
||||
if len(splitStr) != 2 {
|
||||
return 0, sdkerrors.Wrap(ErrInvalidChannelIdentifier, "channel identifier must be in format: `channel-{N}`")
|
||||
}
|
||||
|
||||
sequence, err := strconv.ParseUint(splitStr[1], 10, 64)
|
||||
if err != nil {
|
||||
return 0, sdkerrors.Wrap(err, "failed to parse channel identifier sequence")
|
||||
}
|
||||
return sequence, nil
|
||||
}
|
||||
|
||||
44
x/ibc/core/04-channel/types/keys_test.go
Normal file
44
x/ibc/core/04-channel/types/keys_test.go
Normal file
@ -0,0 +1,44 @@
|
||||
package types_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// tests ParseChannelSequence and IsValidChannelID
|
||||
func TestParseChannelSequence(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
channelID string
|
||||
expSeq uint64
|
||||
expPass bool
|
||||
}{
|
||||
{"valid 0", "channel-0", 0, true},
|
||||
{"valid 1", "channel-1", 1, true},
|
||||
{"valid large sequence", "channel-234568219356718293", 234568219356718293, true},
|
||||
// uint64 == 20 characters
|
||||
{"invalid large sequence", "channel-2345682193567182931243", 0, false},
|
||||
{"capital prefix", "Channel-0", 0, false},
|
||||
{"missing dash", "channel0", 0, false},
|
||||
{"blank id", " ", 0, false},
|
||||
{"empty id", "", 0, false},
|
||||
{"negative sequence", "channel--1", 0, false},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
seq, err := types.ParseChannelSequence(tc.channelID)
|
||||
valid := types.IsValidChannelID(tc.channelID)
|
||||
require.Equal(t, tc.expSeq, seq)
|
||||
|
||||
if tc.expPass {
|
||||
require.NoError(t, err, tc.name)
|
||||
require.True(t, valid)
|
||||
} else {
|
||||
require.Error(t, err, tc.name)
|
||||
require.False(t, valid)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,19 +12,19 @@ import (
|
||||
|
||||
var _ sdk.Msg = &MsgChannelOpenInit{}
|
||||
|
||||
// NewMsgChannelOpenInit creates a new MsgChannelOpenInit
|
||||
// NewMsgChannelOpenInit creates a new MsgChannelOpenInit. It sets the counterparty channel
|
||||
// identifier to be empty.
|
||||
// nolint:interfacer
|
||||
func NewMsgChannelOpenInit(
|
||||
portID, channelID string, version string, channelOrder Order, connectionHops []string,
|
||||
counterpartyPortID, counterpartyChannelID string, signer sdk.AccAddress,
|
||||
portID, version string, channelOrder Order, connectionHops []string,
|
||||
counterpartyPortID string, signer sdk.AccAddress,
|
||||
) *MsgChannelOpenInit {
|
||||
counterparty := NewCounterparty(counterpartyPortID, counterpartyChannelID)
|
||||
counterparty := NewCounterparty(counterpartyPortID, "")
|
||||
channel := NewChannel(INIT, channelOrder, counterparty, connectionHops, version)
|
||||
return &MsgChannelOpenInit{
|
||||
PortId: portID,
|
||||
ChannelId: channelID,
|
||||
Channel: channel,
|
||||
Signer: signer.String(),
|
||||
PortId: portID,
|
||||
Channel: channel,
|
||||
Signer: signer.String(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,15 +43,15 @@ func (msg MsgChannelOpenInit) ValidateBasic() error {
|
||||
if err := host.PortIdentifierValidator(msg.PortId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid port ID")
|
||||
}
|
||||
if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid channel ID")
|
||||
}
|
||||
if msg.Channel.State != INIT {
|
||||
return sdkerrors.Wrapf(ErrInvalidChannelState,
|
||||
"channel state must be INIT in MsgChannelOpenInit. expected: %s, got: %s",
|
||||
INIT, msg.Channel.State,
|
||||
)
|
||||
}
|
||||
if msg.Channel.Counterparty.ChannelId != "" {
|
||||
return sdkerrors.Wrap(ErrInvalidCounterparty, "counterparty channel identifier must be empty")
|
||||
}
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err)
|
||||
@ -79,21 +79,20 @@ var _ sdk.Msg = &MsgChannelOpenTry{}
|
||||
// NewMsgChannelOpenTry creates a new MsgChannelOpenTry instance
|
||||
// nolint:interfacer
|
||||
func NewMsgChannelOpenTry(
|
||||
portID, desiredChannelID, counterpartyChosenChannelID, version string, channelOrder Order, connectionHops []string,
|
||||
portID, previousChannelID, version string, channelOrder Order, connectionHops []string,
|
||||
counterpartyPortID, counterpartyChannelID, counterpartyVersion string,
|
||||
proofInit []byte, proofHeight clienttypes.Height, signer sdk.AccAddress,
|
||||
) *MsgChannelOpenTry {
|
||||
counterparty := NewCounterparty(counterpartyPortID, counterpartyChannelID)
|
||||
channel := NewChannel(TRYOPEN, channelOrder, counterparty, connectionHops, version)
|
||||
return &MsgChannelOpenTry{
|
||||
PortId: portID,
|
||||
DesiredChannelId: desiredChannelID,
|
||||
CounterpartyChosenChannelId: counterpartyChosenChannelID,
|
||||
Channel: channel,
|
||||
CounterpartyVersion: counterpartyVersion,
|
||||
ProofInit: proofInit,
|
||||
ProofHeight: proofHeight,
|
||||
Signer: signer.String(),
|
||||
PortId: portID,
|
||||
PreviousChannelId: previousChannelID,
|
||||
Channel: channel,
|
||||
CounterpartyVersion: counterpartyVersion,
|
||||
ProofInit: proofInit,
|
||||
ProofHeight: proofHeight,
|
||||
Signer: signer.String(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,11 +111,10 @@ func (msg MsgChannelOpenTry) ValidateBasic() error {
|
||||
if err := host.PortIdentifierValidator(msg.PortId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid port ID")
|
||||
}
|
||||
if err := host.ChannelIdentifierValidator(msg.DesiredChannelId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid desired channel ID")
|
||||
}
|
||||
if msg.CounterpartyChosenChannelId != "" && msg.CounterpartyChosenChannelId != msg.DesiredChannelId {
|
||||
return sdkerrors.Wrap(ErrInvalidChannelIdentifier, "counterparty chosen channel ID must be empty or equal to desired channel ID")
|
||||
if msg.PreviousChannelId != "" {
|
||||
if !IsValidChannelID(msg.PreviousChannelId) {
|
||||
return sdkerrors.Wrap(ErrInvalidChannelIdentifier, "invalid previous channel ID")
|
||||
}
|
||||
}
|
||||
if len(msg.ProofInit) == 0 {
|
||||
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof init")
|
||||
@ -130,6 +128,11 @@ func (msg MsgChannelOpenTry) ValidateBasic() error {
|
||||
TRYOPEN, msg.Channel.State,
|
||||
)
|
||||
}
|
||||
// counterparty validate basic allows empty counterparty channel identifiers
|
||||
if err := host.ChannelIdentifierValidator(msg.Channel.Counterparty.ChannelId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid counterparty channel ID")
|
||||
}
|
||||
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err)
|
||||
@ -186,8 +189,8 @@ func (msg MsgChannelOpenAck) ValidateBasic() error {
|
||||
if err := host.PortIdentifierValidator(msg.PortId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid port ID")
|
||||
}
|
||||
if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid channel ID")
|
||||
if !IsValidChannelID(msg.ChannelId) {
|
||||
return ErrInvalidChannelIdentifier
|
||||
}
|
||||
if err := host.ChannelIdentifierValidator(msg.CounterpartyChannelId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid counterparty channel ID")
|
||||
@ -252,8 +255,8 @@ func (msg MsgChannelOpenConfirm) ValidateBasic() error {
|
||||
if err := host.PortIdentifierValidator(msg.PortId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid port ID")
|
||||
}
|
||||
if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid channel ID")
|
||||
if !IsValidChannelID(msg.ChannelId) {
|
||||
return ErrInvalidChannelIdentifier
|
||||
}
|
||||
if len(msg.ProofAck) == 0 {
|
||||
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof ack")
|
||||
@ -312,8 +315,8 @@ func (msg MsgChannelCloseInit) ValidateBasic() error {
|
||||
if err := host.PortIdentifierValidator(msg.PortId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid port ID")
|
||||
}
|
||||
if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid channel ID")
|
||||
if !IsValidChannelID(msg.ChannelId) {
|
||||
return ErrInvalidChannelIdentifier
|
||||
}
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
@ -369,8 +372,8 @@ func (msg MsgChannelCloseConfirm) ValidateBasic() error {
|
||||
if err := host.PortIdentifierValidator(msg.PortId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid port ID")
|
||||
}
|
||||
if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid channel ID")
|
||||
if !IsValidChannelID(msg.ChannelId) {
|
||||
return ErrInvalidChannelIdentifier
|
||||
}
|
||||
if len(msg.ProofInit) == 0 {
|
||||
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof init")
|
||||
|
||||
@ -23,7 +23,7 @@ import (
|
||||
const (
|
||||
// valid constatns used for testing
|
||||
portid = "testportid"
|
||||
chanid = "testchannel"
|
||||
chanid = "channel-0"
|
||||
cpportid = "testcpport"
|
||||
cpchanid = "testcpchannel"
|
||||
|
||||
@ -35,7 +35,7 @@ const (
|
||||
invalidLongPort = "invalidlongportinvalidlongportinvalidlongportidinvalidlongportidinvalid"
|
||||
|
||||
invalidChannel = "(invalidchannel1)"
|
||||
invalidShortChannel = "invalidch"
|
||||
invalidShortChannel = "invalid"
|
||||
invalidLongChannel = "invalidlongchannelinvalidlongchannelinvalidlongchannelinvalidlongchannel"
|
||||
|
||||
invalidConnection = "(invalidconnection1)"
|
||||
@ -114,22 +114,18 @@ func (suite *TypesTestSuite) TestMsgChannelOpenInitValidateBasic() {
|
||||
msg *types.MsgChannelOpenInit
|
||||
expPass bool
|
||||
}{
|
||||
{"", types.NewMsgChannelOpenInit(portid, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, addr), true},
|
||||
{"too short port id", types.NewMsgChannelOpenInit(invalidShortPort, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, addr), false},
|
||||
{"too long port id", types.NewMsgChannelOpenInit(invalidLongPort, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, addr), false},
|
||||
{"port id contains non-alpha", types.NewMsgChannelOpenInit(invalidPort, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, addr), false},
|
||||
{"too short channel id", types.NewMsgChannelOpenInit(portid, invalidShortChannel, version, types.ORDERED, connHops, cpportid, cpchanid, addr), false},
|
||||
{"too long channel id", types.NewMsgChannelOpenInit(portid, invalidLongChannel, version, types.ORDERED, connHops, cpportid, cpchanid, addr), false},
|
||||
{"channel id contains non-alpha", types.NewMsgChannelOpenInit(portid, invalidChannel, version, types.ORDERED, connHops, cpportid, cpchanid, addr), false},
|
||||
{"invalid channel order", types.NewMsgChannelOpenInit(portid, chanid, version, types.Order(3), connHops, cpportid, cpchanid, addr), false},
|
||||
{"connection hops more than 1 ", types.NewMsgChannelOpenInit(portid, chanid, version, types.ORDERED, invalidConnHops, cpportid, cpchanid, addr), false},
|
||||
{"too short connection id", types.NewMsgChannelOpenInit(portid, chanid, version, types.UNORDERED, invalidShortConnHops, cpportid, cpchanid, addr), false},
|
||||
{"too long connection id", types.NewMsgChannelOpenInit(portid, chanid, version, types.UNORDERED, invalidLongConnHops, cpportid, cpchanid, addr), false},
|
||||
{"connection id contains non-alpha", types.NewMsgChannelOpenInit(portid, chanid, version, types.UNORDERED, []string{invalidConnection}, cpportid, cpchanid, addr), false},
|
||||
{"", types.NewMsgChannelOpenInit(portid, chanid, "", types.UNORDERED, connHops, cpportid, cpchanid, addr), true},
|
||||
{"invalid counterparty port id", types.NewMsgChannelOpenInit(portid, chanid, version, types.UNORDERED, connHops, invalidPort, cpchanid, addr), false},
|
||||
{"invalid counterparty channel id", types.NewMsgChannelOpenInit(portid, chanid, version, types.UNORDERED, connHops, cpportid, invalidChannel, addr), false},
|
||||
{"channel not in INIT state", &types.MsgChannelOpenInit{portid, chanid, tryOpenChannel, addr.String()}, false},
|
||||
{"", types.NewMsgChannelOpenInit(portid, version, types.ORDERED, connHops, cpportid, addr), true},
|
||||
{"too short port id", types.NewMsgChannelOpenInit(invalidShortPort, version, types.ORDERED, connHops, cpportid, addr), false},
|
||||
{"too long port id", types.NewMsgChannelOpenInit(invalidLongPort, version, types.ORDERED, connHops, cpportid, addr), false},
|
||||
{"port id contains non-alpha", types.NewMsgChannelOpenInit(invalidPort, version, types.ORDERED, connHops, cpportid, addr), false},
|
||||
{"invalid channel order", types.NewMsgChannelOpenInit(portid, version, types.Order(3), connHops, cpportid, addr), false},
|
||||
{"connection hops more than 1 ", types.NewMsgChannelOpenInit(portid, version, types.ORDERED, invalidConnHops, cpportid, addr), false},
|
||||
{"too short connection id", types.NewMsgChannelOpenInit(portid, version, types.UNORDERED, invalidShortConnHops, cpportid, addr), false},
|
||||
{"too long connection id", types.NewMsgChannelOpenInit(portid, version, types.UNORDERED, invalidLongConnHops, cpportid, addr), false},
|
||||
{"connection id contains non-alpha", types.NewMsgChannelOpenInit(portid, version, types.UNORDERED, []string{invalidConnection}, cpportid, addr), false},
|
||||
{"", types.NewMsgChannelOpenInit(portid, "", types.UNORDERED, connHops, cpportid, addr), true},
|
||||
{"invalid counterparty port id", types.NewMsgChannelOpenInit(portid, version, types.UNORDERED, connHops, invalidPort, addr), false},
|
||||
{"channel not in INIT state", &types.MsgChannelOpenInit{portid, tryOpenChannel, addr.String()}, false},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
@ -155,27 +151,25 @@ func (suite *TypesTestSuite) TestMsgChannelOpenTryValidateBasic() {
|
||||
msg *types.MsgChannelOpenTry
|
||||
expPass bool
|
||||
}{
|
||||
{"", types.NewMsgChannelOpenTry(portid, chanid, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), true},
|
||||
{"too short port id", types.NewMsgChannelOpenTry(invalidShortPort, chanid, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"too long port id", types.NewMsgChannelOpenTry(invalidLongPort, chanid, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"port id contains non-alpha", types.NewMsgChannelOpenTry(invalidPort, chanid, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"too short channel id", types.NewMsgChannelOpenTry(portid, invalidShortChannel, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"too long channel id", types.NewMsgChannelOpenTry(portid, invalidLongChannel, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"channel id contains non-alpha", types.NewMsgChannelOpenTry(portid, invalidChannel, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"", types.NewMsgChannelOpenTry(portid, chanid, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, "", suite.proof, height, addr), true},
|
||||
{"proof height is zero", types.NewMsgChannelOpenTry(portid, chanid, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, clienttypes.ZeroHeight(), addr), false},
|
||||
{"invalid channel order", types.NewMsgChannelOpenTry(portid, chanid, chanid, version, types.Order(4), connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"connection hops more than 1 ", types.NewMsgChannelOpenTry(portid, chanid, chanid, version, types.UNORDERED, invalidConnHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"too short connection id", types.NewMsgChannelOpenTry(portid, chanid, chanid, version, types.UNORDERED, invalidShortConnHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"too long connection id", types.NewMsgChannelOpenTry(portid, chanid, chanid, version, types.UNORDERED, invalidLongConnHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"connection id contains non-alpha", types.NewMsgChannelOpenTry(portid, chanid, chanid, version, types.UNORDERED, []string{invalidConnection}, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"", types.NewMsgChannelOpenTry(portid, chanid, chanid, "", types.UNORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), true},
|
||||
{"invalid counterparty port id", types.NewMsgChannelOpenTry(portid, chanid, chanid, version, types.UNORDERED, connHops, invalidPort, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"invalid counterparty channel id", types.NewMsgChannelOpenTry(portid, chanid, chanid, version, types.UNORDERED, connHops, cpportid, invalidChannel, version, suite.proof, height, addr), false},
|
||||
{"empty proof", types.NewMsgChannelOpenTry(portid, chanid, chanid, version, types.UNORDERED, connHops, cpportid, cpchanid, version, emptyProof, height, addr), false},
|
||||
{"valid empty proved channel id", types.NewMsgChannelOpenTry(portid, chanid, "", version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), true},
|
||||
{"invalid proved channel id, doesn't match channel id", types.NewMsgChannelOpenTry(portid, chanid, "differentchannel", version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"channel not in TRYOPEN state", &types.MsgChannelOpenTry{portid, chanid, chanid, initChannel, version, suite.proof, height, addr.String()}, false},
|
||||
{"", types.NewMsgChannelOpenTry(portid, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), true},
|
||||
{"too short port id", types.NewMsgChannelOpenTry(invalidShortPort, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"too long port id", types.NewMsgChannelOpenTry(invalidLongPort, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"port id contains non-alpha", types.NewMsgChannelOpenTry(invalidPort, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"too short channel id", types.NewMsgChannelOpenTry(portid, invalidShortChannel, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"too long channel id", types.NewMsgChannelOpenTry(portid, invalidLongChannel, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"channel id contains non-alpha", types.NewMsgChannelOpenTry(portid, invalidChannel, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"", types.NewMsgChannelOpenTry(portid, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, "", suite.proof, height, addr), true},
|
||||
{"proof height is zero", types.NewMsgChannelOpenTry(portid, chanid, version, types.ORDERED, connHops, cpportid, cpchanid, version, suite.proof, clienttypes.ZeroHeight(), addr), false},
|
||||
{"invalid channel order", types.NewMsgChannelOpenTry(portid, chanid, version, types.Order(4), connHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"connection hops more than 1 ", types.NewMsgChannelOpenTry(portid, chanid, version, types.UNORDERED, invalidConnHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"too short connection id", types.NewMsgChannelOpenTry(portid, chanid, version, types.UNORDERED, invalidShortConnHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"too long connection id", types.NewMsgChannelOpenTry(portid, chanid, version, types.UNORDERED, invalidLongConnHops, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"connection id contains non-alpha", types.NewMsgChannelOpenTry(portid, chanid, version, types.UNORDERED, []string{invalidConnection}, cpportid, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"", types.NewMsgChannelOpenTry(portid, chanid, "", types.UNORDERED, connHops, cpportid, cpchanid, version, suite.proof, height, addr), true},
|
||||
{"invalid counterparty port id", types.NewMsgChannelOpenTry(portid, chanid, version, types.UNORDERED, connHops, invalidPort, cpchanid, version, suite.proof, height, addr), false},
|
||||
{"invalid counterparty channel id", types.NewMsgChannelOpenTry(portid, chanid, version, types.UNORDERED, connHops, cpportid, invalidChannel, version, suite.proof, height, addr), false},
|
||||
{"empty proof", types.NewMsgChannelOpenTry(portid, chanid, version, types.UNORDERED, connHops, cpportid, cpchanid, version, emptyProof, height, addr), false},
|
||||
{"channel not in TRYOPEN state", &types.MsgChannelOpenTry{portid, chanid, initChannel, version, suite.proof, height, addr.String()}, false},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
// CommitPacket returns the packet commitment bytes. The commitment consists of:
|
||||
// sha256_hash(timeout_timestamp + timeout_height.VersionNumber + timeout_height.VersionHeight + sha256_hash(data))
|
||||
// sha256_hash(timeout_timestamp + timeout_height.RevisionNumber + timeout_height.RevisionHeight + sha256_hash(data))
|
||||
// from a given packet. This results in a fixed length preimage.
|
||||
// NOTE: sdk.Uint64ToBigEndian sets the uint64 to a slice of length 8.
|
||||
func CommitPacket(cdc codec.BinaryMarshaler, packet exported.PacketI) []byte {
|
||||
@ -20,11 +20,11 @@ func CommitPacket(cdc codec.BinaryMarshaler, packet exported.PacketI) []byte {
|
||||
|
||||
buf := sdk.Uint64ToBigEndian(packet.GetTimeoutTimestamp())
|
||||
|
||||
versionNumber := sdk.Uint64ToBigEndian(timeoutHeight.GetVersionNumber())
|
||||
buf = append(buf, versionNumber...)
|
||||
revisionNumber := sdk.Uint64ToBigEndian(timeoutHeight.GetRevisionNumber())
|
||||
buf = append(buf, revisionNumber...)
|
||||
|
||||
versionHeight := sdk.Uint64ToBigEndian(timeoutHeight.GetVersionHeight())
|
||||
buf = append(buf, versionHeight...)
|
||||
revisionHeight := sdk.Uint64ToBigEndian(timeoutHeight.GetRevisionHeight())
|
||||
buf = append(buf, revisionHeight...)
|
||||
|
||||
dataHash := sha256.Sum256(packet.GetData())
|
||||
buf = append(buf, dataHash[:]...)
|
||||
|
||||
@ -512,10 +512,10 @@ type QueryChannelConsensusStateRequest struct {
|
||||
PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"`
|
||||
// channel unique identifier
|
||||
ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"`
|
||||
// version number of the consensus state
|
||||
VersionNumber uint64 `protobuf:"varint,3,opt,name=version_number,json=versionNumber,proto3" json:"version_number,omitempty"`
|
||||
// version height of the consensus state
|
||||
VersionHeight uint64 `protobuf:"varint,4,opt,name=version_height,json=versionHeight,proto3" json:"version_height,omitempty"`
|
||||
// revision number of the consensus state
|
||||
RevisionNumber uint64 `protobuf:"varint,3,opt,name=revision_number,json=revisionNumber,proto3" json:"revision_number,omitempty"`
|
||||
// revision height of the consensus state
|
||||
RevisionHeight uint64 `protobuf:"varint,4,opt,name=revision_height,json=revisionHeight,proto3" json:"revision_height,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryChannelConsensusStateRequest) Reset() { *m = QueryChannelConsensusStateRequest{} }
|
||||
@ -565,16 +565,16 @@ func (m *QueryChannelConsensusStateRequest) GetChannelId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *QueryChannelConsensusStateRequest) GetVersionNumber() uint64 {
|
||||
func (m *QueryChannelConsensusStateRequest) GetRevisionNumber() uint64 {
|
||||
if m != nil {
|
||||
return m.VersionNumber
|
||||
return m.RevisionNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryChannelConsensusStateRequest) GetVersionHeight() uint64 {
|
||||
func (m *QueryChannelConsensusStateRequest) GetRevisionHeight() uint64 {
|
||||
if m != nil {
|
||||
return m.VersionHeight
|
||||
return m.RevisionHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
@ -1699,100 +1699,100 @@ func init() {
|
||||
func init() { proto.RegisterFile("ibc/core/channel/v1/query.proto", fileDescriptor_1034a1e9abc4cca1) }
|
||||
|
||||
var fileDescriptor_1034a1e9abc4cca1 = []byte{
|
||||
// 1487 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0xdf, 0x6b, 0x14, 0xd7,
|
||||
0x17, 0xcf, 0xdd, 0x44, 0x4d, 0x8e, 0xbf, 0x6f, 0x12, 0x8d, 0x63, 0x5c, 0xe3, 0x7e, 0xbf, 0x6d,
|
||||
0xa3, 0xe0, 0x5c, 0x13, 0xad, 0x15, 0x8a, 0x2d, 0x31, 0x50, 0x1b, 0x50, 0x6b, 0x47, 0x6d, 0x55,
|
||||
0x5a, 0x97, 0xd9, 0xd9, 0xeb, 0x66, 0x48, 0x32, 0xb3, 0xee, 0xcc, 0xc6, 0x84, 0xb0, 0xd0, 0x56,
|
||||
0x90, 0x52, 0x2a, 0x14, 0xa4, 0x14, 0xfa, 0xd2, 0x97, 0x42, 0xf1, 0xb1, 0xff, 0x43, 0x1f, 0x7c,
|
||||
0xe8, 0x83, 0xd0, 0x16, 0x2c, 0x05, 0x2b, 0x5a, 0xa8, 0x0f, 0x7d, 0x6e,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xa2, 0x59, 0x1e, 0x21, 0x63, 0x64, 0x7c, 0x40,
|
||||
0xdb, 0xe8, 0x3d, 0xce, 0x94, 0xe9, 0x3e, 0x00, 0xc4, 0xe3, 0xbd, 0xcb, 0x89, 0x77, 0x03, 0xb8,
|
||||
0x32, 0x53, 0x2e, 0xdc, 0x23, 0x30, 0x14, 0x8f, 0xe7, 0x54, 0x6d, 0xcb, 0xe1, 0xf4, 0x38, 0x6c,
|
||||
0x42, 0x2b, 0x11, 0x70, 0xf3, 0xe4, 0xa8, 0x9a, 0xa0, 0xa6, 0xea, 0xbb, 0xf9, 0xc6, 0x74, 0x08,
|
||||
0x36, 0x54, 0x6b, 0xb6, 0x7d, 0x5d, 0x6c, 0xb5, 0x45, 0x93, 0x0f, 0x74, 0x1a, 0xb6, 0x88, 0x0f,
|
||||
0xc5, 0x59, 0x6e, 0x56, 0x66, 0xdd, 0x91, 0x5e, 0x11, 0x52, 0x89, 0x84, 0x94, 0x19, 0x58, 0x9c,
|
||||
0x50, 0xdf, 0x16, 0x16, 0xa7, 0xfa, 0xee, 0x3f, 0xda, 0xdf, 0xa3, 0x6d, 0x16, 0x5e, 0x72, 0xa9,
|
||||
0x70, 0x2d, 0x0e, 0xd5, 0xf1, 0xb9, 0xbf, 0x05, 0x10, 0x26, 0x06, 0xd1, 0xbe, 0xac, 0xca, 0x2c,
|
||||
0xaa, 0x5e, 0x16, 0x55, 0x79, 0x28, 0x30, 0x8b, 0xea, 0x79, 0xbd, 0xc2, 0xd1, 0x57, 0x8b, 0x78,
|
||||
0x16, 0x1e, 0x11, 0x18, 0x6e, 0xda, 0x00, 0xc5, 0x38, 0x05, 0xfd, 0xc8, 0xcf, 0x19, 0x21, 0x63,
|
||||
0xbd, 0x22, 0x7e, 0x92, 0x1a, 0x33, 0x65, 0x6e, 0xb9, 0xe6, 0x75, 0x93, 0x97, 0x7d, 0x5d, 0x02,
|
||||
0x3f, 0x7a, 0x3a, 0x86, 0x32, 0x27, 0x50, 0xbe, 0xb2, 0x2a, 0x4a, 0x09, 0x20, 0x0a, 0x93, 0x9e,
|
||||
0x80, 0x8d, 0x6d, 0xaa, 0x88, 0xf6, 0x85, 0x4f, 0x09, 0xe4, 0x25, 0x41, 0xdb, 0xb2, 0xb8, 0xe1,
|
||||
0x45, 0x6b, 0xd6, 0x32, 0x0f, 0x60, 0x04, 0x2f, 0xf1, 0x28, 0x45, 0x56, 0x9a, 0xb4, 0xce, 0x3d,
|
||||
0xb7, 0xd6, 0xcf, 0x08, 0xec, 0x4f, 0x85, 0xf2, 0xdf, 0x52, 0xfd, 0xb2, 0x2f, 0xba, 0xc4, 0x34,
|
||||
0x2d, 0xac, 0x2f, 0xb8, 0xba, 0xcb, 0x3b, 0x2d, 0xde, 0xdf, 0x03, 0x11, 0x13, 0x42, 0xa3, 0x88,
|
||||
0x3a, 0xec, 0x36, 0x03, 0x7d, 0x8a, 0x12, 0x6a, 0xd1, 0xf1, 0x4c, 0xb0, 0x52, 0x0e, 0x26, 0x11,
|
||||
0x89, 0x48, 0x1a, 0x89, 0x39, 0x6c, 0x26, 0x2d, 0x77, 0xb3, 0xe4, 0xef, 0x11, 0x38, 0x10, 0x63,
|
||||
0xe8, 0x71, 0xb2, 0x9c, 0xba, 0xb3, 0x1e, 0xfa, 0xd1, 0x97, 0x60, 0xdb, 0x22, 0xaf, 0x39, 0xa6,
|
||||
0x6d, 0x15, 0xad, 0xfa, 0x42, 0x89, 0xd7, 0x04, 0xc8, 0x3e, 0x6d, 0x2b, 0xae, 0x9e, 0x13, 0x8b,
|
||||
0x51, 0x33, 0xe4, 0xd2, 0x17, 0x33, 0x43, 0xac, 0xbf, 0x11, 0x28, 0x64, 0x61, 0xc5, 0x84, 0x9c,
|
||||
0x84, 0xed, 0x86, 0xff, 0x26, 0x96, 0x88, 0x21, 0x55, 0x7e, 0x17, 0xa8, 0xfe, 0x77, 0x81, 0x3a,
|
||||
0x65, 0x2d, 0x6b, 0xdb, 0x8c, 0x58, 0x18, 0xba, 0x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x1b, 0x04, 0x66, 0xfa, 0x1d, 0x81, 0x4d, 0x78, 0xdd, 0xa4, 0xe3, 0x89,
|
||||
0xf5, 0x9e, 0xf0, 0x63, 0x81, 0x72, 0x70, 0x0d, 0x96, 0x92, 0x79, 0xe1, 0xf4, 0x27, 0x3f, 0xfd,
|
||||
0x71, 0x37, 0x37, 0x45, 0xdf, 0x64, 0x09, 0xbf, 0x74, 0xc8, 0x1f, 0x45, 0xfc, 0x59, 0x8b, 0xad,
|
||||
0x84, 0x3a, 0x37, 0x98, 0xa7, 0xbe, 0xc3, 0x56, 0x30, 0x27, 0x0d, 0x7a, 0x87, 0x40, 0xbf, 0x3f,
|
||||
0xe1, 0xd1, 0xd5, 0x01, 0xf8, 0x67, 0x5b, 0x39, 0xb4, 0x16, 0x53, 0x04, 0x7b, 0x48, 0x80, 0xfd,
|
||||
0x3f, 0x2d, 0xac, 0x0e, 0x96, 0xfe, 0x40, 0x80, 0xb6, 0xce, 0x9e, 0xf4, 0x68, 0xc6, 0x76, 0x69,
|
||||
0x43, 0xb3, 0x72, 0xac, 0x3d, 0x27, 0x44, 0x3b, 0x2d, 0xd0, 0x9e, 0xa4, 0xaf, 0x67, 0xa0, 0x0d,
|
||||
0xbc, 0x3d, 0x75, 0x83, 0x87, 0x46, 0x48, 0xe3, 0x17, 0x8f, 0x46, 0xcb, 0xf4, 0x97, 0x49, 0x23,
|
||||
0x6d, 0x0c, 0xcd, 0xa4, 0x91, 0x3a, 0x60, 0x16, 0x2e, 0x0a, 0x1a, 0xe7, 0xe8, 0x99, 0x0e, 0x4f,
|
||||
0x08, 0x8b, 0xce, 0xa6, 0xf4, 0xcb, 0x1c, 0x0c, 0x27, 0xce, 0x51, 0xf4, 0xf8, 0xea, 0x28, 0x93,
|
||||
0x86, 0x44, 0xe5, 0xb5, 0xb6, 0xfd, 0x90, 0xe0, 0x67, 0x44, 0x30, 0xbc, 0x45, 0xe8, 0x47, 0xa4,
|
||||
0x63, 0x8e, 0xf1, 0xc9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 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0xdd, 0x6f, 0x14, 0x55,
|
||||
0x14, 0xef, 0xdd, 0x16, 0x68, 0x0f, 0xc8, 0xc7, 0x6d, 0x0b, 0x65, 0x28, 0x4b, 0x19, 0x8d, 0x14,
|
||||
0x12, 0xe6, 0xd2, 0x82, 0x48, 0x62, 0xd0, 0x94, 0x26, 0x62, 0x13, 0x40, 0x1c, 0x40, 0x81, 0x28,
|
||||
0x9b, 0xd9, 0xd9, 0xcb, 0x76, 0xd2, 0x76, 0x66, 0xd8, 0x99, 0x2d, 0x6d, 0x9a, 0x7d, 0x50, 0x13,
|
||||
0xe2, 0x83, 0x24, 0x26, 0x3c, 0x68, 0x7c, 0xf1, 0xc5, 0xc4, 0xf0, 0xe0, 0x83, 0xff, 0x83, 0x0f,
|
||||
0xbc, 0x49, 0xa2, 0x26, 0x18, 0x13, 0x24, 0x60, 0x22, 0x0f, 0x3e, 0xeb, 0xab, 0x99, 0xfb, 0x31,
|
||||
0x1f, 0xbb, 0x33, 0xd3, 0x2e, 0xdb, 0x4d, 0x1a, 0x9f, 0xba, 0x73, 0xe7, 0x9c, 0x73, 0x7f, 0xbf,
|
||||
0xdf, 0xb9, 0xe7, 0xec, 0x3d, 0x5b, 0x38, 0x60, 0x95, 0x4d, 0x62, 0x3a, 0x35, 0x4a, 0xcc, 0x59,
|
||||
0xc3, 0xb6, 0xe9, 0x3c, 0x59, 0x9c, 0x20, 0xb7, 0xea, 0xb4, 0xb6, 0xac, 0xb9, 0x35, 0xc7, 0x77,
|
||||
0xf0, 0xa0, 0x55, 0x36, 0xb5, 0xc0, 0x40, 0x13, 0x06, 0xda, 0xe2, 0x84, 0x12, 0xf3, 0x9a, 0xb7,
|
||||
0xa8, 0xed, 0x07, 0x4e, 0xfc, 0x13, 0xf7, 0x52, 0x8e, 0x98, 0x8e, 0xb7, 0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16, 0x92, 0x67, 0x60, 0x71, 0x42,
|
||||
0x7b, 0x87, 0x59, 0x9c, 0xe9, 0x7b, 0xf0, 0xf8, 0x40, 0x8f, 0xbe, 0x95, 0x79, 0xf1, 0x25, 0xf5,
|
||||
0x46, 0x12, 0xaa, 0x27, 0xb9, 0xbf, 0x0d, 0x10, 0x25, 0x46, 0xa0, 0x7d, 0x55, 0xe3, 0x59, 0xd4,
|
||||
0x82, 0x2c, 0x6a, 0xfc, 0x50, 0x88, 0x2c, 0x6a, 0x17, 0x8d, 0x2a, 0x15, 0xbe, 0x7a, 0xcc, 0x53,
|
||||
0x7d, 0x8c, 0x60, 0xb8, 0x69, 0x03, 0x21, 0xc6, 0x19, 0xe8, 0x17, 0xfc, 0xbc, 0x11, 0x34, 0xd6,
|
||||
0xcb, 0xe2, 0xa7, 0xa9, 0x31, 0x53, 0xa1, 0xb6, 0x6f, 0xdd, 0xb4, 0x68, 0x45, 0xea, 0x12, 0xfa,
|
||||
0xe1, 0xb3, 0x09, 0x94, 0x05, 0x86, 0xf2, 0xd0, 0xaa, 0x28, 0x39, 0x80, 0x38, 0x4c, 0x7c, 0x0a,
|
||||
0x36, 0xb7, 0xa9, 0xa2, 0xb0, 0x57, 0x3f, 0x43, 0x50, 0xe4, 0x04, 0x1d, 0xdb, 0xa6, 0x66, 0x10,
|
||||
0xad, 0x59, 0xcb, 0x22, 0x80, 0x19, 0xbe, 0x14, 0x47, 0x29, 0xb6, 0xd2, 0xa4, 0x75, 0xe1, 0x85,
|
||||
0xb5, 0x7e, 0x8e, 0xe0, 0x40, 0x26, 0x94, 0xff, 0x97, 0xea, 0x57, 0xa5, 0xe8, 0x1c, 0xd3, 0x34,
|
||||
0xb3, 0xbe, 0xe4, 0x1b, 0x3e, 0xed, 0xb4, 0x78, 0xff, 0x08, 0x45, 0x4c, 0x09, 0x2d, 0x44, 0x34,
|
||||
0x60, 0x8f, 0x15, 0xea, 0x53, 0xe2, 0x50, 0x4b, 0x5e, 0x60, 0x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, 0x24, 0x63, 0x14, 0x06, 0xa2, 0x78, 0x88, 0xc5, 0x8b, 0x16,
|
||||
0x62, 0x9a, 0x14, 0xda, 0xd4, 0xe4, 0x8e, 0x6c, 0x37, 0xd1, 0xd6, 0x53, 0xe6, 0x5c, 0xc7, 0x82,
|
||||
0x1c, 0x83, 0x21, 0x21, 0x88, 0x61, 0xce, 0xb5, 0x28, 0x81, 0x5d, 0x79, 0xf2, 0x22, 0x09, 0xea,
|
||||
0xb0, 0x2f, 0x15, 0x47, 0x97, 0xf9, 0x5f, 0x13, 0x77, 0xdd, 0x0b, 0x74, 0x29, 0xcc, 0x87, 0xce,
|
||||
0x01, 0x74, 0x7a, 0x8f, 0xfe, 0x01, 0xc1, 0x58, 0x76, 0x6c, 0xc1, 0x6b, 0x12, 0x86, 0x6d, 0xba,
|
||||
0x14, 0x1d, 0x96, 0x92, 0x60, 0xcf, 0xb6, 0xea, 0xd3, 0x07, 0xed, 0x56, 0xdf, 0x2e, 0xb6, 0xb0,
|
||||
0xc9, 0x9f, 0x76, 0xc3, 0x26, 0x86, 0x19, 0x7f, 0x87, 0x60, 0x8b, 0xb8, 0x6e, 0xe2, 0xf1, 0xd4,
|
||||
0x7a, 0x4f, 0xf9, 0xc1, 0x40, 0x39, 0xbc, 0x06, 0x4b, 0xce, 0x5c, 0x3d, 0xfb, 0xc9, 0xcf, 0x7f,
|
||||
0xde, 0x2b, 0x4c, 0xe1, 0xb7, 0x48, 0xca, 0xaf, 0x1d, 0xfc, 0x87, 0x11, 0x39, 0x6f, 0x91, 0x95,
|
||||
0x48, 0xe7, 0x06, 0x09, 0xd4, 0xf7, 0xc8, 0x8a, 0xc8, 0x49, 0x03, 0xdf, 0x45, 0xd0, 0x2f, 0xa7,
|
||||
0x3c, 0xbc, 0x3a, 0x00, 0x79, 0xb6, 0x95, 0x23, 0x6b, 0x31, 0x15, 0x60, 0x8f, 0x30, 0xb0, 0xaf,
|
||||
0x60, 0x75, 0x75, 0xb0, 0xf8, 0x47, 0x04, 0xb8, 0x75, 0xfe, 0xc4, 0xc7, 0x73, 0xb6, 0xcb, 0x1a,
|
||||
0x9c, 0x95, 0x13, 0xed, 0x39, 0x09, 0xb4, 0xd3, 0x0c, 0xed, 0x69, 0xfc, 0x46, 0x0e, 0xda, 0xd0,
|
||||
0x3b, 0x50, 0x37, 0x7c, 0x68, 0x44, 0x34, 0x7e, 0x0d, 0x68, 0xb4, 0x4c, 0x80, 0xb9, 0x34, 0xb2,
|
||||
0x46, 0xd1, 0x5c, 0x1a, 0x99, 0x43, 0xa6, 0x7a, 0x99, 0xd1, 0xb8, 0x80, 0xcf, 0x75, 0x78, 0x42,
|
||||
0x48, 0x7c, 0x3e, 0xc5, 0x5f, 0x15, 0x60, 0x38, 0x75, 0x8e, 0xc2, 0x27, 0x57, 0x47, 0x99, 0x36,
|
||||
0x28, 0x2a, 0xaf, 0xb7, 0xed, 0x27, 0x08, 0xde, 0x45, 0x8c, 0xe1, 0x1d, 0x84, 0x3f, 0x45, 0x1d,
|
||||
0x73, 0x4c, 0x4e, 0x7e, 0x44, 0x8e, 0x90, 0x64, 0xa5, 0x69, 0x18, 0x6d, 0x10, 0xde, 0x20, 0x62,
|
||||
0x2f, 0xf8, 0x42, 0x03, 0x3f, 0x41, 0xb0, 0xb3, 0xf9, 0x46, 0x8f, 0x27, 0xb2, 0xd9, 0x65, 0x4c,
|
||||
0x6c, 0xca, 0x64, 0x3b, 0x2e, 0x42, 0x0b, 0xca, 0xa4, 0x28, 0xe1, 0x8f, 0x3a, 0x15, 0xa2, 0xe5,
|
||||
0x8b, 0xd8, 0x23, 0x2b, 0xb2, 0xbb, 0x36, 0xf0, 0x23, 0x04, 0xbb, 0x5a, 0x86, 0x16, 0xdc, 0x06,
|
||||
0xe0, 0xb0, 0x34, 0x8f, 0xb7, 0xe5, 0x23, 0x58, 0x5e, 0x67, 0x2c, 0x2f, 0x63, 0x7d, 0xfd, 0x59,
|
||||
0xe2, 0x5f, 0x10, 0xbc, 0x94,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 0xd3, 0xe1, 0x5d, 0x7c, 0xbe, 0x53, 0x1d, 0x12, 0xf7, 0xf9, 0x33, 0xfa, 0x83, 0xa7,
|
||||
0x45, 0xf4, 0xf0, 0x69, 0x11, 0x3d, 0x79, 0x5a, 0x44, 0x5f, 0x3c, 0x2b, 0xf6, 0x3c, 0x7c, 0x56,
|
||||
0xec, 0x79, 0xf4, 0xac, 0xd8, 0x73, 0xfd, 0x54, 0xd5, 0xf2, 0x67, 0xeb, 0x65, 0xcd, 0x74, 0x16,
|
||||
0x88, 0xf8, 0xe7, 0x20, 0xff, 0x73, 0xd4, 0xab, 0xcc, 0x91, 0xa5, 0x08, 0xc6, 0xb1, 0x13, 0x47,
|
||||
0x25, 0x12, 0x7f, 0xd9, 0xa5, 0x5e, 0x79, 0x33, 0xfb, 0x1d, 0xf7, 0xf8, 0x7f, 0x01, 0x00, 0x00,
|
||||
0xff, 0xff, 0xce, 0x1d, 0x1b, 0xcd, 0xab, 0x1c, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -2740,13 +2740,13 @@ func (m *QueryChannelConsensusStateRequest) MarshalToSizedBuffer(dAtA []byte) (i
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.VersionHeight != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.RevisionHeight))
|
||||
i--
|
||||
dAtA[i] = 0x20
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.RevisionNumber))
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
@ -3775,11 +3775,11 @@ func (m *QueryChannelConsensusStateRequest) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
n += 1 + sovQuery(uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
n += 1 + sovQuery(uint64(m.RevisionNumber))
|
||||
}
|
||||
if m.VersionHeight != 0 {
|
||||
n += 1 + sovQuery(uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
n += 1 + sovQuery(uint64(m.RevisionHeight))
|
||||
}
|
||||
return n
|
||||
}
|
||||
@ -5295,9 +5295,9 @@ func (m *QueryChannelConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionNumber", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionNumber", wireType)
|
||||
}
|
||||
m.VersionNumber = 0
|
||||
m.RevisionNumber = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
@ -5307,16 +5307,16 @@ func (m *QueryChannelConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionNumber |= uint64(b&0x7F) << shift
|
||||
m.RevisionNumber |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 4:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionHeight", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionHeight", wireType)
|
||||
}
|
||||
m.VersionHeight = 0
|
||||
m.RevisionHeight = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
@ -5326,7 +5326,7 @@ func (m *QueryChannelConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionHeight |= uint64(b&0x7F) << shift
|
||||
m.RevisionHeight |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
|
||||
@ -324,26 +324,26 @@ func request_Query_ChannelConsensusState_0(ctx context.Context, marshaler runtim
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_number"]
|
||||
val, ok = pathParams["revision_number"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_number")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_number")
|
||||
}
|
||||
|
||||
protoReq.VersionNumber, err = runtime.Uint64(val)
|
||||
protoReq.RevisionNumber, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_number", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_number", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_height"]
|
||||
val, ok = pathParams["revision_height"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_height")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_height")
|
||||
}
|
||||
|
||||
protoReq.VersionHeight, err = runtime.Uint64(val)
|
||||
protoReq.RevisionHeight, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_height", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_height", err)
|
||||
}
|
||||
|
||||
msg, err := client.ChannelConsensusState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
@ -384,26 +384,26 @@ func local_request_Query_ChannelConsensusState_0(ctx context.Context, marshaler
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_number"]
|
||||
val, ok = pathParams["revision_number"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_number")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_number")
|
||||
}
|
||||
|
||||
protoReq.VersionNumber, err = runtime.Uint64(val)
|
||||
protoReq.RevisionNumber, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_number", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_number", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_height"]
|
||||
val, ok = pathParams["revision_height"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_height")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_height")
|
||||
}
|
||||
|
||||
protoReq.VersionHeight, err = runtime.Uint64(val)
|
||||
protoReq.RevisionHeight, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_height", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_height", err)
|
||||
}
|
||||
|
||||
msg, err := server.ChannelConsensusState(ctx, &protoReq)
|
||||
@ -1744,7 +1744,7 @@ var (
|
||||
|
||||
pattern_Query_ChannelClientState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8}, []string{"ibc", "core", "channel", "v1beta1", "channels", "channel_id", "ports", "port_id", "client_state"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ChannelConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 2, 9, 1, 0, 4, 1, 5, 10, 2, 11, 1, 0, 4, 1, 5, 12}, []string{"ibc", "core", "channel", "v1beta1", "channels", "channel_id", "ports", "port_id", "consensus_state", "version", "version_number", "height", "version_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_ChannelConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 2, 9, 1, 0, 4, 1, 5, 10, 2, 11, 1, 0, 4, 1, 5, 12}, []string{"ibc", "core", "channel", "v1beta1", "channels", "channel_id", "ports", "port_id", "consensus_state", "revision", "revision_number", "height", "revision_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_PacketCommitment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9}, []string{"ibc", "core", "channel", "v1beta1", "channels", "channel_id", "ports", "port_id", "packet_commitments", "sequence"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user