-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (88 loc) · 4.09 KB
/
emerynet-localchain-test.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
name: IBC Testing with Emerynet and Local Chain
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
ibc-testing:
runs-on: ubuntu-latest
env:
EMERYNET_BALANCE_FILE: emerynet_file.txt
LOCAL_BALANCE_FILE: local_file.txt
EMERYNET_CHAIN_ID: agoric-emerynet-8
LOCAL_CHAIN_ID: agoric-local
WALLET_ADDRESS_EMERYNET: agoric10emrzln03exuc9uv98mjwmp95735mjm6k2n9xm
WALLET_ADDRESS_LOCAL: agoric1myfpdaxyj34lqexe9cypu6vrf34xemtfq2a0nt
RELAYER_CONFIG: /workspace/relayer/config-testnet.toml
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Start Testnet Docker Services
run: docker-compose -f docker-compose-testnet.yaml up -d
- name: Check if Hermes relayer has started
run: |
timeout 540 bash -c "\
until docker logs relayer 2>&1 | grep -q 'Hermes has started'; do
echo 'waiting for relayer to start...'
done"
- name: Check Emerynet Wallet Balance
run: |
curl https://emerynet.api.agoric.net/cosmos/bank/v1beta1/balances/$WALLET_ADDRESS_EMERYNET |
jq -r '.balances[] | select(.denom == "ubld") | .amount | tonumber' > $EMERYNET_BALANCE_FILE
- name: Verify Token Count in Local Chain Wallet
run: |
curl http://localhost:1317/cosmos/bank/v1beta1/balances/$WALLET_ADDRESS_LOCAL |
jq -r '.balances | length' > $LOCAL_BALANCE_FILE
- name: Monitor Channel Initialization
run: |
timeout 360 bash -c "\
until line=\$(docker logs relayer 2>&1 | grep 'OpenInitChannel'); do
echo 'Waiting for channel initialization...'
sleep 1
done
if [[ -n \$line ]]; then
channel_id=\$(echo \$line | awk -F'channel_id: ' '{print \$2}' | awk -F', ' '{print \$1}')
echo \"Channel ID extracted: \$channel_id\"
echo \$channel_id > channel_id.txt
else
echo 'Channel initialization timed out.'
exit 1
fi"
- name: Confirm Channel Status
run: |
channel_id=$(cat channel_id.txt)
timeout 600 bash -c "\
until docker logs relayer 2>&1 | grep -q 'OpenConfirmChannel.*$channel_id'; do
echo 'Awaiting confirmation for channel ID: $channel_id...'
sleep 1
done
echo 'Channel ID $channel_id confirmed.'"
- name: Execute IBC Token Transfer
run: |
docker exec relayer hermes --config $RELAYER_CONFIG tx ft-transfer --src-chain $EMERYNET_CHAIN_ID --src-channel $(cat channel_id.txt) \
--dst-chain $LOCAL_CHAIN_ID --src-port transfer --amount 100 --denom 'ubld' --timeout-seconds 1000 && \
sleep 5
- name: Verify Token Transfer on Emerynet
run: |
NEW_EMERYNET_BALANCE=$(curl https://emerynet.api.agoric.net/cosmos/bank/v1beta1/balances/$WALLET_ADDRESS_EMERYNET |
jq -r '.balances[] | select(.denom == "ubld") | .amount | tonumber')
ORIGINAL_EMERYNET_BALANCE=$(cat $EMERYNET_BALANCE_FILE)
BALANCE_DIFFERENCE=$((ORIGINAL_EMERYNET_BALANCE - NEW_EMERYNET_BALANCE))
if [ "$BALANCE_DIFFERENCE" -ne 100 ]; then
echo "Token transfer discrepancy detected: Expected 100, found $BALANCE_DIFFERENCE."
exit 1
else
echo "Token transfer validated: Balance difference is exactly 100ubld."
fi
- name: Verify Token Transfer on Local Chain
run: |
timeout 120 bash -c '
OLD_BALANCE_LENGTH=$(cat "$LOCAL_BALANCE_FILE")
NEW_BALANCE_LENGTH=$(curl -s http://localhost:1317/cosmos/bank/v1beta1/balances/"$WALLET_ADDRESS_LOCAL" | jq -r ".balances | length")
until [ "$NEW_BALANCE_LENGTH" -gt "$OLD_BALANCE_LENGTH" ]; do
NEW_BALANCE_LENGTH=$(curl -s http://localhost:1317/cosmos/bank/v1beta1/balances/"$WALLET_ADDRESS_LOCAL" | jq -r ".balances | length")
echo "Old Balance Length: $OLD_BALANCE_LENGTH"
echo "New Balance Length: $NEW_BALANCE_LENGTH"
done
'