Skip to content

Commit

Permalink
tilt: add ibc relayer which connects wormchain and terra2 to dev envi…
Browse files Browse the repository at this point in the history
…ronment (#2215)

- updates terra2 devnet chain timeout_commit to "1s" since the timeout_commit of "0.5s" is too fast and leads to Terra2's clock going into the future.
- updates terra2 devnet chain unbonding_time to "1814400s" which is the default value and translates to a valid trusting period for IBC connectivity.
  • Loading branch information
nik-suri committed Jan 18, 2023
1 parent 0783143 commit a797613
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 2 deletions.
22 changes: 22 additions & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ config.define_bool("node_metrics", False, "Enable Prometheus & Grafana for Guard
config.define_bool("guardiand_governor", False, "Enable chain governor in guardiand")
config.define_bool("wormchain", False, "Enable a wormchain node")
config.define_bool("secondWormchain", False, "Enable a second wormchain node with different validator keys")
config.define_bool("ibc_relayer", False, "Enable IBC relayer between cosmos chains")

cfg = config.parse()
num_guardians = int(cfg.get("num", "1"))
Expand All @@ -77,6 +78,7 @@ guardiand_debug = cfg.get("guardiand_debug", False)
node_metrics = cfg.get("node_metrics", False)
guardiand_governor = cfg.get("guardiand_governor", False)
secondWormchain = cfg.get("secondWormchain", False)
ibc_relayer = cfg.get("ibc_relayer", False)
btc = cfg.get("btc", False)

if cfg.get("manual", False):
Expand Down Expand Up @@ -753,6 +755,26 @@ if wormchain:
trigger_mode = trigger_mode,
)

if ibc_relayer:
docker_build(
ref = "ibc-relayer-image",
context = ".",
dockerfile = "./wormchain/ibc-relayer/Dockerfile",
only = []
)

k8s_yaml_with_ns("devnet/ibc-relayer.yaml")

k8s_resource(
"ibc-relayer",
port_forwards = [
port_forward(7597, name = "HTTPDEBUG [:7597]", host = webHost),
],
resource_deps = ["guardian-validator", "terra2-terrad"],
labels = ["ibc-relayer"],
trigger_mode = trigger_mode,
)

if btc:
k8s_yaml_with_ns("devnet/btc-localnet.yaml")

Expand Down
4 changes: 3 additions & 1 deletion cosmwasm/devnet/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,9 @@ timeout_precommit_delta = "500ms"
# How long we wait after committing a block, before starting on the new
# height (this gives us a chance to receive some more precommits, even
# though we already have +2/3).
timeout_commit = "0.5s"
# If the timeout_commit is too fast, the chain clock will get messed up and go into the future.
# This is important for IBC - to sync IBC headers, the clocks on each chain cannot differ by > 10 minutes.
timeout_commit = "1s"

# How many blocks to look back to check existence of the node's consensus votes before joining consensus
# When non-zero, the node will panic upon restart
Expand Down
2 changes: 1 addition & 1 deletion cosmwasm/devnet/config/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
},
"staking": {
"params": {
"unbonding_time": "600s",
"unbonding_time": "1814400s",
"max_validators": 100,
"max_entries": 7,
"historical_entries": 10000,
Expand Down
1 change: 1 addition & 0 deletions cosmwasm/devnet/config/tiltRelayer-mnemonic
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius
51 changes: 51 additions & 0 deletions devnet/ibc-relayer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: ibc-relayer
name: ibc-relayer
spec:
ports:
- name: rest
port: 7597
protocol: TCP
selector:
app: ibc-relayer
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: ibc-relayer
name: ibc-relayer
spec:
replicas: 1
selector:
matchLabels:
app: ibc-relayer
template:
metadata:
labels:
app: ibc-relayer
spec:
containers:
- name: ibc-relayer
image: ibc-relayer-image
command:
- rly
- transact
- link-then-start
- terra-wormchain
- --debug-addr
- localhost:7597
ports:
- containerPort: 7597
name: rest
protocol: TCP
readinessProbe:
httpGet:
port: 7597
path: /
periodSeconds: 1
restartPolicy: Always
serviceName: ibc-relayer
16 changes: 16 additions & 0 deletions wormchain/build/config/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@
"pub_key": null,
"account_number": "0",
"sequence": "0"
},
{
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"address": "wormhole14vtqhv6550uh6gycxxum8qmx3kmy7ak2qwzecx",
"pub_key": null,
"account_number": "0",
"sequence": "0"
}
]
},
Expand All @@ -70,6 +77,15 @@
"amount": "20000"
}
]
},
{
"address": "wormhole14vtqhv6550uh6gycxxum8qmx3kmy7ak2qwzecx",
"coins": [
{
"denom": "utest",
"amount": "20000"
}
]
}
],
"supply": [],
Expand Down
1 change: 1 addition & 0 deletions wormchain/build/config/tiltRelayer-mnemonic
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
barrel eager leaf heart runway bridge crowd warm refuse anxiety blur rain desert good hill prison dune oyster abuse owner bless trash talk wheat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wMS0wNiAxNToyNzoxMS42MTQ4MDk0MDQgKzAwMDAgVVRDIG09KzAuMDg3MDY4NjYzIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoicG42OVRJeE8wQ19aQkN1aiJ9.ZKxjML28R42dsEVy3QkGdTIqXYwtnwGINdZogK7CQSE6Hn1Rtxj1eA.3CgXMxCZ-nebt9GA.BuiYeWJnkRPRxLrJqFq5ZFsxksZ5A-YgvDxKK0g-ZwNzldrKT_gKV05s8TA1Qfq_bHLIAsK-iQRkbXln1IxgPhaX9PqN8Ov43pxlE3_xdk4gw2hkSlRDf1OdQ6G7XSM3Cdixc8slopC2ve58A82f5tBB1f94j7BhZ6hpqsabQNYzg-8JU_AaTyhjnv4YS35ANAdzxmCpHLCbq8CV4nx_DjFhiN5nDUltD9C02UTOuT5V82I0HLDeyaxh7jI7jA.UkodXyu2G6TDFxfE26z5Zw
1 change: 1 addition & 0 deletions wormchain/build/keyring-test/tiltRelayer.info
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMy0wMS0wNiAxNToyNzoxMS42MDcwMDIyNzYgKzAwMDAgVVRDIG09KzAuMDc5MjYxNTM1IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoibVdJWGd2aXpvd0FrSWhZdyJ9.E__rUpYMIWWoNwrz9qxjKaeeL-l51jS2C29z4i0rE5_aRfeE9F4p6Q.Q5JZRDmXqlBMRksv.rSrvtuNaVJYqo3zn3CL4gORPGZKmrCr07JCXMP2NlZ25MwTuU1Ct7tujgHEgI2_nBHHzIAlptMmhpRFChgaeoezl2DrLnDfj9eKlBd3TNZtrErwPBcSeRyda0JuHfeTSeqV0wcsyvNuhej4qjcMpHvCuabV-prFU7WsLxuXNAZzR3rwiBzMuADr0q6IiJm5kgqhYSCnQ0OBh7bttMaIPQ8lhrejK0HArYNOx1cRWiJjallqy6H_e7OLpcDltjdjgB0pSegwGENT8kQ9Q0U4orJeoL4x7SR75YJwEUdVS2-Ez-_1ZkhQYBncR4MkBGrGX5hAng21nOHbtZq7RMo9jnqdue8lUvUTho9ml2gH3bZzuqUnc8o8.E4GGzFAjRvZrciDXlWjZaA
24 changes: 24 additions & 0 deletions wormchain/ibc-relayer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM docker.io/golang:1.19.0@sha256:4c00329e17be6fedd8bd4412df454a205348da00f9e0e5d763380a29eb096b75

#used for a readiness probe
RUN apt-get update
RUN apt install -y netcat
RUN apt install -y jq

WORKDIR /app

RUN curl -OL --ssl https://github.com/cosmos/relayer/archive/c30b8d9e0ba6b45f8a576f768cad0777de545cb3.tar.gz
RUN printf '%s %s\n' "ede065997ee5873b6256748662fb93cd2652f45cb19937b7e6873ecc088109d9" "c30b8d9e0ba6b45f8a576f768cad0777de545cb3.tar.gz" | sha256sum --check
RUN tar xzf c30b8d9e0ba6b45f8a576f768cad0777de545cb3.tar.gz
WORKDIR relayer-c30b8d9e0ba6b45f8a576f768cad0777de545cb3
RUN make install

COPY ./wormchain/ibc-relayer/chains /chains

RUN rly config init
RUN rly chains add-dir /chains
RUN rly keys restore localterra default "notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius" --coin-type 330
RUN rly keys restore wormchain default "barrel eager leaf heart runway bridge crowd warm refuse anxiety blur rain desert good hill prison dune oyster abuse owner bless trash talk wheat"
RUN rly paths new localterra wormchain terra-wormchain

EXPOSE 7597
16 changes: 16 additions & 0 deletions wormchain/ibc-relayer/chains/localterra.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "cosmos",
"value": {
"key": "default",
"chain-id": "localterra",
"rpc-addr": "http://terra2-terrad:26657",
"account-prefix": "terra",
"keyring-backend": "test",
"gas-adjustment": 1.2,
"gas-prices": "1uluna",
"debug": true,
"timeout": "20s",
"output-format": "json",
"sign-mode": "direct"
}
}
16 changes: 16 additions & 0 deletions wormchain/ibc-relayer/chains/wormchain.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "cosmos",
"value": {
"key": "default",
"chain-id": "wormchain",
"rpc-addr": "http://guardian-validator:26657",
"account-prefix": "wormhole",
"keyring-backend": "test",
"gas-adjustment": 1.2,
"gas-prices": "0.01utest",
"debug": true,
"timeout": "20s",
"output-format": "json",
"sign-mode": "direct"
}
}

0 comments on commit a797613

Please sign in to comment.