Skip to content

Commit

Permalink
e2e: support icad binary using new genesis commands (#3309)
Browse files Browse the repository at this point in the history
* e2e: support icad binary using new genesis commands

* add logging

* bump interchaintest dependency

* use FeatureReleases

* revert change in semverGTE

* remove log message

* use branch for e2e tests

* trying to use a branch of ibc-go

* add support for gov1 gov genesis module for icad

* address review comments

* go mod tidy e2e
  • Loading branch information
Carlos Rodriguez authored May 15, 2023
1 parent 201a5bb commit 3882830
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 22 deletions.
14 changes: 4 additions & 10 deletions e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,6 @@ github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJ
github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
github.com/avast/retry-go/v4 v4.3.3 h1:G56Bp6mU0b5HE1SkaoVjscZjlQb0oy4mezwY/cGH19w=
github.com/avast/retry-go/v4 v4.3.3/go.mod h1:rg6XFaiuFYII0Xu3RDbZQkxCofFwruZKW8oEF1jpWiU=
github.com/avast/retry-go/v4 v4.3.4 h1:pHLkL7jvCvP317I8Ge+Km2Yhntv3SdkJm7uekkqbKhM=
github.com/avast/retry-go/v4 v4.3.4/go.mod h1:rv+Nla6Vk3/ilU0H51VHddWHiwimzX66yZ0JT6T+UvE=
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
Expand Down Expand Up @@ -306,6 +304,7 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cmars/basen v0.0.0-20150613233007-fe3947df716e h1:0XBUw73chJ1VYSsfvcPvVT7auykAJce9FpRr10L6Qhw=
github.com/cmars/basen v0.0.0-20150613233007-fe3947df716e/go.mod h1:P13beTBKr5Q18lJe1rIoLUqjM+CB1zYrRg44ZqGuQSA=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand Down Expand Up @@ -978,8 +977,6 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU=
github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA=
github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230417164426-9b8f7ae9bf1d h1:1H86OyIqNGoV4RSWFIs0IwB4uCczIbwZ9VfSGzT02d8=
github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230417164426-9b8f7ae9bf1d/go.mod h1:hSX04HOzi+4PmwB9TKk2FpDr1sEYO4+7QDZo4NGviRw=
github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230503171723-5e55f37618b7 h1:+FRVLRfJwZNkkipuPuK+FyY/5ZEkAjAjtiWQg6qc550=
github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230503171723-5e55f37618b7/go.mod h1:/FpoaMKTF3OREchZZvg6eGfVYvk7lAwqP9q2TN+lOGs=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
Expand Down Expand Up @@ -1705,6 +1702,7 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
launchpad.net/gocheck v0.0.0-20140225173054-000000000087 h1:Izowp2XBH6Ya6rv+hqbceQyw/gSGoXfH/UPoTGduL54=
launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM=
lukechampine.com/blake3 v1.1.7 h1:GgRMhmdsuK8+ii6UZFDL8Nb+VyMwadAgcJyfYHxG6n0=
lukechampine.com/blake3 v1.1.7/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA=
Expand All @@ -1716,8 +1714,6 @@ modernc.org/ccgo/v3 v3.16.13 h1:Mkgdzl46i5F/CNR/Kj80Ri59hC8TKAhZrYSaqvkwzUw=
modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY=
modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk=
modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=
modernc.org/libc v1.22.4 h1:wymSbZb0AlrjdAVX3cjreCHTPCpPARbQXNz6BHPzdwQ=
modernc.org/libc v1.22.4/go.mod h1:jj+Z7dTNX8fBScMVNRAYZ/jF91K8fdT2hYMThc3YjBY=
modernc.org/libc v1.22.5 h1:91BNch/e5B0uPbJFgqbxXuOnxBQjlS//icfQEGmvyjE=
modernc.org/libc v1.22.5/go.mod h1:jj+Z7dTNX8fBScMVNRAYZ/jF91K8fdT2hYMThc3YjBY=
modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ=
Expand All @@ -1726,16 +1722,14 @@ modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds=
modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/sqlite v1.22.0 h1:Uo+wEWePCspy4SAu0w2VbzUHEftOs7yoaWX/cYjsq84=
modernc.org/sqlite v1.22.0/go.mod h1:cxbLkB5WS32DnQqeH4h4o1B0eMr8W/y8/RGuxQ3JsC0=
modernc.org/sqlite v1.22.1 h1:P2+Dhp5FR1RlVRkQ3dDfCiv3Ok8XPxqpe70IjYVA9oE=
modernc.org/sqlite v1.22.1/go.mod h1:OrDj17Mggn6MhE+iPbBNf7RGKODDE9NFT0f3EwDzJqk=
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
modernc.org/tcl v1.15.1 h1:mOQwiEK4p7HruMZcwKTZPw/aqtGM4aY00uzWhlKKYws=
modernc.org/tcl v1.15.2 h1:C4ybAYCGJw968e+Me18oW55kD/FexcHbqH2xak1ROSY=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
modernc.org/z v1.7.0 h1:xkDw/KepgEjeizO2sNco+hqYkU12taxQFqPEmgm1GWE=
modernc.org/z v1.7.3 h1:zDJf6iHjrnB+WRD88stbXokugjyc0/pB91ri1gO6LZY=
nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g=
nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
Expand Down
2 changes: 1 addition & 1 deletion e2e/semverutil/semver.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (fr FeatureReleases) IsSupported(versionStr string) bool {
return true
}

if semverGTE(versionStr, fr.MajorVersion) {
if fr.MajorVersion != "" && semverGTE(versionStr, fr.MajorVersion) {
return true
}

Expand Down
47 changes: 36 additions & 11 deletions e2e/testconfig/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,18 @@ const (
// defaultConfigFileName is the default filename for the config file that can be used to configure
// e2e tests. See sample.config.yaml as an example for what this should look like.
defaultConfigFileName = ".ibc-go-e2e-config.yaml"

// icadBinary is the binary for interchain-accounts-demo repository.
icadBinary = "icad"
)

// icadNewGenesisCommandsFeatureReleases represents the releases of icad using the new genesis commands.
var icadNewGenesisCommandsFeatureReleases = semverutil.FeatureReleases{
MinorVersions: []string{
"v0.5",
},
}

func getChainImage(binary string) string {
if binary == "" {
binary = defaultBinary
Expand Down Expand Up @@ -360,6 +370,8 @@ func newDefaultSimappConfig(cc ChainConfig, name, chainID, denom string, cometCf
tmTomlOverrides["log_level"] = cometCfg.LogLevel // change to debug in ~/.ibc-go-e2e-config.json to increase cometbft logging.
configFileOverrides["config/config.toml"] = tmTomlOverrides

useNewGenesisCommand := cc.Binary == icadBinary && icadNewGenesisCommandsFeatureReleases.IsSupported(cc.Tag)

return ibc.ChainConfig{
Type: "cosmos",
Name: name,
Expand All @@ -370,25 +382,30 @@ func newDefaultSimappConfig(cc ChainConfig, name, chainID, denom string, cometCf
Version: cc.Tag,
},
},
Bin: cc.Binary,
Bech32Prefix: "cosmos",
CoinType: fmt.Sprint(sdk.GetConfig().GetCoinType()),
Denom: denom,
GasPrices: fmt.Sprintf("0.00%s", denom),
GasAdjustment: 1.3,
TrustingPeriod: "508h",
NoHostMount: false,
ModifyGenesis: getGenesisModificationFunction(cc),
ConfigFileOverrides: configFileOverrides,
Bin: cc.Binary,
Bech32Prefix: "cosmos",
CoinType: fmt.Sprint(sdk.GetConfig().GetCoinType()),
Denom: denom,
GasPrices: fmt.Sprintf("0.00%s", denom),
GasAdjustment: 1.3,
TrustingPeriod: "508h",
NoHostMount: false,
ModifyGenesis: getGenesisModificationFunction(cc),
ConfigFileOverrides: configFileOverrides,
UsingNewGenesisCommand: useNewGenesisCommand,
}
}

// getGenesisModificationFunction returns a genesis modification function that handles the GenesisState type
// correctly depending on if the govv1beta1 gov module is used or if govv1 is being used.
func getGenesisModificationFunction(cc ChainConfig) func(ibc.ChainConfig, []byte) ([]byte, error) {
binary := cc.Binary
version := cc.Tag

if govGenesisFeatureReleases.IsSupported(version) {
doesSimdSupportGovv1Genesis := binary == defaultBinary && govGenesisFeatureReleases.IsSupported(version)
doesIcadSupportGovv1Genesis := icadGovGenesisFeatureReleases.IsSupported(version)

if doesSimdSupportGovv1Genesis || doesIcadSupportGovv1Genesis {
return defaultGovv1ModifyGenesis()
}

Expand All @@ -401,6 +418,14 @@ var govGenesisFeatureReleases = semverutil.FeatureReleases{
MajorVersion: "v7",
}

// icadGovGenesisFeatureReleases represents the releases of icad where the governance module genesis
// was upgraded from v1beta1 to v1.
var icadGovGenesisFeatureReleases = semverutil.FeatureReleases{
MinorVersions: []string{
"v0.5",
},
}

// defaultGovv1ModifyGenesis will only modify governance params to ensure the voting period and minimum deposit
// are functional for e2e testing purposes.
func defaultGovv1ModifyGenesis() func(ibc.ChainConfig, []byte) ([]byte, error) {
Expand Down

0 comments on commit 3882830

Please sign in to comment.