Skip to content

Commit

Permalink
docs: deviation from cosmos relay (#129)
Browse files Browse the repository at this point in the history
Co-authored-by: izyak <[email protected]>
Co-authored-by: viveksharmapoudel <[email protected]>
  • Loading branch information
3 people authored Aug 9, 2023
1 parent 8646489 commit 0c0e636
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
[![codecov](https://codecov.io/gh/icon-project/ibc-relay/branch/main/graph/badge.svg?token=3OSG4KPSPZ)](https://codecov.io/gh/icon-project/ibc-relay)
</div>

---

This repo is a fork of cosmos [relayer](https://github.com/cosmos/relayer). The goal of this project is to relay packets between ICON and Wasm chains by following the IBC Specs.
1. [What is ICON-IBC Integration](https://github.com/icon-project/IBC-Integration)
2. [Deviations from Cosmos Relayer](./docs/deviations_from_ibc.md)
---


In IBC, blockchains do not directly pass messages to each other over the network. This is where `relayer` comes in.
A relayer process monitors for updates on opens paths between sets of [IBC](https://ibcprotocol.org/) enabled chains.
The relayer submits these updates in the form of specific message types to the counterparty chain. Clients are then used to
Expand Down
71 changes: 71 additions & 0 deletions docs/deviations_from_ibc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Deviations from IBC Relay

This relayer was meant to be used for [ICON-IBC Integration](https://github.com/icon-project/IBC-Integration). So, it is made to accomodate all the changes made on IBC Integration such that IBC can be established between ICON and Cosmos based chains.

All the deviations that the ICON-IBC Integrations can be found [here]().

## Changes
The major changes in the relayer include:
- [ICON Module](#icon-module)
- [Wasm Module](#wasm-module)
- [Relayer Internal](#relayer-internal)
- [Cmd](#cmd)
- [Config](#config)

## Icon Module
- Icon Chain Module has been added to support ICON Chain.
- We use [BTP Blocks](https://icon.community/glossary/btp-blocks/) provided by ICON chain significantly.
- Icon provides a websocket api which we can use to stream all blocks of mainnet. We do use this websockets instead of polling each height as done on cosmos chain processor.
- The relayer interfaces with IBC contract deployed on ICON and calls methods of the contract via ICON Provider.
- To update counterparty light client, we use information obtained BTP Blocks rather than actual main ICON chain.
- We query if the block is a BTP Block, and if yes, it initiates messages that'll be sent to counterparty contract. So, for each BTP Block produced, light client is updated.

## Wasm Module
- Wasm Module has been added to support CosmWasm contracts.
- Like cosmos chain processor, polling is done for each height of the chain.
- Wasm Provider provides methods to interface with the IBC Wasm contract deployed on respective cosmos chain.

## Relayer Internal
- Minimal changes has had to be added on the internal logic of the relayer to support for BTP Blocks.
- Since ICON cannot produce non membership proofs via BTP Blocks, a method called `requestTimeout` was introduced on ICON contract for when packet is to be timed out on wasm contracts. Logic for this has been added on relayer internal.
- Update client and the message to be sent after, has been sent on different transaction. [Reason for this decision]()

## Cmd
- Relevant methods for ICON has been added accordingly.
- When a BTP client is to be created on WASM contract, we need to specify a BTP height for the relayer. By default, it takes the first BTP height for this network. If we are to give a custom height, a flag `btp-block-height` has been added. The height should be a BTP Block for given BTP network type and BTP Network Id.
```sh
rly tx clients icon-path-name --client-tp "1000000m" --btp-block-height 11313986
```

## Config
- Example Config for ICON-IBC Integration
- [Here](../examples/config_IBC_ICON.yaml)



## Wasm Config
Other parameters are same as in cosmos chains. The specifications for added fields in config are
- IBC Handler Address
- WASM Contract Address of IBC Handler
- First Retry Block After:
- For first retry transaction, wait for this number of blocks (default set to 3)
- Start Height:
- Custom height to start chain processor from
- Block Interval:
- Block Interval of cosmos chain

## Icon Config
- keystore and password
- Keystore and password is used to generate a wallet for relay
- Icon Network ID
- Network ID for ICON chain (varies for testnet, localnet and mainnet)
- BTP Network ID, BTP Network Type ID
- BTP Specific IDs required
- Start Height:
- Height to start ICON chain processor from
- IBC Handler Address:
- Address of IBC java contract
- Block Interval:
- Block Interval of ICON chain
- First Retry Block After:
- For first retry transaction, wait for this number of blocks (default set to 8)
59 changes: 59 additions & 0 deletions examples/config_IBC_ICON.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
global:
api-listen-addr: :5183
timeout: 10s
memo: ""
light-cache-size: 20
chains:
archway:
type: wasm
value:
key-directory: /home/user/.relayer/keys/localnet
key: relayWallet
chain-id: localnet
rpc-addr: http://localhost:26657
account-prefix: archway
keyring-backend: test
gas-adjustment: 1.5
gas-prices: 0.025stake
min-gas-amount: 1000000
debug: true
timeout: 20s
block-timeout: ""
output-format: json
sign-mode: direct
extra-codecs: []
coin-type: 0
broadcast-mode: batch
ibc-handler-address: archway14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sy85n2u
first-retry-block-after: 0
start-height: 0
block-interval: 6000
icon:
type: icon
value:
key: ""
chain-id: ibc-icon
rpc-addr: http://localhost:9082/api/v3/
timeout: 30s
keystore: /home/user/keystore/godWallet.json
password: gochain
icon-network-id: 3
btp-network-id: 1
btp-network-type-id: 1
start-height: 0
ibc-handler-address: cxa1daa337788364a72644860a5097e3eef7a5d416
first-retry-block-after: 0
block-interval: 2000
paths:
icon-archway:
src:
chain-id: ibc-icon
client-id: 07-tendermint-0
connection-id: connection-0
dst:
chain-id: localnet
client-id: iconclient-0
connection-id: connection-0
src-channel-filter:
rule: ""
channel-list: []

0 comments on commit 0c0e636

Please sign in to comment.