Skip to content

Commit

Permalink
Push master @jackzampolin: prep for v1.0.0-rc0 and refactor scripts t…
Browse files Browse the repository at this point in the history
…o remove GOPATH per cosmos#282
  • Loading branch information
jackzampolin committed Nov 5, 2020
1 parent a5c62e3 commit 14195ec
Show file tree
Hide file tree
Showing 19 changed files with 263 additions and 501 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
go-version: 1.15

# - run: echo https://github.com/tendermint/tendermint/blob/${GITHUB_REF#refs/tags/}/CHANGELOG.md#${GITHUB_REF#refs/tags/} > ../release_notes.md
- run: echo https://github.com/tendermint/tendermint/blob/${GITHUB_REF#refs/tags/}/CHANGELOG.md#${GITHUB_REF#refs/tags/} > ../release_notes.md

- name: add env
run: |
Expand All @@ -28,6 +28,6 @@ jobs:
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist #--release-notes=../release_notes.md
args: release --rm-dist --release-notes=../release_notes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ release.tar.gz
nchainz/
.idea/
.csv
chain-code/
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

## v1.0.0-rc0

*5 November 2020*

This is the first RC for the 1.0.0 release of the relayer. Currently we are waiting on the following items for the v1.0.0 release:
- [ ] [`tendermint`](https://github.com/tendermint/tendermint) v0.34.0 final - We anticipate that the current [v0.34.0-rc6](https://github.com/tendermint/tendermint/releases/tag/v0.34.0-rc6) will be `v0.34.0` final after being tested in a series of testnets for the SDK
- [ ] [`cosmos-sdk`](https://github.com/cosmos/cosmos-sdk) v0.40.0 final - the `rc0` release of the relayer relies on `v0.40.0-rc2` of the `cosmos-sdk`, there will be a `v0.40.0-rc3` cut that included `[email protected]` as well as some minor changes.
- [ ] A fix for the [timeouts issue](https://github.com/cosmos/relayer/pull/322). Currently timeouts aren't passing proof validation and that will be fixed for both `ORDERED` and `UNORDERED` channels prior to a `v1.0.0` final on the relayer.
27 changes: 25 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
SDKCOMMIT := $(shell go list -m -u -f '{{.Version}}' github.com/cosmos/cosmos-sdk)
# GAIACOMMIT := $(shell go list -m -u -f '{{.Version}}' github.com/cosmos/gaia)
GAIA_VERSION := jack/gaiav3.0
AKASH_VERSION := jack/update-sdk
all: ci-lint install

###############################################################################
Expand Down Expand Up @@ -59,4 +60,26 @@ lint:

.PHONY: install build lint coverage clean

# TODO: Full tested and working releases
###############################################################################
# Chain Code Downloads
###############################################################################

get-gaia:
@mkdir -p ./chain-code/
@git clone --branch $(GAIA_VERSION) [email protected]:cosmos/gaia.git ./chain-code/gaia

build-gaia:
@./scripts/build-gaia

build-akash:
@./scripts/build-akash

get-akash:
@mkdir -p ./chain-code/
@git clone --branch $(AKASH_VERSION) [email protected]:ovrclk/akash.git ./chain-code/akash

get-chains: get-gaia get-akash

delete-chains:
@echo "Removing the ./chain-code/ directory..."
@rm -rf ./chain-code
55 changes: 19 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,76 +36,59 @@ If you would like to join a relayer testnet, please [check out the instructions]
While the relayer is under active development, it is meant primarily as a learning tool to better understand the Inter-Blockchain Communication (IBC) protocol. In that vein, the following demo demonstrates the core functionality which will remain even after the changes:

```bash
# ensure go is installed and GOPATH, GOBIN are set appropriately and GOBIN is in your PATH
# Documentation: https://golang.org/doc/install
# ensure go and jq are installed
# Go Documentation: https://golang.org/doc/install
# jq Documentation: https://stedolan.github.io/jq/download

# two-chainz creates two gaia-based chains with data directories in this
# First, download and build the gaia source code so we have a working blockchain to test against
$ make get-gaia build-gaia

# two-chainz creates two gaia-based chains with data directories in this repo
# it also builds and configures the relayer for operations with those chains
$ ./scripts/two-chainz
# NOTE: If you want to stop the two gaia-based chains running in the background use `killall gaiad`

# Make the relayer binary (rly)
$ make install

# First initialize your configuration for the relayer
$ rly config init

# NOTE: you may want to look at the config between these steps to see
# what is added in each step. The config is located at ~/.relayer/config/config.yaml
$ cat ~/.relayer/config/config.yaml

# Then add the chains and paths that you will need to work with the
# gaia chains spun up by the two-chains script
$ rly cfg add-dir configs/demo/

# NOTE: you may want to look at the config between these steps
$ cat ~/.relayer/config/config.yaml

# Now, add the key seeds from each chain to the relayer to give it funds to work with
$ rly keys restore ibc-0 testkey "$(jq -r '.mnemonic' data/ibc-0/key_seed.json)"
$ rly k r ibc-1 testkey "$(jq -r '.mnemonic' data/ibc-1/key_seed.json)"

# Then its time to initialize the relayer's light clients for each chain
# All data moving forward is validated by these light clients.
$ rly light init ibc-0 -f
$ rly l i ibc-1 -f

# At this point the relayer --home directory is ready for normal operations between
# ibc-0 and ibc-1. Looking at the folder structure of the relayer at this point is helpful
# NOTE: to install tree try `brew install tree` on mac or `apt install tree` on linux
$ tree ~/.relayer

# See if the chains are ready to relay over
$ rly chains list

# See the current status of the path you will relay over
$ rly paths list

# Now you can connect the two chains with one command:
$ rly tx link demo -d -o 3s

# Check the token balances on both chains
$ rly q balance ibc-0 | jq
$ rly q bal ibc-1 | jq
$ rly q balance ibc-0
$ rly q bal ibc-1

# Then send some tokens between the chains
$ rly tx transfer ibc-0 ibc-1 1000000samoleans $(rly chains address ibc-1)
$ rly tx relay demo -d

# See that the transfer has completed
$ rly q bal ibc-0 | jq
$ rly q bal ibc-1 | jq
$ rly q bal ibc-0
$ rly q bal ibc-1

# Send the tokens back to the account on ibc-0
$ rly tx xfer ibc-1 ibc-0 1000000transfer/ibczeroxfer/samoleans $(rly ch addr ibc-0)
$ rly tx rly demo -d

# See that the return trip has completed
$ rly q bal ibc-0 | jq
$ rly q bal ibc-1 | jq
$ rly q bal ibc-0
$ rly q bal ibc-1

# NOTE: you will see the stake balances decreasing on each chain. This is to pay for fees
# You can change the amount of fees you are paying on each chain in the configuration.
```

## Setting up Developer Environment

Working with the relayer can frequently involve working with local development branches of `gaia`, `cosmos-sdk` and the `relayer`. To setup your environment to point at the local versions of the code and reduce the amount of time in your read-eval-print loops try the following:
Working with the relayer can frequently involve working with local development branches of `gaia`, `akash`, `cosmos-sdk` and the `relayer`. To setup your environment to point at the local versions of the code and reduce the amount of time in your read-eval-print loops try the following:

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.
Expand Down
2 changes: 1 addition & 1 deletion configs/three/demo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"src":{"chain-id":"ibc-0","client-id":"ibconeclient","connection-id":"ibconeconnection","channel-id":"ibconexfer","port-id":"transfer","order":"ordered","version":"ics20-1"},"dst":{"chain-id":"ibc-1","client-id":"ibczeroclient","connection-id":"ibczeroconnection","channel-id":"ibczeroxfer","port-id":"transfer","order":"ordered","version":"ics20-1"},"strategy":{"type":"naive"}}
{"src":{"chain-id":"ibc-0","client-id":"ibconeclient","connection-id":"ibconeconnection","channel-id":"ibconexfer","port-id":"transfer","order":"unordered","version":"ics20-1"},"dst":{"chain-id":"ibc-1","client-id":"ibczeroclient","connection-id":"ibczeroconnection","channel-id":"ibczeroxfer","port-id":"transfer","order":"unordered","version":"ics20-1"},"strategy":{"type":"naive"}}
2 changes: 1 addition & 1 deletion configs/three/demo2.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"src":{"chain-id":"ibc-1","client-id":"ibctwoclient","connection-id":"ibctwoconnection","channel-id":"ibctwoxfer","port-id":"transfer","order":"ordered","version":"ics20-1"},"dst":{"chain-id":"ibc-2","client-id":"ibconeclient","connection-id":"ibconeconnection","channel-id":"ibconexfer","port-id":"transfer","order":"ordered","version":"ics20-1"},"strategy":{"type":"naive"}}
{"src":{"chain-id":"ibc-1","client-id":"ibctwoclient","connection-id":"ibctwoconnection","channel-id":"ibctwoxfer","port-id":"transfer","order":"unordered","version":"ics20-1"},"dst":{"chain-id":"ibc-2","client-id":"ibconeclient","connection-id":"ibconeconnection","channel-id":"ibconexfer","port-id":"transfer","order":"unordered","version":"ics20-1"},"strategy":{"type":"naive"}}
9 changes: 6 additions & 3 deletions dev-env
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ fi

cd $RELAYER_DIR
rm -rf $RELAYER_CONF &> /dev/null
bash scripts/two-chainz-akash "local" "skip"
bash scripts/config-relayer-akash "skip"
bash scripts/two-chainz-akash "skip"

echo "waiting for blocks..."
sleep 3

rly tx full-path demo -d -o 3s
rly tx txf ibc-0 ibc-1 100000samoleans $(rly ch addr ibc-1)
rly tx txf ibc-1 ibc-0 100000samoleans $(rly ch addr ibc-0)
rly tx txf ibc-1 ibc-0 100000samoleans $(rly ch addr ibc-0)
sleep 1
rly tx rly demo -d
sleep 1
rly tx acks demo -d
11 changes: 11 additions & 0 deletions scripts/build-akash
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
AKASHDIR="$(dirname $SCRIPTDIR)/chain-code/akash"

[ ! -d "$AKASHDIR" ] && echo "Repositry for akash does not exist at $AKASHDIR. Try running 'make get-akash'..." && exit 1

cd $AKASHDIR
echo "Building akash binary at branch($(git branch --show-current)) tag($(git describe --tags)) commit($(git rev-parse HEAD))"
make install &> /dev/null
akash version --long
11 changes: 11 additions & 0 deletions scripts/build-gaia
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
GAIADIR="$(dirname $SCRIPTDIR)/chain-code/gaia"

[ ! -d "$GAIADIR" ] && echo "Repositry for gaia does not exist at $GAIADIR. Try running 'make get-gaia'..." && exit 1

cd $GAIADIR
echo "Building gaiad binary at branch($(git branch --show-current)) tag($(git describe --tags)) commit($(git rev-parse HEAD))"
make install &> /dev/null
gaiad version --long
40 changes: 0 additions & 40 deletions scripts/config-relayer

This file was deleted.

40 changes: 0 additions & 40 deletions scripts/config-relayer-akash

This file was deleted.

46 changes: 0 additions & 46 deletions scripts/config-three

This file was deleted.

1 change: 1 addition & 0 deletions scripts/four-chainz
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
# TODO: test again, don't think this is currently working

# Ensure jq is installed
if [[ ! -x "$(which jq)" ]]; then
Expand Down
Loading

0 comments on commit 14195ec

Please sign in to comment.