-
Notifications
You must be signed in to change notification settings - Fork 67
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
Changes from 9 commits
f7e5ce3
0bb850e
e455c96
7ffd9ec
9ffc8d8
c3728b8
d81a17a
6bda8c5
76ff33c
cc3dc74
bb27038
85b9e2b
f648ff6
6384a25
a73a324
1c94289
2835a9e
ea5f007
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 { | ||
// 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 | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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":[]}`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need to supply the |
||
} | ||
cmdArgs = append(cmdArgs, getCommonDymdTxFlags(rollappConfig)...) | ||
return exec.Command( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how it supposed to work when no clients created? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah but will it create the "txs" to release the empty blocks? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -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..." | ||
|
@@ -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") | ||
} | ||
|
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: "" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.