diff --git a/.gitignore b/.gitignore index 7bdd3ecd..a73c0cd2 100644 --- a/.gitignore +++ b/.gitignore @@ -92,3 +92,5 @@ tsconfig.tsbuildinfo # Generated files .docusaurus .cache-loader + +dist/ \ No newline at end of file diff --git a/cli/.goreleaser.yaml b/cli/.goreleaser.yaml new file mode 100644 index 00000000..a65edfee --- /dev/null +++ b/cli/.goreleaser.yaml @@ -0,0 +1,45 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + +archives: + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of uname. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +# The lines beneath this are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj diff --git a/cli/commands/bridge/bridge.go b/cli/commands/bridge/bridge.go new file mode 100644 index 00000000..5a786ec1 --- /dev/null +++ b/cli/commands/bridge/bridge.go @@ -0,0 +1,89 @@ +/* +Copyright © 2023 Hugobyte AI Labs +*/ +package bridge + +import ( + "fmt" + "strconv" + "strings" + + "github.com/hugobyte/dive/common" + "github.com/kurtosis-tech/kurtosis/api/golang/core/kurtosis_core_rpc_api_bindings" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +const bridgeMainFunction = "run_btp_setup" + +var ( + chainA string + chainB string +) + +func NewBridgeCmd(diveContext *common.DiveContext) *cobra.Command { + + var bridgeCmd = &cobra.Command{ + Use: "bridge", + Short: "Command for cross chain communication between two different chains", + Long: `To connect two different chains using any of the supported cross chain communication protocols. This will create an relay to connect two different chains and pass any messages between them.`, + Run: func(cmd *cobra.Command, args []string) { + cmd.Help() + }, + } + + bridgeCmd.AddCommand(btpBridgeCmd(diveContext)) + + return bridgeCmd +} + +func btpBridgeCmd(diveContext *common.DiveContext) *cobra.Command { + + var btpbridgeCmd = &cobra.Command{ + Use: "btp", + Short: "Starts Bridge BTP between ChainA and Chain B", + Long: ``, + Run: func(cmd *cobra.Command, args []string) { + + enclaveCtx, err := diveContext.GetEnclaveContext() + + if err != nil { + logrus.Errorln(err) + } + + bridge, _ := cmd.Flags().GetBool("bridge") + + params := fmt.Sprintf(`{"args":{"links": {"src": "%s", "dst": "%s"},"bridge":"%s"}}`, chainA, chainB, strconv.FormatBool(bridge)) + + if strings.ToLower(chainA) == "icon" && strings.ToLower(chainB) == "icon" { + + data, _, err := enclaveCtx.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveBridgeScript, bridgeMainFunction, params, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + + if err != nil { + fmt.Println(err) + } + response := common.GetSerializedData(data) + + common.WriteToFile(response) + } else { + data, _, err := enclaveCtx.RunStarlarkPackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveBridgeScript, bridgeMainFunction, params, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + + if err != nil { + fmt.Println(err) + } + response := common.GetSerializedData(data) + + common.WriteToFile(response) + } + }, + } + + btpbridgeCmd.Flags().StringVar(&chainA, "chainA", "", "Metion Name of Supported Chain") + btpbridgeCmd.Flags().StringVar(&chainB, "chainB", "", "Metion Name of Supported Chain") + btpbridgeCmd.Flags().Bool("bridge", false, "Mention Bridge ENV") + + btpbridgeCmd.MarkFlagRequired("chainA") + btpbridgeCmd.MarkFlagRequired("chainB") + + return btpbridgeCmd +} diff --git a/cli/commands/chain/chains.go b/cli/commands/chain/chains.go new file mode 100644 index 00000000..aeda3556 --- /dev/null +++ b/cli/commands/chain/chains.go @@ -0,0 +1,33 @@ +/* +Copyright © 2023 Hugobyte AI Labs +*/ +package chain + +import ( + "github.com/hugobyte/dive/commands/chain/types" + "github.com/hugobyte/dive/common" + "github.com/spf13/cobra" +) + +// chainCmd represents the chain command +func NewChainCmd(diveContext *common.DiveContext) *cobra.Command { + var chainCmd = &cobra.Command{ + + Use: "chain", + Short: "Build, initialize and start a given blockchain node.", + Long: `The command builds, initializes, and starts a specified blockchain node, providing a seamless setup process. It encompasses compiling and configuring the + necessary dependencies and components required for the blockchain network. By executing this command, the node is launched, enabling network participation, transaction + processing, and ledger maintenance within the specified blockchain ecosystem.`, + Run: func(cmd *cobra.Command, args []string) { + cmd.Help() + + }, + } + + chainCmd.AddCommand(types.NewIconCmd(diveContext)) + chainCmd.AddCommand(types.NewEthCmd(diveContext)) + chainCmd.AddCommand(types.NewHardhatCmd(diveContext)) + + return chainCmd + +} diff --git a/cli/commands/chain/types/eth.go b/cli/commands/chain/types/eth.go new file mode 100644 index 00000000..e2ae4e10 --- /dev/null +++ b/cli/commands/chain/types/eth.go @@ -0,0 +1,57 @@ +package types + +import ( + "github.com/hugobyte/dive/common" + "github.com/kurtosis-tech/kurtosis/api/golang/core/kurtosis_core_rpc_api_bindings" + "github.com/spf13/cobra" +) + +func NewEthCmd(diveContext *common.DiveContext) *cobra.Command { + + var ethCmd = &cobra.Command{ + Use: "eth", + Short: "Build, initialize and start a eth node.", + Long: `The command starts an Ethereum node, initiating the process of setting up and launching a local Ethereum network. It establishes a connection to the Ethereum +network and allows the node in executing smart contracts and maintaining the decentralized ledger.`, + Run: func(cmd *cobra.Command, args []string) { + + data, err := RunEthNode(diveContext) + + if err != nil { + diveContext.FatalError("Fail to Start ETH Node", err.Error()) + } + data.WriteDiveResponse(diveContext) + }, + } + + return ethCmd + +} + +func RunEthNode(diveContext *common.DiveContext) (*common.DiveserviceResponse, error) { + + kurtosisEnclaveContext, err := diveContext.GetEnclaveContext() + + if err != nil { + return nil, err + } + + data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveEthHardhatNodeScript, "start_eth_node", `{"args":{}}`, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + + if err != nil { + return nil, err + } + + responseData := common.GetSerializedData(data) + + ethResponseData := &common.DiveserviceResponse{} + + result, err := ethResponseData.Decode([]byte(responseData)) + + if err != nil { + return nil, err + } + + return result, nil + +} diff --git a/cli/commands/chain/types/hardhat.go b/cli/commands/chain/types/hardhat.go new file mode 100644 index 00000000..454ec46d --- /dev/null +++ b/cli/commands/chain/types/hardhat.go @@ -0,0 +1,58 @@ +package types + +import ( + "github.com/hugobyte/dive/common" + "github.com/kurtosis-tech/kurtosis/api/golang/core/kurtosis_core_rpc_api_bindings" + "github.com/spf13/cobra" +) + +func NewHardhatCmd(diveContext *common.DiveContext) *cobra.Command { + + var ethCmd = &cobra.Command{ + Use: "hardhat", + Short: "Build, initialize and start a hardhat node.", + Long: `The command starts an hardhat node, initiating the process of setting up and launching a local hardhat network. It establishes a connection to the hardhat +network and allows the node in executing smart contracts and maintaining the decentralized ledger.`, + Run: func(cmd *cobra.Command, args []string) { + + data, err := RunHardhatNode(diveContext) + + if err != nil { + diveContext.FatalError("Fail to Start Hardhat Node", err.Error()) + } + + data.WriteDiveResponse(diveContext) + }, + } + + return ethCmd + +} + +func RunHardhatNode(diveContext *common.DiveContext) (*common.DiveserviceResponse, error) { + + kurtosisEnclaveContext, err := diveContext.GetEnclaveContext() + + if err != nil { + return nil, err + } + + data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveEthHardhatNodeScript, "start_hardhat_node", "{}", common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + + if err != nil { + return nil, err + } + + responseData := common.GetSerializedData(data) + + hardhatResponseData := &common.DiveserviceResponse{} + + result, err := hardhatResponseData.Decode([]byte(responseData)) + + if err != nil { + return nil, err + } + + return result, nil + +} diff --git a/cli/commands/chain/types/icon.go b/cli/commands/chain/types/icon.go new file mode 100644 index 00000000..93a47a3d --- /dev/null +++ b/cli/commands/chain/types/icon.go @@ -0,0 +1,259 @@ +package types + +import ( + "encoding/json" + "fmt" + "path/filepath" + + "github.com/hugobyte/dive/common" + "github.com/kurtosis-tech/kurtosis/api/golang/core/kurtosis_core_rpc_api_bindings" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +const genesisIcon = "github.com/hugobyte/dive/services/jvm/icon/static-files/config/genesis-icon-0.zip" + +var ( + id = "" + genesis = "" + serviceName = "" + keystorePath = "" + keystorepassword = "" + networkID = "" + nodeEndpoint = "" + configFilePath = "" +) + +type IconServiceConfig struct { + Id string `json:"id" default:"0"` + Port int `json:"private_port"` + PublicPort int `json:"public_port"` + P2PListenAddress string `json:"p2p_listen_address"` + P2PAddress string `json:"p2p_address"` + Cid string `json:"cid"` +} + +func (sc *IconServiceConfig) GetDefaultConfigIconNode0() { + + sc.Id = "0" + sc.Port = 9080 + sc.PublicPort = 8090 + sc.P2PListenAddress = "7080" + sc.P2PAddress = "8080" + sc.Cid = "0xacbc4e" + +} + +func (sc *IconServiceConfig) GetDefaultConfigIconNode1() { + + sc.Id = "1" + sc.Port = 9081 + sc.PublicPort = 8091 + sc.P2PListenAddress = "7081" + sc.P2PAddress = "8081" + sc.Cid = "0x42f1f3" + +} + +func (sc *IconServiceConfig) EncodeToString() (string, error) { + encodedBytes, err := json.Marshal(sc) + if err != nil { + return "", nil + } + + return string(encodedBytes), nil +} + +func NewIconCmd(diveContext *common.DiveContext) *cobra.Command { + var iconCmd = &cobra.Command{ + Use: "icon", + Short: "Build, initialize and start a icon node.", + Long: `The command starts an Icon node, initiating the process of setting up and launching a local Icon network. It establishes a connection to the Icon +network and allows the node in executing smart contracts and maintaining the decentralized ledger.`, + Run: func(cmd *cobra.Command, args []string) { + + decentralisation, _ := cmd.Flags().GetBool("decentralisation") + + serviceConfig := &IconServiceConfig{} + + if configFilePath == "" { + serviceConfig.GetDefaultConfigIconNode0() + } else { + data, err := common.ReadConfigFile(configFilePath) + if err != nil { + serviceConfig.GetDefaultConfigIconNode0() + } + + err = json.Unmarshal(data, serviceConfig) + + if err != nil { + logrus.Fatalln(err) + } + + } + + if decentralisation { + + nodeResponse, err := RunIconNode(diveContext, serviceConfig, genesis) + if err != nil { + diveContext.FatalError("Run Icon Node Failed", err.Error()) + } + + params := GetDecentralizeParms(nodeResponse.ServiceName, nodeResponse.PrivateEndpoint, nodeResponse.KeystorePath, nodeResponse.KeyPassword, nodeResponse.NetworkId) + + response, err := Decentralisation(diveContext, params) + + if err != nil { + diveContext.FatalError("Icon Node Decentralisation Failed", err.Error()) + } + + diveContext.Info(response) + + nodeResponse.WriteDiveResponse(diveContext) + + } else { + + data, err := RunIconNode(diveContext, serviceConfig, genesis) + if err != nil { + diveContext.FatalError("Run Icon Node Failed", err.Error()) + } + + data.WriteDiveResponse(diveContext) + + } + + }, + } + + iconCmd.Flags().StringVarP(&id, "id", "i", "", "chain id") + iconCmd.Flags().StringVarP(&genesis, "genesis", "g", "", "gen file") + iconCmd.Flags().StringVarP(&configFilePath, "config", "c", "", "gen file") + iconCmd.Flags().BoolP("decentralisation", "d", false, "Decentralise Icon Node") + + decentralisationCmd := IconDecentralisationCmd(diveContext) + + iconCmd.AddCommand(decentralisationCmd) + + return iconCmd +} + +func IconDecentralisationCmd(diveContext *common.DiveContext) *cobra.Command { + + var decentralisationCmd = &cobra.Command{ + Use: "decentralize", + Short: "Decentralise already running Icon Node", + Long: `Decentralise Icon Node is necessary if you want to connect your local icon node to BTP network`, + Run: func(cmd *cobra.Command, args []string) { + + params := GetDecentralizeParms(serviceName, nodeEndpoint, keystorePath, keystorepassword, networkID) + + response, err := Decentralisation(diveContext, params) + + if err != nil { + diveContext.FatalError("Icon Node Decentralisation Failed", err.Error()) + } + + diveContext.Info(response) + }, + } + decentralisationCmd.Flags().StringVarP(&serviceName, "serviceName", "s", "", "service name") + decentralisationCmd.Flags().StringVarP(&nodeEndpoint, "nodeEndpoint", "e", "", "endpoint address") + decentralisationCmd.Flags().StringVarP(&keystorePath, "keystorePath", "k", "", "keystore path") + decentralisationCmd.Flags().StringVarP(&keystorepassword, "keyPassword", "p", "", "keypassword") + decentralisationCmd.Flags().StringVarP(&networkID, "nid", "n", "", "NetworkId of Icon Node") + + decentralisationCmd.MarkFlagRequired("serviceName") + decentralisationCmd.MarkFlagRequired("nodeEndpoint") + decentralisationCmd.MarkFlagRequired("keystorePath") + decentralisationCmd.MarkFlagRequired("keyPassword") + decentralisationCmd.MarkFlagRequired("nid") + + return decentralisationCmd + +} + +func RunIconNode(diveContext *common.DiveContext, serviceConfig *IconServiceConfig, genesisFilePath string) (*common.DiveserviceResponse, error) { + + paramData, err := serviceConfig.EncodeToString() + if err != nil { + return nil, err + } + + kurtosisEnclaveContext, err := diveContext.GetEnclaveContext() + + if err != nil { + return nil, err + } + + data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveIconNodeScript, "get_service_config", paramData, false, 4, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + + if err != nil { + return nil, err + } + + responseData := common.GetSerializedData(data) + var genesisFile = "" + var uploadedFiles = "" + var genesisPath = "" + + if genesisFilePath != "" { + genesisFileName := filepath.Base(genesisFilePath) + r, d, err := kurtosisEnclaveContext.UploadFiles(genesisFilePath, genesisFileName) + logrus.Infof("File Uploaded sucessfully : UUID %s", r) + uploadedFiles = fmt.Sprintf(`{"file_path":"%s","file_name":"%s"}`, d, genesisFileName) + + if err != nil { + return nil, err + } + } else { + genesisFile = filepath.Base(genesisIcon) + genesisPath = genesisIcon + uploadedFiles = `{}` + + } + + params := fmt.Sprintf(`{"service_config":%s,"id":"%s","uploaded_genesis":%s,"genesis_file_path":"%s","genesis_file_name":"%s"}`, responseData, serviceConfig.Id, uploadedFiles, genesisPath, genesisFile) + icon_data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveIconNodeScript, "start_icon_node", params, false, 4, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + + if err != nil { + return nil, err + } + + response := common.GetSerializedData(icon_data) + + iconResponseData := &common.DiveserviceResponse{} + + result, err := iconResponseData.Decode([]byte(response)) + + if err != nil { + return nil, err + } + + return result, nil +} + +func Decentralisation(diveContext *common.DiveContext, params string) (string, error) { + + kurtosisEnclaveContext, err := diveContext.GetEnclaveContext() + + if err != nil { + return "", err + } + + data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveIconDecentraliseScript, "configure_node", params, false, 4, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + + if err != nil { + return "", err + } + + response := common.GetSerializedData(data) + + return response, nil + +} + +func GetDecentralizeParms(serviceName, nodeEndpoint, keystorePath, keystorepassword, networkID string) string { + + return fmt.Sprintf(`{"args":{"service_name":"%s","endpoint":"%s","keystore_path":"%s","keypassword":"%s","nid":"%s"}}`, serviceName, nodeEndpoint, keystorePath, keystorepassword, networkID) + +} diff --git a/cli/commands/clean/clean.go b/cli/commands/clean/clean.go new file mode 100644 index 00000000..744c05b8 --- /dev/null +++ b/cli/commands/clean/clean.go @@ -0,0 +1,31 @@ +/* +Copyright © 2023 Hugobyte AI Labs +*/ +package clean + +import ( + "github.com/hugobyte/dive/common" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +func NewCleanCmd(diveContext *common.DiveContext) *cobra.Command { + + cleanCmd := &cobra.Command{ + Use: "clean", + Short: "Cleans up Kurtosis leftover artifacts", + Long: `Destroys and removes any running encalves. If no enclaves running to remove it will throw an error`, + Run: func(cmd *cobra.Command, args []string) { + + enclaveName := diveContext.GetEnclaves() + if enclaveName == "" { + logrus.Errorf("No enclaves running to clean !!") + } else { + diveContext.Clean() + } + }, + } + + return cleanCmd + +} diff --git a/cli/commands/discord/discord.go b/cli/commands/discord/discord.go new file mode 100644 index 00000000..c37ba364 --- /dev/null +++ b/cli/commands/discord/discord.go @@ -0,0 +1,26 @@ +/* +Copyright © 2023 Hugobyte AI Labs +*/ +package discord + +import ( + "github.com/hugobyte/dive/common" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +const diveURL = "https://discord.com/channels/1097522975630184469/1124224608250376293" + +// discordCmd redirects users to DIVE discord channel +var DiscordCmd = &cobra.Command{ + Use: "discord", + Short: "Opens DIVE discord channel", + Long: `The command opens the Discord channel for DIVE, providing a direct link or launching the Discord application to access the dedicated DIVE community. It allows +users to engage in discussions, seek support, share insights, and collaborate with other members of the DIVE community within the Discord platform.`, + Run: func(cmd *cobra.Command, args []string) { + logrus.Info("Redirecting to DIVE discord channel...") + if err := common.OpenFile(diveURL); err != nil { + logrus.Errorf("Failed to open Dive discord channel with error %v", err) + } + }, +} diff --git a/cli/commands/root.go b/cli/commands/root.go new file mode 100644 index 00000000..0fc7909c --- /dev/null +++ b/cli/commands/root.go @@ -0,0 +1,57 @@ +/* +Copyright © 2023 Hugobyte AI Labs +*/ +package commands + +import ( + "os" + + "github.com/hugobyte/dive/commands/bridge" + "github.com/hugobyte/dive/commands/chain" + "github.com/hugobyte/dive/common" + + "github.com/hugobyte/dive/commands/clean" + "github.com/hugobyte/dive/commands/discord" + "github.com/hugobyte/dive/commands/tutorial" + "github.com/hugobyte/dive/commands/twitter" + "github.com/hugobyte/dive/commands/version" + "github.com/hugobyte/dive/styles" + "github.com/spf13/cobra" +) + +// rootCmd represents the base command when called without any subcommands +var rootCmd = &cobra.Command{ + Use: "dive", + Short: "Deployable Infrastructure for Virtually Effortless blockchain integration", + Long: ``, + Run: func(cmd *cobra.Command, args []string) { + styles.RenderBanner() + cmd.Help() + }, +} + +// Execute adds all child commands to the root command and sets flags appropriately. +// This is called by main.main(). It only needs to happen once to the rootCmd. +func Execute() { + err := rootCmd.Execute() + if err != nil { + os.Exit(1) + } +} + +func init() { + + diveContext := common.NewDiveContext() + + rootCmd.CompletionOptions.DisableDefaultCmd = true + rootCmd.CompletionOptions.DisableNoDescFlag = true + rootCmd.SetHelpCommand(&cobra.Command{Hidden: true}) + + rootCmd.AddCommand(chain.NewChainCmd(diveContext)) + rootCmd.AddCommand(bridge.NewBridgeCmd(diveContext)) + rootCmd.AddCommand(clean.NewCleanCmd(diveContext)) + rootCmd.AddCommand(version.VersionCmd) + rootCmd.AddCommand(discord.DiscordCmd) + rootCmd.AddCommand(twitter.TwitterCmd) + rootCmd.AddCommand(tutorial.TutorialCmd) +} diff --git a/cli/commands/tutorial/tutorial.go b/cli/commands/tutorial/tutorial.go new file mode 100644 index 00000000..5c04f369 --- /dev/null +++ b/cli/commands/tutorial/tutorial.go @@ -0,0 +1,26 @@ +/* +Copyright © 2023 Hugobyte AI Labs +*/ +package tutorial + +import ( + "github.com/hugobyte/dive/common" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +const tutorialURL = "https://www.youtube.com/@hugobyte" + +// tutorilaCmd redirects users to DIVE youtube playlist +var TutorialCmd = &cobra.Command{ + Use: "tutorial", + Short: "Opens DIVE tutorial youtube playlist", + Long: `The command opens the YouTube playlist containing DIVE tutorials. It launches a web browser or the YouTube application, directing users to a curated collection of +tutorial videos specifically designed to guide and educate users about DIVE. The playlist offers step-by-step instructions, tips, and demonstrations to help users better understand and utilize the features and functionalities of DIVE.`, + Run: func(cmd *cobra.Command, args []string) { + logrus.Info("Redirecting to YouTube...") + if err := common.OpenFile(tutorialURL); err != nil { + logrus.Errorf("Failed to open Dive YouTube chanel with error %v", err) + } + }, +} diff --git a/cli/commands/twitter/twitter.go b/cli/commands/twitter/twitter.go new file mode 100644 index 00000000..80c028eb --- /dev/null +++ b/cli/commands/twitter/twitter.go @@ -0,0 +1,26 @@ +/* +Copyright © 2023 Hugobyte AI Labs +*/ +package twitter + +import ( + "github.com/hugobyte/dive/common" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +const twitterURL = "https://twitter.com/hugobyte" + +// twitterCmd redirects users to twitter home page +var TwitterCmd = &cobra.Command{ + Use: "twitter", + Short: "Opens official HugoByte twitter home page", + Long: `The command opens the official HugoByte Twitter homepage. It launches a web browser and directs users to the designated Twitter profile of HugoByte, providing +access to the latest updates, announcements, news, and insights shared by the official HugoByte Twitter account. Users can stay informed about HugoByte's activities, engage with the community, and follow our social media presence directly from the Twitter homepage.`, + Run: func(cmd *cobra.Command, args []string) { + logrus.Info("Redirecting to twitter...") + if err := common.OpenFile(twitterURL); err != nil { + logrus.Errorf("Failed to open HugoByte twitter with error %v", err) + } + }, +} diff --git a/cli/commands/version/version.go b/cli/commands/version/version.go new file mode 100644 index 00000000..3175a022 --- /dev/null +++ b/cli/commands/version/version.go @@ -0,0 +1,24 @@ +/* +Copyright © 2023 Hugobyte AI Labs +*/ +package version + +import ( + "fmt" + + "github.com/fatih/color" + "github.com/hugobyte/dive/common" + "github.com/spf13/cobra" +) + +// versionCmd represents the version command +var VersionCmd = &cobra.Command{ + Use: "version", + Short: "Prints the CLI version", + Long: `Prints the current DIVE CLI version and warns if you are using an old version.`, + Run: func(cmd *cobra.Command, args []string) { + version := color.New(color.Bold).Sprint("CLI version - ") + common.DiveVersion + fmt.Println(version) + + }, +} diff --git a/cli/common/constants.go b/cli/common/constants.go new file mode 100644 index 00000000..b6d0c1bc --- /dev/null +++ b/cli/common/constants.go @@ -0,0 +1,30 @@ +package common + +const ( + DiveEnclave = "dive" + DiveRemotePackagePath = "github.com/hugobyte/dive" + DiveIconNodeScript = "services/jvm/icon/src/node-setup/start_icon_node.star" + DiveIconDecentraliseScript = "services/jvm/icon/src/node-setup/setup_icon_node.star" + DiveEthHardhatNodeScript = "services/evm/eth/src/node-setup/start-eth-node.star" + DiveBridgeScript = "main.star" + DiveDryRun = false + DiveDefaultParallelism = 4 +) + +const ( + linuxOSName = "linux" + macOSName = "darwin" + windowsOSName = "windows" + + openFileLinuxCommandName = "xdg-open" + openFileMacCommandName = "open" + openFileWindowsCommandName = "rundll32" + + openFileWindowsCommandFirstArgumentDefault = "url.dll,FileProtocolHandler" +) + +const ( + // !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!! + DiveVersion = "v 0.0.1(alpha)" + // !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!! +) diff --git a/cli/common/types.go b/cli/common/types.go new file mode 100644 index 00000000..6863bc4a --- /dev/null +++ b/cli/common/types.go @@ -0,0 +1,220 @@ +package common + +import ( + "context" + "encoding/json" + "fmt" + "os" + "os/exec" + "runtime" + + "github.com/google/go-github/github" + "github.com/kurtosis-tech/kurtosis/api/golang/core/kurtosis_core_rpc_api_bindings" + "github.com/kurtosis-tech/kurtosis/api/golang/core/lib/enclaves" + "github.com/kurtosis-tech/kurtosis/api/golang/engine/lib/kurtosis_context" + "github.com/kurtosis-tech/stacktrace" + "github.com/sirupsen/logrus" +) + +type DiveserviceResponse struct { + ServiceName string `json:"service_name"` + PublicEndpoint string `json:"endpoint_public"` + PrivateEndpoint string `json:"endpoint"` + KeyPassword string `json:"keypassword"` + KeystorePath string `json:"keystore_path"` + Network string `json:"network"` + NetworkName string `json:"network_name"` + NetworkId string `json:"nid"` +} + +func (dive *DiveserviceResponse) Decode(responseData []byte) (*DiveserviceResponse, error) { + + err := json.Unmarshal(responseData, &dive) + if err != nil { + return nil, err + } + return dive, nil +} +func (dive *DiveserviceResponse) EncodeToString() (string, error) { + encodedBytes, err := json.Marshal(dive) + if err != nil { + return "", nil + } + + return string(encodedBytes), nil +} +func (dive *DiveserviceResponse) WriteDiveResponse(diveContext *DiveContext) { + + serialisedData, err := dive.EncodeToString() + + if err != nil { + diveContext.FatalError("Failed To Serialzed Data", err.Error()) + } + + WriteToFile(serialisedData) +} + +func GetSerializedData(response chan *kurtosis_core_rpc_api_bindings.StarlarkRunResponseLine) string { + + var serializedOutputObj string + + for executionResponseLine := range response { + + runFinishedEvent := executionResponseLine.GetRunFinishedEvent() + + if runFinishedEvent == nil { + + } else { + + if runFinishedEvent.GetIsRunSuccessful() { + + serializedOutputObj = runFinishedEvent.GetSerializedOutput() + } else { + logrus.Fatal("Starlark run Fails") + } + } + } + + return serializedOutputObj + +} + +func OpenFile(URL string) error { + var args []string + switch runtime.GOOS { + case linuxOSName: + args = []string{openFileLinuxCommandName, URL} + case macOSName: + args = []string{openFileMacCommandName, URL} + case windowsOSName: + args = []string{openFileWindowsCommandName, openFileWindowsCommandFirstArgumentDefault, URL} + default: + return stacktrace.NewError("Unsupported operating system") + } + command := exec.Command(args[0], args[1:]...) + if err := command.Start(); err != nil { + return stacktrace.Propagate(err, "An error occurred while opening '%v'", URL) + } + return nil +} + +// This function will fetch the latest version from HugoByte/Dive repo +func GetLatestVersion() string { + + // Repo Name + repo := "DIVE" + owner := "HugoByte" + + // Create a new github client + client := github.NewClient(nil) + release, _, err := client.Repositories.GetLatestRelease(context.Background(), owner, repo) + if err != nil { + fmt.Println(err) + return "" + } + + // Print the release version. + return release.GetName() +} + +type DiveContext struct { + Ctx context.Context + KurtosisContext *kurtosis_context.KurtosisContext + log *logrus.Logger +} + +func NewDiveContext() *DiveContext { + + ctx := context.Background() + + kurtosisContext, err := kurtosis_context.NewKurtosisContextFromLocalEngine() + if err != nil { + logrus.Fatal("The Kurtosis Engine Server is unavailable and is probably not running; you will need to start it using the Kurtosis CLI before you can create a connection to it") + + } + log := logrus.New() + log.SetFormatter(&logrus.TextFormatter{ + FullTimestamp: true, + TimestampFormat: "2006-01-02 15:04:05", + }) + return &DiveContext{Ctx: ctx, KurtosisContext: kurtosisContext, log: logrus.New()} +} + +func (diveContext *DiveContext) GetEnclaveContext() (*enclaves.EnclaveContext, error) { + + _, err := diveContext.KurtosisContext.GetEnclave(diveContext.Ctx, DiveEnclave) + if err != nil { + enclaveCtx, err := diveContext.KurtosisContext.CreateEnclave(diveContext.Ctx, DiveEnclave, false) + if err != nil { + return nil, err + + } + return enclaveCtx, nil + } + enclaveCtx, err := diveContext.KurtosisContext.GetEnclaveContext(diveContext.Ctx, DiveEnclave) + + if err != nil { + return nil, err + } + return enclaveCtx, nil +} + +func ReadConfigFile(filePath string) ([]byte, error) { + + file, err := os.ReadFile(filePath) + + if err != nil { + return nil, err + } + + return file, nil +} +func WriteToFile(data string) { + file, err := os.Create("dive.json") + if err != nil { + return + } + defer file.Close() + + file.WriteString(data) +} + +// To get names of running enclaves, returns empty string if no enclaves +func (diveContext *DiveContext) GetEnclaves() string { + enclaves, err := diveContext.KurtosisContext.GetEnclaves(diveContext.Ctx) + if err != nil { + logrus.Errorf("Getting Enclaves failed with error: %v", err) + } + enclaveMap := enclaves.GetEnclavesByName() + for _, enclaveInfoList := range enclaveMap { + for _, enclaveInfo := range enclaveInfoList { + return enclaveInfo.GetName() + } + } + return "" +} + +// Funstionality to clean the enclaves +func (diveContext *DiveContext) Clean() { + logrus.Info("Successfully connected to kurtosis engine...") + logrus.Info("Initializing cleaning process...") + + // shouldCleanAll set to true as default for beta release. + enclaves, err := diveContext.KurtosisContext.Clean(diveContext.Ctx, true) + if err != nil { + logrus.Errorf("Failed cleaning with error: %v", err) + } + + // Assuming only one enclave is running for beta release + logrus.Infof("Successfully destroyed and cleaned enclave %s", enclaves[0].Name) +} + +func (diveContext *DiveContext) FatalError(message, err string) { + + diveContext.log.Fatalf("%s : %s", message, err) +} + +func (diveContext *DiveContext) Info(message string) { + + diveContext.log.Info(message) +} diff --git a/cli/go.mod b/cli/go.mod new file mode 100644 index 00000000..b196116c --- /dev/null +++ b/cli/go.mod @@ -0,0 +1,39 @@ +module github.com/hugobyte/dive + +go 1.20 + +require ( + github.com/fatih/color v1.15.0 + github.com/google/go-github v17.0.0+incompatible + github.com/kurtosis-tech/kurtosis/api/golang v0.80.8 + github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409 + github.com/sirupsen/logrus v1.9.3 + github.com/spf13/cobra v1.7.0 +) + +require ( + github.com/Masterminds/semver/v3 v3.1.1 // indirect + github.com/dsnet/compress v0.0.1 // indirect + github.com/go-yaml/yaml v2.1.0+incompatible // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/go-querystring v1.1.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20230328194643-b4dea3081e25 // indirect + github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20230427135111-ee2492059d06 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mholt/archiver v3.1.1+incompatible // indirect + github.com/nwaples/rardecode v1.1.3 // indirect + github.com/pierrec/lz4 v2.6.1+incompatible // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/ulikunitz/xz v0.5.10 // indirect + github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.10.0 // indirect + golang.org/x/text v0.8.0 // indirect + google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect + google.golang.org/grpc v1.41.0 // indirect + google.golang.org/protobuf v1.29.1 // indirect +) diff --git a/cli/go.sum b/cli/go.sum new file mode 100644 index 00000000..dd6a48f2 --- /dev/null +++ b/cli/go.sum @@ -0,0 +1,212 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +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/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +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/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q= +github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo= +github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= +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/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +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/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o= +github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= +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.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +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-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= +github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20230328194643-b4dea3081e25 h1:ig5umBAI6smmP/4xPLSL5KSlH9N/bZURzDkJzD8qWb8= +github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20230328194643-b4dea3081e25/go.mod h1:YjVghnKmmELgH8DmIKBFxwArWbtLUYqwnol9DAWnBM8= +github.com/kurtosis-tech/kurtosis/api/golang v0.80.8 h1:b3rbAMkI91yAAVdULtlyxqe2TKJ/Lyeszr1lPdNU7N4= +github.com/kurtosis-tech/kurtosis/api/golang v0.80.8/go.mod h1:RBzI3lOEioZWLoWCYo7UfMQLsIttxWTYRaIGM6NtRq4= +github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20230427135111-ee2492059d06 h1:Y8JeWlV+R+ZOVCgIl+f3ltY3fvWHN22YvS43AV3c60g= +github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20230427135111-ee2492059d06/go.mod h1:Dw7pqbZWNdjGEYO6B+xzfaQrtXsLNDpYLhHfXirbzTs= +github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409 h1:YQTATifMUwZEtZYb0LVA7DK2pj8s71iY8rzweuUQ5+g= +github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409/go.mod h1:y5weVs5d9wXXHcDA1awRxkIhhHC1xxYJN8a7aXnE6S8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mholt/archiver v3.1.1+incompatible h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU= +github.com/mholt/archiver v3.1.1+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU= +github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc= +github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= +github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= +github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +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/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +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= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= +github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= +github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= +github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +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/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/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.4.2/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-20190108225652-1e06a53dbb7e/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-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +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-20181221193216-37e7f081c4d4/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-20210220032951-036812b2e83c/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-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-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +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-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +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-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c h1:wtujag7C+4D6KMoulW9YauvK2lgdvCMS260jsqqBXr0= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +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.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= +google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +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.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.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-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +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/cli/main.go b/cli/main.go new file mode 100644 index 00000000..44bea226 --- /dev/null +++ b/cli/main.go @@ -0,0 +1,24 @@ +/* +Copyright © 2023 Hugobyte AI Labs +*/ +package main + +import ( + "github.com/hugobyte/dive/commands" + "github.com/hugobyte/dive/common" + "github.com/sirupsen/logrus" +) + +func main() { + logrus.SetFormatter(&logrus.TextFormatter{ + FullTimestamp: true, + TimestampFormat: "2006-01-02 15:04:05", + }) + latestVersion := common.GetLatestVersion() + if common.DiveVersion != latestVersion { + logrus.Warnf("Update available '%s'. Get the latest version of our DIVE CLI for bug fixes, performance improvements, and new features.", latestVersion) + } + + commands.Execute() + +} diff --git a/cli/styles/banner.go b/cli/styles/banner.go new file mode 100644 index 00000000..820d516e --- /dev/null +++ b/cli/styles/banner.go @@ -0,0 +1,20 @@ +package styles + +import "fmt" + +var banner = ` + ___ _____ _____ + | \_ _\ \ / / __| + | |) | | \ V /| _| + |___/___| \_/ |___| + + %s +` + +func RenderBanner() { + + banner := fmt.Sprintf(BANNER_COLOR(banner), TAG_COLOR("Developed by HugoByte and Powered by Kurtosis")) + + fmt.Println(banner) + +} diff --git a/cli/styles/colors.go b/cli/styles/colors.go new file mode 100644 index 00000000..45d7dafd --- /dev/null +++ b/cli/styles/colors.go @@ -0,0 +1,15 @@ +package styles + +import "fmt" + +func color(colorString string) func(...interface{}) string { + sprint := func(args ...interface{}) string { + return fmt.Sprintf(colorString, + fmt.Sprint(args...)) + } + return sprint +} + +var ERROR_COLOR = color("\033[0;31m]") +var BANNER_COLOR = color("\033[1;34m%s\033[0m") +var TAG_COLOR = color("\033[3;32m%s\033[0m") diff --git a/package_io/constants.star b/package_io/constants.star index 3adb519a..b77ff0de 100644 --- a/package_io/constants.star +++ b/package_io/constants.star @@ -1,5 +1,5 @@ ICON_NODE_CLIENT = struct( - node_image = "iconloop/goloop-icon:v1.3.7", + node_image = "iconloop/goloop-icon:v1.3.8", config_files_directory = "/goloop/config/", contracts_directory = "/goloop/contracts/", keystore_directory = "/goloop/keystores/", @@ -9,7 +9,8 @@ ICON_NODE_CLIENT = struct( port_key = "rpc", public_ip_address = "127.0.0.1", rpc_endpoint_path = "api/v3/icon_dex", - service_name = "icon-node-" + service_name = "icon-node-", + genesis_file_path = "/goloop/genesis/" ) HARDHAT_NODE_CLIENT = struct( diff --git a/services/evm/eth/eth.star b/services/evm/eth/eth.star index 23618692..bd482f02 100644 --- a/services/evm/eth/eth.star +++ b/services/evm/eth/eth.star @@ -10,8 +10,8 @@ def start_eth_node_serivce(plan,args,node_type): "nid" : node_service_data.nid, "network" : node_service_data.network, "network_name": node_service_data.network_name, - "endpoint": "http://%s" % node_service_data.endpoint , - "endpoint_public": "http://%s" % node_service_data.endpoint_public , + "endpoint": node_service_data.endpoint , + "endpoint_public": node_service_data.endpoint_public , "keystore_path" : node_service_data.keystore_path, "keypassword": node_service_data.keypassword } diff --git a/services/evm/eth/src/node-setup/start-eth-node.star b/services/evm/eth/src/node-setup/start-eth-node.star index a4127aae..15c09f7e 100644 --- a/services/evm/eth/src/node-setup/start-eth-node.star +++ b/services/evm/eth/src/node-setup/start-eth-node.star @@ -12,8 +12,8 @@ def start_eth_node(plan,args): network_name= eth_contstants.network_name, network = eth_contstants.network, nid = eth_contstants.nid, - endpoint = network_address, - endpoint_public = "", + endpoint = "http://%s" % network_address, + endpoint_public = "http://", keystore_path = eth_contstants.keystore_path, keypassword = eth_contstants.keypassword ) @@ -64,8 +64,8 @@ def start_hardhat_node(plan): network_name= "hardhat", network = hardhat_constants.network, nid = hardhat_constants.network_id, - endpoint = private_url, - endpoint_public = public_url, + endpoint = "http://%s" % private_url, + endpoint_public = "http://%s" % public_url, keystore_path = hardhat_constants.keystore_path, keypassword = hardhat_constants.keypassword ) \ No newline at end of file diff --git a/services/jvm/icon/icon.star b/services/jvm/icon/icon.star index 6e5bedb3..4166364c 100644 --- a/services/jvm/icon/icon.star +++ b/services/jvm/icon/icon.star @@ -3,8 +3,8 @@ setup_node = import_module("github.com/hugobyte/dive/services/jvm/icon/src/node- icon_node_launcher = import_module("github.com/hugobyte/dive/services/jvm/icon/src/node-setup/start_icon_node.star") icon_relay_setup = import_module("github.com/hugobyte/dive/services/jvm/icon/src/relay-setup/contract_configuration.star") -START_FILE_FOR_ICON0 = "start-icon-0.sh" -START_FILE_FOR_ICON1 = "start-icon-1.sh" +START_FILE_FOR_ICON0 = "start-icon.sh" +START_FILE_FOR_ICON1 = "start-icon.sh" ICON0_NODE_ID = 0 ICON1_NODE_ID = 1 ICON0_NODE_PRIVATE_RPC_PORT = 9080 @@ -17,13 +17,17 @@ ICON1_NODE_P2P_LISTEN_ADDRESS = 7081 ICON1_NODE_P2P_ADDRESS = 8081 ICON0_NODE_CID = "0xacbc4e" ICON1_NODE_CID = "0x42f1f3" +ICON0_GENESIS_FILE_PATH = "github.com/hugobyte/dive/services/jvm/icon/static-files/config/genesis-icon-0.zip" +ICON1_GENESIS_FILE_PATH = "github.com/hugobyte/dive/services/jvm/icon/static-files/config/genesis-icon-1.zip" +ICON0_GENESIS_FILE_NAME= "genesis-icon-0.zip" +ICON1_GENESIS_FILE_NAME= "genesis-icon-1.zip" # Spins up ICON Node ID 0 def start_icon_node_0(plan,service_config): plan.print("Starting Icon Node: Id 0") - node_service = icon_node_launcher.start_icon_node(plan,service_config,ICON0_NODE_ID,START_FILE_FOR_ICON0) + node_service = icon_node_launcher.start_icon_node(plan,service_config,ICON0_NODE_ID,{},ICON0_GENESIS_FILE_PATH,ICON0_GENESIS_FILE_NAME) return node_service @@ -32,7 +36,7 @@ def start_icon_node_1(plan,service_config): plan.print("Starting Icon Node: Id 1") - node_service = icon_node_launcher.start_icon_node(plan,service_config,ICON1_NODE_ID,START_FILE_FOR_ICON1) + node_service = icon_node_launcher.start_icon_node(plan,service_config,ICON1_NODE_ID,{},ICON1_GENESIS_FILE_PATH,ICON1_GENESIS_FILE_NAME) return node_service diff --git a/services/jvm/icon/src/node-setup/contract_deploy.star b/services/jvm/icon/src/node-setup/contract_deploy.star index 23eea494..2ca63ae2 100644 --- a/services/jvm/icon/src/node-setup/contract_deploy.star +++ b/services/jvm/icon/src/node-setup/contract_deploy.star @@ -17,6 +17,7 @@ def deploy_contract(plan,contract_name,init_message,args): execute_command = ["./bin/goloop","rpc","sendtx","deploy","contracts/"+contract,"--content_type","application/java","--params",init_message,"--key_store",keystore_path,"--key_password",keystore_password,"--step_limit",DEFAULT_STEP_LIMIT,"--uri",uri,"--nid",nid] + plan.print(execute_command) result = plan.exec(service_name=service_name,recipe=ExecRecipe(command=execute_command)) return result["output"] diff --git a/services/jvm/icon/src/node-setup/start_icon_node.star b/services/jvm/icon/src/node-setup/start_icon_node.star index ee29cdc7..e83f1e8b 100644 --- a/services/jvm/icon/src/node-setup/start_icon_node.star +++ b/services/jvm/icon/src/node-setup/start_icon_node.star @@ -1,17 +1,19 @@ constants = import_module("github.com/hugobyte/dive/package_io/constants.star") # Starts The Icon Node -def start_icon_node(plan,service_config,id,start_file_name): +def start_icon_node(plan,service_config,id,uploaded_genesis,genesis_file_path,genesis_file_name): + + plan.print(uploaded_genesis) icon_node_constants = constants.ICON_NODE_CLIENT - service_name = service_config.service_name - private_port = service_config.private_port - public_port = service_config.public_port - network_name = service_config.network_name - p2p_listen_address = service_config.p2p_listen_address - p2p_address = service_config.p2p_address - cid = service_config.cid + service_name = service_config["service_name"] + private_port = service_config["private_port"] + public_port = service_config["public_port"] + network_name = service_config["network_name"] + p2p_listen_address = service_config["p2p_listen_address"] + p2p_address = service_config["p2p_address"] + cid = service_config["cid"] plan.print("Launching "+service_name+" Service") @@ -22,6 +24,16 @@ def start_icon_node(plan,service_config,id,start_file_name): plan.upload_files(src=icon_node_constants.contract_files_path,name="contracts-{0}".format(id)) plan.upload_files(src=icon_node_constants.keystore_files_path,name="kesytore-{0}".format(id) ) + file_path = "" + file_name = "" + if len(uploaded_genesis) == 0: + plan.upload_files(src=genesis_file_path,name=genesis_file_name) + file_path = genesis_file_name + file_name = genesis_file_name + else: + file_path = uploaded_genesis["file_path"] + file_name = uploaded_genesis["file_name"] + icon_node_service_config = ServiceConfig( image=icon_node_constants.node_image, ports={ @@ -33,7 +45,9 @@ def start_icon_node(plan,service_config,id,start_file_name): files={ icon_node_constants.config_files_directory : "config-files-{0}".format(id), icon_node_constants.contracts_directory : "contracts-{0}".format(id), - icon_node_constants.keystore_directory : "kesytore-{0}".format(id) + icon_node_constants.keystore_directory : "kesytore-{0}".format(id), + icon_node_constants.genesis_file_path : file_path + }, env_vars={ "GOLOOP_LOG_LEVEL": "trace", @@ -42,7 +56,7 @@ def start_icon_node(plan,service_config,id,start_file_name): "GOLOOP_P2P": ":%s" % p2p_address, "ICON_CONFIG": icon_node_constants.config_files_directory+"icon_config.json" }, - cmd= ["/bin/sh","-c",icon_node_constants.config_files_directory+"%s" % start_file_name] + cmd= ["/bin/sh","-c",icon_node_constants.config_files_directory+"start.sh %s %s" % (cid,file_name)] ) @@ -57,6 +71,8 @@ def start_icon_node(plan,service_config,id,start_file_name): network = "{0}.icon".format(chain_id["output"]) + + return struct( service_name = service_name, network_name = network_name, @@ -84,12 +100,15 @@ def get_service_url(ip_address,ports,path): # Retruns Service Config def get_service_config(id,private_port,public_port,p2p_listen_address,p2p_address,cid): - return struct( - service_name = "{0}{1}".format(constants.ICON_NODE_CLIENT.service_name,id), - private_port = private_port, - public_port = public_port, - network_name = "icon-{0}".format(id), - p2p_listen_address = p2p_listen_address, - p2p_address = p2p_address, - cid = cid - ) \ No newline at end of file + config = { + "service_name" : "{0}{1}".format(constants.ICON_NODE_CLIENT.service_name,id), + "private_port" : private_port, + "public_port" : public_port, + "network_name" : "icon-{0}".format(id), + "p2p_listen_address" : p2p_listen_address, + "p2p_address" : p2p_address, + "cid":cid + } + + + return config \ No newline at end of file diff --git a/services/jvm/icon/static-files/config/start-icon-1.sh b/services/jvm/icon/static-files/config/start-icon-1.sh deleted file mode 100755 index 7b71700d..00000000 --- a/services/jvm/icon/static-files/config/start-icon-1.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -start_chain() { - while true; do - RES=$(goloop system info 2>&1) - if [ "$?" == "0" ]; then - break - fi - sleep 1 - done - echo $RES - - CID=42f1f3 - if [ ! -e ${GOLOOP_NODE_DIR}/${CID} ]; then - # join chain - GENESIS=/goloop/config/genesis-icon-1.zip - goloop chain join \ - --platform icon \ - --channel icon_dex \ - --genesis ${GENESIS} \ - --tx_timeout 10000 \ - --node_cache small \ - --normal_tx_pool 1000 \ - --db_type rocksdb \ - --role 3 - fi - goloop chain start 0x${CID} -} - -# start chain in backgound -start_chain & - -# start goloop server -exec goloop server start diff --git a/services/jvm/icon/static-files/config/start-icon-0.sh b/services/jvm/icon/static-files/config/start.sh similarity index 84% rename from services/jvm/icon/static-files/config/start-icon-0.sh rename to services/jvm/icon/static-files/config/start.sh index 90d86c2b..caf6c0a7 100755 --- a/services/jvm/icon/static-files/config/start-icon-0.sh +++ b/services/jvm/icon/static-files/config/start.sh @@ -10,10 +10,11 @@ start_chain() { done echo $RES - CID=acbc4e + + CID=${1} if [ ! -e ${GOLOOP_NODE_DIR}/${CID} ]; then # join chain - GENESIS=/goloop/config/genesis-icon-0.zip + GENESIS=/goloop/genesis/${2} goloop chain join \ --platform icon \ --channel icon_dex \ @@ -24,11 +25,11 @@ start_chain() { --db_type rocksdb \ --role 3 fi - goloop chain start 0x${CID} + goloop chain start ${CID} } # start chain in backgound -start_chain & +start_chain "$1" "$2" & # start goloop server exec goloop server start