From ce90d7106d28456359f8772d0a8c59071ea8b8ba Mon Sep 17 00:00:00 2001 From: Abhishek Harde <47945971+abhiyana@users.noreply.github.com> Date: Tue, 3 Oct 2023 21:27:28 +0530 Subject: [PATCH] feat: icon to archway/neutron start relay implementation (#187) * test: add test scripts and functional tests for neutron chain, neutron-archway ibc, icon-neutron ibc * refactor: change RunStarlarkPackage to RunStarlarkRemotePackage in neutron.go * test: add functional tests for icon to neutron/archway ibc relay * test: add functional tests for icon to neutron/archway running with custom configuration * fix: fix icon to archway/neutron ibc fail * fix: fix icon to neutron/archway ibc relay setup with custom icon chain fail * feat: start relay between icon to neutron/archway chains --- cli/commands/bridge/relays/ibc.go | 21 +++++++++++++++++++++ cli/common/constants.go | 1 + 2 files changed, 22 insertions(+) diff --git a/cli/commands/bridge/relays/ibc.go b/cli/commands/bridge/relays/ibc.go index 0c2afe06..e5a1d6bb 100644 --- a/cli/commands/bridge/relays/ibc.go +++ b/cli/commands/bridge/relays/ibc.go @@ -81,9 +81,30 @@ func startIbcRelay(diveContext *common.DiveContext, enclaveContext *enclaves.Enc } } + + if chainA == "icon" { + startIbcRelayIconToCosmos(diveContext, enclaveContext, common.RelayServiceNameIconToCosmos) + } + return starlarkExecutionResponse } +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{}) + + executionSerializedData, services, _, err := diveContext.GetSerializedData(executionData) + + if err != nil { + diveContext.StopServices(services) + return "", err + + } + + return executionSerializedData, nil +} + func startCosmosChainsAndSetupIbcRelay(diveContext *common.DiveContext, enclaveCtx *enclaves.EnclaveContext, chains *Chains) (string, error) { params := chains.getIbcRelayParams() diff --git a/cli/common/constants.go b/cli/common/constants.go index 17347f70..0fa423cd 100644 --- a/cli/common/constants.go +++ b/cli/common/constants.go @@ -14,6 +14,7 @@ const ( DiveArchwayNodeScript = "services/cosmvm/archway/src/node-setup/start_node.star" DiveArchwayDefaultNodeScript = "services/cosmvm/archway/archway.star" DiveNeutronNodeScript = "services/cosmvm/neutron/src/node-setup/start_node.star" + RelayServiceNameIconToCosmos = "ibc-relayer" DiveNeutronDefaultNodeScript = "services/cosmvm/neutron/neutron.star" DiveBridgeScript = "main.star" DiveDryRun = false