diff --git a/cli/commands/bridge/relays/btp.go b/cli/commands/bridge/relays/btp.go index 58c512fa..5f11ff09 100644 --- a/cli/commands/bridge/relays/btp.go +++ b/cli/commands/bridge/relays/btp.go @@ -6,7 +6,6 @@ import ( "github.com/hugobyte/dive/cli/commands/chain/types" "github.com/hugobyte/dive/cli/common" - "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/spf13/cobra" ) @@ -195,8 +194,8 @@ func BtpRelayCmd(diveContext *common.DiveContext) *cobra.Command { func runBtpSetupByRunningNodes(diveContext *common.DiveContext, enclaveCtx *enclaves.EnclaveContext, params string) { diveContext.SetSpinnerMessage(" Executing BTP Starlark Package") - - data, _, err := enclaveCtx.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveBridgeScript, bridgeMainFunction, params, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + starlarkConfig := diveContext.GetStarlarkRunConfig(params, common.DiveBridgeScript, bridgeMainFunction) + data, _, err := enclaveCtx.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { diveContext.FatalError("Starlark Run Failed", err.Error()) @@ -218,7 +217,8 @@ func runBtpSetupForAlreadyRunningNodes(diveContext *common.DiveContext, enclaveC params := fmt.Sprintf(`{"src_chain":"%s", "dst_chain":"%s", "config_data":%s, "src_service_name":"%s", "dst_service_name":"%s"}`, srcChain, dstChain, configData, srcChainServiceName, dstChainServiceName) - data, _, err := enclaveCtx.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveBridgeScript, mainFunctionName, params, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + starlarkConfig := diveContext.GetStarlarkRunConfig(params, common.DiveBridgeScript, mainFunctionName) + data, _, err := enclaveCtx.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { diveContext.FatalError("Starlark Run Failed", err.Error()) diff --git a/cli/commands/bridge/relays/ibc.go b/cli/commands/bridge/relays/ibc.go index ddb307ea..55178c4b 100644 --- a/cli/commands/bridge/relays/ibc.go +++ b/cli/commands/bridge/relays/ibc.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/hugobyte/dive/cli/common" - "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/spf13/cobra" ) @@ -94,8 +93,8 @@ func startIbcRelay(diveContext *common.DiveContext, enclaveContext *enclaves.Enc func startIbcRelayIconToCosmos(diveContext *common.DiveContext, enclaveContext *enclaves.EnclaveContext, serviceName string) (string, error) { params := fmt.Sprintf(`{"service_name": "%s"}`, serviceName) - - executionData, _, err := enclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, "services/bridges/ibc/src/bridge.star", "start_relay", params, false, 4, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + starlarkConfig := diveContext.GetStarlarkRunConfig(params, "services/bridges/ibc/src/bridge.star", "start_relay") + executionData, _, err := enclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { return "", err @@ -139,7 +138,8 @@ func setupIbcRelayforAlreadyRunningCosmosChain(diveContext *common.DiveContext, } func runStarlarkPackage(diveContext *common.DiveContext, enclaveContext *enclaves.EnclaveContext, params, functionName string) (string, error) { - executionData, _, err := enclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveBridgeScript, functionName, params, false, 4, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + starlarkConfig := diveContext.GetStarlarkRunConfig(params, common.DiveBridgeScript, functionName) + executionData, _, err := enclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { return "", err diff --git a/cli/commands/chain/types/archway.go b/cli/commands/chain/types/archway.go index cca19313..a38db42a 100644 --- a/cli/commands/chain/types/archway.go +++ b/cli/commands/chain/types/archway.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/hugobyte/dive/cli/common" - "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/spf13/cobra" ) @@ -124,8 +123,8 @@ func RunArchwayNode(diveContext *common.DiveContext) *common.DiveserviceResponse } func runArchwayWithCustomServiceConfig(diveContext *common.DiveContext, enclaveContext *enclaves.EnclaveContext, data string) (string, error) { - - serviceExecutionResponse, _, err := enclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveArchwayNodeScript, constructServiceConfigFunctionName, data, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + starlarkConfig := diveContext.GetStarlarkRunConfig(data, common.DiveArchwayNodeScript, constructServiceConfigFunctionName) + serviceExecutionResponse, _, err := enclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { @@ -140,8 +139,9 @@ func runArchwayWithCustomServiceConfig(diveContext *common.DiveContext, enclaveC } params := fmt.Sprintf(`{"args":%s}`, serviceExecutionResponseData) + starlarkConfig = diveContext.GetStarlarkRunConfig(params, common.DiveArchwayNodeScript, runArchwayNodeWithCustomServiceFunctionName) - nodeExecutionResponse, _, err := enclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveArchwayNodeScript, runArchwayNodeWithCustomServiceFunctionName, params, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + nodeExecutionResponse, _, err := enclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { @@ -162,7 +162,8 @@ func runArchwayWithCustomServiceConfig(diveContext *common.DiveContext, enclaveC func runArchwayWithDefaultServiceConfig(diveContext *common.DiveContext, enclaveContext *enclaves.EnclaveContext) (string, error) { params := `{"args":{"data":{}}}` - nodeServiceResponse, _, err := enclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveArchwayDefaultNodeScript, runArchwayNodeWithDefaultConfigFunctionName, params, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + starlarkConfig := diveContext.GetStarlarkRunConfig(params, common.DiveArchwayDefaultNodeScript, runArchwayNodeWithDefaultConfigFunctionName) + nodeServiceResponse, _, err := enclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { diff --git a/cli/commands/chain/types/eth.go b/cli/commands/chain/types/eth.go index 09adce2c..5ff72be7 100644 --- a/cli/commands/chain/types/eth.go +++ b/cli/commands/chain/types/eth.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/hugobyte/dive/cli/common" - "github.com/kurtosis-tech/kurtosis/api/golang/core/kurtosis_core_rpc_api_bindings" "github.com/spf13/cobra" ) @@ -45,8 +44,8 @@ func RunEthNode(diveContext *common.DiveContext) *common.DiveserviceResponse { diveContext.FatalError("Failed To Retrive Enclave Context", err.Error()) } diveContext.StartSpinner(" Starting ETH Node") - - data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveEthHardhatNodeScript, "start_eth_node", `{"args":{}}`, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + starlarkConfig := diveContext.GetStarlarkRunConfig(`{"args":{}}`, common.DiveEthHardhatNodeScript, "start_eth_node") + data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { diff --git a/cli/commands/chain/types/hardhat.go b/cli/commands/chain/types/hardhat.go index 43e6ce20..b9db37c6 100644 --- a/cli/commands/chain/types/hardhat.go +++ b/cli/commands/chain/types/hardhat.go @@ -2,7 +2,6 @@ package types import ( "github.com/hugobyte/dive/cli/common" - "github.com/kurtosis-tech/kurtosis/api/golang/core/kurtosis_core_rpc_api_bindings" "github.com/spf13/cobra" ) @@ -43,7 +42,8 @@ func RunHardhatNode(diveContext *common.DiveContext) *common.DiveserviceResponse diveContext.FatalError("Failed To Retrive Enclave Context", err.Error()) } diveContext.StartSpinner(" Starting Hardhat Node") - data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveEthHardhatNodeScript, "start_hardhat_node", "{}", common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + starlarkConfig := diveContext.GetStarlarkRunConfig("{}", common.DiveEthHardhatNodeScript, "start_hardhat_node") + data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { diveContext.FatalError("Starlark Run Failed", err.Error()) diff --git a/cli/commands/chain/types/icon.go b/cli/commands/chain/types/icon.go index 050d077c..2894051b 100644 --- a/cli/commands/chain/types/icon.go +++ b/cli/commands/chain/types/icon.go @@ -7,12 +7,11 @@ import ( "path/filepath" "github.com/hugobyte/dive/cli/common" - "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/spf13/cobra" ) -const DefaultIconGenesisFile = "github.com/hugobyte/dive/services/jvm/icon/static-files/config/genesis-icon-0.zip" +const DefaultIconGenesisFile = "../../static-files/config/genesis-icon-0.zip" var ( genesis = "" @@ -159,8 +158,8 @@ func RunIconNode(diveContext *common.DiveContext) *common.DiveserviceResponse { if err != nil { diveContext.FatalError("Failed To Retrive Enclave Context", err.Error()) } - - data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveIconNodeScript, "get_service_config", paramData, false, 4, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + starlarkConfig := diveContext.GetStarlarkRunConfig(paramData, common.DiveIconNodeScript, "get_service_config") + data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { diveContext.FatalError("Starlark Run Failed", err.Error()) @@ -182,7 +181,8 @@ func RunIconNode(diveContext *common.DiveContext) *common.DiveserviceResponse { diveContext.CheckInstructionSkipped(skippedInstructions, "Instruction Executed Already") params := fmt.Sprintf(`{"service_config":%s,"uploaded_genesis":%s,"genesis_file_path":"%s","genesis_file_name":"%s"}`, responseData, genesisHandler.uploadedFiles, genesisHandler.genesisPath, genesisHandler.genesisFile) - icon_data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveIconNodeScript, "start_icon_node", params, false, 4, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + starlarkConfig = diveContext.GetStarlarkRunConfig(params, common.DiveIconNodeScript, "start_icon_node") + icon_data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { @@ -225,8 +225,8 @@ func Decentralisation(diveContext *common.DiveContext, params string) { if err != nil { diveContext.FatalError("Failed To Retrieve Enclave Context", err.Error()) } - - data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveIconDecentraliseScript, "configure_node", params, false, 4, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + starlarkConfig := diveContext.GetStarlarkRunConfig(params, common.DiveIconDecentraliseScript, "configure_node") + data, _, err := kurtosisEnclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { diveContext.FatalError("Starlark Run Failed", err.Error()) diff --git a/cli/commands/chain/types/neutron.go b/cli/commands/chain/types/neutron.go index 6e0d69bb..744c9421 100644 --- a/cli/commands/chain/types/neutron.go +++ b/cli/commands/chain/types/neutron.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/hugobyte/dive/cli/common" - "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/spf13/cobra" ) @@ -14,7 +13,7 @@ import ( const ( runNeutronNodeWithDefaultConfigFunctionName = "start_node_service" runNeutronNodeWithCustomServiceFunctionName = "start_neutron_node" - construcNeutrontServiceConfigFunctionName = "get_service_config" + constructNeutronServiceConfigFunctionName = "get_service_config" ) // Variable to store the Neutron node configuration file path @@ -120,7 +119,8 @@ func RunNeutronNode(diveContext *common.DiveContext) *common.DiveserviceResponse // RunNeutronWithServiceConfig runs the Neutron service with the provided configuration data. func RunNeutronWithServiceConfig(diveContext *common.DiveContext, enclaveContext *enclaves.EnclaveContext, data string) (string, error) { params := fmt.Sprintf(`{"args":{"data":%s}}`, data) - nodeServiceResponse, _, err := enclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, common.DiveNeutronDefaultNodeScript, runNeutronNodeWithDefaultConfigFunctionName, params, common.DiveDryRun, common.DiveDefaultParallelism, []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}) + starlarkConfig := diveContext.GetStarlarkRunConfig(params, common.DiveNeutronDefaultNodeScript, runNeutronNodeWithDefaultConfigFunctionName) + nodeServiceResponse, _, err := enclaveContext.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig) if err != nil { return "", err } diff --git a/cli/common/constants.go b/cli/common/constants.go index 483ff99e..9ce23a34 100644 --- a/cli/common/constants.go +++ b/cli/common/constants.go @@ -3,7 +3,7 @@ package common var DiveLogs bool // !!!!!!!!!!! DO NOT UPDATE! WILL BE UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!! -var DiveVersion = "v0.0.11-beta" +var DiveVersion = "v0.0.12-beta" const ( DiveEnclave = "dive" diff --git a/cli/common/context.go b/cli/common/context.go index 8b4a9d54..3427388e 100644 --- a/cli/common/context.go +++ b/cli/common/context.go @@ -12,6 +12,7 @@ import ( "github.com/fatih/color" "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/core/lib/starlark_run_config" "github.com/kurtosis-tech/kurtosis/api/golang/engine/lib/kurtosis_context" log "github.com/sirupsen/logrus" @@ -206,7 +207,9 @@ func (diveContext *DiveContext) StopServices(services map[string]string) { for serviceName, serviceUUID := range services { params := fmt.Sprintf(`{"service_name": "%s", "uuid": "%s"}`, serviceName, serviceUUID) - _, err := enclaveContext.RunStarlarkScriptBlocking(diveContext.Ctx, "", starlarkScript, params, DiveDryRun, DiveDefaultParallelism, nil) + starlarkConfig := diveContext.GetStarlarkRunConfig(params, "", "") + _, err := enclaveContext.RunStarlarkScriptBlocking(diveContext.Ctx, starlarkScript, starlarkConfig) + if err != nil { diveContext.Log.Fatal("Failed To Stop Services", err) } @@ -216,3 +219,16 @@ func (diveContext *DiveContext) StopServices(services map[string]string) { } } + +func (diveContext *DiveContext) GetStarlarkRunConfig(params string, relativePathToMainFile string, mainFunctionName string) *starlark_run_config.StarlarkRunConfig { + + starlarkConfig := &starlark_run_config.StarlarkRunConfig{ + RelativePathToMainFile: relativePathToMainFile, + MainFunctionName: mainFunctionName, + DryRun: DiveDryRun, + SerializedParams: params, + Parallelism: DiveDefaultParallelism, + ExperimentalFeatureFlags: []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}, + } + return starlarkConfig +} diff --git a/cli/go.mod b/cli/go.mod index 4751ecaf..2c48b18a 100644 --- a/cli/go.mod +++ b/cli/go.mod @@ -6,7 +6,7 @@ require ( github.com/briandowns/spinner v1.23.0 github.com/fatih/color v1.15.0 github.com/google/go-github v17.0.0+incompatible - github.com/kurtosis-tech/kurtosis/api/golang v0.83.16 + github.com/kurtosis-tech/kurtosis/api/golang v0.84.0 github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409 github.com/natefinch/lumberjack v2.0.0+incompatible github.com/sirupsen/logrus v1.9.3