Skip to content

Commit 87f14e6

Browse files
author
Daisuke Kanda
committed
add timeout test and ordered channel test in eth2eth
Signed-off-by: Daisuke Kanda <[email protected]>
1 parent 7220f20 commit 87f14e6

File tree

4 files changed

+83
-1
lines changed

4 files changed

+83
-1
lines changed

tests/cases/eth2eth/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ test-single:
2727
./scripts/handshake
2828
./scripts/test-channel-upgrade single
2929
./scripts/test-tx
30+
./scripts/test-timeout
31+
32+
.PHONY: test-ordered
33+
test-ordered:
34+
./scripts/fixture single
35+
./scripts/init-rly path-ordered.json
36+
./scripts/handshake
37+
./scripts/test-tx
38+
./scripts/test-timeout
3039

3140
.PHONY: network-down
3241
network-down:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"src": {
3+
"chain-id": "ibc0",
4+
"client-id": "",
5+
"connection-id": "",
6+
"channel-id": "",
7+
"port-id": "mockapp",
8+
"order": "ordered",
9+
"version": "mockapp-1"
10+
},
11+
"dst": {
12+
"chain-id": "ibc1",
13+
"client-id": "",
14+
"connection-id": "",
15+
"channel-id": "",
16+
"port-id": "mockapp",
17+
"order": "ordered",
18+
"version": "mockapp-1"
19+
},
20+
"strategy": {
21+
"type": "naive"
22+
}
23+
}

tests/cases/eth2eth/scripts/init-rly

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set -eu
44

55
SCRIPT_DIR=$(cd $(dirname ${BASH_SOURCE:-$0}); pwd)
66
source ${SCRIPT_DIR}/util/relayer-util
7+
PATH_JSON=${1:-path.json}
78

89
rm -rf ${RELAYER_CONF} &> /dev/null
910

@@ -13,4 +14,4 @@ ${RLY} config init
1314
${RLY} chains add-dir ${CONF_DIR}/chains/
1415

1516
# add a path between chain0 and chain1
16-
$RLY paths add $CHAINID_ONE $CHAINID_TWO $PATH_NAME --file=${CONF_DIR}/path.json
17+
$RLY paths add $CHAINID_ONE $CHAINID_TWO $PATH_NAME --file=${CONF_DIR}/$PATH_JSON
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
SCRIPT_DIR=$(cd $(dirname ${BASH_SOURCE:-$0}); pwd)
6+
FIXTURES_DIR=${SCRIPT_DIR}/../fixtures
7+
8+
source ${SCRIPT_DIR}/util/relayer-util
9+
10+
ADDRESSES_DIR_A="${FIXTURES_DIR}/ethereum/ibc0/addresses"
11+
ADDRESSES_DIR_B="${FIXTURES_DIR}/ethereum/ibc1/addresses"
12+
MOCKAPP_A=`cat ${ADDRESSES_DIR_A}/AppV1`
13+
MOCKAPP_B=`cat ${ADDRESSES_DIR_B}/AppV1`
14+
15+
CONFIG_JSON=${RELAYER_CONF}/config/config.json
16+
17+
MNEMONIC_A=$(jq -r '.chains[] | select(.chain.chain_id == "ibc0").chain.signer.mnemonic' ${CONFIG_JSON})
18+
MNEMONIC_B=$(jq -r '.chains[] | select(.chain.chain_id == "ibc1").chain.signer.mnemonic' ${CONFIG_JSON})
19+
20+
RPC_ADDRESS_A=$(jq -r '.chains[] | select(.chain.chain_id == "ibc0").chain.rpc_addr' ${CONFIG_JSON})
21+
RPC_ADDRESS_B=$(jq -r '.chains[] | select(.chain.chain_id == "ibc1").chain.rpc_addr' ${CONFIG_JSON})
22+
23+
PORT_A=$(jq -r '.paths.ibc01.src."port-id"' ${CONFIG_JSON})
24+
PORT_B=$(jq -r '.paths.ibc01.dst."port-id"' ${CONFIG_JSON})
25+
CHANNEL_A=$(jq -r '.paths.ibc01.src."channel-id"' ${CONFIG_JSON})
26+
CHANNEL_B=$(jq -r '.paths.ibc01.dst."channel-id"' ${CONFIG_JSON})
27+
28+
# send a packet from ibc0 to ibc1
29+
echo "!!! ibc0 alice -> ibc1 bob !!!"
30+
ALICE_INDEX=1
31+
cast send \
32+
--rpc-url $RPC_ADDRESS_A \
33+
--mnemonic "$MNEMONIC_A" \
34+
--mnemonic-index ${ALICE_INDEX} \
35+
$MOCKAPP_A \
36+
'sendPacket(bytes,string,string,(uint64,uint64),uint64)' \
37+
$(cast from-utf8 'mock packet data') \
38+
$PORT_A \
39+
$CHANNEL_A \
40+
'(0,100000)' \
41+
$(date -d 1sec +%s%N)
42+
43+
sleep 5
44+
tmpfile=$0.log
45+
waitRelay "sendPacket" "unrelayed-packets" "src"
46+
${RLY} tx relay ${PATH_NAME} 2>&1 | tee $tmpfile
47+
grep -e 'core\.(\*RelayMsgs)\.Send' $tmpfile | grep ProofUnreceived
48+
49+

0 commit comments

Comments
 (0)