forked from hyperledger-labs/yui-relayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dongri Jin <[email protected]>
- Loading branch information
Showing
4 changed files
with
186 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#!/bin/bash | ||
|
||
: <<'END_COMMENT' | ||
* relay-interval = 10s | ||
* relay-optimize-interval = 15s | ||
* relay-optimize-count = 3 | ||
- relay service [query = 0, time = 0] -> skip | ||
- transfer | ||
- | ||
- | ||
- finality | ||
- query = 1 | ||
- | ||
- | ||
- | ||
- | ||
- relay service [query = 1, time = 10] -> skip | ||
- transfer | ||
- | ||
- | ||
- finality | ||
- query = 2 | ||
- | ||
- | ||
- | ||
- | ||
- relay service [query = 2, time = 20] -> exec (time) | ||
- transfer x 3 | ||
- | ||
- | ||
- finality | ||
- query 3 | ||
- | ||
- | ||
- | ||
- | ||
- relay service [query = 3, time = 10] -> exec (count) | ||
END_COMMENT | ||
|
||
set -eux | ||
|
||
SCRIPT_DIR=$(cd $(dirname $0); pwd) | ||
RLY_BINARY=${SCRIPT_DIR}/../../../../build/yrly | ||
RLY="${RLY_BINARY} --debug" | ||
|
||
TM_ADDRESS0=$(${RLY} tendermint keys show ibc0 testkey) | ||
TM_ADDRESS1=$(${RLY} tendermint keys show ibc1 testkey) | ||
|
||
RETRY_COUNT=5 | ||
RETRY_INTERVAL=1 | ||
|
||
${RLY} service start ibc01 --relay-interval 10s --relay-optimize-interval 15s --relay-optimize-count 3 & | ||
RLY_PID=$! | ||
|
||
# transfer a token | ||
${RLY} tx transfer ibc01 ibc0 ibc1 100samoleans ${TM_ADDRESS1} | ||
sleep 3 # finality_delay | ||
|
||
# query unrelayed-packets 1 | ||
unrelayed_packets=$(${RLY} query unrelayed-packets ibc01 | jq '.src | length') | ||
if [ $unrelayed_packets -ne 1 ]; then | ||
echo "unrelayed_packets: $unrelayed_packets" | ||
kill $RLY_PID | ||
exit 1 | ||
fi | ||
|
||
sleep 7 # wait for relay-interval | ||
echo "xxxxxxx relay service -> skip xxxxxx" | ||
|
||
# transfer a token | ||
${RLY} tx transfer ibc01 ibc0 ibc1 100samoleans ${TM_ADDRESS1} | ||
sleep 3 # finality_delay | ||
|
||
# query unrelayed-packets 2 | ||
unrelayed_packets=$(${RLY} query unrelayed-packets ibc01 | jq '.src | length') | ||
if [ $unrelayed_packets -ne 2 ]; then | ||
echo "unrelayed_packets: $unrelayed_packets" | ||
kill $RLY_PID | ||
exit 1 | ||
fi | ||
|
||
sleep 7 # wait for relay-interval | ||
echo "xxxxxxx relay service -> exec - time xxxxxx" | ||
|
||
# transfer a token x 3 | ||
${RLY} tx transfer ibc01 ibc0 ibc1 100samoleans ${TM_ADDRESS1} | ||
${RLY} tx transfer ibc01 ibc0 ibc1 100samoleans ${TM_ADDRESS1} | ||
${RLY} tx transfer ibc01 ibc0 ibc1 100samoleans ${TM_ADDRESS1} | ||
sleep 3 # finality_delay | ||
|
||
# query unrelayed-packets 3 | ||
unrelayed_packets=$(${RLY} query unrelayed-packets ibc01 | jq '.src | length') | ||
if [ $unrelayed_packets -ne 3 ]; then | ||
echo "unrelayed_packets: $unrelayed_packets" | ||
kill $RLY_PID | ||
exit 1 | ||
fi | ||
|
||
sleep 7 # wait for relay-interval | ||
echo "xxxxxxx relay service -> exec - count xxxxxx" | ||
|
||
# wait for relay service to execute | ||
for i in `seq $RETRY_COUNT` | ||
do | ||
echo "[try:$i] waiting for sendPacket finalization ..." | ||
sleep $RETRY_INTERVAL | ||
unrelayed=$(${RLY} query unrelayed-packets ibc01 | jq '.src | length') | ||
if [ $unrelayed -eq 0 ]; then | ||
break | ||
fi | ||
done | ||
|
||
kill $RLY_PID |