Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Add support for standard ibc #614

Merged
merged 18 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
f7e5ce3
Removed set-settlement command of relayer.
omritoptix Dec 4, 2023
0bb850e
Changed relayer start command to use the actual rly start and not run…
omritoptix Dec 4, 2023
e455c96
Fixed bug with missing 'go' command before and logFile option.
omritoptix Dec 4, 2023
7ffd9ec
Added migration file to migrate to version v1.0.0
omritoptix Dec 5, 2023
9ffc8d8
Changed create-rollapp command to match new hub version.
omritoptix Dec 5, 2023
c3728b8
Change channel creation logic to match new relayer version.
omritoptix Dec 5, 2023
d81a17a
Updated binary versions in compile script.
omritoptix Dec 6, 2023
6bda8c5
Fixed test goldens to match new relayer configuration.
omritoptix Dec 6, 2023
76ff33c
Removed redundant code to fix linter error.
omritoptix Dec 6, 2023
cc3dc74
Updated local gas price to match the new local hub gas price.
omritoptix Dec 9, 2023
bb27038
Updated relayer migration script to add extra-codec necessary for rea…
omritoptix Dec 9, 2023
85b9e2b
Added context to start commands to get killed once context is done.
omritoptix Dec 9, 2023
f648ff6
Updated hub tag to be latest.
omritoptix Dec 9, 2023
6384a25
Fixed tests to match new relayer config.
omritoptix Dec 9, 2023
a73a324
feat: add denom registration on rollapp creation (#628)
mtsitrin Dec 10, 2023
1c94289
Fixed bug where override wasn't passed to create link cmd.
omritoptix Dec 10, 2023
2835a9e
Updated compile locally to use v2.0.0-alpha.3
omritoptix Dec 10, 2023
ea5f007
Fixed bug with relayer key migration.
omritoptix Dec 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var migrationsRegistry = []VersionMigrator{
&VersionMigratorV0112{},
&VersionMigratorV0113{},
&VersionMigratorV0118{},
&VersionMigratorV1000{},
}

func Cmd() *cobra.Command {
Expand Down
29 changes: 29 additions & 0 deletions cmd/migrate/v1_0_00.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package migrate

import (
"fmt"

"github.com/dymensionxyz/roller/cmd/utils"
"github.com/dymensionxyz/roller/config"
)

type VersionMigratorV1000 struct{}

func (v *VersionMigratorV1000) ShouldMigrate(prevVersion VersionData) bool {
return prevVersion.Major < 1
}

func (v *VersionMigratorV1000) PerformMigration(rlpCfg config.RollappConfig) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changes required on the rollapp itself? how it's state will change to use the tendermint IBC?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change to the rollapp itself is in the rollapp binary.

// Get relayer address in order to create a keys migration
fmt.Println("💈 Migrating relayer keys...")
_, err := utils.GetRelayerAddress(rlpCfg.Home, rlpCfg.HubData.ID)
if err != nil {
return err
}
_, err = utils.GetRelayerAddress(rlpCfg.Home, rlpCfg.RollappID)
if err != nil {
return err
}
return nil

}
12 changes: 1 addition & 11 deletions cmd/relayer/start/start.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package start

import (
"context"
"fmt"
"math/big"

Expand Down Expand Up @@ -58,16 +57,7 @@ func Start() *cobra.Command {
_, err := rly.CreateIBCChannel(override, logFileOption, seq)
utils.PrettifyErrorIfExists(err)
}

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

updateClientsCmd := rly.GetUpdateClientsCmd()
utils.RunCommandEvery(ctx, updateClientsCmd.Path, updateClientsCmd.Args[1:], 3600, logFileOption)
relayPacketsCmd := rly.GetRelayPacketsCmd()
utils.RunCommandEvery(ctx, relayPacketsCmd.Path, relayPacketsCmd.Args[1:], 5, logFileOption)
relayAcksCmd := rly.GetRelayAcksCmd()
utils.RunCommandEvery(ctx, relayAcksCmd.Path, relayAcksCmd.Args[1:], 5, logFileOption)
go utils.RunBashCmdAsync(rly.GetStartCmd(), func() {}, func(errMessage string) string { return errMessage }, logFileOption)
omritoptix marked this conversation as resolved.
Show resolved Hide resolved
fmt.Printf("💈 The relayer is running successfully on you local machine! Channels: src, %s <-> %s, dst",
rly.SrcChannel, rly.DstChannel)

Expand Down
2 changes: 1 addition & 1 deletion cmd/tx/register/bash_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

func getRegisterRollappCmd(rollappConfig config.RollappConfig) *exec.Cmd {
cmdArgs := []string{
"tx", "rollapp", "create-rollapp", rollappConfig.RollappID, "stamp1", "genesis-path/1", "3", "3", `{"Addresses":[]}`,
"tx", "rollapp", "create-rollapp", rollappConfig.RollappID, "3", `{"Addresses":[]}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to supply the tokenMetada, so it will be used by the denommetada middleware
I had a branch for it IIRC

}
cmdArgs = append(cmdArgs, getCommonDymdTxFlags(rollappConfig)...)
return exec.Command(
Expand Down
4 changes: 2 additions & 2 deletions compile_locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)

# The list of projects to be installed
PROJECTS=("dymension" "dymension-relayer" "rollapp-evm")
PROJECTS=("dymension" "go-relayer" "rollapp-evm")
REPOS=("" "" "")
VERSIONS=("v1.0.0-rc2" "v0.1.6-relayer-v0.2.0" "v0.1.0-rc10")
VERSIONS=("v2.0.0-alpha.1" "v0.2.0-v2.3.1-relayer" "v1.0.0-beta")
BUILDCOMMANDS=("" "" "")
BINARYNAME=("dymd" "rly" "rollapp-evm")

Expand Down
6 changes: 6 additions & 0 deletions relayer/periodic_commands.go → relayer/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ func (r *Relayer) GetRelayPacketsCmd() *exec.Cmd {
return exec.Command(consts.Executables.Relayer, args...)
}

func (r *Relayer) GetStartCmd() *exec.Cmd {
args := []string{"start"}
args = append(args, r.getRelayerDefaultArgs()...)
return exec.Command(consts.Executables.Relayer, args...)
}

func (r *Relayer) getArgsWithSrcChannel() []string {
return []string{consts.DefaultRelayerPath, r.DstChannel, "--home", filepath.Join(r.Home, consts.ConfigDirName.Relayer)}
}
5 changes: 0 additions & 5 deletions relayer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ import (

func CreatePath(rlpCfg config.RollappConfig) error {
relayerHome := filepath.Join(rlpCfg.Home, consts.ConfigDirName.Relayer)
setSettlementCmd := exec.Command(consts.Executables.Relayer, "chains", "set-settlement",
rlpCfg.HubData.ID, "--home", relayerHome)
if err := setSettlementCmd.Run(); err != nil {
return err
}
newPathCmd := exec.Command(consts.Executables.Relayer, "paths", "new", rlpCfg.HubData.ID, rlpCfg.RollappID,
consts.DefaultRelayerPath, "--home", relayerHome)
if err := newPathCmd.Run(); err != nil {
Expand Down
53 changes: 6 additions & 47 deletions relayer/create_ibc_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,12 @@ func (r *Relayer) CreateIBCChannel(override bool, logFileOption utils.CommandOpt
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

createClientsCmd := r.getCreateClientsCmd(override)
status := "Creating clients..."
fmt.Printf("💈 %s\n", status)
if err := r.WriteRelayerStatus(status); err != nil {
return ConnectionChannels{}, err
}
if err := utils.ExecBashCmd(createClientsCmd, logFileOption); err != nil {
return ConnectionChannels{}, err
}

//after successful update clients, keep running in the background
updateClientsCmd := r.GetUpdateClientsCmd()
utils.RunCommandEvery(ctx, updateClientsCmd.Path, updateClientsCmd.Args[1:], 20, utils.WithDiscardLogging())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how it supposed to work when no clients created?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it loops without success until clients are created. as the commands of clients creation are part of the link creation, and not their own separate command, it becomes more complicated to only run it after client creation. agree it's not ideal and we could query the chains until clients are created but I don't think it's worth the effort currently as the con is simply letting it fail for a few seconds until the clients are created.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but will it create the "txs" to release the empty blocks?
IIRC we did it for that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea it's fine. the txs for releasing empty blocks are required only after the create clients which are not dependent in that.


//wait for block to be created
status = "Waiting for block creation..."
status := "Waiting for state update before creating the channel..."
fmt.Printf("💈 %s\n", status)
if err := r.WriteRelayerStatus(status); err != nil {
return ConnectionChannels{}, err
Expand All @@ -44,28 +34,15 @@ func (r *Relayer) CreateIBCChannel(override bool, logFileOption utils.CommandOpt
return ConnectionChannels{}, err
}

connectionID, _ := r.GetActiveConnection()
if connectionID == "" || override {
status = "Creating connection..."
fmt.Printf("💈 %s\n", status)
if err := r.WriteRelayerStatus(status); err != nil {
return ConnectionChannels{}, err
}
createConnectionCmd := r.getCreateConnectionCmd(override)
if err := utils.ExecBashCmd(createConnectionCmd, logFileOption); err != nil {
return ConnectionChannels{}, err
}
}

var src, dst string
// we ran create channel with override, as it not recovarable anyway
createChannelCmd := r.getCreateChannelCmd(true)
status = "Creating channel..."
createLinkCmd := r.getCreateLinkCmd(true)
omritoptix marked this conversation as resolved.
Show resolved Hide resolved
status = "Creating link..."
fmt.Printf("💈 %s\n", status)
if err := r.WriteRelayerStatus(status); err != nil {
return ConnectionChannels{}, err
}
if err := utils.ExecBashCmd(createChannelCmd, logFileOption); err != nil {
if err := utils.ExecBashCmd(createLinkCmd, logFileOption); err != nil {
return ConnectionChannels{}, err
}
status = "Validating channel established..."
Expand Down Expand Up @@ -148,26 +125,8 @@ func waitForValidRollappHeight(seq *sequencer.Sequencer) error {
}
}

func (r *Relayer) getCreateClientsCmd(override bool) *exec.Cmd {
args := []string{"tx", "clients"}
args = append(args, r.getRelayerDefaultArgs()...)
if override {
args = append(args, "--override")
}
return exec.Command(consts.Executables.Relayer, args...)
}

func (r *Relayer) getCreateConnectionCmd(override bool) *exec.Cmd {
args := []string{"tx", "connection", "-t", "300s", "-d"}
if override {
args = append(args, "--override")
}
args = append(args, r.getRelayerDefaultArgs()...)
return exec.Command(consts.Executables.Relayer, args...)
}

func (r *Relayer) getCreateChannelCmd(override bool) *exec.Cmd {
args := []string{"tx", "channel", "-t", "300s", "-r", "5", "-d"}
func (r *Relayer) getCreateLinkCmd(override bool) *exec.Cmd {
args := []string{"tx", "link", "-t", "300s", "--src-port", "transfer", "--dst-port", "transfer", "--version", "ics20-1"}
if override {
args = append(args, "--override")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
global:
api-listen-addr: :5183
timeout: 10s
memo: ""
light-cache-size: 20
chains:
dymension_100-1:
type: cosmos
value:
key: relayer-hub-key
chain-id: dymension_100-1
rpc-addr: http://localhost:36657
account-prefix: dym
keyring-backend: test
gas-adjustment: 1.2
gas-prices: 0udym
debug: true
timeout: 10s
output-format: json
sign-mode: direct
client-type: 07-tendermint
PLACEHOLDER_ROLLAPP_ID:
type: cosmos
value:
key: relayer-rollapp-key
chain-id: PLACEHOLDER_ROLLAPP_ID
rpc-addr: http://localhost:26657
account-prefix: ethm
keyring-backend: test
gas-adjustment: 1.2
gas-prices: 0udym
debug: true
timeout: 10s
output-format: json
sign-mode: direct
client-type: 01-dymint
PLACEHOLDER_ROLLAPP_ID:
type: cosmos
value:
account-prefix: ethm
chain-id: PLACEHOLDER_ROLLAPP_ID
client-type: 01-dymint
debug: true
gas-adjustment: 1.2
gas-prices: 0udym
key: relayer-rollapp-key
keyring-backend: test
output-format: json
rpc-addr: http://localhost:26657
sign-mode: direct
timeout: 10s
dymension_100-1:
type: cosmos
value:
account-prefix: dym
chain-id: dymension_100-1
client-type: 07-tendermint
debug: true
gas-adjustment: 1.2
gas-prices: 0udym
key: relayer-hub-key
keyring-backend: test
output-format: json
rpc-addr: http://localhost:36657
sign-mode: direct
timeout: 10s
global:
api-listen-addr: :5183
light-cache-size: 20
memo: ""
timeout: 10s
paths:
rollapp-hub:
src:
chain-id: dymension_100-1
dst:
chain-id: PLACEHOLDER_ROLLAPP_ID
src-channel-filter:
rule: ""
channel-list: []
settlement: dymension_100-1
rollapp-hub:
dst:
chain-id: PLACEHOLDER_ROLLAPP_ID
src:
chain-id: dymension_100-1
src-channel-filter:
channel-list: []
rule: ""
settlement: ""
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
chains:
PLACEHOLDER_ROLLAPP_ID:
type: cosmos
value:
key: relayer-rollapp-key
chain-id: PLACEHOLDER_ROLLAPP_ID
rpc-addr: http://localhost:26657
account-prefix: ethm
keyring-backend: test
gas-adjustment: 1.2
gas-prices: 0udym
debug: true
timeout: 10s
output-format: json
sign-mode: direct
client-type: 01-dymint
dymension_100-1:
type: cosmos
value:
key: relayer-hub-key
chain-id: dymension_100-1
rpc-addr: http://localhost:36657
account-prefix: dym
keyring-backend: test
gas-adjustment: 1.2
gas-prices: 0udym
debug: true
timeout: 10s
output-format: json
sign-mode: direct
client-type: 07-tendermint

PLACEHOLDER_ROLLAPP_ID:
type: cosmos
value:
account-prefix: ethm
chain-id: PLACEHOLDER_ROLLAPP_ID
client-type: 01-dymint
debug: true
gas-adjustment: 1.2
gas-prices: 0udym
key: relayer-rollapp-key
keyring-backend: test
output-format: json
rpc-addr: http://localhost:26657
sign-mode: direct
timeout: 10s
dymension_100-1:
type: cosmos
value:
account-prefix: dym
chain-id: dymension_100-1
client-type: 07-tendermint
debug: true
gas-adjustment: 1.2
gas-prices: 0udym
key: relayer-hub-key
keyring-backend: test
output-format: json
rpc-addr: http://localhost:36657
sign-mode: direct
timeout: 10s
global:
api-listen-addr: :5183
timeout: 10s
memo: ""
light-cache-size: 20
api-listen-addr: :5183
light-cache-size: 20
memo: ""
timeout: 10s
paths:
rollapp-hub:
dst:
chain-id: PLACEHOLDER_ROLLAPP_ID
src:
chain-id: dymension_100-1
src-channel-filter:
rule: ""
channel-list: []
settlement: dymension_100-1
rollapp-hub:
dst:
chain-id: PLACEHOLDER_ROLLAPP_ID
src:
chain-id: dymension_100-1
src-channel-filter:
channel-list: []
rule: ""
settlement: ""
Loading