diff --git a/cmd/config/init/consts.go b/cmd/config/init/consts.go index 65ec8ddf..0615b9a9 100644 --- a/cmd/config/init/consts.go +++ b/cmd/config/init/consts.go @@ -50,6 +50,6 @@ var Hubs = map[string]config.HubData{ ID: LocalHubID, RPC_URL: "http://localhost:36657", ARCHIVE_RPC_URL: "http://localhost:36657", - GAS_PRICE: "0", + GAS_PRICE: "100000000", }, } diff --git a/cmd/config/init/denom_metadata.go b/cmd/config/init/denom_metadata.go new file mode 100644 index 00000000..c8e97524 --- /dev/null +++ b/cmd/config/init/denom_metadata.go @@ -0,0 +1,74 @@ +package initconfig + +import ( + "encoding/json" + "fmt" + "os" + "strings" +) + +type BankDenomMetadata struct { + Base string `json:"base"` + DenomUnits []BankDenomUnitMetadata `json:"denom_units"` + Description string `json:"description"` + Display string `json:"display"` + Name string `json:"name"` + Symbol string `json:"symbol"` +} + +type BankDenomUnitMetadata struct { + Aliases []string `json:"aliases"` + Denom string `json:"denom"` + Exponent uint `json:"exponent"` +} + +func getBankDenomMetadata(denom string, decimals uint) string { + displayDenom := denom[1:] + + metadata := []BankDenomMetadata{ + { + Base: denom, + DenomUnits: []BankDenomUnitMetadata{ + { + Aliases: []string{}, + Denom: denom, + Exponent: 0, + }, + { + Aliases: []string{}, + Denom: displayDenom, + Exponent: decimals, + }, + }, + Description: fmt.Sprintf("Denom metadata for %s (%s)", displayDenom, denom), + Display: displayDenom, + Name: displayDenom, + Symbol: strings.ToUpper(displayDenom), + }, + } + + json, err := json.Marshal(metadata) + if err != nil { + return "" + } + + return string(json) +} + +func createTokenMetadaJSON(metadataPath string, denom string, decimals uint) error { + metadata := getBankDenomMetadata(denom, decimals) + if metadata == "" { + return fmt.Errorf("failed to generate token metadata") + } + + file, err := os.Create(metadataPath) + if err != nil { + return err + } + _, err = file.WriteString(metadata) + if err != nil { + return err + } + + return nil +} diff --git a/cmd/config/init/genesis.go b/cmd/config/init/genesis.go index 835b020b..98a72a40 100644 --- a/cmd/config/init/genesis.go +++ b/cmd/config/init/genesis.go @@ -5,7 +5,6 @@ import ( "math/big" "os" "strconv" - "strings" "github.com/dymensionxyz/roller/cmd/consts" "github.com/dymensionxyz/roller/cmd/utils" @@ -57,6 +56,12 @@ func initializeRollappGenesis(initConfig config.RollappConfig) error { if err != nil { return err } + + err = createTokenMetadaJSON(filepath.Join(RollappConfigDir(initConfig.Home), "tokenmetadata.json"), initConfig.Denom, initConfig.Decimals) + if err != nil { + return err + } + return nil } @@ -70,25 +75,8 @@ type PathValue struct { Value interface{} } -type BankDenomMetadata struct { - Base string `json:"base"` - DenomUnits []BankDenomUnitMetadata `json:"denom_units"` - Description string `json:"description"` - Display string `json:"display"` - Name string `json:"name"` - Symbol string `json:"symbol"` -} - -type BankDenomUnitMetadata struct { - Aliases []string `json:"aliases"` - Denom string `json:"denom"` - Exponent uint `json:"exponent"` -} - // TODO(#130): fix to support epochs func getDefaultGenesisParams(denom string, decimals uint) []PathValue { - displayDenom := denom[1:] - return []PathValue{ {"app_state.mint.params.mint_denom", denom}, {"app_state.staking.params.bond_denom", denom}, @@ -101,27 +89,7 @@ func getDefaultGenesisParams(denom string, decimals uint) []PathValue { {"app_state.distribution.params.community_tax", "0.00002"}, {"app_state.gov.voting_params.voting_period", "300s"}, {"app_state.staking.params.unbonding_time", "3628800s"}, - {"app_state.bank.denom_metadata", []BankDenomMetadata{ - { - Base: denom, - DenomUnits: []BankDenomUnitMetadata{ - { - Aliases: []string{}, - Denom: denom, - Exponent: 0, - }, - { - Aliases: []string{}, - Denom: displayDenom, - Exponent: decimals, - }, - }, - Description: fmt.Sprintf("Denom metadata for %s (%s)", displayDenom, denom), - Display: displayDenom, - Name: displayDenom, - Symbol: strings.ToUpper(displayDenom), - }, - }}, + {"app_state.bank.denom_metadata", getBankDenomMetadata(denom, decimals)}, } } @@ -171,7 +139,7 @@ func generateGenesisTx(initConfig config.RollappConfig) error { func registerSequencerAsGoverner(initConfig config.RollappConfig) error { totalSupply, err := strconv.Atoi(initConfig.TokenSupply) if err != nil { - return fmt.Errorf("Error converting string to integer: %w", err) + return fmt.Errorf("error converting string to integer: %w", err) } // Convert to token supply with decimals stakedSupply := big.NewInt(int64(totalSupply / totalSupplyToStakingRatio)) diff --git a/cmd/config/init/relayer.go b/cmd/config/init/relayer.go index 35034f10..14216f69 100644 --- a/cmd/config/init/relayer.go +++ b/cmd/config/init/relayer.go @@ -2,11 +2,12 @@ package initconfig import ( "encoding/json" - "github.com/dymensionxyz/roller/relayer" "os" "os/exec" "path/filepath" + "github.com/dymensionxyz/roller/relayer" + "github.com/dymensionxyz/roller/config" "github.com/dymensionxyz/roller/cmd/consts" @@ -17,24 +18,23 @@ type RelayerFileChainConfig struct { Value RelayerFileChainConfigValue `json:"value"` } type RelayerFileChainConfigValue struct { - Key string `json:"key"` - ChainID string `json:"chain-id"` - RpcAddr string `json:"rpc-addr"` - AccountPrefix string `json:"account-prefix"` - KeyringBackend string `json:"keyring-backend"` - GasAdjustment float64 `json:"gas-adjustment"` - GasPrices string `json:"gas-prices"` - Debug bool `json:"debug"` - Timeout string `json:"timeout"` - OutputFormat string `json:"output-format"` - SignMode string `json:"sign-mode"` - ClientType string `json:"client-type"` + Key string `json:"key"` + ChainID string `json:"chain-id"` + RpcAddr string `json:"rpc-addr"` + AccountPrefix string `json:"account-prefix"` + KeyringBackend string `json:"keyring-backend"` + GasAdjustment float64 `json:"gas-adjustment"` + GasPrices string `json:"gas-prices"` + Debug bool `json:"debug"` + Timeout string `json:"timeout"` + OutputFormat string `json:"output-format"` + SignMode string `json:"sign-mode"` + ExtraCodecs []string `json:"extra-codecs"` } type RelayerChainConfig struct { ChainConfig relayer.ChainConfig GasPrices string - ClientType string KeyName string } @@ -65,7 +65,7 @@ func getRelayerFileChainConfig(relayerChainConfig RelayerChainConfig) RelayerFil Timeout: "10s", OutputFormat: "json", SignMode: "direct", - ClientType: relayerChainConfig.ClientType, + ExtraCodecs: []string{"ethermint"}, }, } } @@ -91,14 +91,12 @@ func addChainsConfig(rollappConfig relayer.ChainConfig, hubConfig relayer.ChainC relayerRollappConfig := getRelayerFileChainConfig(RelayerChainConfig{ ChainConfig: rollappConfig, GasPrices: rollappConfig.GasPrices + rollappConfig.Denom, - ClientType: "01-dymint", KeyName: consts.KeysIds.RollappRelayer, }) relayerHubConfig := getRelayerFileChainConfig(RelayerChainConfig{ ChainConfig: hubConfig, GasPrices: hubConfig.GasPrices + hubConfig.Denom, - ClientType: "07-tendermint", KeyName: consts.KeysIds.HubRelayer, }) diff --git a/cmd/consts/consts.go b/cmd/consts/consts.go index 4879b28d..44d38e2e 100644 --- a/cmd/consts/consts.go +++ b/cmd/consts/consts.go @@ -107,7 +107,7 @@ var Hubs = map[string]config.HubData{ ID: LocalHubID, RPC_URL: "http://localhost:36657", ARCHIVE_RPC_URL: "http://localhost:36657", - GAS_PRICE: "0", + GAS_PRICE: "100000000", }, // TODO: Add mainnet hub data MainnetHubName: FroopylandHubData, diff --git a/cmd/da-light-client/start/start.go b/cmd/da-light-client/start/start.go index 0144386f..b3316d9c 100644 --- a/cmd/da-light-client/start/start.go +++ b/cmd/da-light-client/start/start.go @@ -1,6 +1,7 @@ package start import ( + "context" "errors" "fmt" @@ -52,7 +53,10 @@ func Cmd() *cobra.Command { logFilePath := utils.GetDALogFilePath(rollappConfig.Home) LCEndpoint = damanager.GetLightNodeEndpoint() - utils.RunBashCmdAsync(startDALCCmd, printOutput, parseError, utils.WithLogging(logFilePath)) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + go utils.RunBashCmdAsync(ctx, startDALCCmd, printOutput, parseError, utils.WithLogging(logFilePath)) + select {} }, } diff --git a/cmd/migrate/migrate.go b/cmd/migrate/migrate.go index cbd97761..877bff14 100644 --- a/cmd/migrate/migrate.go +++ b/cmd/migrate/migrate.go @@ -18,6 +18,7 @@ var migrationsRegistry = []VersionMigrator{ &VersionMigratorV0112{}, &VersionMigratorV0113{}, &VersionMigratorV0118{}, + &VersionMigratorV1000{}, } func Cmd() *cobra.Command { diff --git a/cmd/migrate/v1_0_00.go b/cmd/migrate/v1_0_00.go new file mode 100644 index 00000000..73a19f33 --- /dev/null +++ b/cmd/migrate/v1_0_00.go @@ -0,0 +1,40 @@ +package migrate + +import ( + "fmt" + "os/exec" + + "github.com/dymensionxyz/roller/cmd/consts" + "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" + "github.com/dymensionxyz/roller/relayer" +) + +type VersionMigratorV1000 struct{} + +func (v *VersionMigratorV1000) ShouldMigrate(prevVersion VersionData) bool { + return prevVersion.Major < 1 +} + +func (v *VersionMigratorV1000) PerformMigration(rlpCfg config.RollappConfig) error { + fmt.Println("💈 Migrating Rollapp key...") + migrateRollappKeyCmd := exec.Command(consts.Executables.RollappEVM, "keys", "migrate", "--home", rlpCfg.Home+"/relayer/keys/"+rlpCfg.RollappID, "--keyring-backend", "test") + out, err := utils.ExecBashCommandWithStdout(migrateRollappKeyCmd) + if err != nil { + return err + } + fmt.Println(out.String()) + fmt.Println("💈 Migrating Hub key...") + migrateHubKeyCmd := exec.Command(consts.Executables.Dymension, "keys", "migrate", "--home", rlpCfg.Home+"/relayer/keys/"+rlpCfg.HubData.ID, "--keyring-backend", "test") + out, err = utils.ExecBashCommandWithStdout(migrateHubKeyCmd) + if err != nil { + return err + } + fmt.Println(out.String()) + fmt.Println("💈 Updating relayer configuration to match new relayer key...") + if err := relayer.UpdateRlyConfigValue(rlpCfg, []string{"chains", rlpCfg.RollappID, "value", "extra-codecs"}, []string{"ethermint"}); err != nil { + return err + } + return nil + +} diff --git a/cmd/relayer/start/start.go b/cmd/relayer/start/start.go index f27caec3..6a00a5b2 100644 --- a/cmd/relayer/start/start.go +++ b/cmd/relayer/start/start.go @@ -58,16 +58,9 @@ 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(ctx, rly.GetStartCmd(), func() {}, func(errMessage string) string { return errMessage }, logFileOption) fmt.Printf("💈 The relayer is running successfully on you local machine! Channels: src, %s <-> %s, dst", rly.SrcChannel, rly.DstChannel) diff --git a/cmd/sequencer/start/start.go b/cmd/sequencer/start/start.go index 458bc568..5a6a7171 100644 --- a/cmd/sequencer/start/start.go +++ b/cmd/sequencer/start/start.go @@ -1,11 +1,13 @@ package sequnecer_start import ( + "context" "fmt" - "github.com/dymensionxyz/roller/sequencer" "math/big" "path/filepath" + "github.com/dymensionxyz/roller/sequencer" + "strings" "github.com/dymensionxyz/roller/cmd/consts" @@ -38,10 +40,13 @@ func StartCmd() *cobra.Command { utils.PrintInsufficientBalancesIfAny(sequencerInsufficientAddrs, rollappConfig) seq := sequencer.GetInstance(rollappConfig) startRollappCmd := seq.GetStartCmd() - utils.RunBashCmdAsync(startRollappCmd, func() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + go utils.RunBashCmdAsync(ctx, startRollappCmd, func() { printOutput(rollappConfig) }, parseError, utils.WithLogging(utils.GetSequencerLogPath(rollappConfig))) + select {} }, } diff --git a/cmd/tx/register/bash_commands.go b/cmd/tx/register/bash_commands.go index 352ec052..b449fc9b 100644 --- a/cmd/tx/register/bash_commands.go +++ b/cmd/tx/register/bash_commands.go @@ -13,8 +13,9 @@ import ( ) func getRegisterRollappCmd(rollappConfig config.RollappConfig) *exec.Cmd { + tokenMetadataPath := filepath.Join(rollappConfig.Home, consts.ConfigDirName.Rollapp, "config", "tokenmetadata.json") cmdArgs := []string{ - "tx", "rollapp", "create-rollapp", rollappConfig.RollappID, "stamp1", "genesis-path/1", "3", "3", `{"Addresses":[]}`, + "tx", "rollapp", "create-rollapp", rollappConfig.RollappID, "3", `{"Addresses":[]}`, tokenMetadataPath, } cmdArgs = append(cmdArgs, getCommonDymdTxFlags(rollappConfig)...) return exec.Command( diff --git a/cmd/utils/bash_commands.go b/cmd/utils/bash_commands.go index 6dcd088b..2dc21504 100644 --- a/cmd/utils/bash_commands.go +++ b/cmd/utils/bash_commands.go @@ -42,7 +42,7 @@ func GetCommonDymdFlags(rollappConfig config.RollappConfig) []string { type CommandOption func(cmd *exec.Cmd) -func RunBashCmdAsync(cmd *exec.Cmd, printOutput func(), parseError func(errMsg string) string, +func RunBashCmdAsync(ctx context.Context, cmd *exec.Cmd, printOutput func(), parseError func(errMsg string) string, options ...CommandOption) { for _, option := range options { option(cmd) @@ -68,6 +68,14 @@ func RunBashCmdAsync(cmd *exec.Cmd, printOutput func(), parseError func(errMsg s PrettifyErrorIfExists(errors.New(errMsg)) } printOutput() + + go func() { + <-ctx.Done() + if cmd.Process != nil { + cmd.Process.Kill() + } + }() + err = cmd.Wait() if err != nil { errMsg := parseError(stderr.String()) diff --git a/compile_locally.sh b/compile_locally.sh index 0a7776af..1b0b6a67 100755 --- a/compile_locally.sh +++ b/compile_locally.sh @@ -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.3" "v0.2.0-v2.3.1-relayer" "v1.0.0-beta") BUILDCOMMANDS=("" "" "") BINARYNAME=("dymd" "rly" "rollapp-evm") diff --git a/relayer/periodic_commands.go b/relayer/commands.go similarity index 82% rename from relayer/periodic_commands.go rename to relayer/commands.go index d3b9bd84..a4d32e4e 100644 --- a/relayer/periodic_commands.go +++ b/relayer/commands.go @@ -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)} } diff --git a/relayer/config.go b/relayer/config.go index cbe2ebd1..5aa798d3 100644 --- a/relayer/config.go +++ b/relayer/config.go @@ -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 { diff --git a/relayer/create_ibc_channel.go b/relayer/create_ibc_channel.go index d460a4af..e0f210ff 100644 --- a/relayer/create_ibc_channel.go +++ b/relayer/create_ibc_channel.go @@ -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()) //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(override) + 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") } diff --git a/test/config/init/goldens/init_with_flags/relayer/config/config.yaml b/test/config/init/goldens/init_with_flags/relayer/config/config.yaml index 7f3040e8..144d04fb 100644 --- a/test/config/init/goldens/init_with_flags/relayer/config/config.yaml +++ b/test/config/init/goldens/init_with_flags/relayer/config/config.yaml @@ -1,46 +1,67 @@ -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 + block-timeout: "" + broadcast-mode: batch + chain-id: PLACEHOLDER_ROLLAPP_ID + coin-type: null + debug: true + extension-options: [] + extra-codecs: + - ethermint + feegrants: null + gas-adjustment: 1.2 + gas-prices: 0udym + key: relayer-rollapp-key + key-directory: PLACEHOLDER_KEY_DIRECTORY + keyring-backend: test + max-gas-amount: 0 + min-gas-amount: 0 + min-loop-duration: 0s + output-format: json + rpc-addr: http://localhost:26657 + sign-mode: direct + signing-algorithm: "" + timeout: 10s + dymension_100-1: + type: cosmos + value: + account-prefix: dym + block-timeout: "" + broadcast-mode: batch + chain-id: dymension_100-1 + coin-type: null + debug: true + extension-options: [] + extra-codecs: + - ethermint + feegrants: null + gas-adjustment: 1.2 + gas-prices: 100000000udym + key: relayer-hub-key + key-directory: PLACEHOLDER_KEY_DIRECTORY + keyring-backend: test + max-gas-amount: 0 + min-gas-amount: 0 + min-loop-duration: 0s + output-format: json + rpc-addr: http://localhost:36657 + sign-mode: direct + signing-algorithm: "" + 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: "" diff --git a/test/config/init/goldens/init_without_flags/relayer/config/config.yaml b/test/config/init/goldens/init_without_flags/relayer/config/config.yaml index e6f035df..144d04fb 100644 --- a/test/config/init/goldens/init_without_flags/relayer/config/config.yaml +++ b/test/config/init/goldens/init_without_flags/relayer/config/config.yaml @@ -1,47 +1,67 @@ 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 + block-timeout: "" + broadcast-mode: batch + chain-id: PLACEHOLDER_ROLLAPP_ID + coin-type: null + debug: true + extension-options: [] + extra-codecs: + - ethermint + feegrants: null + gas-adjustment: 1.2 + gas-prices: 0udym + key: relayer-rollapp-key + key-directory: PLACEHOLDER_KEY_DIRECTORY + keyring-backend: test + max-gas-amount: 0 + min-gas-amount: 0 + min-loop-duration: 0s + output-format: json + rpc-addr: http://localhost:26657 + sign-mode: direct + signing-algorithm: "" + timeout: 10s + dymension_100-1: + type: cosmos + value: + account-prefix: dym + block-timeout: "" + broadcast-mode: batch + chain-id: dymension_100-1 + coin-type: null + debug: true + extension-options: [] + extra-codecs: + - ethermint + feegrants: null + gas-adjustment: 1.2 + gas-prices: 100000000udym + key: relayer-hub-key + key-directory: PLACEHOLDER_KEY_DIRECTORY + keyring-backend: test + max-gas-amount: 0 + min-gas-amount: 0 + min-loop-duration: 0s + output-format: json + rpc-addr: http://localhost:36657 + sign-mode: direct + signing-algorithm: "" + 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: "" diff --git a/test/config/init/testutils/relayer.go b/test/config/init/testutils/relayer.go index 08eee0db..be0aa66d 100644 --- a/test/config/init/testutils/relayer.go +++ b/test/config/init/testutils/relayer.go @@ -2,10 +2,16 @@ package testutils import ( "errors" + "reflect" + "github.com/dymensionxyz/roller/config" "github.com/dymensionxyz/roller/relayer" "github.com/dymensionxyz/roller/utils" - "reflect" +) + +const ( + placeholderRollappID = "PLACEHOLDER_ROLLAPP_ID" + placerholderKeyDirectory = "PLACEHOLDER_KEY_DIRECTORY" ) func SanitizeRlyConfig(rlpCfg *config.RollappConfig) error { @@ -13,7 +19,14 @@ func SanitizeRlyConfig(rlpCfg *config.RollappConfig) error { if err != nil { return err } - const placeholderRollappID = "PLACEHOLDER_ROLLAPP_ID" + err = utils.SetNestedValue(rlyCfg, []string{"chains", rlpCfg.RollappID, "value", "key-directory"}, placerholderKeyDirectory) + if err != nil { + return err + } + err = utils.SetNestedValue(rlyCfg, []string{"chains", rlpCfg.HubData.ID, "value", "key-directory"}, placerholderKeyDirectory) + if err != nil { + return err + } err = utils.SetNestedValue(rlyCfg, []string{"chains", rlpCfg.RollappID, "value", "chain-id"}, placeholderRollappID) if err != nil { return err