-
Notifications
You must be signed in to change notification settings - Fork 16
240 lines (180 loc) · 12.1 KB
/
test_e2e_IBC.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: Integration_test_ibc
on:
pull_request:
push:
branches:
- master
jobs:
test-e2e:
name: End-to-end Test
runs-on: ubuntu-latest
steps:
- name: Set up Golang
uses: actions/setup-go@v2
- name: Checkout current repository
uses: actions/checkout@v2
- name: Checkout leejw51crypto/ibc-rs
uses: actions/checkout@v2
with:
repository: leejw51crypto/ibc-rs
ref: ibc
path: hermes-rs
submodules: recursive
- name: Checkout `chain-main` repository
uses: actions/checkout@v2
with:
repository: crypto-org-chain/chain-main
path: chain-main
ref: v3.1.1
submodules: recursive
- name: Build and start CHAIN_1
run: |
sudo apt-get install jq
mkdir ./chain2 && mkdir ./chain1
cp -r chain-main/* ./chain1/
cp -r chain-main/* ./chain2/
## Setup, configure and start `chain1`
cd ./chain1
rm -rf $CHAIN_1_HOME
export CHAIN_1_HOME=$PWD/chain1_data
export CHAIN_1_ID=testnet1
export CHAIN_1_MONIKER=chain1
export ETHCONFIG=$CHAIN_1_HOME/config/config.toml
export GENESIS=$CHAIN_1_HOME/config/genesis.json
export TMPGENESIS=$CHAIN_1_HOME/config/tmp_genesis.json
export APPCONFIG=$CHAIN_1_HOME/config/app.toml
export CLIENTCONFIG=$CHAIN_1_HOME/config/client.toml
export DENOM=denomone
export CLI=./build/chain-maind
export VALIDATOR_MNEMONIC="whale dry improve icon perfect sauce lesson wire oblige gadget exhaust toast spin enforce labor logic giraffe feed project weasel absent build reject life"
export ECOSYSTEM_MNEMONIC="rubber rocket snack author mad ship core physical arrange language enrich story lamp move dynamic into game marine ramp trap anchor beyond mystery gun"
export TOTALAMOUNT=100000000000000000000000000000000$DENOM
export MYAMOUNT=1000100000000000000001$DENOM
NETWORK=testnet make install
NETWORK=testnet make build
$CLI config keyring-backend test --home $CHAIN_1_HOME
$CLI config chain-id $CHAIN_1_ID --home $CHAIN_1_HOME
$CLI init $CHAIN_1_MONIKER --chain-id $CHAIN_1_ID --home $CHAIN_1_HOME
echo $VALIDATOR_MNEMONIC | $CLI keys add validator --keyring-backend test --recover --index 0 --home $CHAIN_1_HOME
echo $ECOSYSTEM_MNEMONIC | $CLI keys add ecosystem --keyring-backend test --recover --index 1 --home $CHAIN_1_HOME
# $CLI keys add validator --keyring-backend test --home $CHAIN_1_HOME --output json >> ./validator.json
# $CLI keys add ecosystem --keyring-backend test --home $CHAIN_1_HOME --output json >> ./ecosystem.json
# Change parameter token denominations to $DENOM
cat $GENESIS | jq '.app_state["staking"]["params"]["bond_denom"]="'$DENOM'"' > $TMPGENESIS && mv $TMPGENESIS $GENESIS
cat $GENESIS | jq '.app_state["crisis"]["constant_fee"]["denom"]="'$DENOM'"' > $TMPGENESIS && mv $TMPGENESIS $GENESIS
cat $GENESIS | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="'$DENOM'"' > $TMPGENESIS && mv $TMPGENESIS $GENESIS
cat $GENESIS | jq '.app_state["mint"]["params"]["mint_denom"]="'$DENOM'"' > $TMPGENESIS && mv $TMPGENESIS $GENESIS
# increase block time (?)
cat $GENESIS | jq '.consensus_params["block"]["time_iota_ms"]="1000"' > $TMPGENESIS && mv $TMPGENESIS $GENESIS
# Set gas limit in genesis
cat $GENESIS | jq '.consensus_params["block"]["max_gas"]="10000000"' > $TMPGENESIS && mv $TMPGENESIS $GENESIS
# Allocate genesis accounts (cosmos formatted addresses)
$CLI add-genesis-account $($CLI keys show validator -a --keyring-backend test --home $CHAIN_1_HOME) $TOTALAMOUNT --keyring-backend test --home $CHAIN_1_HOME
$CLI add-genesis-account $($CLI keys show ecosystem -a --keyring-backend test --home $CHAIN_1_HOME) $MYAMOUNT --keyring-backend test --home $CHAIN_1_HOME
$CLI gentx validator $MYAMOUNT --keyring-backend test --chain-id $CHAIN_1_ID --home $CHAIN_1_HOME
$CLI collect-gentxs --home $CHAIN_1_HOME
$CLI validate-genesis --home $CHAIN_1_HOME
$CLI start --pruning=nothing --trace --log_level info --minimum-gas-prices=0.0001$DENOM --home $CHAIN_1_HOME &
- name: Build and start CHAIN_2
run: |
## Setup, configure and start `chain2`
cd ./chain2
rm -rf $CHAIN_2_HOME
export CHAIN_2_HOME=$PWD/chain2_data
export CHAIN_2_ID=testnet2
export CHAIN_2_MONIKER=chain2
export ETHCONFIG=$CHAIN_2_HOME/config/config.toml
export GENESIS=$CHAIN_2_HOME/config/genesis.json
export TMPGENESIS=$CHAIN_2_HOME/config/tmp_genesis.json
export APPCONFIG=$CHAIN_2_HOME/config/app.toml
export CLIENTCONFIG=$CHAIN_2_HOME/config/client.toml
export CLI=./build/chain-maind
export VALIDATOR_MNEMONIC="whale dry improve icon perfect sauce lesson wire oblige gadget exhaust toast spin enforce labor logic giraffe feed project weasel absent build reject life"
export ECOSYSTEM_MNEMONIC="rubber rocket snack author mad ship core physical arrange language enrich story lamp move dynamic into game marine ramp trap anchor beyond mystery gun"
# New node ports and hosts
export DENOM_2=denomtwo
export GRPCPORT0=9080
export GRPCPORT1=9081
export ETHPORT0=8535
export ETHPORT1=8536
export COSMOSPORT0=26646
export COSMOSPORT1=26647
export NODE=tcp://127.0.0.1:26707
export TOTALAMOUNT=200000000000000000000000000000000$DENOM_2
export MYAMOUNT=2000200000000000000001$DENOM_2
NETWORK=testnet make install
NETWORK=testnet make build
$CLI config keyring-backend test --home $CHAIN_2_HOME
$CLI config chain-id $CHAIN_2_ID --home $CHAIN_2_HOME
$CLI init $CHAIN_2_MONIKER --chain-id $CHAIN_2_ID --home $CHAIN_2_HOME
echo $VALIDATOR_MNEMONIC | $CLI keys add validator --keyring-backend test --recover --index 0 --home $CHAIN_2_HOME
echo $ECOSYSTEM_MNEMONIC | $CLI keys add ecosystem --keyring-backend test --recover --index 1 --home $CHAIN_2_HOME
# $CLI keys add validator --keyring-backend test --home $CHAIN_2_HOME --output json >> ./validator.json
# $CLI keys add ecosystem --keyring-backend test --home $CHAIN_2_HOME --output json >> ./ecosystem.json
# Change parameter token denominations to $DENOM_2
cat $GENESIS | jq '.app_state["staking"]["params"]["bond_denom"]="'$DENOM_2'"' > $TMPGENESIS && mv $TMPGENESIS $GENESIS
cat $GENESIS | jq '.app_state["crisis"]["constant_fee"]["denom"]="'$DENOM_2'"' > $TMPGENESIS && mv $TMPGENESIS $GENESIS
cat $GENESIS | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="'$DENOM_2'"' > $TMPGENESIS && mv $TMPGENESIS $GENESIS
cat $GENESIS | jq '.app_state["mint"]["params"]["mint_denom"]="'$DENOM_2'"' > $TMPGENESIS && mv $TMPGENESIS $GENESIS
# increase block time (?)
cat $GENESIS | jq '.consensus_params["block"]["time_iota_ms"]="1000"' > $TMPGENESIS && mv $TMPGENESIS $GENESIS
# Set gas limit in genesis
cat $GENESIS | jq '.consensus_params["block"]["max_gas"]="10000000"' > $TMPGENESIS && mv $TMPGENESIS $GENESIS
# change port
sed -i "s/create_empty_blocks = true/create_empty_blocks = false/g" $ETHCONFIG
sed -i "s/26657/$COSMOSPORT1/g" $CLIENTCONFIG
sed -i "s/26657/$COSMOSPORT1/g" $ETHCONFIG
sed -i "s/26656/$COSMOSPORT0/g" $ETHCONFIG
sed -i "s/9090/$GRPCPORT0/g" $APPCONFIG
sed -i "s/9091/$GRPCPORT1/g" $APPCONFIG
sed -i "s/8545/$ETHPORT0/g" $APPCONFIG
sed -i "s/8546/$ETHPORT1/g" $APPCONFIG
sed -i "s/aphoton/$DENOM_2/g" $APPCONFIG
sed -i "s/aphoton/$DENOM_2/g" $GENESIS
# Allocate genesis accounts (cosmos formatted addresses)
$CLI add-genesis-account $($CLI keys show validator -a --keyring-backend test --home $CHAIN_2_HOME) $TOTALAMOUNT --keyring-backend test --home $CHAIN_2_HOME
$CLI add-genesis-account $($CLI keys show ecosystem -a --keyring-backend test --home $CHAIN_2_HOME) $MYAMOUNT --keyring-backend test --home $CHAIN_2_HOME
$CLI gentx validator $MYAMOUNT --keyring-backend test --chain-id $CHAIN_2_ID --home $CHAIN_2_HOME
$CLI collect-gentxs --home $CHAIN_2_HOME
$CLI validate-genesis --home $CHAIN_2_HOME
$CLI start --pruning=nothing --trace --log_level info --minimum-gas-prices=0.0001$DENOM_2 --home $CHAIN_2_HOME &
- name: Ping and check both the networks
run: |
## Sleep 5 Seconds
sleep 5
# Network 1 : chain1 | Should return `network1` & `chain1`
curl --location --request GET 'localhost:26657/status' | jq '.result'
# Network 2 : chain2 | Should return `network2` & `chain2`
curl --location --request GET 'localhost:26647/status' | jq '.result'
- name: Setup hermes
run: |
wget -q -O hermes.tar.gz https://github.com/informalsystems/ibc-rs/releases/download/v0.7.0/hermes-v0.7.0-x86_64-unknown-linux-gnu.tar.gz
mkdir -p $HOME/.hermes/bin
tar -C $HOME/.hermes/bin/ -xzf hermes.tar.gz
export PATH="$HOME/.hermes/bin:$PATH"
cp workflowConfig/config.toml ./hermes-rs
cd hermes-rs
export MYIBC0=testnet1
export MYIBC1=testnet2
export MYCHANNEL=channel-0
export MYCONFIG=$PWD/config.toml
cat $MYCONFIG
hermes -c $MYCONFIG keys restore $MYIBC0 -m "whale dry improve icon perfect sauce lesson wire oblige gadget exhaust toast spin enforce labor logic giraffe feed project weasel absent build reject life" -p "m/44'/1'/0'/0/0"
hermes -c $MYCONFIG keys restore $MYIBC1 -m "whale dry improve icon perfect sauce lesson wire oblige gadget exhaust toast spin enforce labor logic giraffe feed project weasel absent build reject life" -p "m/44'/1'/0'/0/0"
hermes -c $MYCONFIG keys list $MYIBC0
hermes -c $MYCONFIG keys list $MYIBC1
hermes -c $MYCONFIG create channel $MYIBC0 $MYIBC1 --port-a transfer --port-b transfer
hermes -c $MYCONFIG start &
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- uses: actions/cache@v2
id: cache-deps
with:
path: node_modules
key: ${{ runner.os }}-node${{ matrix.code }}-${{ hashFiles('**/package-lock.json') }}
- name: Run e2e test suite
run: |
npm install --no-progress --silent --quiet
npm run test:e2e:ibc