Skip to content

Commit

Permalink
Merge PR #141: Adding github workflows for CoCo, along with testnet c…
Browse files Browse the repository at this point in the history
…hains

* Adding github workflows for coco

* Adding CoCo & FreeFlix chains details

* updating node details.
  • Loading branch information
saiSunkari19 authored Apr 27, 2020
1 parent 31efb44 commit 498f1c3
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 7 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/coco-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: TESTING - coco to ibc integration

on: [push]

jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
# Install and setup go
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go

# checkout relayer
- name: checkout relayer
uses: actions/checkout@v2

# build cache
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# run tests
- name: run coco tests
run: TEST_DEBUG=true make test-coco
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ coverage.out
release.tar.gz
.env
nchainz/
.idea/
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ test-rocketzone:
@TEST_DEBUG=true go test -mod=readonly -v -coverprofile coverage.out ./test/... -run TestRocket*

test-agoric:
@TEST_DEBUG=true go test -mod=readonly -v -coverprofile coverage.out ./test/... -run TestAgoric*
@TEST_DEBUG=true go test -mod=readonly -v -coverprofile coverage.out ./test/... -run TestAgoric*

test-coco:
@TEST_DEBUG=true go test -mod=mod -v -coverprofile coverage.out ./test/... -run TestCoCo*

coverage:
@echo "viewing test coverage..."
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ If you would like to join the relayer testnet, please [check out the instruction
| [`gaia`](https://github.com/cosmos/gaia) | ![gaia](https://github.com/iqlusioninc/relayer/workflows/TESTING%20-%20gaia%20to%20gaia%20integration/badge.svg) | `transfer` |
| `microtick` | ![microtick](https://github.com/iqlusioninc/relayer/workflows/TESTING%20-%20mtd%20to%20ibc%20integration/badge.svg) | `transfer` |
| [`rocketzone`](https://github.com/rocket-protocol/rocketzone) | ![rocketzone](https://github.com/iqlusioninc/relayer/workflows/TESTING%20-%20rocketzone%20to%20ibc%20integration/badge.svg) | `transfer` |
| [`coco`](https://github.com/CosmicCompass/post-chain) | ![coco](https://github.com/CosmicCompass/relayer/workflows/TESTING%20-%20coco%20to%20ibc%20integration/badge.svg) | `transfer` |

## Demoing the Relayer

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/iqlusioninc/relayer
go 1.14

require (
github.com/CosmicCompass/post-chain v0.0.0-20200425063042-f936180f841c
github.com/avast/retry-go v2.6.0+incompatible
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200102211924-4bcbc698314f h1:4O1om+U
github.com/ChainSafe/go-schnorrkel v0.0.0-20200102211924-4bcbc698314f/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4=
github.com/CosmicCompass/post-chain v0.0.0-20200425063042-f936180f841c h1:X6DyGTZFA9UySkh8EWhnWO26XRWjHlD95TyKPFfoR0E=
github.com/CosmicCompass/post-chain v0.0.0-20200425063042-f936180f841c/go.mod h1:3X8dI91RhiEOGbCKCHkQmTrNEC3d16tZMee1snJwTbw=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
Expand Down Expand Up @@ -342,10 +344,12 @@ github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:v
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo=
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
Expand Down
97 changes: 97 additions & 0 deletions test/relayer_coco_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
package test

import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/iqlusioninc/relayer/relayer"
"github.com/stretchr/testify/require"
)

var (
cocoChains = []testChain{
{"coco-post-chain", cocoTestConfig},
{"ibc", gaiaTestConfig},
}
)

func TestCoCo_CoCoToFFtStreamingRelayer(t *testing.T) {
chains := spinUpTestChains(t, cocoChains...)

var (
src = chains.MustGet("coco-post-chain")
dst = chains.MustGet("ibc")
testDenomSrc = "mdm"
testDenomDst = "samoleans"
testCoinSrc = sdk.NewCoin(testDenomSrc, sdk.NewInt(1000))
twoTestCoinSrc = sdk.NewCoin(testDenomSrc, sdk.NewInt(2000))
testCoinDst = sdk.NewCoin(testDenomDst, sdk.NewInt(1000))
twoTestCoinDst = sdk.NewCoin(testDenomDst, sdk.NewInt(2000))
)

path, err := genTestPathAndSet(src, dst, "transfer", "transfer")
require.NoError(t, err)

// query initial balances to compare against at the end
srcExpected, err := src.QueryBalance(src.Key)
require.NoError(t, err)
dstExpected, err := dst.QueryBalance(dst.Key)
require.NoError(t, err)

// create path
require.NoError(t, src.CreateClients(dst))
testClientPair(t, src, dst)
require.NoError(t, src.CreateConnection(dst, src.GetTimeout()))
testConnectionPair(t, src, dst)
require.NoError(t, src.CreateChannel(dst, true, src.GetTimeout()))
testChannelPair(t, src, dst)

// send a couple of transfers to the queue on src
require.NoError(t, src.SendTransferMsg(dst, testCoinSrc, dst.MustGetAddress(), true))
require.NoError(t, src.SendTransferMsg(dst, testCoinSrc, dst.MustGetAddress(), true))

// send a couple of transfers to the queue on dst
require.NoError(t, dst.SendTransferMsg(src, testCoinDst, src.MustGetAddress(), true))
require.NoError(t, dst.SendTransferMsg(src, testCoinDst, src.MustGetAddress(), true))

// Wait for message inclusion in both chains
require.NoError(t, dst.WaitForNBlocks(1))

// start the relayer process in it's own goroutine
rlyDone, err := relayer.RunStrategy(src, dst, path.MustGetStrategy(), path.Ordered())
require.NoError(t, err)

// send those tokens from dst back to dst and src back to src
require.NoError(t, src.SendTransferMsg(dst, twoTestCoinDst, dst.MustGetAddress(), false))
require.NoError(t, dst.SendTransferMsg(src, twoTestCoinSrc, src.MustGetAddress(), false))

// wait for packet processing
require.NoError(t, dst.WaitForNBlocks(4))

// kill relayer routine
rlyDone()

// check balance on src against expected
srcGot, err := src.QueryBalance(src.Key)
require.NoError(t, err)
require.Equal(t, srcExpected.AmountOf(testDenomSrc).Int64(), srcGot.AmountOf(testDenomSrc).Int64())

// check balance on dst against expected
dstGot, err := dst.QueryBalance(dst.Key)
require.NoError(t, err)
require.Equal(t, dstExpected.AmountOf(testDenomDst).Int64(), dstGot.AmountOf(testDenomDst).Int64())

// Test the full transfer command as well
require.NoError(t, src.SendTransferBothSides(dst, testCoinSrc, dst.MustGetAddress(), true))
require.NoError(t, dst.SendTransferBothSides(src, testCoinSrc, src.MustGetAddress(), false))

// check balance on src against expected
srcGot, err = src.QueryBalance(src.Key)
require.NoError(t, err)
require.Equal(t, srcExpected.AmountOf(testDenomSrc).Int64(), srcGot.AmountOf(testDenomSrc).Int64())

// check balance on dst against expected
dstGot, err = dst.QueryBalance(dst.Key)
require.NoError(t, err)
require.Equal(t, dstExpected.AmountOf(testDenomDst).Int64(), dstGot.AmountOf(testDenomDst).Int64())
}
31 changes: 25 additions & 6 deletions test/test_chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import (
"fmt"
"testing"
"time"

codecstd "github.com/cosmos/cosmos-sdk/codec/std"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/stretchr/testify/require"
"github.com/tendermint/go-amino"

. "github.com/iqlusioninc/relayer/relayer"
"github.com/CosmicCompass/post-chain/app"
)

var (
Expand All @@ -32,7 +33,7 @@ var (
defaultDenom: "stake",
trustingPeriod: "330h",
}

// MTD BLOCK TIMEOUTS on microtick/mtzonetest:ibc-alpha
// timeout_commit = "1000ms"
// timeout_propose = "1000ms"
Expand All @@ -50,7 +51,7 @@ var (
defaultDenom: "stake",
trustingPeriod: "330h",
}

// RocketZone
// timeout_commit = "1000ms"
// timeout_propose = "1000ms"
Expand All @@ -68,7 +69,7 @@ var (
defaultDenom: "ufuel",
trustingPeriod: "330h",
}

// Agoric Chain
// timeout_commit = "1000ms"
// timeout_propose = "1000ms"
Expand All @@ -86,6 +87,24 @@ var (
defaultDenom: "uag",
trustingPeriod: "330h",
}

// CoCo Chain saisunkari19/coco:ibc-alpha
// timeout_commit = "1000ms"
// timeout_propose = "1000ms"
// 3 second relayer timeout works well with these block times
cocoTestConfig = testChainConfig{
cdc: codecstd.NewAppCodec(codecstd.MakeCodec(app.ModuleBasics)),
amino: codecstd.MakeCodec(app.ModuleBasics),
dockerImage: "saisunkari19/coco",
dockerTag: "ibc-alpha",
timeout: 3 * time.Second,
rpcPort: "26657",
accountPrefix: "cosmic",
gas: 200000,
gasPrices: "0.025coco",
defaultDenom: "coco",
trustingPeriod: "330h",
}
)

type (
Expand All @@ -95,7 +114,7 @@ type (
chainID string
t testChainConfig
}

// testChainConfig represents the chain specific docker and codec configurations
// required.
testChainConfig struct {
Expand Down
1 change: 1 addition & 0 deletions testnets/relayer-alpha-2/coco-post-chain.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"faucet","chain-id":"coco-post-chain","rpc-addr":"http://51.178.119.163:26657","account-prefix":"cosmic","gas":200000,"gas-prices":"0.025coco","default-denom":"coco","trusting-period":"330h"}
1 change: 1 addition & 0 deletions testnets/relayer-alpha-2/freeflix-media-hub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"faucet","chain-id":"freeflix-media-hub","rpc-addr":"http://51.178.119.162:26657","account-prefix":"freeflix","gas":200000,"gas-prices":"0.025fmt","default-denom":"fmt","trusting-period":"330h"}

0 comments on commit 498f1c3

Please sign in to comment.