-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add a migration to update the relayer path (#482)
- Loading branch information
1 parent
44d0af7
commit 92e36c3
Showing
6 changed files
with
70 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package migrate | ||
|
||
import ( | ||
"github.com/dymensionxyz/roller/config" | ||
"github.com/dymensionxyz/roller/relayer" | ||
) | ||
|
||
type VersionMigratorV0113 struct{} | ||
|
||
func (v *VersionMigratorV0113) ShouldMigrate(prevVersion VersionData) bool { | ||
return prevVersion.Major < 1 && prevVersion.Minor < 2 && prevVersion.Patch < 13 | ||
} | ||
|
||
func (v *VersionMigratorV0113) PerformMigration(rlpCfg config.RollappConfig) error { | ||
if err := relayer.DeletePath(rlpCfg, "hub-rollapp"); err != nil { | ||
return err | ||
} | ||
return relayer.CreatePath(rlpCfg) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package relayer | ||
|
||
import ( | ||
"github.com/dymensionxyz/roller/cmd/consts" | ||
"github.com/dymensionxyz/roller/cmd/utils" | ||
"github.com/dymensionxyz/roller/config" | ||
"os/exec" | ||
"path/filepath" | ||
) | ||
|
||
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 { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func DeletePath(rlpCfg config.RollappConfig, pathName string) error { | ||
deletePathCmd := exec.Command(consts.Executables.Relayer, "paths", "delete", pathName, "--home", | ||
filepath.Join(rlpCfg.Home, consts.ConfigDirName.Relayer)) | ||
_, err := utils.ExecBashCommandWithStdout(deletePathCmd) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
type ChainConfig struct { | ||
ID string | ||
RPC string | ||
Denom string | ||
AddressPrefix string | ||
GasPrices string | ||
} |