diff --git a/cmd/config/init/consts.go b/cmd/config/init/consts.go index e8911eae..169d9b51 100644 --- a/cmd/config/init/consts.go +++ b/cmd/config/init/consts.go @@ -1,6 +1,6 @@ package initconfig -import "github.com/dymensionxyz/roller/cmd/utils" +import "github.com/dymensionxyz/roller/config" var FlagNames = struct { TokenSupply string @@ -8,12 +8,14 @@ var FlagNames = struct { HubID string Decimals string Interactive string + DAType string }{ TokenSupply: "token-supply", RollappBinary: "rollapp-binary", HubID: "hub", Interactive: "interactive", Decimals: "decimals", + DAType: "da", } const ( @@ -22,7 +24,7 @@ const ( ) // TODO(#112): The avaialble hub networks should be read from YAML file -var Hubs = map[string]utils.HubData{ +var Hubs = map[string]config.HubData{ StagingHubID: { API_URL: "https://dymension.devnet.api.silknodes.io:443", ID: "devnet_304-1", diff --git a/cmd/config/init/da_light_client.go b/cmd/config/init/da_light_client.go deleted file mode 100644 index b8acc5fa..00000000 --- a/cmd/config/init/da_light_client.go +++ /dev/null @@ -1,19 +0,0 @@ -package initconfig - -import ( - "os/exec" - "path/filepath" - - "github.com/dymensionxyz/roller/cmd/utils" - - "github.com/dymensionxyz/roller/cmd/consts" -) - -func initializeLightNodeConfig(initConfig utils.RollappConfig) error { - initLightNodeCmd := exec.Command(consts.Executables.Celestia, "light", "init", "--p2p.network", consts.DefaultCeletiaNetowrk, "--node.store", filepath.Join(initConfig.Home, consts.ConfigDirName.DALightNode)) - err := initLightNodeCmd.Run() - if err != nil { - return err - } - return nil -} diff --git a/cmd/config/init/flags.go b/cmd/config/init/flags.go index c394979f..be4e99cc 100644 --- a/cmd/config/init/flags.go +++ b/cmd/config/init/flags.go @@ -2,9 +2,11 @@ package initconfig import ( "fmt" + "strings" "github.com/dymensionxyz/roller/cmd/consts" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" "github.com/spf13/cobra" ) @@ -22,6 +24,8 @@ func addFlags(cmd *cobra.Command) error { "It should be an integer ranging between 1 and 18. This is akin to how 1 Ether equates to 10^18 Wei in Ethereum. "+ "Note: EVM RollApps must set this value to 18.") + cmd.Flags().StringP(FlagNames.DAType, "", "Celestia", "The DA layer for the RollApp. Can be one of 'Celestia, Avail, Mock'") + // TODO: Expose when supporting custom sdk rollapps. err := cmd.Flags().MarkHidden(FlagNames.Decimals) if err != nil { @@ -30,12 +34,8 @@ func addFlags(cmd *cobra.Command) error { return nil } -func getTokenSupply(cmd *cobra.Command) string { - return cmd.Flag(FlagNames.TokenSupply).Value.String() -} - -func GetInitConfig(initCmd *cobra.Command, args []string) (utils.RollappConfig, error) { - cfg := utils.RollappConfig{} +func GetInitConfig(initCmd *cobra.Command, args []string) (config.RollappConfig, error) { + cfg := config.RollappConfig{} cfg.Home = initCmd.Flag(utils.FlagNames.Home).Value.String() cfg.RollappBinary = initCmd.Flag(FlagNames.RollappBinary).Value.String() // Error is ignored because the flag is validated in the cobra preRun hook @@ -51,24 +51,16 @@ func GetInitConfig(initCmd *cobra.Command, args []string) (utils.RollappConfig, denom := args[1] hubID := initCmd.Flag(FlagNames.HubID).Value.String() - tokenSupply := getTokenSupply(initCmd) + tokenSupply := initCmd.Flag(FlagNames.TokenSupply).Value.String() cfg.RollappID = rollappId cfg.Denom = "u" + denom cfg.HubData = Hubs[hubID] cfg.TokenSupply = tokenSupply + cfg.DA = config.DAType(strings.ToLower(initCmd.Flag(FlagNames.DAType).Value.String())) return cfg, nil } -func getValidRollappIdMessage() string { - return "A valid RollApp ID should follow the format 'name_EIP155-revision', where 'name' is made up of" + - " lowercase English letters, 'EIP155-revision' is a 1 to 5 digit number representing the EIP155 rollapp ID, and '" + - "revision' is a 1 to 5 digit number representing the revision. For example: 'mars_9721-1'" -} func getAvailableHubsMessage() string { return fmt.Sprintf("Acceptable values are '%s' or '%s'", StagingHubID, LocalHubID) } - -func getValidDenomMessage() string { - return "A valid denom should consist of exactly 3 English alphabet letters, for example 'btc', 'eth'" -} diff --git a/cmd/config/init/genesis.go b/cmd/config/init/genesis.go index 810915a9..118ea7d1 100644 --- a/cmd/config/init/genesis.go +++ b/cmd/config/init/genesis.go @@ -7,6 +7,7 @@ import ( "github.com/dymensionxyz/roller/cmd/consts" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" "os/exec" "path/filepath" @@ -14,7 +15,7 @@ import ( "github.com/tidwall/sjson" ) -func initializeRollappGenesis(initConfig utils.RollappConfig) error { +func initializeRollappGenesis(initConfig config.RollappConfig) error { totalTokenSupply, success := new(big.Int).SetString(initConfig.TokenSupply, 10) if !success { return fmt.Errorf("invalid token supply") diff --git a/cmd/config/init/init.go b/cmd/config/init/init.go index b2d945a4..97d5438b 100644 --- a/cmd/config/init/init.go +++ b/cmd/config/init/init.go @@ -2,17 +2,21 @@ package initconfig import ( "fmt" - "github.com/cosmos/cosmos-sdk/types/errors" + "os" + "github.com/dymensionxyz/roller/cmd/consts" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" + datalayer "github.com/dymensionxyz/roller/data_layer" "github.com/spf13/cobra" - "os" ) func InitCmd() *cobra.Command { initCmd := &cobra.Command{ - Use: "init ", - Short: "Initialize a RollApp configuration on your local machine.", + Use: "init | --interactive", + Short: "Initialize a RollApp configuration on your local machine.", + Long: "Initialize a RollApp configuration on your local machine\n" + requiredFlagsUsage(), + Example: `init mars_9721-1 btc`, PreRunE: func(cmd *cobra.Command, args []string) error { interactive, _ := cmd.Flags().GetBool(FlagNames.Interactive) if interactive { @@ -37,15 +41,17 @@ func InitCmd() *cobra.Command { return nil }, Run: func(cmd *cobra.Command, args []string) { + initConfig, err := GetInitConfig(cmd, args) + utils.PrettifyErrorIfExists(err) + spin := utils.GetLoadingSpinner() spin.Suffix = consts.SpinnerMsgs.UniqueIdVerification spin.Start() - initConfig, err := GetInitConfig(cmd, args) - utils.PrettifyErrorIfExists(err) err = initConfig.Validate() - err = errors.Wrap(err, getValidRollappIdMessage()) - utils.PrettifyErrorIfExists(err) + utils.PrettifyErrorIfExists(err, func() { + fmt.Println(requiredFlagsUsage()) + }) utils.PrettifyErrorIfExists(VerifyUniqueRollappID(initConfig.RollappID, initConfig)) isRootExist, err := dirNotEmpty(initConfig.Home) @@ -84,18 +90,23 @@ func InitCmd() *cobra.Command { utils.PrettifyErrorIfExists(err) /* ------------------------ Initialize DA light node ------------------------ */ - utils.PrettifyErrorIfExists(initializeLightNodeConfig(initConfig)) - daAddress, err := utils.GetCelestiaAddress(initConfig.Home) + damanager := datalayer.NewDAManager(initConfig.DA, initConfig.Home) + err = damanager.InitializeLightNodeConfig() utils.PrettifyErrorIfExists(err) - addresses = append(addresses, utils.AddressData{ - Addr: daAddress, - Name: consts.KeysIds.DALightNode, - }) + daAddress, err := damanager.GetDAAccountAddress() + utils.PrettifyErrorIfExists(err) + + if daAddress != "" { + addresses = append(addresses, utils.AddressData{ + Name: consts.KeysIds.DALightNode, + Addr: daAddress, + }) + } /* --------------------------- Initiailize Rollapp -------------------------- */ utils.PrettifyErrorIfExists(initializeRollappConfig(initConfig)) utils.PrettifyErrorIfExists(initializeRollappGenesis(initConfig)) - utils.PrettifyErrorIfExists(utils.WriteConfigToTOML(initConfig)) + utils.PrettifyErrorIfExists(config.WriteConfigToTOML(initConfig)) /* ------------------------------ Print output ------------------------------ */ spin.Stop() @@ -109,3 +120,13 @@ func InitCmd() *cobra.Command { return initCmd } + +func requiredFlagsUsage() string { + return ` +A valid RollApp ID should follow the format 'name_uniqueID-revision', where +- 'name' is made up of lowercase English letters +- 'uniqueID' is a number up to the length of 5 digits representing the unique ID EIP155 rollapp ID +- 'revision' is a number up to the length of 5 digits representing the revision number for this rollapp + +A valid denom should consist of exactly 3 English alphabet letters, for example 'btc', 'eth'` +} diff --git a/cmd/config/init/interactive.go b/cmd/config/init/interactive.go index 119dfc17..ebeb92c8 100644 --- a/cmd/config/init/interactive.go +++ b/cmd/config/init/interactive.go @@ -3,19 +3,20 @@ package initconfig import ( "fmt" "os" + "strings" - "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" "github.com/manifoldco/promptui" ) // TODO: return error output -func RunInteractiveMode(config *utils.RollappConfig) { +func RunInteractiveMode(cfg *config.RollappConfig) { promptNetwork := promptui.Select{ Label: "Select your network", Items: []string{"devnet", "local"}, } _, mode, _ := promptNetwork.Run() - config.HubData = Hubs[mode] + cfg.HubData = Hubs[mode] promptChainID := promptui.Prompt{ Label: "Enter your RollApp ID", @@ -27,8 +28,8 @@ func RunInteractiveMode(config *utils.RollappConfig) { if err != nil { break } - if err := utils.ValidateRollAppID(chainID); err == nil { - config.RollappID = chainID + if err := config.ValidateRollAppID(chainID); err == nil { + cfg.RollappID = chainID break } fmt.Println("Expected format: name_uniqueID-revision (e.g. myrollapp_1234-1)") @@ -38,37 +39,45 @@ func RunInteractiveMode(config *utils.RollappConfig) { Label: "Specify your RollApp denom", Default: "RAX", Validate: func(s string) error { - if !utils.IsValidTokenSymbol(s) { + if !config.IsValidTokenSymbol(s) { return fmt.Errorf("invalid token symbol") } return nil }, } denom, _ := promptDenom.Run() - config.Denom = "u" + denom + cfg.Denom = "u" + denom promptTokenSupply := promptui.Prompt{ Label: "How many " + denom + " tokens do you wish to mint for Genesis?", Default: "1000000000", - Validate: utils.VerifyTokenSupply, + Validate: config.VerifyTokenSupply, } supply, _ := promptTokenSupply.Run() - config.TokenSupply = supply + cfg.TokenSupply = supply + availableDAs := []config.DAType{config.Avail, config.Celestia} + if mode == "local" { + availableDAs = append(availableDAs, config.Mock) + } promptDAType := promptui.Select{ Label: "Choose your data layer", - Items: []string{"Celestia", "Avail"}, + Items: availableDAs, } //TODO(#76): temporary hack to only support Celestia for { _, da, err := promptDAType.Run() - if err != nil || da == "Celestia" { + if err != nil { break } - if da != "Celestia" { - fmt.Println("Only Celestia supported for now") + da = strings.ToLower(da) + if da == string(config.Avail) { + fmt.Println("Avail not supported yet") + continue } + cfg.DA = config.DAType(da) + break } promptExecutionEnv := promptui.Select{ @@ -79,7 +88,7 @@ func RunInteractiveMode(config *utils.RollappConfig) { if env == "custom" { promptBinaryPath := promptui.Prompt{ Label: "Set your runtime binary", - Default: config.RollappBinary, + Default: cfg.RollappBinary, AllowEdit: true, Validate: func(s string) error { _, err := os.Stat(s) @@ -87,6 +96,6 @@ func RunInteractiveMode(config *utils.RollappConfig) { }, } path, _ := promptBinaryPath.Run() - config.RollappBinary = path + cfg.RollappBinary = path } } diff --git a/cmd/config/init/keys.go b/cmd/config/init/keys.go index 691478b9..ddee8136 100644 --- a/cmd/config/init/keys.go +++ b/cmd/config/init/keys.go @@ -8,9 +8,10 @@ import ( "github.com/dymensionxyz/roller/cmd/consts" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" ) -func generateKeys(rollappConfig utils.RollappConfig) ([]utils.AddressData, error) { +func generateKeys(rollappConfig config.RollappConfig) ([]utils.AddressData, error) { sequencerAddresses, err := generateSequencersKeys(rollappConfig) if err != nil { return nil, err @@ -22,7 +23,7 @@ func generateKeys(rollappConfig utils.RollappConfig) ([]utils.AddressData, error return append(sequencerAddresses, relayerAddresses...), nil } -func generateSequencersKeys(initConfig utils.RollappConfig) ([]utils.AddressData, error) { +func generateSequencersKeys(initConfig config.RollappConfig) ([]utils.AddressData, error) { keys := getSequencerKeysConfig() addresses := make([]utils.AddressData, 0) for _, key := range keys { @@ -63,7 +64,7 @@ func getSequencerKeysConfig() []utils.CreateKeyConfig { } } -func getRelayerKeysConfig(rollappConfig utils.RollappConfig) map[string]utils.CreateKeyConfig { +func getRelayerKeysConfig(rollappConfig config.RollappConfig) map[string]utils.CreateKeyConfig { return map[string]utils.CreateKeyConfig{ consts.KeysIds.RollappRelayer: { Dir: path.Join(rollappConfig.Home, consts.ConfigDirName.Relayer), @@ -92,7 +93,7 @@ func createAddressBinary(keyConfig utils.CreateKeyConfig, binaryPath string, hom return utils.ParseAddressFromOutput(out) } -func generateRelayerKeys(rollappConfig utils.RollappConfig) ([]utils.AddressData, error) { +func generateRelayerKeys(rollappConfig config.RollappConfig) ([]utils.AddressData, error) { relayerAddresses := make([]utils.AddressData, 0) keys := getRelayerKeysConfig(rollappConfig) createRollappKeyCmd := getAddRlyKeyCmd(keys[consts.KeysIds.RollappRelayer], rollappConfig.RollappID) diff --git a/cmd/config/init/output.go b/cmd/config/init/output.go index 443a4a98..3b48c26c 100644 --- a/cmd/config/init/output.go +++ b/cmd/config/init/output.go @@ -6,9 +6,10 @@ import ( "github.com/dymensionxyz/roller/cmd/consts" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" ) -func printInitOutput(rollappConfig utils.RollappConfig, addresses []utils.AddressData, rollappId string) { +func printInitOutput(rollappConfig config.RollappConfig, addresses []utils.AddressData, rollappId string) { fmt.Printf("💈 RollApp '%s' configuration files have been successfully generated on your local machine. Congratulations!\n\n", rollappId) fmt.Println(FormatTokenSupplyLine(rollappConfig)) fmt.Println() @@ -32,7 +33,7 @@ func formatAddresses(addresses []utils.AddressData) []utils.AddressData { return filteredAddresses } -func FormatTokenSupplyLine(rollappConfig utils.RollappConfig) string { +func FormatTokenSupplyLine(rollappConfig config.RollappConfig) string { displayDenom := strings.ToUpper(rollappConfig.Denom[1:]) return fmt.Sprintf("💰 Total Token Supply: %s %s. Note that 1 %s == 1 * 10^%d %s (like 1 ETH == 1 * 10^18 wei).", addCommasToNum(rollappConfig.TokenSupply), displayDenom, displayDenom, rollappConfig.Decimals, "u"+displayDenom) diff --git a/cmd/config/init/relayer.go b/cmd/config/init/relayer.go index 7471ae23..aad1a04b 100644 --- a/cmd/config/init/relayer.go +++ b/cmd/config/init/relayer.go @@ -2,12 +2,14 @@ package initconfig import ( "encoding/json" - "github.com/dymensionxyz/roller/cmd/utils" "io/ioutil" "os" "os/exec" "path/filepath" + "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" + "github.com/dymensionxyz/roller/cmd/consts" ) @@ -131,7 +133,7 @@ func setupPath(rollappConfig ChainConfig, hubConfig ChainConfig, relayerHome str return nil } -func initializeRelayerConfig(rollappConfig ChainConfig, hubConfig ChainConfig, initConfig utils.RollappConfig) error { +func initializeRelayerConfig(rollappConfig ChainConfig, hubConfig ChainConfig, initConfig config.RollappConfig) error { relayerHome := filepath.Join(initConfig.Home, consts.ConfigDirName.Relayer) if err := initRelayer(relayerHome); err != nil { return err diff --git a/cmd/config/init/rollapp.go b/cmd/config/init/rollapp.go index 71fa4a6f..6509ab74 100644 --- a/cmd/config/init/rollapp.go +++ b/cmd/config/init/rollapp.go @@ -6,12 +6,13 @@ import ( "path/filepath" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" "github.com/dymensionxyz/roller/cmd/consts" toml "github.com/pelletier/go-toml" ) -func initializeRollappConfig(initConfig utils.RollappConfig) error { +func initializeRollappConfig(initConfig config.RollappConfig) error { home := filepath.Join(initConfig.Home, consts.ConfigDirName.Rollapp) initRollappCmd := exec.Command(initConfig.RollappBinary, "init", consts.KeysIds.HubSequencer, "--chain-id", diff --git a/cmd/config/init/unique_rollapp_id.go b/cmd/config/init/unique_rollapp_id.go index 95a969ca..2992720c 100644 --- a/cmd/config/init/unique_rollapp_id.go +++ b/cmd/config/init/unique_rollapp_id.go @@ -4,11 +4,11 @@ import ( "fmt" "net/http" - "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" ) // TODO(#150): roller should use RPC for queries instead of REST -func IsRollappIDUnique(rollappID string, initConfig utils.RollappConfig) (bool, error) { +func IsRollappIDUnique(rollappID string, initConfig config.RollappConfig) (bool, error) { url := initConfig.HubData.API_URL + "/dymensionxyz/dymension/rollapp/rollapp/" + rollappID req, err := http.NewRequest("GET", url, nil) @@ -34,7 +34,7 @@ func IsRollappIDUnique(rollappID string, initConfig utils.RollappConfig) (bool, } } -func VerifyUniqueRollappID(rollappID string, initConfig utils.RollappConfig) error { +func VerifyUniqueRollappID(rollappID string, initConfig config.RollappConfig) error { isUniqueRollapp, err := IsRollappIDUnique(rollappID, initConfig) if err != nil { return err diff --git a/cmd/da-light-client/start/start.go b/cmd/da-light-client/start/start.go index 9247dbd7..4c2acfb9 100644 --- a/cmd/da-light-client/start/start.go +++ b/cmd/da-light-client/start/start.go @@ -1,42 +1,44 @@ package start import ( + "errors" "fmt" - "math/big" - "os/exec" - "path/filepath" "github.com/dymensionxyz/roller/cmd/consts" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" + datalayer "github.com/dymensionxyz/roller/data_layer" "github.com/spf13/cobra" ) -// TODO: test how much is enough to run the LC for one day and set the minimum balance accordingly. const ( - gatewayAddr = "0.0.0.0" - gatewayPort = "26659" rpcEndpointFlag = "--rpc-endpoint" ) -var ( - lcMinBalance = big.NewInt(1) - LCEndpoint = fmt.Sprintf("http://%s:%s", gatewayAddr, gatewayPort) -) +var LCEndpoint = "" func Cmd() *cobra.Command { runCmd := &cobra.Command{ Use: "start", - Short: "Runs the rollapp sequencer.", + Short: "Runs the DA light client.", Run: func(cmd *cobra.Command, args []string) { home := cmd.Flag(utils.FlagNames.Home).Value.String() - rollappConfig, err := utils.LoadConfigFromTOML(home) + rollappConfig, err := config.LoadConfigFromTOML(home) utils.PrettifyErrorIfExists(err) - insufficientBalances, err := CheckDABalance(rollappConfig) + + damanager := datalayer.NewDAManager(rollappConfig.DA, rollappConfig.Home) + insufficientBalances, err := damanager.CheckDABalance() utils.PrettifyErrorIfExists(err) utils.PrintInsufficientBalancesIfAny(insufficientBalances) rpcEndpoint := cmd.Flag(rpcEndpointFlag).Value.String() - startDALCCmd := GetStartDACmd(rollappConfig, rpcEndpoint) + + startDALCCmd := damanager.GetStartDACmd(rpcEndpoint) + if startDALCCmd == nil { + utils.PrettifyErrorIfExists(errors.New("can't run mock DA. It runs automatically with the app")) + } + logFilePath := utils.GetDALogFilePath(rollappConfig.Home) + LCEndpoint = damanager.GetLightNodeEndpoint() utils.RunBashCmdAsync(startDALCCmd, printOutput, parseError, utils.WithLogging(logFilePath)) }, } @@ -49,24 +51,6 @@ func addFlags(cmd *cobra.Command) { cmd.Flags().StringP(rpcEndpointFlag, "", consts.DefaultCelestiaRPC, "The DA rpc endpoint to connect to.") } -func CheckDABalance(config utils.RollappConfig) ([]utils.NotFundedAddressData, error) { - accData, err := utils.GetCelLCAccData(config) - if err != nil { - return nil, err - } - var insufficientBalances []utils.NotFundedAddressData - if accData.Balance.Cmp(lcMinBalance) < 0 { - insufficientBalances = append(insufficientBalances, utils.NotFundedAddressData{ - Address: accData.Address, - CurrentBalance: accData.Balance, - RequiredBalance: lcMinBalance, - KeyName: consts.KeysIds.DALightNode, - Denom: consts.Denoms.Celestia, - }) - } - return insufficientBalances, nil -} - func printOutput() { fmt.Println("💈 The data availability light node is running on your local machine!") fmt.Printf("💈 Light node endpoint: %s", LCEndpoint) @@ -75,15 +59,3 @@ func printOutput() { func parseError(errMsg string) string { return errMsg } - -func GetStartDACmd(rollappConfig utils.RollappConfig, rpcEndpoint string) *exec.Cmd { - return exec.Command( - consts.Executables.Celestia, "light", "start", - "--core.ip", rpcEndpoint, - "--node.store", filepath.Join(rollappConfig.Home, consts.ConfigDirName.DALightNode), - "--gateway", - "--gateway.addr", gatewayAddr, - "--gateway.port", gatewayPort, - "--p2p.network", consts.DefaultCeletiaNetowrk, - ) -} diff --git a/cmd/keys/export/export.go b/cmd/keys/export/export.go index 613d7b5c..b6c86514 100644 --- a/cmd/keys/export/export.go +++ b/cmd/keys/export/export.go @@ -2,12 +2,14 @@ package export import ( "fmt" - "github.com/dymensionxyz/roller/cmd/consts" - "github.com/dymensionxyz/roller/cmd/utils" - "github.com/spf13/cobra" "os/exec" "path/filepath" "strings" + + "github.com/dymensionxyz/roller/cmd/consts" + "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" + "github.com/spf13/cobra" ) var supportedKeys = []string{ @@ -22,7 +24,7 @@ func Cmd() *cobra.Command { strings.Join(supportedKeys, ", ")), Run: func(cmd *cobra.Command, args []string) { home := cmd.Flag(utils.FlagNames.Home).Value.String() - config, err := utils.LoadConfigFromTOML(home) + config, err := config.LoadConfigFromTOML(home) utils.PrettifyErrorIfExists(err) keyID := args[0] diff --git a/cmd/keys/list/list.go b/cmd/keys/list/list.go index e16e3028..bd78feca 100644 --- a/cmd/keys/list/list.go +++ b/cmd/keys/list/list.go @@ -1,10 +1,13 @@ package list import ( + "path/filepath" + "github.com/dymensionxyz/roller/cmd/consts" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" + datalayer "github.com/dymensionxyz/roller/data_layer" "github.com/spf13/cobra" - "path/filepath" ) func Cmd() *cobra.Command { @@ -13,15 +16,20 @@ func Cmd() *cobra.Command { Short: "List all the addresses of roller on the local machine.", Run: func(cmd *cobra.Command, args []string) { home := cmd.Flag(utils.FlagNames.Home).Value.String() - rollappConfig, err := utils.LoadConfigFromTOML(home) - utils.PrettifyErrorIfExists(err) - daAddr, err := utils.GetCelestiaAddress(rollappConfig.Home) + rollappConfig, err := config.LoadConfigFromTOML(home) utils.PrettifyErrorIfExists(err) + addresses := make([]utils.AddressData, 0) - addresses = append(addresses, utils.AddressData{ - Addr: daAddr, - Name: consts.KeysIds.DALightNode, - }) + damanager := datalayer.NewDAManager(rollappConfig.DA, rollappConfig.Home) + + daAddr, err := damanager.DataLayer.GetDAAccountAddress() + utils.PrettifyErrorIfExists(err) + if daAddr != "" { + addresses = append(addresses, utils.AddressData{ + Addr: daAddr, + Name: consts.KeysIds.DALightNode, + }) + } hubSeqAddr, err := utils.GetAddressBinary(utils.GetKeyConfig{ Dir: filepath.Join(rollappConfig.Home, consts.ConfigDirName.HubKeys), ID: consts.KeysIds.HubSequencer, diff --git a/cmd/register/bash_commands.go b/cmd/register/bash_commands.go index 78602a88..a1cf4e2c 100644 --- a/cmd/register/bash_commands.go +++ b/cmd/register/bash_commands.go @@ -5,13 +5,14 @@ import ( "path/filepath" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" "fmt" "github.com/dymensionxyz/roller/cmd/consts" ) -func getRegisterRollappCmd(rollappConfig utils.RollappConfig) *exec.Cmd { +func getRegisterRollappCmd(rollappConfig config.RollappConfig) *exec.Cmd { cmdArgs := []string{ "tx", "rollapp", "create-rollapp", rollappConfig.RollappID, "stamp1", "genesis-path/1", "3", "3", `{"Addresses":[]}`, } @@ -21,7 +22,7 @@ func getRegisterRollappCmd(rollappConfig utils.RollappConfig) *exec.Cmd { ) } -func getRegisterSequencerCmd(rollappConfig utils.RollappConfig) (*exec.Cmd, error) { +func getRegisterSequencerCmd(rollappConfig config.RollappConfig) (*exec.Cmd, error) { seqPubKey, err := utils.GetSequencerPubKey(rollappConfig) if err != nil { return nil, err @@ -38,7 +39,7 @@ func getRegisterSequencerCmd(rollappConfig utils.RollappConfig) (*exec.Cmd, erro return exec.Command(consts.Executables.Dymension, cmdArgs...), nil } -func getCommonDymdTxFlags(rollappConfig utils.RollappConfig) []string { +func getCommonDymdTxFlags(rollappConfig config.RollappConfig) []string { commonFlags := utils.GetCommonDymdFlags(rollappConfig) txArgs := []string{ "--from", consts.KeysIds.HubSequencer, diff --git a/cmd/register/register.go b/cmd/register/register.go index 1e7c9aa6..fcb9bf70 100644 --- a/cmd/register/register.go +++ b/cmd/register/register.go @@ -12,6 +12,7 @@ import ( initconfig "github.com/dymensionxyz/roller/cmd/config/init" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" "github.com/spf13/cobra" ) @@ -27,7 +28,7 @@ func Cmd() *cobra.Command { spin.Suffix = consts.SpinnerMsgs.BalancesVerification spin.Start() home := cmd.Flag(utils.FlagNames.Home).Value.String() - rollappConfig, err := utils.LoadConfigFromTOML(home) + rollappConfig, err := config.LoadConfigFromTOML(home) utils.PrettifyErrorIfExists(err) notFundedAddrs, err := utils.GetSequencerInsufficientAddrs(rollappConfig, *registerUdymPrice) utils.PrettifyErrorIfExists(err) @@ -52,7 +53,7 @@ func Cmd() *cobra.Command { return registerCmd } -func registerRollapp(rollappConfig utils.RollappConfig) error { +func registerRollapp(rollappConfig config.RollappConfig) error { cmd := getRegisterRollappCmd(rollappConfig) var stdout bytes.Buffer var stderr bytes.Buffer @@ -75,7 +76,7 @@ type Response struct { RawLog string `json:"raw_log"` } -func handleStdOut(stdout bytes.Buffer, rollappConfig utils.RollappConfig) error { +func handleStdOut(stdout bytes.Buffer, rollappConfig config.RollappConfig) error { var response Response err := json.NewDecoder(&stdout).Decode(&response) @@ -90,6 +91,6 @@ func handleStdOut(stdout bytes.Buffer, rollappConfig utils.RollappConfig) error return nil } -func printRegisterOutput(rollappConfig utils.RollappConfig) { +func printRegisterOutput(rollappConfig config.RollappConfig) { fmt.Printf("💈 Rollapp '%s' has been successfully registered on the hub.\n", rollappConfig.RollappID) } diff --git a/cmd/relayer/start/create_ibc_channel.go b/cmd/relayer/start/create_ibc_channel.go index 703f0787..d7e5a907 100644 --- a/cmd/relayer/start/create_ibc_channel.go +++ b/cmd/relayer/start/create_ibc_channel.go @@ -7,10 +7,11 @@ import ( "github.com/dymensionxyz/roller/cmd/consts" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" ) // Creates an IBC channel between the hub and the client, and return the source channel ID. -func createIBCChannelIfNeeded(rollappConfig utils.RollappConfig, logFileOption utils.CommandOption) (string, error) { +func createIBCChannelIfNeeded(rollappConfig config.RollappConfig, logFileOption utils.CommandOption) (string, error) { createClientsCmd := getCreateClientsCmd(rollappConfig, rollappConfig.RollappID, rollappConfig.HubData.ID) fmt.Println("Creating clients...") if err := utils.ExecBashCmdWithOSOutput(createClientsCmd, logFileOption); err != nil { @@ -53,25 +54,25 @@ func createIBCChannelIfNeeded(rollappConfig utils.RollappConfig, logFileOption u return srcChannelId, nil } -func getCreateChannelCmd(config utils.RollappConfig) *exec.Cmd { +func getCreateChannelCmd(config config.RollappConfig) *exec.Cmd { defaultRlyArgs := getRelayerDefaultArgs(config) args := []string{"tx", "channel", "-t", "300s", "--override"} args = append(args, defaultRlyArgs...) return exec.Command(consts.Executables.Relayer, args...) } -func getCreateClientsCmd(rollappConfig utils.RollappConfig, srcId string, dstId string) *exec.Cmd { +func getCreateClientsCmd(rollappConfig config.RollappConfig, srcId string, dstId string) *exec.Cmd { defaultRlyArgs := getRelayerDefaultArgs(rollappConfig) args := []string{"tx", "clients"} args = append(args, defaultRlyArgs...) return exec.Command(consts.Executables.Relayer, args...) } -func getRelayerDefaultArgs(config utils.RollappConfig) []string { +func getRelayerDefaultArgs(config config.RollappConfig) []string { return []string{consts.DefaultRelayerPath, "--home", filepath.Join(config.Home, consts.ConfigDirName.Relayer)} } -func getCreateConnectionCmd(config utils.RollappConfig) *exec.Cmd { +func getCreateConnectionCmd(config config.RollappConfig) *exec.Cmd { defaultRlyArgs := getRelayerDefaultArgs(config) args := []string{"tx", "connection", "-t", "300s"} args = append(args, defaultRlyArgs...) diff --git a/cmd/relayer/start/get_active_src_channel.go b/cmd/relayer/start/get_active_src_channel.go index 98663b24..19e12453 100644 --- a/cmd/relayer/start/get_active_src_channel.go +++ b/cmd/relayer/start/get_active_src_channel.go @@ -2,14 +2,16 @@ package start import ( "encoding/json" + "os/exec" + "github.com/dymensionxyz/roller/cmd/consts" "github.com/dymensionxyz/roller/cmd/utils" - "os/exec" + "github.com/dymensionxyz/roller/config" ) // GetSourceChannelForConnection Returns the open source channel for the given destination connection ID. If no open channel exists, it returns an // empty string. -func GetSourceChannelForConnection(dstConnectionID string, rollappConfig utils.RollappConfig) (string, error) { +func GetSourceChannelForConnection(dstConnectionID string, rollappConfig config.RollappConfig) (string, error) { commonDymdFlags := utils.GetCommonDymdFlags(rollappConfig) args := []string{"query", "ibc", "channel", "connections", dstConnectionID} args = append(args, commonDymdFlags...) diff --git a/cmd/relayer/start/start.go b/cmd/relayer/start/start.go index 73d5151a..00332cf6 100644 --- a/cmd/relayer/start/start.go +++ b/cmd/relayer/start/start.go @@ -2,12 +2,14 @@ package start import ( "fmt" - "github.com/dymensionxyz/roller/cmd/consts" - "github.com/dymensionxyz/roller/cmd/utils" - "github.com/spf13/cobra" "math/big" "os/exec" "path/filepath" + + "github.com/dymensionxyz/roller/cmd/consts" + "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" + "github.com/spf13/cobra" ) // TODO: Test relaying on 35-C and update the prices @@ -24,7 +26,7 @@ func Start() *cobra.Command { Short: "Starts a relayer between the Dymension hub and the rollapp.", Run: func(cmd *cobra.Command, args []string) { home := cmd.Flag(utils.FlagNames.Home).Value.String() - rollappConfig, err := utils.LoadConfigFromTOML(home) + rollappConfig, err := config.LoadConfigFromTOML(home) VerifyRelayerBalances(rollappConfig) utils.PrettifyErrorIfExists(err) relayerLogFilePath := utils.GetRelayerLogPath(rollappConfig) @@ -43,25 +45,25 @@ func Start() *cobra.Command { return relayerStartCmd } -func getUpdateClientsCmd(config utils.RollappConfig) *exec.Cmd { +func getUpdateClientsCmd(config config.RollappConfig) *exec.Cmd { defaultRlyArgs := getRelayerDefaultArgs(config) args := []string{"tx", "update-clients"} args = append(args, defaultRlyArgs...) return exec.Command(consts.Executables.Relayer, args...) } -func getRelayPacketsCmd(config utils.RollappConfig, srcChannel string) *exec.Cmd { +func getRelayPacketsCmd(config config.RollappConfig, srcChannel string) *exec.Cmd { return exec.Command(consts.Executables.Relayer, "tx", "relay-packets", consts.DefaultRelayerPath, srcChannel, "-l", "1", "--home", filepath.Join(config.Home, consts.ConfigDirName.Relayer)) } -func VerifyRelayerBalances(rolCfg utils.RollappConfig) { +func VerifyRelayerBalances(rolCfg config.RollappConfig) { insufficientBalances, err := GetRelayerInsufficientBalances(rolCfg) utils.PrettifyErrorIfExists(err) utils.PrintInsufficientBalancesIfAny(insufficientBalances) } -func GetRlyHubInsufficientBalances(config utils.RollappConfig) ([]utils.NotFundedAddressData, error) { +func GetRlyHubInsufficientBalances(config config.RollappConfig) ([]utils.NotFundedAddressData, error) { HubRlyAddr, err := utils.GetRelayerAddress(config.Home, config.HubData.ID) if err != nil { return nil, err @@ -87,7 +89,7 @@ func GetRlyHubInsufficientBalances(config utils.RollappConfig) ([]utils.NotFunde return insufficientBalances, nil } -func GetRelayerInsufficientBalances(config utils.RollappConfig) ([]utils.NotFundedAddressData, error) { +func GetRelayerInsufficientBalances(config config.RollappConfig) ([]utils.NotFundedAddressData, error) { insufficientBalances, err := GetRlyHubInsufficientBalances(config) if err != nil { return insufficientBalances, err diff --git a/cmd/run/run.go b/cmd/run/run.go index 7e1adc17..93017c14 100644 --- a/cmd/run/run.go +++ b/cmd/run/run.go @@ -7,10 +7,11 @@ import ( "sync" "github.com/dymensionxyz/roller/cmd/consts" - da_start "github.com/dymensionxyz/roller/cmd/da-light-client/start" relayer_start "github.com/dymensionxyz/roller/cmd/relayer/start" sequnecer_start "github.com/dymensionxyz/roller/cmd/sequencer/start" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" + datalayer "github.com/dymensionxyz/roller/data_layer" "github.com/spf13/cobra" ) @@ -19,11 +20,8 @@ func Cmd() *cobra.Command { Use: "run", Short: "Runs the rollapp on the local machine.", Run: func(cmd *cobra.Command, args []string) { - spin := utils.GetLoadingSpinner() - spin.Suffix = consts.SpinnerMsgs.BalancesVerification - spin.Start() home := cmd.Flag(utils.FlagNames.Home).Value.String() - rollappConfig, err := utils.LoadConfigFromTOML(home) + rollappConfig, err := config.LoadConfigFromTOML(home) utils.PrettifyErrorIfExists(err) verifyBalances(rollappConfig) logger := utils.GetRollerLogger(rollappConfig.Home) @@ -35,29 +33,28 @@ func Cmd() *cobra.Command { Context: ctx, WaitGroup: &waitingGroup, } - spin.Suffix = " Starting RollApp services..." - spin.Restart() + + /* ------------------------------ run processes ----------------------------- */ runDaWithRestarts(rollappConfig, serviceConfig) runSequencerWithRestarts(rollappConfig, serviceConfig) runRelayerWithRestarts(rollappConfig, serviceConfig) - PrintServicesStatus(rollappConfig) + + /* ------------------------------ render output ----------------------------- */ + RenderUI(rollappConfig) cancel() - spin.Suffix = " Killing subprocesses..." - spin.Restart() waitingGroup.Wait() - spin.Stop() }, } return cmd } -func runRelayerWithRestarts(config utils.RollappConfig, serviceConfig utils.ServiceConfig) { +func runRelayerWithRestarts(config config.RollappConfig, serviceConfig utils.ServiceConfig) { startRelayerCmd := getStartRelayerCmd(config) utils.RunServiceWithRestart(startRelayerCmd, serviceConfig) } -func getStartRelayerCmd(config utils.RollappConfig) *exec.Cmd { +func getStartRelayerCmd(config config.RollappConfig) *exec.Cmd { ex, err := os.Executable() if err != nil { panic(err) @@ -65,26 +62,35 @@ func getStartRelayerCmd(config utils.RollappConfig) *exec.Cmd { return exec.Command(ex, "relayer", "start", "--home", config.Home) } -func runDaWithRestarts(rollappConfig utils.RollappConfig, serviceConfig utils.ServiceConfig) { +func runDaWithRestarts(rollappConfig config.RollappConfig, serviceConfig utils.ServiceConfig) { + damanager := datalayer.NewDAManager(rollappConfig.DA, rollappConfig.Home) daLogFilePath := utils.GetDALogFilePath(rollappConfig.Home) - startDALCCmd := da_start.GetStartDACmd(rollappConfig, consts.DefaultCelestiaRPC) + startDALCCmd := damanager.GetStartDACmd(consts.DefaultCelestiaRPC) + if startDALCCmd == nil { + serviceConfig.WaitGroup.Done() + return + } utils.RunServiceWithRestart(startDALCCmd, serviceConfig, utils.WithLogging(daLogFilePath)) } -func runSequencerWithRestarts(rollappConfig utils.RollappConfig, serviceConfig utils.ServiceConfig) { +func runSequencerWithRestarts(rollappConfig config.RollappConfig, serviceConfig utils.ServiceConfig) { startRollappCmd := sequnecer_start.GetStartRollappCmd(rollappConfig, consts.DefaultDALCRPC) utils.RunServiceWithRestart(startRollappCmd, serviceConfig, utils.WithLogging(utils.GetSequencerLogPath(rollappConfig))) } -func verifyBalances(rollappConfig utils.RollappConfig) { - insufficientBalances, err := da_start.CheckDABalance(rollappConfig) +func verifyBalances(rollappConfig config.RollappConfig) { + damanager := datalayer.NewDAManager(rollappConfig.DA, rollappConfig.Home) + insufficientBalances, err := damanager.CheckDABalance() utils.PrettifyErrorIfExists(err) + sequencerInsufficientBalances, err := utils.GetSequencerInsufficientAddrs( rollappConfig, *sequnecer_start.OneDaySequencePrice) utils.PrettifyErrorIfExists(err) insufficientBalances = append(insufficientBalances, sequencerInsufficientBalances...) + rlyAddrs, err := relayer_start.GetRlyHubInsufficientBalances(rollappConfig) utils.PrettifyErrorIfExists(err) insufficientBalances = append(insufficientBalances, rlyAddrs...) + utils.PrintInsufficientBalancesIfAny(insufficientBalances) } diff --git a/cmd/run/services.go b/cmd/run/services.go index 38edc533..3306812d 100644 --- a/cmd/run/services.go +++ b/cmd/run/services.go @@ -1,8 +1,11 @@ package run import ( - "github.com/dymensionxyz/roller/cmd/utils" "log" + + "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" + datalayer "github.com/dymensionxyz/roller/data_layer" ) type ServiceData struct { @@ -17,13 +20,20 @@ type fetchResult struct { id int } -func fetchServicesData(rollappConfig utils.RollappConfig, logger *log.Logger) ([]ServiceData, error) { - fetchFuncs := []func(utils.RollappConfig) (*utils.AccountData, error){ +func fetchServicesData(rollappConfig config.RollappConfig, logger *log.Logger) ([]ServiceData, error) { + damanager := datalayer.NewDAManager(rollappConfig.DA, rollappConfig.Home) + + //TODO: avoid requiring passing rollappConfig to every function + fetchFuncs := []func(config.RollappConfig) (*utils.AccountData, error){ utils.GetSequencerData, utils.GetHubRlyAccData, utils.GetRolRlyAccData, - utils.GetCelLCAccData, } + + if damanager.GetLightNodeEndpoint() != "" { + fetchFuncs = append(fetchFuncs, damanager.GetDAAccData) + } + results := fetchAsync(fetchFuncs, rollappConfig) data := processDataResults(results, len(fetchFuncs), logger) return buildServiceData(data, rollappConfig), nil @@ -49,10 +59,10 @@ func getInitialServiceData() []ServiceData { } } -func fetchAsync(fetchFuncs []func(utils.RollappConfig) (*utils.AccountData, error), rollappConfig utils.RollappConfig) chan fetchResult { +func fetchAsync(fetchFuncs []func(config.RollappConfig) (*utils.AccountData, error), rollappConfig config.RollappConfig) chan fetchResult { results := make(chan fetchResult, len(fetchFuncs)) for i, fn := range fetchFuncs { - go func(id int, fn func(utils.RollappConfig) (*utils.AccountData, error)) { + go func(id int, fn func(config.RollappConfig) (*utils.AccountData, error)) { data, err := fn(rollappConfig) results <- fetchResult{data, err, id} }(i, fn) diff --git a/cmd/run/services_info.go b/cmd/run/services_info.go index f576e729..8608e81f 100644 --- a/cmd/run/services_info.go +++ b/cmd/run/services_info.go @@ -2,11 +2,14 @@ package run import ( "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" "github.com/gizak/termui/v3" "github.com/gizak/termui/v3/widgets" + + datalayer "github.com/dymensionxyz/roller/data_layer" ) -func getServicesInfo(rollappConfig utils.RollappConfig, termWidth int) *widgets.Table { +func NewServicesInfoTable(rollappConfig config.RollappConfig, termWidth int) *widgets.Table { table := widgets.NewTable() table.RowStyles[0] = termui.NewStyle(termui.ColorWhite, termui.ColorClear, termui.ModifierBold) table.SetRect(0, 13, termWidth, 22) @@ -17,7 +20,11 @@ func getServicesInfo(rollappConfig utils.RollappConfig, termWidth int) *widgets. {"Name", "Log File", "Ports"}, {"Sequencer", utils.GetSequencerLogPath(rollappConfig), "26657, 8545, 1317"}, {"Relayer", utils.GetRelayerLogPath(rollappConfig), ""}, - {"DA Light Client", utils.GetDALogFilePath(rollappConfig.Home), "26659"}, + } + + damanager := datalayer.NewDAManager(rollappConfig.DA, rollappConfig.Home) + if damanager.GetLightNodeEndpoint() != "" { + table.Rows = append(table.Rows, []string{"DA Light Client", utils.GetDALogFilePath(rollappConfig.Home), "26659"}) } return table } diff --git a/cmd/run/services_status.go b/cmd/run/services_status.go index 761a9872..c6709062 100644 --- a/cmd/run/services_status.go +++ b/cmd/run/services_status.go @@ -1,13 +1,16 @@ package run import ( - "github.com/dymensionxyz/roller/cmd/consts" - "github.com/dymensionxyz/roller/cmd/utils" "log" "math/big" "path/filepath" "time" + "github.com/dymensionxyz/roller/cmd/consts" + "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" + datalayer "github.com/dymensionxyz/roller/data_layer" + ui "github.com/gizak/termui/v3" "github.com/gizak/termui/v3/widgets" ) @@ -37,31 +40,34 @@ func activeIfSufficientBalance(currentBalance, threshold *big.Int) string { } } -func buildServiceData(data []*utils.AccountData, rollappConfig utils.RollappConfig) []ServiceData { - rolRlyData := data[2] - return []ServiceData{ +func buildServiceData(data []*utils.AccountData, rollappConfig config.RollappConfig) []ServiceData { + damanager := datalayer.NewDAManager(rollappConfig.DA, rollappConfig.Home) + + var servicedata = []ServiceData{ { Name: "Sequencer", Balance: data[0].Balance.String() + consts.Denoms.Hub, - // TODO: for now, we just check if the balance of the rollapp relayer is greater than 0 - // in the future, we should have a better way to check the rollapp health. - Status: activeIfSufficientBalance(rolRlyData.Balance, big.NewInt(1)), - }, - { - Name: "DA Light Client", - Balance: data[3].Balance.String() + consts.Denoms.Celestia, - Status: activeIfSufficientBalance(data[3].Balance, consts.OneDAWritePrice), + Status: activeIfSufficientBalance(data[0].Balance, big.NewInt(1)), }, { Name: "Relayer", Balance: data[1].Balance.String() + consts.Denoms.Hub + ", " + - rolRlyData.Balance.String() + rollappConfig.Denom, + data[1].Balance.String() + rollappConfig.Denom, Status: "Starting...", }, } + + if damanager.GetLightNodeEndpoint() != "" { + servicedata = append(servicedata, ServiceData{ + Name: "DA Light Client", + Balance: data[3].Balance.String() + consts.Denoms.Celestia, + Status: activeIfSufficientBalance(data[3].Balance, consts.OneDAWritePrice), + }) + } + return servicedata } -func PrintServicesStatus(rollappConfig utils.RollappConfig) { +func RenderUI(rollappConfig config.RollappConfig) { logger := utils.GetLogger(filepath.Join(rollappConfig.Home, "roller.log")) initializeUI() defer ui.Close() @@ -69,16 +75,21 @@ func PrintServicesStatus(rollappConfig utils.RollappConfig) { termWidth, _ := ui.TerminalDimensions() p := buildTitleParagraph(rollappConfig, termWidth) - servicesStatusTable := buildUITable(termWidth) - servicesInfoTable := getServicesInfo(rollappConfig, termWidth) - serviceData := getInitialServiceData() + servicesStatusTable := NewServiceStatusTable(termWidth) + servicesInfoTable := NewServicesInfoTable(rollappConfig, termWidth) + serviceData, err := fetchServicesData(rollappConfig, logger) + if err != nil { + logger.Printf("Error: failed to fetch service data: %v", err) + serviceData = []ServiceData{} + } updateUITable(serviceData, servicesStatusTable) ui.Render(p, servicesStatusTable, servicesInfoTable) events := ui.PollEvents() ticker := time.NewTicker(time.Second * 5).C + //TODO: the renderer should be a struct that holds the config and the tables config := ServiceStatusConfig{ rollappConfig: rollappConfig, logger: logger, @@ -100,6 +111,7 @@ func eventLoop(events <-chan ui.Event, ticker <-chan time.Time, config ServiceSt serviceData, err := fetchServicesData(config.rollappConfig, config.logger) if err != nil { config.logger.Printf("Error: failed to fetch service data: %v", err) + serviceData = []ServiceData{} } else { config.logger.Printf("Fetched services data successfully %s", serviceData) } @@ -110,7 +122,7 @@ func eventLoop(events <-chan ui.Event, ticker <-chan time.Time, config ServiceSt } type ServiceStatusConfig struct { - rollappConfig utils.RollappConfig + rollappConfig config.RollappConfig logger *log.Logger table *widgets.Table } diff --git a/cmd/run/ui.go b/cmd/run/ui.go index 269f869f..85c7a392 100644 --- a/cmd/run/ui.go +++ b/cmd/run/ui.go @@ -2,10 +2,11 @@ package run import ( "fmt" - "github.com/dymensionxyz/roller/cmd/utils" + "log" + + "github.com/dymensionxyz/roller/config" "github.com/gizak/termui/v3" "github.com/gizak/termui/v3/widgets" - "log" ) func initializeUI() { @@ -14,7 +15,7 @@ func initializeUI() { } } -func buildTitleParagraph(rollappConfig utils.RollappConfig, termWidth int) *widgets.Paragraph { +func buildTitleParagraph(rollappConfig config.RollappConfig, termWidth int) *widgets.Paragraph { p := widgets.NewParagraph() p.Text = fmt.Sprintf("💈 Rollapp '%s' is successfully running on your local machine, connected to Dymension hub '%s'.", rollappConfig.RollappID, rollappConfig.HubData.ID) @@ -22,7 +23,7 @@ func buildTitleParagraph(rollappConfig utils.RollappConfig, termWidth int) *widg return p } -func buildUITable(termWidth int) *widgets.Table { +func NewServiceStatusTable(termWidth int) *widgets.Table { table := widgets.NewTable() table.RowStyles[0] = termui.NewStyle(termui.ColorWhite, termui.ColorClear, termui.ModifierBold) table.SetRect(0, 3, termWidth, 12) diff --git a/cmd/sequencer/start/start.go b/cmd/sequencer/start/start.go index 70e7f6e7..7a308717 100644 --- a/cmd/sequencer/start/start.go +++ b/cmd/sequencer/start/start.go @@ -10,6 +10,7 @@ import ( "github.com/dymensionxyz/roller/cmd/consts" "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" "github.com/spf13/cobra" ) @@ -28,7 +29,7 @@ func StartCmd() *cobra.Command { Short: "Runs the rollapp sequencer.", Run: func(cmd *cobra.Command, args []string) { home := cmd.Flag(utils.FlagNames.Home).Value.String() - rollappConfig, err := utils.LoadConfigFromTOML(home) + rollappConfig, err := config.LoadConfigFromTOML(home) utils.PrettifyErrorIfExists(err) LogPath = filepath.Join(rollappConfig.Home, consts.ConfigDirName.Rollapp, "rollapp.log") @@ -76,31 +77,38 @@ func parseError(errMsg string) string { return errMsg } -func GetStartRollappCmd(rollappConfig utils.RollappConfig, lightNodeEndpoint string) *exec.Cmd { +func GetStartRollappCmd(rollappConfig config.RollappConfig, lightNodeEndpoint string) *exec.Cmd { daConfig := fmt.Sprintf(`{"base_url": "%s", "timeout": 60000000000, "fee":20000, "gas_limit": 20000000, "namespace_id":"000000000000ffff"}`, lightNodeEndpoint) rollappConfigDir := filepath.Join(rollappConfig.Home, consts.ConfigDirName.Rollapp) hubKeysDir := filepath.Join(rollappConfig.Home, consts.ConfigDirName.HubKeys) + //TODO(#110): this will be refactored when using config file + dastrings := []string{"--dymint.da_layer", "celestia", "--dymint.da_config", daConfig} + if rollappConfig.DA == config.Mock { + dastrings = []string{"--dymint.da_layer", "mock"} + } + cmd := exec.Command( - rollappConfig.RollappBinary, "start", - "--dymint.da_layer", "celestia", - "--dymint.da_config", daConfig, - "--dymint.settlement_layer", "dymension", - "--dymint.block_batch_size", "500", - "--dymint.namespace_id", "000000000000ffff", - "--dymint.block_time", "0.2s", - "--dymint.batch_submit_max_time", "100s", - "--dymint.empty_blocks_max_time", "10s", - "--dymint.settlement_config.rollapp_id", rollappConfig.RollappID, - "--dymint.settlement_config.node_address", rollappConfig.HubData.RPC_URL, - "--dymint.settlement_config.dym_account_name", consts.KeysIds.HubSequencer, - "--dymint.settlement_config.keyring_home_dir", hubKeysDir, - "--dymint.settlement_config.gas_prices", "0udym", - "--home", rollappConfigDir, - "--log-file", filepath.Join(rollappConfigDir, "rollapp.log"), - "--log_level", "info", - "--max-log-size", "2000", + rollappConfig.RollappBinary, + append([]string{ + "start", + "--dymint.settlement_layer", "dymension", + "--dymint.block_batch_size", "500", + "--dymint.namespace_id", "000000000000ffff", + "--dymint.block_time", "0.2s", + "--dymint.batch_submit_max_time", "100s", + "--dymint.empty_blocks_max_time", "10s", + "--dymint.settlement_config.rollapp_id", rollappConfig.RollappID, + "--dymint.settlement_config.node_address", rollappConfig.HubData.RPC_URL, + "--dymint.settlement_config.dym_account_name", consts.KeysIds.HubSequencer, + "--dymint.settlement_config.keyring_home_dir", hubKeysDir, + "--dymint.settlement_config.gas_prices", "0udym", + "--home", rollappConfigDir, + "--log-file", filepath.Join(rollappConfigDir, "rollapp.log"), + "--log_level", "info", + "--max-log-size", "2000", + }, dastrings...)..., ) return cmd } diff --git a/cmd/utils/balance.go b/cmd/utils/balance.go index 02bf8d77..02aed9fc 100644 --- a/cmd/utils/balance.go +++ b/cmd/utils/balance.go @@ -8,6 +8,7 @@ import ( "os/exec" "github.com/dymensionxyz/roller/cmd/consts" + "github.com/dymensionxyz/roller/config" ) type ChainQueryConfig struct { @@ -58,8 +59,8 @@ type AccountData struct { Balance *big.Int } -func GetSequencerInsufficientAddrs(config RollappConfig, requiredBalance big.Int) ([]NotFundedAddressData, error) { - sequencerData, err := GetSequencerData(config) +func GetSequencerInsufficientAddrs(cfg config.RollappConfig, requiredBalance big.Int) ([]NotFundedAddressData, error) { + sequencerData, err := GetSequencerData(cfg) if err != nil { return nil, err } diff --git a/cmd/utils/bash_commands.go b/cmd/utils/bash_commands.go index 4894091d..aa340c89 100644 --- a/cmd/utils/bash_commands.go +++ b/cmd/utils/bash_commands.go @@ -9,6 +9,8 @@ import ( "os/exec" "strings" "time" + + "github.com/dymensionxyz/roller/config" ) func GetRelayerDefaultFlags(root string) []string { @@ -36,7 +38,7 @@ func RunCommandEvery(command string, args []string, intervalSec int, options ... }() } -func GetCommonDymdFlags(rollappConfig RollappConfig) []string { +func GetCommonDymdFlags(rollappConfig config.RollappConfig) []string { return []string{ "--node", rollappConfig.HubData.RPC_URL, "--output", "json", } diff --git a/cmd/utils/fetch_accounts_data.go b/cmd/utils/fetch_accounts_data.go index 1c8f1b1b..55e09845 100644 --- a/cmd/utils/fetch_accounts_data.go +++ b/cmd/utils/fetch_accounts_data.go @@ -1,21 +1,21 @@ package utils import ( - "fmt" "path/filepath" "github.com/dymensionxyz/roller/cmd/consts" + "github.com/dymensionxyz/roller/config" ) -func GetRolRlyAccData(config RollappConfig) (*AccountData, error) { - RollappRlyAddr, err := GetRelayerAddress(config.Home, config.RollappID) +func GetRolRlyAccData(cfg config.RollappConfig) (*AccountData, error) { + RollappRlyAddr, err := GetRelayerAddress(cfg.Home, cfg.RollappID) if err != nil { return nil, err } RollappRlyBalance, err := QueryBalance(ChainQueryConfig{ RPC: consts.DefaultRollappRPC, - Denom: config.Denom, - Binary: config.RollappBinary, + Denom: cfg.Denom, + Binary: cfg.RollappBinary, }, RollappRlyAddr) if err != nil { return nil, err @@ -26,13 +26,13 @@ func GetRolRlyAccData(config RollappConfig) (*AccountData, error) { }, nil } -func GetHubRlyAccData(config RollappConfig) (*AccountData, error) { - HubRlyAddr, err := GetRelayerAddress(config.Home, config.HubData.ID) +func GetHubRlyAccData(cfg config.RollappConfig) (*AccountData, error) { + HubRlyAddr, err := GetRelayerAddress(cfg.Home, cfg.HubData.ID) if err != nil { return nil, err } HubRlyBalance, err := QueryBalance(ChainQueryConfig{ - RPC: config.HubData.RPC_URL, + RPC: cfg.HubData.RPC_URL, Denom: consts.Denoms.Hub, Binary: consts.Executables.Dymension, }, HubRlyAddr) @@ -45,10 +45,10 @@ func GetHubRlyAccData(config RollappConfig) (*AccountData, error) { }, nil } -func GetSequencerData(config RollappConfig) (*AccountData, error) { +func GetSequencerData(cfg config.RollappConfig) (*AccountData, error) { sequencerAddress, err := GetAddressBinary(GetKeyConfig{ ID: consts.KeysIds.HubSequencer, - Dir: filepath.Join(config.Home, consts.ConfigDirName.HubKeys), + Dir: filepath.Join(cfg.Home, consts.ConfigDirName.HubKeys), }, consts.Executables.Dymension) if err != nil { return nil, err @@ -56,7 +56,7 @@ func GetSequencerData(config RollappConfig) (*AccountData, error) { sequencerBalance, err := QueryBalance(ChainQueryConfig{ Binary: consts.Executables.Dymension, Denom: consts.Denoms.Hub, - RPC: config.HubData.RPC_URL, + RPC: cfg.HubData.RPC_URL, }, sequencerAddress) if err != nil { return nil, err @@ -66,26 +66,3 @@ func GetSequencerData(config RollappConfig) (*AccountData, error) { Balance: sequencerBalance, }, nil } - -func GetCelLCAccData(rollappConfig RollappConfig) (*AccountData, error) { - celAddress, err := GetCelestiaAddress(rollappConfig.Home) - if err != nil { - return nil, err - } - var restQueryUrl = fmt.Sprintf( - "%s/cosmos/bank/v1beta1/balances/%s", - consts.CelestiaRestApiEndpoint, celAddress, - ) - balancesJson, err := RestQueryJson(restQueryUrl) - if err != nil { - return nil, err - } - balance, err := ParseBalanceFromResponse(*balancesJson, consts.Denoms.Celestia) - if err != nil { - return nil, err - } - return &AccountData{ - Address: celAddress, - Balance: balance, - }, nil -} diff --git a/cmd/utils/keys.go b/cmd/utils/keys.go index d176063e..32dd0060 100644 --- a/cmd/utils/keys.go +++ b/cmd/utils/keys.go @@ -12,6 +12,7 @@ import ( "github.com/olekukonko/tablewriter" "github.com/dymensionxyz/roller/cmd/consts" + "github.com/dymensionxyz/roller/config" ) type KeyInfo struct { @@ -27,20 +28,6 @@ func ParseAddressFromOutput(output bytes.Buffer) (string, error) { return key.Address, nil } -func GetCelestiaAddress(rollerRoot string) (string, error) { - daKeysDir := filepath.Join(rollerRoot, consts.ConfigDirName.DALightNode, consts.KeysDirName) - cmd := exec.Command( - consts.Executables.CelKey, "show", consts.KeysIds.DALightNode, "--node.type", "light", "--keyring-dir", - daKeysDir, "--keyring-backend", "test", "--output", "json", - ) - output, err := ExecBashCommand(cmd) - if err != nil { - return "", err - } - address, err := ParseAddressFromOutput(output) - return address, err -} - type GetKeyConfig struct { Dir string ID string @@ -105,7 +92,7 @@ func PrintAddresses(addresses []AddressData) { table.Render() } -func GetSequencerPubKey(rollappConfig RollappConfig) (string, error) { +func GetSequencerPubKey(rollappConfig config.RollappConfig) (string, error) { cmd := exec.Command( rollappConfig.RollappBinary, "dymint", diff --git a/cmd/utils/log.go b/cmd/utils/log.go index 10219107..a16dfbbf 100644 --- a/cmd/utils/log.go +++ b/cmd/utils/log.go @@ -1,12 +1,14 @@ package utils import ( - "github.com/dymensionxyz/roller/cmd/consts" - "gopkg.in/natefinch/lumberjack.v2" "io" "log" "os/exec" "path/filepath" + + "github.com/dymensionxyz/roller/cmd/consts" + "github.com/dymensionxyz/roller/config" + "gopkg.in/natefinch/lumberjack.v2" ) func GetRollerLogger(home string) *log.Logger { @@ -34,12 +36,12 @@ func GetLogger(filepath string) *log.Logger { return logger } -func GetSequencerLogPath(rollappConfig RollappConfig) string { +func GetSequencerLogPath(rollappConfig config.RollappConfig) string { return filepath.Join(rollappConfig.Home, consts.ConfigDirName.Rollapp, "rollapp.log") } -func GetRelayerLogPath(config RollappConfig) string { - return filepath.Join(config.Home, consts.ConfigDirName.Relayer, "relayer.log") +func GetRelayerLogPath(cfg config.RollappConfig) string { + return filepath.Join(cfg.Home, consts.ConfigDirName.Relayer, "relayer.log") } func GetDALogFilePath(home string) string { diff --git a/cmd/utils/service.go b/cmd/utils/service.go index b2177ee0..c9d17676 100644 --- a/cmd/utils/service.go +++ b/cmd/utils/service.go @@ -13,6 +13,7 @@ type ServiceConfig struct { Logger *log.Logger } +// FIXME(#154): this functions have busy loop in case some process fails to start func RunServiceWithRestart(cmd *exec.Cmd, serviceConfig ServiceConfig, options ...CommandOption) { go func() { defer serviceConfig.WaitGroup.Done() diff --git a/cmd/utils/config.go b/config/config.go similarity index 77% rename from cmd/utils/config.go rename to config/config.go index 19770103..de8954ca 100644 --- a/cmd/utils/config.go +++ b/config/config.go @@ -1,43 +1,22 @@ -package utils +package config import ( "fmt" - "io/ioutil" "math/big" - "path/filepath" "regexp" "strings" "unicode" - - "github.com/pelletier/go-toml" ) -func WriteConfigToTOML(InitConfig RollappConfig) error { - tomlBytes, err := toml.Marshal(InitConfig) - if err != nil { - return err - } - err = ioutil.WriteFile(filepath.Join(InitConfig.Home, RollerConfigFileName), tomlBytes, 0644) - if err != nil { - return err - } - - return nil -} +const RollerConfigFileName = "config.toml" -func LoadConfigFromTOML(root string) (RollappConfig, error) { - var config RollappConfig - tomlBytes, err := ioutil.ReadFile(filepath.Join(root, RollerConfigFileName)) - if err != nil { - return config, err - } - err = toml.Unmarshal(tomlBytes, &config) - if err != nil { - return config, err - } +type DAType string - return config, nil -} +const ( + Mock DAType = "mock" + Celestia DAType = "celestia" + Avail DAType = "avail" +) type RollappConfig struct { Home string @@ -47,6 +26,13 @@ type RollappConfig struct { TokenSupply string Decimals uint HubData HubData + DA DAType +} + +type HubData = struct { + API_URL string + ID string + RPC_URL string } func (c RollappConfig) Validate() error { @@ -69,15 +55,20 @@ func (c RollappConfig) Validate() error { if err := ValidateDecimals(c.Decimals); err != nil { return err } + + if !IsValidDAType(string(c.DA)) { + return fmt.Errorf("invalid DA type: %s", c.DA) + } + return nil } -const RollerConfigFileName = "config.toml" - -type HubData = struct { - API_URL string - ID string - RPC_URL string +func IsValidDAType(t string) bool { + switch DAType(t) { + case Mock, Celestia, Avail: + return true + } + return false } func ValidateRollAppID(id string) error { diff --git a/config/toml.go b/config/toml.go new file mode 100644 index 00000000..a7f09d73 --- /dev/null +++ b/config/toml.go @@ -0,0 +1,36 @@ +package config + +import ( + "io/ioutil" + "path/filepath" + + "github.com/pelletier/go-toml" +) + +func WriteConfigToTOML(InitConfig RollappConfig) error { + tomlBytes, err := toml.Marshal(InitConfig) + if err != nil { + return err + } + err = ioutil.WriteFile(filepath.Join(InitConfig.Home, RollerConfigFileName), tomlBytes, 0644) + if err != nil { + return err + } + + return nil +} + +// TODO: should be called from root command +func LoadConfigFromTOML(root string) (RollappConfig, error) { + var config RollappConfig + tomlBytes, err := ioutil.ReadFile(filepath.Join(root, RollerConfigFileName)) + if err != nil { + return config, err + } + err = toml.Unmarshal(tomlBytes, &config) + if err != nil { + return config, err + } + + return config, nil +} diff --git a/data_layer/celestia/celestia.go b/data_layer/celestia/celestia.go new file mode 100644 index 00000000..cf0be8c5 --- /dev/null +++ b/data_layer/celestia/celestia.go @@ -0,0 +1,109 @@ +package celestia + +import ( + "fmt" + "math/big" + "os/exec" + "path/filepath" + + "github.com/dymensionxyz/roller/cmd/consts" + "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" +) + +// TODO: test how much is enough to run the LC for one day and set the minimum balance accordingly. +const ( + gatewayAddr = "0.0.0.0" + gatewayPort = "26659" +) + +var ( + lcMinBalance = big.NewInt(1) + LCEndpoint = fmt.Sprintf("http://%s:%s", gatewayAddr, gatewayPort) +) + +type Celestia struct { + Root string +} + +func (c *Celestia) GetLightNodeEndpoint() string { + return LCEndpoint +} + +// GetDAAccountAddress implements datalayer.DataLayer. +func (c *Celestia) GetDAAccountAddress() (string, error) { + daKeysDir := filepath.Join(c.Root, consts.ConfigDirName.DALightNode, consts.KeysDirName) + cmd := exec.Command( + consts.Executables.CelKey, "show", consts.KeysIds.DALightNode, "--node.type", "light", "--keyring-dir", + daKeysDir, "--keyring-backend", "test", "--output", "json", + ) + output, err := utils.ExecBashCommand(cmd) + if err != nil { + return "", err + } + address, err := utils.ParseAddressFromOutput(output) + return address, err +} + +// TODO: wrap in some DA interfafce to be used for Avail as well +func (c *Celestia) InitializeLightNodeConfig() error { + initLightNodeCmd := exec.Command(consts.Executables.Celestia, "light", "init", "--p2p.network", consts.DefaultCeletiaNetowrk, "--node.store", filepath.Join(c.Root, consts.ConfigDirName.DALightNode)) + err := initLightNodeCmd.Run() + if err != nil { + return err + } + return nil +} + +func (c *Celestia) GetDAAccData(config.RollappConfig) (*utils.AccountData, error) { + celAddress, err := c.GetDAAccountAddress() + if err != nil { + return nil, err + } + var restQueryUrl = fmt.Sprintf( + "%s/cosmos/bank/v1beta1/balances/%s", + consts.CelestiaRestApiEndpoint, celAddress, + ) + balancesJson, err := utils.RestQueryJson(restQueryUrl) + if err != nil { + return nil, err + } + balance, err := utils.ParseBalanceFromResponse(*balancesJson, consts.Denoms.Celestia) + if err != nil { + return nil, err + } + return &utils.AccountData{ + Address: celAddress, + Balance: balance, + }, nil +} + +func (c *Celestia) CheckDABalance() ([]utils.NotFundedAddressData, error) { + accData, err := c.GetDAAccData(config.RollappConfig{}) + if err != nil { + return nil, err + } + var insufficientBalances []utils.NotFundedAddressData + if accData.Balance.Cmp(lcMinBalance) < 0 { + insufficientBalances = append(insufficientBalances, utils.NotFundedAddressData{ + Address: accData.Address, + CurrentBalance: accData.Balance, + RequiredBalance: lcMinBalance, + KeyName: consts.KeysIds.DALightNode, + Denom: consts.Denoms.Celestia, + }) + } + return insufficientBalances, nil +} + +func (c *Celestia) GetStartDACmd(rpcEndpoint string) *exec.Cmd { + return exec.Command( + consts.Executables.Celestia, "light", "start", + "--core.ip", rpcEndpoint, + "--node.store", filepath.Join(c.Root, consts.ConfigDirName.DALightNode), + "--gateway", + "--gateway.addr", gatewayAddr, + "--gateway.port", gatewayPort, + "--p2p.network", consts.DefaultCeletiaNetowrk, + ) +} diff --git a/data_layer/da_layer.go b/data_layer/da_layer.go new file mode 100644 index 00000000..605d6ee1 --- /dev/null +++ b/data_layer/da_layer.go @@ -0,0 +1,45 @@ +package datalayer + +import ( + "os/exec" + + "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" + "github.com/dymensionxyz/roller/data_layer/celestia" + "github.com/dymensionxyz/roller/data_layer/damock" +) + +type DataLayer interface { + GetDAAccountAddress() (string, error) + InitializeLightNodeConfig() error + CheckDABalance() ([]utils.NotFundedAddressData, error) + GetStartDACmd(rpcEndpoint string) *exec.Cmd + GetDAAccData(c config.RollappConfig) (*utils.AccountData, error) + GetLightNodeEndpoint() string +} + +type DAManager struct { + datype config.DAType + DataLayer +} + +func NewDAManager(datype config.DAType, home string) *DAManager { + var dalayer DataLayer + + switch datype { + case config.Celestia: + dalayer = &celestia.Celestia{ + Root: home, + } + case config.Mock: + dalayer = &damock.DAMock{} + default: + //TODO: return error + panic("Unknown data layer type") + } + + return &DAManager{ + datype: datype, + DataLayer: dalayer, + } +} diff --git a/data_layer/damock/damock.go b/data_layer/damock/damock.go new file mode 100644 index 00000000..795c4ba3 --- /dev/null +++ b/data_layer/damock/damock.go @@ -0,0 +1,44 @@ +package damock + +import ( + "math/big" + "os/exec" + + "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" +) + +// todo implemet data layer interface +type DAMock struct { +} + +func NewDAMock() *DAMock { + return &DAMock{} +} + +func (d *DAMock) GetDAAccountAddress() (string, error) { + return "", nil +} + +func (d *DAMock) InitializeLightNodeConfig() error { + return nil +} + +func (d *DAMock) CheckDABalance() ([]utils.NotFundedAddressData, error) { + return []utils.NotFundedAddressData{}, nil +} + +func (d *DAMock) GetStartDACmd(rpcEndpoint string) *exec.Cmd { + return nil +} + +func (d *DAMock) GetDAAccData(c config.RollappConfig) (*utils.AccountData, error) { + return &utils.AccountData{ + Address: "mockDA", + Balance: big.NewInt(999999999999999), + }, nil +} + +func (d *DAMock) GetLightNodeEndpoint() string { + return "" +} diff --git a/go.mod b/go.mod index 8d289b6b..fd7e7d27 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/dymensionxyz/roller go 1.18 require ( - github.com/gogo/protobuf v1.3.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 // indirect @@ -11,7 +10,6 @@ require ( require ( github.com/briandowns/spinner v1.23.0 - github.com/cosmos/cosmos-sdk v0.45.10 github.com/fatih/color v1.15.0 github.com/gizak/termui/v3 v3.1.0 github.com/google/go-cmp v0.5.9 @@ -25,32 +23,20 @@ require ( ) require ( - github.com/btcsuite/btcd v0.22.1 // indirect github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/golang/protobuf v1.5.2 // indirect github.com/kr/pretty v0.3.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d // indirect - github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect - github.com/tendermint/tendermint v0.34.22 // indirect github.com/tidwall/gjson v1.14.2 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect - golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect - golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/term v0.1.0 // indirect - golang.org/x/text v0.4.0 // indirect - google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 // indirect - google.golang.org/grpc v1.51.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index ca5c1236..d37936ab 100644 --- a/go.sum +++ b/go.sum @@ -1,52 +1,24 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/briandowns/spinner v1.23.0 h1:alDF2guRWqa/FOZZYWjlMIx2L6H0wyewPxo/CH4Pt2A= github.com/briandowns/spinner v1.23.0/go.mod h1:rPG4gmXeN3wQV/TsAY4w8lPdIM6RX3yqeBQJSrbXjuE= -github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= -github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cosmos/cosmos-sdk v0.45.10 h1:YRf1N6C7OFCc8FJ5wuhcnDDySJNDn5DxSscVgbeXgz4= -github.com/cosmos/cosmos-sdk v0.45.10/go.mod h1:CbfWNs4PuxxsvRD/snQuSBDwIhtsD7rIDTVQyYMKTa0= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc= github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= @@ -72,20 +44,11 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= -github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -97,8 +60,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/tendermint/tendermint v0.34.22 h1:XMhtC8s8QqJO4l/dn+TkQvevTRSow3Vixjclr41o+2Q= -github.com/tendermint/tendermint v0.34.22/go.mod h1:YpP5vBEAKUT4g6oyfjKgFeZmdB/GjkJAxfF+cgmJg6Y= github.com/tidwall/gjson v1.14.2 h1:6BBkirS0rAHjumnjHF6qgy5d2YAJ1TLIaFE2lzfOLqo= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= @@ -107,82 +68,12 @@ github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU= -golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 h1:jmIfw8+gSvXcZSgaFAGyInDXeWzUhvYH57G/5GKMn70= -google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= @@ -195,5 +86,3 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/test/config/init/testutils/rollapp.go b/test/config/init/testutils/rollapp.go index 0561b3f7..b4d9faee 100644 --- a/test/config/init/testutils/rollapp.go +++ b/test/config/init/testutils/rollapp.go @@ -1,9 +1,11 @@ package testutils import ( - "github.com/dymensionxyz/roller/cmd/utils" "path/filepath" + "github.com/dymensionxyz/roller/cmd/utils" + "github.com/dymensionxyz/roller/config" + "errors" initconfig "github.com/dymensionxyz/roller/cmd/config/init" @@ -94,7 +96,7 @@ func SanitizeGenesis(genesisPath string) error { return nil } -func VerifyRollerConfig(rollappConfig utils.RollappConfig) error { +func VerifyRollerConfig(rollappConfig config.RollappConfig) error { existingConfig, err := utils.LoadConfigFromTOML(rollappConfig.Home) if err != nil { return err