Skip to content

Commit

Permalink
addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bermuell committed Jan 10, 2024
1 parent 9724657 commit b758c2e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 73 deletions.
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ test-e2e-multi-consumer:
test-e2e-parallel:
go run ./tests/e2e/... --include-multi-consumer --parallel

# run E2E compatibility tests for v3.x
test-e2e-compatibility-v3:
go run ./tests/e2e/... -parallel -tc compatibility -pv v3.2.0-rc1 -pv v3.1.0 -pv v3.0.0 -cv v3.2.0-rc1 -cv v3.1.0 -cv v3.0.0

# run full E2E tests in sequence (including multiconsumer) using latest tagged gaia
test-gaia-e2e:
go run ./tests/e2e/... --include-multi-consumer --use-gaia
Expand Down
94 changes: 47 additions & 47 deletions tests/e2e/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,53 @@ type StartConsumerChainAction struct {
GenesisChanges string
}

func (tr *TestConfig) startConsumerChain(
action StartConsumerChainAction,
target ExecutionTarget,
verbose bool,
) {
fmt.Println("Starting consumer chain ", action.ConsumerChain)
consumerGenesis := ".app_state.ccvconsumer = " + tr.getConsumerGenesis(action.ProviderChain, action.ConsumerChain, target)
consumerGenesisChanges := tr.chainConfigs[action.ConsumerChain].GenesisChanges
if consumerGenesisChanges != "" {
consumerGenesis = consumerGenesis + " | " + consumerGenesisChanges + " | " + action.GenesisChanges
}

tr.startChain(StartChainAction{
Chain: action.ConsumerChain,
Validators: action.Validators,
GenesisChanges: consumerGenesis,
IsConsumer: true,
}, target, verbose)
}

// Get consumer genesis from provider
func (tr *TestConfig) getConsumerGenesis(providerChain, consumerChain ChainID, target ExecutionTarget) string {
fmt.Println("Exporting consumer genesis from provider")
providerBinaryName := tr.chainConfigs[providerChain].BinaryName

cmd := target.ExecCommand(
providerBinaryName,

"query", "provider", "consumer-genesis",
string(tr.chainConfigs[consumerChain].ChainId),

`--node`, tr.getQueryNode(providerChain),
`-o`, `json`,
)

bz, err := cmd.CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}

// only needed when consumer is running v3.3.x and later
if tr.transformGenesis {
return string(tr.transformConsumerGenesis(consumerChain, bz, target))
}
return string(bz)
}

// Transform consumer genesis content from older version
func (tr *TestConfig) transformConsumerGenesis(consumerChain ChainID, genesis []byte, target ExecutionTarget) []byte {
fmt.Println("Transforming consumer genesis")
Expand Down Expand Up @@ -523,53 +570,6 @@ func (tr *TestConfig) transformConsumerGenesis(consumerChain ChainID, genesis []
return result
}

// Get consumer genesis from provider
func (tr *TestConfig) getConsumerGenesis(providerChain, consumerChain ChainID, target ExecutionTarget) string {
fmt.Println("Exporting consumer genesis from provider")
providerBinaryName := tr.chainConfigs[providerChain].BinaryName

cmd := target.ExecCommand(
providerBinaryName,

"query", "provider", "consumer-genesis",
string(tr.chainConfigs[consumerChain].ChainId),

`--node`, tr.getQueryNode(providerChain),
`-o`, `json`,
)

bz, err := cmd.CombinedOutput()
if err != nil {
log.Fatal(err, "\n", string(bz))
}

// only needed when consumer is running v3.3.x and later
if tr.transformGenesis {
return string(tr.transformConsumerGenesis(consumerChain, bz, target))
}
return string(bz)
}

func (tr *TestConfig) startConsumerChain(
action StartConsumerChainAction,
target ExecutionTarget,
verbose bool,
) {
fmt.Println("Starting consumer chain ", action.ConsumerChain)
consumerGenesis := ".app_state.ccvconsumer = " + tr.getConsumerGenesis(action.ProviderChain, action.ConsumerChain, target)
consumerGenesisChanges := tr.chainConfigs[action.ConsumerChain].GenesisChanges
if consumerGenesisChanges != "" {
consumerGenesis = consumerGenesis + " | " + consumerGenesisChanges + " | " + action.GenesisChanges
}

tr.startChain(StartChainAction{
Chain: action.ConsumerChain,
Validators: action.Validators,
GenesisChanges: consumerGenesis,
IsConsumer: true,
}, target, verbose)
}

type ChangeoverChainAction struct {
SovereignChain ChainID
ProviderChain ChainID
Expand Down
20 changes: 0 additions & 20 deletions tests/e2e/compatibility_tests.go

This file was deleted.

2 changes: 0 additions & 2 deletions tests/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ 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")
consumerVersions VersionSet
providerVersions VersionSet
transformGenesis = flag.Bool("transform-genesis", false, "do consumer genesis transformation for newer clients. Needed when provider chain is on an older version")
Expand Down

0 comments on commit b758c2e

Please sign in to comment.