-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from agoric-labs/rs-local-chain-ibc-testing
local chain ibc testing
- Loading branch information
Showing
2 changed files
with
111 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: 'Check Token Balances' | ||
description: 'Checks token balances on specified blockchain containers.' | ||
|
||
inputs: | ||
container: | ||
description: 'Docker container name' | ||
required: true | ||
address: | ||
description: 'Wallet address to check the balance' | ||
required: true | ||
expected_amount: | ||
description: 'Expected token amount' | ||
required: true | ||
expected_denom: | ||
description: 'Expected token denomination' | ||
required: true | ||
expected_length: | ||
description: 'Expected number of balance entries' | ||
required: true | ||
default: '1' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Check token balances and validate | ||
shell: bash | ||
run: | | ||
# Fetch and process balances | ||
json_output=$(docker exec ${{ inputs.container }} agd query bank balances ${{ inputs.address }} -o json) | ||
balances=$(echo "$json_output" | jq '.balances') | ||
length=$(echo "$balances" | jq 'length') | ||
amount=$(echo "$balances" | jq -r '.[0].amount') | ||
denom=$(echo "$balances" | jq -r '.[0].denom') | ||
# Validate balances | ||
if [ "$length" -ne "${{ inputs.expected_length }}" ] || [ "$amount" != "${{ inputs.expected_amount }}" ] || [ "$denom" != "${{ inputs.expected_denom }}" ]; then | ||
echo "Failure: Expected ${{ inputs.expected_length }} entries with amount ${{ inputs.expected_amount }} and denom ${{ inputs.expected_denom }}, found length $length, amount $amount, denom $denom." | ||
exit 1 | ||
else | ||
echo "Success: Balance check passed with correct length and values." | ||
fi |
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,70 @@ | ||
name: IBC Testing with Local Chains | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
ibc-testing: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build Docker image | ||
run: docker build -t a3p:local . | ||
|
||
- name: Start Docker Compose services | ||
run: docker-compose up -d | ||
|
||
- name: Check if Hermes relayer has started | ||
run: | | ||
timeout 240 bash -c "\ | ||
until docker logs relayer 2>&1 | grep -q 'Hermes has started'; do | ||
echo 'waiting for relayer to start...' | ||
done" | ||
- name: Check token balance on chain 1 | ||
uses: ./.github/actions/check-balances | ||
with: | ||
container: 'agoric-local-1' | ||
address: 'agoric1myfpdaxyj34lqexe9cypu6vrf34xemtfq2a0nt' | ||
expected_amount: '500000000' | ||
expected_denom: 'ubld' | ||
expected_length: '1' | ||
|
||
- name: Check token balance on chain 2 | ||
uses: ./.github/actions/check-balances | ||
with: | ||
container: 'agoric-local-2' | ||
address: 'agoric1aczzle80960fc0vq8gemjuu8ydrql07az7fmur' | ||
expected_amount: '500000000' | ||
expected_denom: 'ubld' | ||
expected_length: '1' | ||
|
||
- name: Transfer tokens via IBC | ||
run: | | ||
docker exec relayer hermes --config /workspace/relayer/config.toml tx ft-transfer --src-chain agoric-local-1 --src-channel channel-0 \ | ||
--dst-chain agoric-local-2 --src-port transfer --amount 100 --denom 'ubld' --timeout-seconds 1000 && \ | ||
sleep 5 | ||
- name: Check token balance on chain 1 after transfer | ||
uses: ./.github/actions/check-balances | ||
with: | ||
container: 'agoric-local-1' | ||
address: 'agoric1myfpdaxyj34lqexe9cypu6vrf34xemtfq2a0nt' | ||
expected_amount: '499999900' | ||
expected_denom: 'ubld' | ||
expected_length: '1' | ||
|
||
- name: Check token balance on chain 2 after tansfer | ||
uses: ./.github/actions/check-balances | ||
with: | ||
container: 'agoric-local-2' | ||
address: 'agoric1aczzle80960fc0vq8gemjuu8ydrql07az7fmur' | ||
expected_amount: '100' | ||
expected_denom: 'ibc/49C630713B2AB60653F76C0C58D43C2A64956803B4D422CACB6DD4AD016ED846' | ||
expected_length: '2' |