From af0fdccbcbbe73fdd9d0e9f161a8f8cb8190366a Mon Sep 17 00:00:00 2001 From: Bernd Mueller Date: Wed, 29 Nov 2023 18:56:46 +0100 Subject: [PATCH] Added cli option to enable genesis-transformation: disabled by default --- tests/e2e/actions.go | 3 ++- tests/e2e/config.go | 7 ++++--- tests/e2e/main.go | 14 +++++++++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 13b1145083..ddebea1f59 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -575,7 +575,8 @@ func (tr TestRun) startConsumerChain( log.Fatal(err, "\n", string(bz)) } - if tr.consumerVersion != "" { + // only needed when consumer is running v3.2.x and later + if tr.transformGenesis { log.Printf("@@@@ Transforming consumer genesis for a newer version: %s\n", tr.consumerVersion) log.Printf("Original ccv genesis: %s\n", string(bz)) diff --git a/tests/e2e/config.go b/tests/e2e/config.go index c98ac1fcc9..7948db35c7 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -78,9 +78,10 @@ type TestRun struct { gaiaTag string // consumer version the provider should be tested against - consumerVersion string - providerVersion string - name string + consumerVersion string + providerVersion string + transformGenesis bool + name string } func getDefaultValidators() map[validatorID]ValidatorConfig { diff --git a/tests/e2e/main.go b/tests/e2e/main.go index 0150ed4e68..056dfe3db1 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -40,6 +40,7 @@ var ( var ( useConsumerVersion = flag.String("consumer-version", "", "ICS tag to specify the consumer version to test the provider against") useProviderVersion = flag.String("provider-version", "", "ICS tag to specify the provider version to test the consumer against") + transformGenesis = flag.Bool("transform-genesis", false, "do consumer genesis transformation for newer clients. Needed when provider chain is on an older version") ) // runs E2E tests @@ -51,14 +52,14 @@ func main() { if shortHappyPathOnly != nil && *shortHappyPathOnly { fmt.Println("=============== running short happy path only ===============") tr := DefaultTestRun() - tr.Run(shortHappyPathSteps, *localSdkPath, *useGaia, *gaiaTag, *useConsumerVersion, *useProviderVersion) + tr.Run(shortHappyPathSteps, *localSdkPath, *useGaia, *gaiaTag, *useConsumerVersion, *useProviderVersion, *transformGenesis) return } if happyPathOnly != nil && *happyPathOnly { fmt.Println("=============== running happy path only ===============") tr := DefaultTestRun() - tr.Run(happyPathSteps, *localSdkPath, *useGaia, *gaiaTag, *useConsumerVersion, *useProviderVersion) + tr.Run(happyPathSteps, *localSdkPath, *useGaia, *gaiaTag, *useConsumerVersion, *useProviderVersion, *transformGenesis) return } @@ -82,7 +83,7 @@ func main() { go func(run testRunWithSteps) { defer wg.Done() tr := run.testRun - tr.Run(run.steps, *localSdkPath, *useGaia, *gaiaTag, *useConsumerVersion, *useProviderVersion) + tr.Run(run.steps, *localSdkPath, *useGaia, *gaiaTag, *useConsumerVersion, *useProviderVersion, *transformGenesis) }(run) } wg.Wait() @@ -92,18 +93,21 @@ func main() { for _, run := range testRuns { tr := run.testRun - tr.Run(run.steps, *localSdkPath, *useGaia, *gaiaTag, *useConsumerVersion, *useProviderVersion) + tr.Run(run.steps, *localSdkPath, *useGaia, *gaiaTag, *useConsumerVersion, *useProviderVersion, *transformGenesis) } fmt.Printf("TOTAL TIME ELAPSED: %v\n", time.Since(start)) } // Run sets up docker container and executes the steps in the test run. // Docker containers are torn down after the test run is complete. -func (tr *TestRun) Run(steps []Step, localSdkPath string, useGaia bool, gaiaTag string, consumerVersion string, providerVersion string) { +func (tr *TestRun) Run(steps []Step, localSdkPath string, useGaia bool, gaiaTag string, consumerVersion string, providerVersion string, transformGenesis bool) { tr.SetDockerConfig(localSdkPath, useGaia, gaiaTag, consumerVersion, providerVersion) tr.SetCometMockConfig(*useCometmock) tr.SetRelayerConfig(*useGorelayer) + // Hack to disable genesis transformation... do it smarter + tr.transformGenesis = transformGenesis + tr.validateStringLiterals() tr.startDocker() tr.executeSteps(steps)