Skip to content

Commit

Permalink
Merge pull request #9 from agoric-labs/rs-segregate-docker-files
Browse files Browse the repository at this point in the history
chore: segregate files and fix ci flakiness
  • Loading branch information
rabi-siddique authored Jul 25, 2024
2 parents af1e77f + ef4f82d commit 0bd054d
Show file tree
Hide file tree
Showing 6 changed files with 223 additions and 44 deletions.
45 changes: 33 additions & 12 deletions .github/workflows/emerynet-localchain-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
LOCAL_CHAIN_ID: agoric-local
WALLET_ADDRESS_EMERYNET: agoric10emrzln03exuc9uv98mjwmp95735mjm6k2n9xm
WALLET_ADDRESS_LOCAL: agoric1myfpdaxyj34lqexe9cypu6vrf34xemtfq2a0nt
RELAYER_CONFIG: /workspace/relayer/config-testnet.toml
RELAYER_CONFIG: /workspace/relayer/config-emerynet-local.toml
TRANSFER_AMOUNT_FROM_EMERYNET: 100
TRANSFER_AMOUNT_FROM_LOCAL: 50
EMERYNET_API_URL: https://emerynet.api.agoric.net/cosmos/bank/v1beta1/balances
Expand All @@ -31,7 +31,7 @@ jobs:
uses: actions/checkout@v4

- name: Start Agoric Local Chain
run: docker-compose -f docker-compose-testnet.yaml up -d agoric-local
run: docker-compose -f docker-compose-emerynet-local.yaml up -d agoric-local

- name: Wait for Local container to be ready
run: |
Expand Down Expand Up @@ -74,17 +74,27 @@ jobs:
echo "done"
}
waitForBlock 2
waitForBlock 8
- name: Start Relayer Service
run: docker-compose -f docker-compose-testnet.yaml up -d relayer
run: docker-compose -f docker-compose-emerynet-local.yaml up -d relayer

- name: Check if Hermes relayer has started
run: |
timeout 540 bash -c "\
echo "Waiting for the Relayer to start..."
timeout 480 bash -c "\
until docker logs relayer 2>&1 | grep -q 'Hermes has started'; do
echo 'waiting for relayer to start...'
sleep 1
done"
docker logs relayer
continue-on-error: true

- name: Stop workflow if Hermes relayer didn't start
if: failure()
run: |
echo "The Hermes relayer failed to start."
docker logs relayer
exit 1 # Explicitly failing the workflow to prevent subsequent steps from running.
- name: Store Local Wallet Balance in a file
uses: ./.github/actions/store-balances
Expand All @@ -104,29 +114,40 @@ jobs:

- name: Monitor Channel Initialization
run: |
timeout 360 bash -c "\
timeout 300 bash -c "\
echo 'Waiting for channel initialization...'
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"
continue-on-error: true

- name: Stop workflow if channel initialization fails
if: failure()
run: |
docker logs relayer
exit 1
- name: Confirm Channel Status
run: |
channel_id=$(cat channel_id.txt)
timeout 600 bash -c "\
timeout 300 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.'"
continue-on-error: true

- name: Stop workflow if channel confirmation fails
if: failure()
run: |
docker logs relayer
exit 1
- name: Execute IBC Token Transfer from Emerynet to Local Chain
run: |
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ agd query bank balances agoric10emrzln03exuc9uv98mjwmp95735mjm6k2n9xm

# IBC Testing with Emerynet and Local Chain

## Start the local chain
## Start the Local Chain

First, start your local chain using this command:

```
docker-compose -f docker-compose-testnet.yaml up -d agoric-local
docker-compose -f docker-compose-emerynet-local.yaml up -d agoric-local
```

## Check Local Chain Logs
Expand All @@ -113,7 +113,7 @@ Once you see messages showing blocks with a status of commit you can rest assure
Next, start the Hermes relayer using this command:

```
docker-compose -f docker-compose-testnet.yaml up -d relayer
docker-compose -f docker-compose-emerynet-local.yaml up -d relayer
```

## Check Relayer Logs
Expand Down Expand Up @@ -153,7 +153,7 @@ First, ensure you have the new channel ID from the relayer logs (from the previo
Use the channel ID to execute the following command. Replace <Channel-ID> with the actual channel ID you noted earlier:

```
$ docker exec relayer hermes --config /workspace/relayer/config-testnet.toml tx ft-transfer --src-chain agoric-emerynet-8 --src-channel <Channel-ID> \
docker exec relayer hermes --config /workspace/relayer/config-emerynet-local.toml tx ft-transfer --src-chain agoric-emerynet-8 --src-channel <Channel-ID> \
--dst-chain agoric-local --src-port transfer --amount 100 --denom 'ubld' --timeout-seconds 1000
```

Expand All @@ -162,7 +162,7 @@ This command transfers 100 units of the `ubld` token from Emerynet to Local Chai
If you need to transfer tokens from the Local Chain to Emerynet, you can use the `counterparty_channel_id` found in the logs. For reversing transfers, the command would typically use `channel-0` as follows:

```
docker exec relayer hermes --config /workspace/relayer/config-testnet.toml tx ft-transfer --src-chain agoric-local --src-channel channel-0 \
docker exec relayer hermes --config /workspace/relayer/config-emerynet-local.toml tx ft-transfer --src-chain agoric-local --src-channel channel-0 \
--dst-chain agoric-emerynet-8 --src-port transfer --amount 100 --denom 'ubld' --timeout-seconds 1000
```
Expand Down
34 changes: 34 additions & 0 deletions docker-compose-emerynet-local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '3.8'

services:
relayer:
image: informalsystems/hermes:v1.7.3
container_name: relayer
depends_on:
- agoric-local
volumes:
- .:/workspace
- state:/state
entrypoint: |
/bin/sh -c "
/workspace/relayer/scripts/run-relayer.sh agoric-emerynet-8 agoric-local /workspace/relayer/keys/whale-emerynet.key /workspace/relayer/keys/alice.key /workspace/relayer/config-emerynet-local.toml
"
agoric-local:
image: a3p:local
platform: linux/amd64
build: .
container_name: agoric-local
environment:
CHAIN_ID: agoric-local
volumes:
- .:/workspace
- state:/state
ports:
- 26656:26656
- 26657:26657
- 1317:1317
entrypoint: /workspace/chain/scripts/run-chain.sh

volumes:
state:
22 changes: 2 additions & 20 deletions docker-compose-testnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,13 @@ services:
relayer:
image: informalsystems/hermes:v1.7.3
container_name: relayer
depends_on:
- agoric-local
volumes:
- .:/workspace
- state:/state
entrypoint: |
/bin/sh -c "
/workspace/relayer/scripts/run-relayer.sh agoric-emerynet-8 agoric-local /workspace/relayer/keys/whale-emerynet.key /workspace/relayer/keys/alice.key /workspace/relayer/config-testnet.toml
/workspace/relayer/scripts/run-relayer.sh agoric-emerynet-8 agoricdev-23 /workspace/relayer/keys/whale-emerynet.key /workspace/relayer/keys/whale-devnet.key /workspace/relayer/config-testnet.toml
"
agoric-local:
image: a3p:local
platform: linux/amd64
build: .
container_name: agoric-local
environment:
CHAIN_ID: agoric-local
volumes:
- .:/workspace
- state:/state
ports:
- 26656:26656
- 26657:26657
- 1317:1317
entrypoint: /workspace/chain/scripts/run-chain.sh

volumes:
state:
state:
142 changes: 142 additions & 0 deletions relayer/config-emerynet-local.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# The global section has parameters that apply globally to the relayer operation.
[global]

log_level = 'info'


# Specify the mode to be used by the relayer. [Required]
[mode]

# Specify the client mode.
[mode.clients]

# Whether or not to enable the client workers. [Required]
enabled = true

# Whether or not to enable periodic refresh of clients. [Default: true]
# This feature only applies to clients that underlie an open channel.
# For Tendermint clients, the frequency at which Hermes refreshes them is 2/3 of their
# trusting period (e.g., refresh every ~9 days if the trusting period is 14 days).
# Note: Even if this is disabled, clients will be refreshed automatically if
# there is activity on a connection or channel they are involved with.
refresh = true

# Whether or not to enable misbehaviour detection for clients. [Default: false]
misbehaviour = false

# Specify the connections mode.
[mode.connections]

# Whether or not to enable the connection workers for handshake completion. [Required]
enabled = false

# Specify the channels mode.
[mode.channels]

# Whether or not to enable the channel workers for handshake completion. [Required]
enabled = false

# Specify the packets mode.
[mode.packets]

# Whether or not to enable the packet workers. [Required]
enabled = true

# Parametrize the periodic packet clearing feature.
# Interval (in number of blocks) at which pending packets
# should be periodically cleared. A value of '0' will disable
# periodic packet clearing. [Default: 100]
clear_interval = 100

# Whether or not to clear packets on start. [Default: false]
clear_on_start = true

# Toggle the transaction confirmation mechanism.
# The tx confirmation mechanism periodically queries the `/tx_search` RPC
# endpoint to check that previously-submitted transactions
# (to any chain in this config file) have been successfully delivered.
# If they have not been, and `clear_interval = 0`, then those packets are
# queued up for re-submission.
# If set to `false`, the following telemetry metrics will be disabled:
# `acknowledgment_packets_confirmed`, `receive_packets_confirmed` and `timeout_packets_confirmed`.
# [Default: false]
tx_confirmation = false

# The REST section defines parameters for Hermes' built-in RESTful API.
# https://hermes.informal.systems/rest.html
[rest]

# Whether or not to enable the REST service. Default: false
enabled = true

# Specify the IPv4/6 host over which the built-in HTTP server will serve the RESTful
# API requests. Default: 127.0.0.1
host = '127.0.0.1'

# Specify the port over which the built-in HTTP server will serve the restful API
# requests. Default: 3000
port = 3000


# The telemetry section defines parameters for Hermes' built-in telemetry capabilities.
# https://hermes.informal.systems/telemetry.html
[telemetry]

# Whether or not to enable the telemetry service. Default: false
enabled = false

# Specify the IPv4/6 host over which the built-in HTTP server will serve the metrics
# gathered by the telemetry service. Default: 127.0.0.1
host = '127.0.0.1'

# Specify the port over which the built-in HTTP server will serve the metrics gathered
# by the telemetry service. Default: 3001
port = 3001


# A chains section includes parameters related to a chain and the full node to which
# the relayer can send transactions and queries.

[[chains]]
id = 'agoric-emerynet-8'
rpc_addr = 'https://emerynet.rpc.agoric.net'
grpc_addr = 'https://emerynet.grpc.agoric.net'
event_source = { mode = 'push', url = 'wss://emerynet.rpc.agoric.net/websocket', batch_delay = '500ms' }
rpc_timeout = '15s'
account_prefix = 'agoric'
key_name = 'whale-emerynet'
address_type = { derivation = 'cosmos' }
store_prefix = 'ibc'
default_gas = 2000000
max_gas = 10000000
gas_price = { price = 0.00, denom = 'ubld' }
gas_multiplier = 1.1
max_msg_num = 25
max_tx_size = 180000
clock_drift = '15s'
#max_block_time = '15s'
trusting_period = '14days'
trust_threshold = { numerator = '1', denominator = '3' }
memo_prefix = 'agoric-emerynet-relay'

[[chains]]
id = 'agoric-local'
rpc_addr = 'http://agoric-local:26657'
grpc_addr = 'http://agoric-local:9090'
event_source = { mode = 'push', url = 'ws://agoric-local:26657/websocket', batch_delay = '500ms' }
rpc_timeout = '15s'
account_prefix = 'agoric'
key_name = 'alice'
address_type = { derivation = 'cosmos' }
store_prefix = 'ibc'
default_gas = 2000000
max_gas = 10000000
gas_price = { price = 0.00, denom = 'ubld' }
gas_multiplier = 1.1
max_msg_num = 25
max_tx_size = 180000
clock_drift = '15s'
#max_block_time = '15s'
trusting_period = '400s'
trust_threshold = { numerator = '1', denominator = '3' }
memo_prefix = 'agoric-local-relay'
14 changes: 7 additions & 7 deletions relayer/config-testnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ trust_threshold = { numerator = '1', denominator = '3' }
memo_prefix = 'agoric-emerynet-relay'

[[chains]]
id = 'agoric-local'
rpc_addr = 'http://agoric-local:26657'
grpc_addr = 'http://agoric-local:9090'
event_source = { mode = 'push', url = 'ws://agoric-local:26657/websocket', batch_delay = '500ms' }
id = 'agoricdev-23'
rpc_addr = 'https://devnet.rpc.agoric.net'
grpc_addr = 'https://devnet.grpc.agoric.net'
event_source = { mode = 'push', url = 'wss://devnet.rpc.agoric.net:26657/websocket', batch_delay = '500ms' }
rpc_timeout = '15s'
account_prefix = 'agoric'
key_name = 'alice'
key_name = 'whale-devnet'
address_type = { derivation = 'cosmos' }
store_prefix = 'ibc'
default_gas = 2000000
Expand All @@ -137,6 +137,6 @@ max_msg_num = 25
max_tx_size = 180000
clock_drift = '15s'
#max_block_time = '15s'
trusting_period = '400s'
trusting_period = '14days'
trust_threshold = { numerator = '1', denominator = '3' }
memo_prefix = 'agoric-local-relay'
memo_prefix = 'agoric-devnet-relay'

0 comments on commit 0bd054d

Please sign in to comment.