Skip to content

Commit

Permalink
Push master @jackzampolin: prep for the v0.3.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
jackzampolin committed Apr 23, 2020
1 parent 7e5a416 commit 781026c
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ Working with the relayer can frequently involve working with local developement
1. Set `replace github.com/cosmos/cosmos-sdk => /path/to/local/github.com/comsos/cosmos-sdk` at the end of the `go.mod` files for the `relayer` and `gaia`. This will force building from the local version of the `cosmos-sdk` when running the `./dev-env` script.
2. After `./dev-env` has run, you can use `go run main.go` for any relayer commands you are working on. This allows you make changes and immediately test them as long as there are no server side changes.
3. If you make changes in `cosmos-sdk` that need to be reflected server-side, be sure to re-run `./two-chainz`.
4. If you need to work off of a `gaia` branch other than `ibc-alpha`, change the branch name at the top of the `./two-chainz` script.
4. If you need to work off of a `gaia` branch other than `master`, change the branch name at the top of the `./two-chainz` script.
24 changes: 24 additions & 0 deletions cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,34 @@ func devCommand() *cobra.Command {
faucetService(),
rlyService(),
listenCmd(),
genesisCmd(),
)
return cmd
}

func genesisCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "genesis [chain-id]",
Aliases: []string{"gen"},
Short: "fetch the genesis file for a configured chain",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
c, err := config.Chains.Get(args[0])
if err != nil {
return err
}

gen, err := c.Client.Genesis()
if err != nil {
return err
}

return c.Print(gen, false, false)
},
}
return cmd
}

// listenCmd represents the listen command
func listenCmd() *cobra.Command {
cmd := &cobra.Command{
Expand Down
2 changes: 2 additions & 0 deletions cmd/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func pathsGenCmd() *cobra.Command {
}

for _, c := range srcClients {
// TODO: support other client types through a switch here as they become available
clnt, ok := c.(tmclient.ClientState)
if ok && clnt.LastHeader.Commit != nil && clnt.LastHeader.Header != nil {
if clnt.GetChainID() == dst && !clnt.IsFrozen() {
Expand All @@ -111,6 +112,7 @@ func pathsGenCmd() *cobra.Command {
}

for _, c := range dstClients {
// TODO: support other client types through a switch here as they become available
clnt, ok := c.(tmclient.ClientState)
if ok && clnt.LastHeader.Commit != nil && clnt.LastHeader.Header != nil {
if c.GetChainID() == src && !c.IsFrozen() {
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
version: "3.7"
services:
ibc0:
image: "jackzampolin/gaiatest:ibc-alpha"
image: "jackzampolin/gaiatest:master"
ports:
- "46657:26657"
command:
- "ibc0"
- "${IBC0ADDR}"
ibc1:
image: "jackzampolin/gaiatest:ibc-alpha"
image: "jackzampolin/gaiatest:master"
ports:
- "46658:26657"
command:
- "ibc1"
- "${IBC1ADDR}"
ibc2:
image: "jackzampolin/gaiatest:ibc-alpha"
image: "jackzampolin/gaiatest:master"
ports:
- "46659:26657"
command:
- "ibc2"
- "${IBC2ADDR}"
ibc3:
image: "jackzampolin/gaiatest:ibc-alpha"
image: "jackzampolin/gaiatest:master"
ports:
- "46660:26657"
command:
Expand Down
12 changes: 6 additions & 6 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ The test framework is built using `go test` and `docker`. What is happening for

### Step 1: Write a Dockerfile and publish an image for your chain

The testing framework expects your chain to have a `Dockerfile` with an `ENTRYPOINT` script that accepts two arguements: `chain-id`, which should be unique to the individual test, and `relayer-address`, an address to include in the genesis file so that the testing relayer has access to funds. This is normally best acomplished with an `./entrypoint.sh` script that performs the necessary chain bootstrapping. The `cosmos/gaia@ibc-alpha` repository provides an example of both:
The testing framework expects your chain to have a `Dockerfile` with an `ENTRYPOINT` script that accepts two arguements: `chain-id`, which should be unique to the individual test, and `relayer-address`, an address to include in the genesis file so that the testing relayer has access to funds. This is normally best acomplished with an `./entrypoint.sh` script that performs the necessary chain bootstrapping. The `cosmos/gaia` repositories provide an example of both:

- [`./entrypoint.sh`](https://github.com/cosmos/gaia/tree/ibc-alpha/contrib/single-node.sh)
- [`Dockerfile.test`](https://github.com/cosmos/gaia/tree/ibc-alpha/contrib/Dockerfile.test)
- [`./entrypoint.sh`](https://github.com/cosmos/gaia/tree/master/contrib/single-node.sh)
- [`Dockerfile.test`](https://github.com/cosmos/gaia/tree/master/contrib/Dockerfile.test)

Then you need to build and push your image to a public image repository. Having it tagged with the git sha and branch is best practice. See the build proceedure for the gaia image:

- [`Makefile`](https://github.com/cosmos/gaia/blob/ibc-alpha/Makefile#L164)
- [`Makefile`](https://github.com/cosmos/gaia/blob/master/Makefile#L164)

At the end, you should have an image you can run which starts up an instance of your chain:

Expand All @@ -38,7 +38,7 @@ rly q bal mychainid

Next you will need to define a new instance of `testChainConfig` in the `test/test_chains.go` file. Follow the `gaiaTestConfig` example:

> NOTE: I've increased the default block timeouts for gaia to the values noted below. This makes the tests faster. If you would like to do the same for your chain see the `sed` commands in the [entrypoint](https://github.com/cosmos/gaia/tree/ibc-alpha/contrib/single-node.sh).
> NOTE: I've increased the default block timeouts for gaia to the values noted below. This makes the tests faster. If you would like to do the same for your chain see the `sed` commands in the [entrypoint](https://github.com/cosmos/gaia/tree/master/contrib/single-node.sh).
```go
// GAIA BLOCK TIMEOUTS on jackzampolin/gaiatest:jack_relayer-testing
Expand All @@ -49,7 +49,7 @@ gaiaTestConfig = testChainConfig{
cdc: codecstd.NewAppCodec(codecstd.MakeCodec(simapp.ModuleBasics)),
amino: codecstd.MakeCodec(simapp.ModuleBasics),
dockerImage: "jackzampolin/gaiatest",
dockerTag: "ibc-alpha",
dockerTag: "master",
timeout: 3 * time.Second,
rpcPort: "26657",
accountPrefix: "cosmos",
Expand Down
5 changes: 5 additions & 0 deletions relayer/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

chanState "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
tmclient "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
"gopkg.in/yaml.v2"
)

Expand Down Expand Up @@ -163,6 +164,10 @@ func FindPaths(chains Chains) (*Paths, error) {
return nil, err
}
for _, client := range clients {
clnt, ok := client.(tmclient.ClientState)
if !ok || clnt.LastHeader.Commit == nil || clnt.LastHeader.Header == nil {
continue
}
dst, err := chains.Get(client.GetChainID())
if err != nil {
continue
Expand Down
2 changes: 1 addition & 1 deletion scripts/three-chainz
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [[ ! -d $GOPATH ]] || [[ ! -d $GOBIN ]] || [[ ! -x "$(which go)" ]]; then
fi

GAIA_REPO="$GOPATH/src/github.com/cosmos/gaia"
GAIA_BRANCH=ibc-alpha
GAIA_BRANCH=master
GAIA_DATA="$(pwd)/data"

# ARGS:
Expand Down
2 changes: 1 addition & 1 deletion scripts/two-chainz
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [[ ! -d $GOPATH ]] || [[ ! -d $GOBIN ]] || [[ ! -x "$(which go)" ]]; then
fi

GAIA_REPO="$GOPATH/src/github.com/cosmos/gaia"
GAIA_BRANCH=ibc-alpha
GAIA_BRANCH=master
GAIA_DATA="$(pwd)/data"

# ARGS:
Expand Down
4 changes: 2 additions & 2 deletions test/test_chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ import (
)

var (
// GAIA BLOCK TIMEOUTS on jackzampolin/gaiatest:ibc-alpha
// GAIA BLOCK TIMEOUTS on jackzampolin/gaiatest:master
// timeout_commit = "1000ms"
// timeout_propose = "1000ms"
// 3 second relayer timeout works well with these block times
gaiaTestConfig = testChainConfig{
cdc: codecstd.NewAppCodec(codecstd.MakeCodec(simapp.ModuleBasics)),
amino: codecstd.MakeCodec(simapp.ModuleBasics),
dockerImage: "jackzampolin/gaiatest",
dockerTag: "ibc-alpha",
dockerTag: "master",
timeout: 3 * time.Second,
rpcPort: "26657",
accountPrefix: "cosmos",
Expand Down
7 changes: 4 additions & 3 deletions testnets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ $ gaiad version --long
name: gaia
server_name: gaiad
client_name: gaiacli
version: 0.0.0-303-g9a09e54
commit: 9a09e5499c25f8bbe48f2f9abe6f74360923266b
version: 0.0.0-180-g50be36d
commit: 50be36de941b9410a4b06ec9ce4288b1529c4bd4
build_tags: netgo,ledger
go: go version go1.14 darwin/amd64
```
Expand Down Expand Up @@ -66,9 +66,10 @@ export DENOM=pylon
export CHAINID=pylonchain
export DOMAIN=shitcoincasinos.com
export RLYKEY=faucet
export GAIASHA=50be36d

# Start by downloading and installing both gaia and the relayer
mkdir -p $(dirname $GAIA) && git clone https://github.com/cosmos/gaia $GAIA && cd $GAIA && git checkout ibc-alpha && make install
mkdir -p $(dirname $GAIA) && git clone https://github.com/cosmos/gaia $GAIA && cd $GAIA && git checkout $GAIASHA && make install
mkdir -p $(dirname $RELAYER) && git clone https://github.com/iqlusioninc/relayer $RELAYER && cd $RELAYER && make install

# Now its time to configure both the relayer and gaia, start with the relayer
Expand Down

0 comments on commit 781026c

Please sign in to comment.