Skip to content

Commit

Permalink
feat!: updated rollapp to use vanilla ibc (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
omritoptix authored Oct 19, 2023
1 parent fe4cd67 commit 25ff887
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 18 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<!-- markdownlint-disable MD033 -->
<h1 align="center">Dymension Rollapp</h1>
<!-- markdownlint-enable MD033 -->

# Rollappd - A template RollApp chain

Expand All @@ -7,12 +9,12 @@ This repository hosts `rollappd`, a template implementation of a dymension rolla
`rollappd` is an example of a working RollApp using `dymension-RDK` and `dymint`.

It uses Cosmos-SDK's [simapp](https://github.com/cosmos/cosmos-sdk/tree/main/simapp) as a reference, but with the following changes:

- minimal app setup
- wired IBC for [ICS 20 Fungible Token Transfers](https://github.com/cosmos/ibc/tree/main/spec/app/ics-020-fungible-token-transfer)
- Uses `dymint` for block sequencing and replacing `tendermint`
- Uses modules from `dymension-RDK` to sync with `dymint` and provide RollApp custom logic


## Overview

**Note**: Requires [Go 1.19](https://go.dev/)
Expand Down Expand Up @@ -72,7 +74,7 @@ SEQUENCER_ADDR=`dymd keys show sequencer --address --keyring-backend test --keyr
fund the sequencer account

```shell
dymd tx bank send local-user $SEQUENCER_ADDR 10000000000000000000000udym --keyring-backend test
dymd tx bank send local-user $SEQUENCER_ADDR 10000000000000000000000udym --keyring-backend test --broadcast-mode block
```

### Register rollapp on settlement
Expand All @@ -96,7 +98,7 @@ set:
settlement_layer = "dymension"
```

### Run rollapp
### Run rollapp locally

```shell
rollappd start
Expand All @@ -107,9 +109,8 @@ rollappd start
### Install dymension relayer

```shell
$ git clone https://github.com/dymensionxyz/dymension-relayer.git
$ git checkout v0.1.0-relayer-v0.2.0-rc3
$ cd dymension-relayer && make install
git clone https://github.com/cosmos/relayer.git --branch v2.3.1
cd relayer && make install
```

### Establish IBC channel
Expand All @@ -128,8 +129,6 @@ After successful run, the new established channels will be shown
rly start hub-rollapp
```



## Developers guide

TODO
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func NewRollapp(
appCodec, keys[seqtypes.StoreKey], app.GetSubspace(seqtypes.ModuleName),
)

app.IBCKeeper = ibckeeper.NewKeeperWithDymint(
app.IBCKeeper = ibckeeper.NewKeeper(
appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper,
)

Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/cosmos/cosmos-sdk v0.46.13
github.com/cosmos/ibc-go/v6 v6.1.1
github.com/dymensionxyz/dymension-rdk v0.4.0-rc6
github.com/dymensionxyz/dymint v0.5.1-rc03
github.com/dymensionxyz/dymint v0.6.0-beta
github.com/gorilla/mux v1.8.0
github.com/rakyll/statik v0.1.7
github.com/spf13/cast v1.5.1
Expand Down Expand Up @@ -278,7 +278,6 @@ require (
replace (
github.com/centrifuge/go-substrate-rpc-client/v4 => github.com/availproject/go-substrate-rpc-client/v4 v4.0.12-avail-1.4.0-rc1-5e286e3
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
github.com/cosmos/ibc-go/v6 => github.com/dymensionxyz/ibc-go/v6 v6.0.0-rc0.0.20230619115257-1a1038e16d71
// use Evmos geth fork
github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26
github.com/evmos/evmos/v12 => github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.2
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4
github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw=
github.com/cosmos/iavl v0.19.6 h1:XY78yEeNPrEYyNCKlqr9chrwoeSDJ0bV2VjocTk//OU=
github.com/cosmos/iavl v0.19.6/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
github.com/cosmos/ibc-go/v6 v6.1.1 h1:oqqMNyjj6SLQF8rvgCaDGwfdITEIsbhs8F77/8xvRIo=
github.com/cosmos/ibc-go/v6 v6.1.1/go.mod h1:NL17FpFAaWjRFVb1T7LUKuOoMSsATPpu+Icc4zL5/Ik=
github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA=
github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
Expand Down Expand Up @@ -487,12 +489,10 @@ github.com/dymensionxyz/dymension v0.2.0-beta.0.20230607115558-745644a96ea6 h1:d
github.com/dymensionxyz/dymension v0.2.0-beta.0.20230607115558-745644a96ea6/go.mod h1:rDkVuF+DxBDi5tTgVHFk1D2xpqf8bOccs6aB1wTOvP0=
github.com/dymensionxyz/dymension-rdk v0.4.0-rc6 h1:32XFCOHyWp68yAAMWGO6V+Ct2J6WSREunvfU/a5wVnw=
github.com/dymensionxyz/dymension-rdk v0.4.0-rc6/go.mod h1:wA0Iqwd7Vh+LifVzrcR1aaxTC9TKnFruw0BS2vlnml8=
github.com/dymensionxyz/dymint v0.5.1-rc03 h1:AolMmiR6C2nu2TUrOvCnWrs0QKcFoIBswx0mBesT/UI=
github.com/dymensionxyz/dymint v0.5.1-rc03/go.mod h1:6gPmjTwN/yGXyehCV3wzez1E31f2zX5n9IeMWATj7ik=
github.com/dymensionxyz/dymint v0.6.0-beta h1:O531cgADz+iZ256gJ7XQ2juwlq7wacd5pnkckj+/c9c=
github.com/dymensionxyz/dymint v0.6.0-beta/go.mod h1:6gPmjTwN/yGXyehCV3wzez1E31f2zX5n9IeMWATj7ik=
github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.2 h1:jh2ZfzNhm8S2z8m8WCho4eITZZywNdHQDS5YhrBgehw=
github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.2/go.mod h1:k4JmDA9a4ZXtjdBmxgTqGwFNeF9pY6Ub1KTFdGTQuxI=
github.com/dymensionxyz/ibc-go/v6 v6.0.0-rc0.0.20230619115257-1a1038e16d71 h1:T04fab8CTYu+FR6mAC/nYB78WtHM4YsI99ikrYydncM=
github.com/dymensionxyz/ibc-go/v6 v6.0.0-rc0.0.20230619115257-1a1038e16d71/go.mod h1:CY3zh2HLfetRiW8LY6kVHMATe90Wj/UOoY8T6cuB0is=
github.com/dymensionxyz/rpc v1.3.1 h1:7EXWIobaBes5zldRvTIg7TmNsEKjicrWA/OjCc0NaGs=
github.com/dymensionxyz/rpc v1.3.1/go.mod h1:f+WpX8ysy8wt95iGc6auYlHcnHj2bUkhiRVkkKNys8c=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
Expand Down
13 changes: 11 additions & 2 deletions scripts/ibc/setup_ibc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,23 @@ echo "waiting to fund accounts. Press to continue..."
read -r answer

echo '# -------------------------------- creating IBC link ------------------------------- #'
rly chains set-settlement "$SETTLEMENT_CHAIN_ID"

rly paths new "$ROLLAPP_CHAIN_ID" "$SETTLEMENT_CHAIN_ID" "$RELAYER_PATH" --src-port "$IBC_PORT" --dst-port "$IBC_PORT" --version "$IBC_VERSION"

while true; do
rly tx update-clients "$RELAYER_PATH" | tee /dev/stdout
sleep 5
done &
UPDATE_CLIENTS_PID=$!

rly transact link -t300s "$RELAYER_PATH" --src-port "$IBC_PORT" --dst-port "$IBC_PORT" --version "$IBC_VERSION"

kill $UPDATE_CLIENTS_PID > /dev/null 2>&1


echo '# -------------------------------- IBC channel established ------------------------------- #'
ROLLAPP_CHANNEL_ID=$(rly q channels "$ROLLAPP_CHAIN_ID" | jq -r 'select(.state == "STATE_OPEN") | .channel_id' | tail -n 1)
HUB_CHANNEL_ID=$(rly q channels "$SETTLEMENT_CHAIN_ID" | jq -r 'select(.state == "STATE_OPEN") | .counterparty.channel_id' | tail -n 1)
HUB_CHANNEL_ID=$(rly q channels "$SETTLEMENT_CHAIN_ID" | jq -r 'select(.state == "STATE_OPEN") | .channel_id' | tail -n 1)

echo "ROLLAPP_CHANNEL_ID: $ROLLAPP_CHANNEL_ID"
echo "HUB_CHANNEL_ID: $HUB_CHANNEL_ID"
2 changes: 1 addition & 1 deletion scripts/settlement/register_rollapp_to_hub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ KEY_NAME_SEQUENCER="sequencer"
MAX_SEQUENCERS=5

#Register rollapp
dymd tx rollapp create-rollapp "$ROLLAPP_CHAIN_ID" stamp1 "genesis-path/1" 3 "$MAX_SEQUENCERS" '{"Addresses":[]}' \
dymd tx rollapp create-rollapp "$ROLLAPP_CHAIN_ID" "$MAX_SEQUENCERS" '{"Addresses":[]}' \
--from "$KEY_NAME_SEQUENCER" \
--keyring-backend test \
--keyring-dir "$KEYRING_PATH" \
Expand Down

0 comments on commit 25ff887

Please sign in to comment.