diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index fa384395291..4370d5924d9 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -349,6 +349,7 @@ func NewAppKeeper( // Set legacy router for backwards compatibility with gov v1beta1 govKeeper.SetLegacyRouter(govRouter) + // appKeepers.GovKeeper = *govKeeper appKeepers.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( // register the governance hooks diff --git a/app/modules.go b/app/modules.go index c4ea6437ad0..b9d4435e026 100644 --- a/app/modules.go +++ b/app/modules.go @@ -48,8 +48,8 @@ import ( ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - ibcprovider "github.com/cosmos/interchain-security/v3/x/ccv/provider" - ibcproviderclient "github.com/cosmos/interchain-security/v3/x/ccv/provider/client" + icsprovider "github.com/cosmos/interchain-security/v3/x/ccv/provider" + icsproviderclient "github.com/cosmos/interchain-security/v3/x/ccv/provider/client" providertypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" "github.com/strangelove-ventures/packet-forward-middleware/v7/router" @@ -90,9 +90,9 @@ var ModuleBasics = module.NewBasicManager( upgradeclient.LegacyCancelProposalHandler, ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler, - ibcproviderclient.ConsumerAdditionProposalHandler, - ibcproviderclient.ConsumerRemovalProposalHandler, - ibcproviderclient.EquivocationProposalHandler, + icsproviderclient.ConsumerAdditionProposalHandler, + icsproviderclient.ConsumerRemovalProposalHandler, + icsproviderclient.EquivocationProposalHandler, }, ), sdkparams.AppModuleBasic{}, @@ -109,7 +109,7 @@ var ModuleBasics = module.NewBasicManager( router.AppModuleBasic{}, ica.AppModuleBasic{}, globalfee.AppModule{}, - ibcprovider.AppModuleBasic{}, + icsprovider.AppModuleBasic{}, consensus.AppModuleBasic{}, ) diff --git a/go.mod b/go.mod index 2e25abfaaf3..ea03416f003 100644 --- a/go.mod +++ b/go.mod @@ -7,13 +7,13 @@ require ( cosmossdk.io/math v1.0.1 cosmossdk.io/simapp v0.0.0-20230602123434-616841b9704d cosmossdk.io/tools/rosetta v0.2.1 - github.com/cometbft/cometbft v0.37.1 + github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 github.com/cosmos/cosmos-sdk v0.47.3 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.1.0 - github.com/cosmos/interchain-security/v3 v3.0.0-rc0 + github.com/cosmos/interchain-security/v3 v3.1.0 github.com/gorilla/mux v1.8.0 github.com/rakyll/statik v0.1.7 github.com/spf13/cast v1.5.1 diff --git a/go.sum b/go.sum index d323d9de5d6..0cc85bd6eb5 100644 --- a/go.sum +++ b/go.sum @@ -569,8 +569,8 @@ github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= -github.com/cometbft/cometbft v0.37.1 h1:KLxkQTK2hICXYq21U2hn1W5hOVYUdQgDQ1uB+90xPIg= -github.com/cometbft/cometbft v0.37.1/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= +github.com/cometbft/cometbft v0.37.2 h1:XB0yyHGT0lwmJlFmM4+rsRnczPlHoAKFX6K8Zgc2/Jc= +github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= @@ -609,8 +609,8 @@ github.com/cosmos/ibc-go/v7 v7.1.0 h1:SCLgs7tqVnzdIDO5MRLgovAnc696vTTKl+8qsTu8IM github.com/cosmos/ibc-go/v7 v7.1.0/go.mod h1:7MptlWeIyqmDiuJeRAFqBvXKY8Hybd+rF8vMSmGd2zg= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= -github.com/cosmos/interchain-security/v3 v3.0.0-rc0 h1:Rm2oMSCod27YkEHFZu5BqjkN3HYtxOrcuHDKMYJBDtw= -github.com/cosmos/interchain-security/v3 v3.0.0-rc0/go.mod h1:HKHw9u4xMm5QJV76A03ORAXB2zisgpcunXZSca8TBdg= +github.com/cosmos/interchain-security/v3 v3.1.0 h1:EKDJCIKIDLG45tvKwfoANrRPgqvqfUt/f1TNKx3b7Uo= +github.com/cosmos/interchain-security/v3 v3.1.0/go.mod h1:2fILBgypEZcwR3BSzKDw+EsYtMKv9Z6cYXfouh4xTYU= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= diff --git a/proto/buf.lock b/proto/buf.lock index 92d4c31f60d..9266086911f 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -26,6 +26,11 @@ deps: repository: ics23 commit: 55085f7c710a45f58fa09947208eb70b digest: shake256:9bf0bc495b5a11c88d163d39ef521bc4b00bc1374a05758c91d82821bdc61f09e8c2c51dda8452529bf80137f34d852561eacbe9550a59015d51cecb0dacb628 + - remote: buf.build + owner: cosmos + repository: interchain-security + commit: 4fcaba68958648a180fdc72c487018b5 + digest: shake256:a699ee174513d757cbd2f7a5827f9622b15c0204fe850bdeedbeb4e141f6c33a0e3e341e7aaf6cdd2e05f3deaf6932282805a090b0624759a2418ed7aceb3bc7 - remote: buf.build owner: googleapis repository: googleapis diff --git a/proto/buf.yaml b/proto/buf.yaml index d8b1f9ce8ef..0be5bfc26d7 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -11,6 +11,7 @@ deps: - buf.build/cosmos/ibc:fbb44f5ad3194450af479a615fa715d9 - buf.build/googleapis/googleapis - buf.build/cosmos/ics23:b1abd8678aab07165efd453c96796a179eb3131f + - buf.build/cosmos/interchain-security:064c601231b85066bfaf734efec2751a672528a7 breaking: use: diff --git a/tests/e2e/chain.go b/tests/e2e/chain.go index c8a8eb43468..22339a351a7 100644 --- a/tests/e2e/chain.go +++ b/tests/e2e/chain.go @@ -19,6 +19,7 @@ import ( govv1beta1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" paramsproptypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + providertypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" gaiaparams "github.com/cosmos/gaia/v11/app/params" ) @@ -48,6 +49,7 @@ func init() { upgradetypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) distribtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + providertypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) cdc = encodingConfig.Marshaler txConfig = encodingConfig.TxConfig diff --git a/tests/e2e/docker/hermes.Dockerfile b/tests/e2e/docker/hermes.Dockerfile index 8230f1f22ba..81d675079f8 100644 --- a/tests/e2e/docker/hermes.Dockerfile +++ b/tests/e2e/docker/hermes.Dockerfile @@ -1,4 +1,4 @@ -FROM informalsystems/hermes:1.4.1 AS hermes-builder +FROM --platform=linux/amd64 informalsystems/hermes:1.4.1 AS hermes-builder FROM debian:buster-slim USER root diff --git a/tests/e2e/e2e_exec_test.go b/tests/e2e/e2e_exec_test.go index 7d6ecb8fc67..2ba718b430b 100644 --- a/tests/e2e/e2e_exec_test.go +++ b/tests/e2e/e2e_exec_test.go @@ -380,7 +380,6 @@ func (s *IntegrationTestSuite) runGovExec(c *chain, valIdx int, submitterAddr, g } gaiaCommand = concatFlags(gaiaCommand, proposalFlags, generalFlags) - s.T().Logf("Executing gaiad tx gov %s on chain %s", govCommand, c.id) s.executeGaiaTxCommand(ctx, c, gaiaCommand, valIdx, s.defaultExecValidation(c, valIdx)) s.T().Logf("Successfully executed %s", govCommand) diff --git a/tests/e2e/e2e_gov_test.go b/tests/e2e/e2e_gov_test.go index 2e7a6684814..0756f8277f1 100644 --- a/tests/e2e/e2e_gov_test.go +++ b/tests/e2e/e2e_gov_test.go @@ -147,64 +147,8 @@ func (s *IntegrationTestSuite) GovCommunityPoolSpend() { ) } -/* -AddRemoveConsumerChain tests adding and subsequently removing a new consumer chain to Gaia. -Test Benchmarks: -1. Submit and pass proposal to add consumer chain -2. Validation that consumer chain was added -3. Submit and pass proposal to remove consumer chain -4. Validation that consumer chain was removed -*/ -// func (s *IntegrationTestSuite) AddRemoveConsumerChain() { -// s.fundCommunityPool() -// chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp")) -// proposerAddress, _ := s.chainA.validators[0].keyInfo.GetAddress() -// sender := proposerAddress.String() -// consumerChainID := "consumer" -// s.writeAddRemoveConsumerProposals(s.chainA, consumerChainID) - -// // Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query -// // Add Consumer Chain -// proposalCounter++ -// submitGovFlags := []string{"consumer-addition", configFile(proposalAddConsumerChainFilename)} -// depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()} -// voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} -// s.runGovProcess(chainAAPIEndpoint, sender, proposalCounter, ccvtypes.ProposalTypeConsumerAddition, submitGovFlags, depositGovFlags, voteGovFlags, "vote", false) - -// // Query and assert consumer has been added -// s.execQueryConsumerChains(s.chainA, 0, gaiaHomePath, validateConsumerAddition, consumerChainID) - -// // Remove Consumer Chain -// proposalCounter++ -// submitGovFlags = []string{"consumer-removal", configFile(proposalRemoveConsumerChainFilename)} -// depositGovFlags = []string{strconv.Itoa(proposalCounter), depositAmount.String()} -// voteGovFlags = []string{strconv.Itoa(proposalCounter), "yes"} -// s.runGovProcess(chainAAPIEndpoint, sender, proposalCounter, ccvtypes.ProposalTypeConsumerRemoval, submitGovFlags, depositGovFlags, voteGovFlags, "vote", false) -// // Query and assert consumer has been removed -// s.execQueryConsumerChains(s.chainA, 0, gaiaHomePath, validateConsumerRemoval, consumerChainID) -// } - -// func validateConsumerAddition(res ccvtypes.QueryConsumerChainsResponse, consumerChainID string) bool { -// if res.Size() == 0 { -// return false -// } -// for _, chain := range res.GetChains() { -// return strings.Compare(chain.ChainId, consumerChainID) == 0 -// } -// return false -// } - -// func validateConsumerRemoval(res ccvtypes.QueryConsumerChainsResponse, consumerChainID string) bool { -// if res.Size() > 0 { -// for _, chain := range res.GetChains() { -// if strings.Compare(chain.ChainId, consumerChainID) == 0 { -// return false -// } -// } -// } -// return true -// } - +// NOTE: @MSalopek +// rename to runGovLegacyProcess or submitLegacyGovProposal func (s *IntegrationTestSuite) runGovProcess(chainAAPIEndpoint, sender string, proposalID int, proposalType string, submitFlags []string, depositFlags []string, voteFlags []string, voteCommand string, withDeposit bool) { s.T().Logf("Submitting Gov Proposal: %s", proposalType) // min deposit of 1000uatom is required in e2e tests, otherwise the gov antehandler causes the proposal to be dropped @@ -219,6 +163,8 @@ func (s *IntegrationTestSuite) runGovProcess(chainAAPIEndpoint, sender string, p s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, voteCommand, voteFlags, govtypesv1beta1.StatusPassed) } +// NOTE: @MSalopek +// rename to runGovProcess or submitGovProposal func (s *IntegrationTestSuite) runGovProcessV1(chainAAPIEndpoint, sender string, proposalID int, proposalType string, submitFlags []string, depositFlags []string, voteFlags []string, voteCommand string, withDeposit bool) { s.T().Logf("Submitting Gov Proposal: %s", proposalType) // min deposit of 1000uatom is required in e2e tests, otherwise the gov antehandler causes the proposal to be dropped @@ -282,7 +228,6 @@ func (s *IntegrationTestSuite) submitGovCommand(chainAAPIEndpoint, sender string func() bool { proposal, err := queryGovProposal(chainAAPIEndpoint, proposalID) s.Require().NoError(err) - return proposal.GetProposal().Status == expectedSuccessStatus }, 15*time.Second, diff --git a/tests/e2e/e2e_ics_test.go b/tests/e2e/e2e_ics_test.go new file mode 100644 index 00000000000..b30ac32311f --- /dev/null +++ b/tests/e2e/e2e_ics_test.go @@ -0,0 +1,139 @@ +package e2e + +import ( + "encoding/json" + "fmt" + "path/filepath" + "strconv" + "strings" + "time" + + ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + providertypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" +) + +const ( + proposalAddConsumerChainFilename = "proposal_add_consumer.json" + proposalRemoveConsumerChainFilename = "proposal_remove_consumer.json" +) + +type ConsumerAdditionProposalWithDeposit struct { + providertypes.ConsumerAdditionProposal + Deposit string `json:"deposit"` + Summary string `json:"summary"` // required on legacy proposals +} + +type ConsumerRemovalProposalWithDeposit struct { + providertypes.ConsumerRemovalProposal + Deposit string `json:"deposit"` + Summary string `json:"summary"` // required on legacy proposals +} + +func (s *IntegrationTestSuite) writeAddRemoveConsumerProposals(c *chain, consumerChainID string) { + hash, _ := json.Marshal("Z2VuX2hhc2g=") + addProp := &providertypes.ConsumerAdditionProposal{ + Title: "Create consumer chain", + Description: "First consumer chain", + ChainId: consumerChainID, + InitialHeight: ibcclienttypes.Height{ + RevisionHeight: 1, + }, + GenesisHash: hash, + BinaryHash: hash, + SpawnTime: time.Now(), + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + } + addPropWithDeposit := ConsumerAdditionProposalWithDeposit{ + ConsumerAdditionProposal: *addProp, + Deposit: "1000uatom", + // Summary is + Summary: "Summary for the First consumer chain addition proposal", + } + + removeProp := &providertypes.ConsumerRemovalProposal{ + Title: "Remove consumer chain", + Description: "Removing consumer chain", + ChainId: consumerChainID, + StopTime: time.Now(), + } + + removePropWithDeposit := ConsumerRemovalProposalWithDeposit{ + ConsumerRemovalProposal: *removeProp, + Summary: "Summary for the First consumer chain removal proposal", + Deposit: "1000uatom", + } + + consumerAddBody, err := json.MarshalIndent(addPropWithDeposit, "", " ") + s.Require().NoError(err) + + consumerRemoveBody, err := json.MarshalIndent(removePropWithDeposit, "", " ") + s.Require().NoError(err) + + err = writeFile(filepath.Join(c.validators[0].configDir(), "config", proposalAddConsumerChainFilename), consumerAddBody) + s.Require().NoError(err) + err = writeFile(filepath.Join(c.validators[0].configDir(), "config", proposalRemoveConsumerChainFilename), consumerRemoveBody) + s.Require().NoError(err) +} + +/* +AddRemoveConsumerChain tests adding and subsequently removing a new consumer chain to Gaia. +Test Benchmarks: +1. Submit and pass proposal to add consumer chain +2. Validation that consumer chain was added +3. Submit and pass proposal to remove consumer chain +4. Validation that consumer chain was removed +*/ +func (s *IntegrationTestSuite) AddRemoveConsumerChain() { + s.fundCommunityPool() + chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp")) + proposerAddress, _ := s.chainA.validators[0].keyInfo.GetAddress() + sender := proposerAddress.String() + consumerChainID := "consumer" + s.writeAddRemoveConsumerProposals(s.chainA, consumerChainID) + + // Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query + // Add Consumer Chain + proposalCounter++ + submitGovFlags := []string{"consumer-addition", configFile(proposalAddConsumerChainFilename)} + depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()} + voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} + s.runGovProcess(chainAAPIEndpoint, sender, proposalCounter, providertypes.ProposalTypeConsumerAddition, submitGovFlags, depositGovFlags, voteGovFlags, "vote", false) + + // Query and assert consumer has been added + s.execQueryConsumerChains(s.chainA, 0, gaiaHomePath, validateConsumerAddition, consumerChainID) + + // Remove Consumer Chain + proposalCounter++ + submitGovFlags = []string{"consumer-removal", configFile(proposalRemoveConsumerChainFilename)} + depositGovFlags = []string{strconv.Itoa(proposalCounter), depositAmount.String()} + voteGovFlags = []string{strconv.Itoa(proposalCounter), "yes"} + s.runGovProcess(chainAAPIEndpoint, sender, proposalCounter, providertypes.ProposalTypeConsumerRemoval, submitGovFlags, depositGovFlags, voteGovFlags, "vote", false) + // Query and assert consumer has been removed + s.execQueryConsumerChains(s.chainA, 0, gaiaHomePath, validateConsumerRemoval, consumerChainID) +} + +func validateConsumerAddition(res providertypes.QueryConsumerChainsResponse, consumerChainID string) bool { + if res.Size() == 0 { + return false + } + for _, chain := range res.GetChains() { + return strings.Compare(chain.ChainId, consumerChainID) == 0 + } + return false +} + +func validateConsumerRemoval(res providertypes.QueryConsumerChainsResponse, consumerChainID string) bool { + if res.Size() > 0 { + for _, chain := range res.GetChains() { + if strings.Compare(chain.ChainId, consumerChainID) == 0 { + return false + } + } + } + return true +} diff --git a/tests/e2e/e2e_query_exec_test.go b/tests/e2e/e2e_query_exec_test.go index 184732a6a16..666af3ec1c2 100644 --- a/tests/e2e/e2e_query_exec_test.go +++ b/tests/e2e/e2e_query_exec_test.go @@ -1,47 +1,47 @@ package e2e -// import ( -// "context" -// "fmt" -// "time" +import ( + "context" + "fmt" + "time" -// ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" -// "github.com/cosmos/cosmos-sdk/client/flags" -// ) + "github.com/cosmos/cosmos-sdk/client/flags" +) -// func (s *IntegrationTestSuite) execQueryConsumerChains( -// c *chain, -// valIdx int, -// homePath string, -// queryValidation func(res ccvtypes.QueryConsumerChainsResponse, consumerChainId string) bool, -// consumerChainID string, -// ) { -// ctx, cancel := context.WithTimeout(context.Background(), time.Minute) -// defer cancel() +func (s *IntegrationTestSuite) execQueryConsumerChains( + c *chain, + valIdx int, + homePath string, + queryValidation func(res ccvtypes.QueryConsumerChainsResponse, consumerChainId string) bool, + consumerChainID string, +) { + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() -// s.T().Logf("Querying consumer chains for chain: %s", c.id) -// gaiaCommand := []string{ -// gaiadBinary, -// "query", -// "provider", -// "list-consumer-chains", -// fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), -// fmt.Sprintf("--%s=%s", flags.FlagHome, homePath), -// "--output=json", -// } + s.T().Logf("Querying consumer chains for chain: %s", c.id) + gaiaCommand := []string{ + gaiadBinary, + "query", + "provider", + "list-consumer-chains", + fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), + fmt.Sprintf("--%s=%s", flags.FlagHome, homePath), + "--output=json", + } -// s.executeGaiaTxCommand(ctx, c, gaiaCommand, valIdx, s.validateQueryConsumers(queryValidation, consumerChainID)) -// s.T().Logf("Successfully queried consumer chains for chain %s", c.id) -// } + s.executeGaiaTxCommand(ctx, c, gaiaCommand, valIdx, s.validateQueryConsumers(queryValidation, consumerChainID)) + s.T().Logf("Successfully queried consumer chains for chain %s", c.id) +} -// func (s *IntegrationTestSuite) validateQueryConsumers(queryValidation func(ccvtypes.QueryConsumerChainsResponse, string) bool, consumerChainID string) func([]byte, []byte) bool { -// return func(stdOut []byte, stdErr []byte) bool { -// var queryConsumersRes ccvtypes.QueryConsumerChainsResponse -// if err := cdc.UnmarshalJSON(stdOut, &queryConsumersRes); err != nil { -// s.T().Logf("Error unmarshalling query consumer chains: %s", err.Error()) -// return false -// } -// return queryValidation(queryConsumersRes, consumerChainID) -// } -// } +func (s *IntegrationTestSuite) validateQueryConsumers(queryValidation func(ccvtypes.QueryConsumerChainsResponse, string) bool, consumerChainID string) func([]byte, []byte) bool { + return func(stdOut []byte, stdErr []byte) bool { + var queryConsumersRes ccvtypes.QueryConsumerChainsResponse + if err := cdc.UnmarshalJSON(stdOut, &queryConsumersRes); err != nil { + s.T().Logf("Error unmarshalling query consumer chains: %s", err.Error()) + return false + } + return queryValidation(queryConsumersRes, consumerChainID) + } +} diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index 84bdf6499e4..9aa1ef43de7 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -38,7 +38,6 @@ import ( "github.com/ory/dockertest/v3" "github.com/stretchr/testify/suite" - // // ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" // "github.com/cosmos/cosmos-sdk/crypto/hd" // "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/ory/dockertest/v3/docker" @@ -600,7 +599,6 @@ func (s *IntegrationTestSuite) runValidators(c *chain, portOffset int) { if status.SyncInfo.CatchingUp || status.SyncInfo.LatestBlockHeight < 3 { return false } - return true }, 5*time.Minute, @@ -910,63 +908,6 @@ func (s *IntegrationTestSuite) writeGovLegProposal(c *chain, height int64, name s.Require().NoError(err) } -// type ConsumerAdditionProposalWithDeposit struct { -// ccvprovider.ConsumerAdditionProposal -// Deposit string `json:"deposit"` -// } -// -// type ConsumerRemovalProposalWithDeposit struct { -// ccvprovider.ConsumerRemovalProposal -// Deposit string `json:"deposit"` -// } -// -// func (s *IntegrationTestSuite) writeAddRemoveConsumerProposals(c *chain, consumerChainID string) { -// hash, _ := json.Marshal("Z2VuX2hhc2g=") -// addProp := &ccvprovider.ConsumerAdditionProposal{ -// Title: "Create consumer chain", -// Description: "First consumer chain", -// ChainId: consumerChainID, -// InitialHeight: ibcclienttypes.Height{ -// RevisionHeight: 1, -// }, -// GenesisHash: hash, -// BinaryHash: hash, -// SpawnTime: time.Now(), -// UnbondingPeriod: time.Duration(100000000000), -// CcvTimeoutPeriod: time.Duration(100000000000), -// TransferTimeoutPeriod: time.Duration(100000000000), -// ConsumerRedistributionFraction: "0.75", -// BlocksPerDistributionTransmission: 10, -// HistoricalEntries: 10000, -// } -// addPropWithDeposit := ConsumerAdditionProposalWithDeposit{ -// ConsumerAdditionProposal: *addProp, -// Deposit: "1000uatom", -// } -// -// removeProp := &ccvprovider.ConsumerRemovalProposal{ -// Title: "Remove consumer chain", -// Description: "Removing consumer chain", -// ChainId: consumerChainID, -// StopTime: time.Now(), -// } -// -// removePropWithDeposit := ConsumerRemovalProposalWithDeposit{ -// ConsumerRemovalProposal: *removeProp, -// Deposit: "1000uatom", -// } -// -// consumerAddBody, err := json.MarshalIndent(addPropWithDeposit, "", " ") -// s.Require().NoError(err) -// -// consumerRemoveBody, err := json.MarshalIndent(removePropWithDeposit, "", " ") -// s.Require().NoError(err) -// -// err = writeFile(filepath.Join(c.validators[0].configDir(), "config", proposalAddConsumerChainFilename), consumerAddBody) -// s.Require().NoError(err) -// err = writeFile(filepath.Join(c.validators[0].configDir(), "config", proposalRemoveConsumerChainFilename), consumerRemoveBody) -// s.Require().NoError(err) -// } func configFile(filename string) string { filepath := filepath.Join(gaiaConfigPath, filename) return filepath diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index daf20a21a86..6f5d231b2ef 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -76,7 +76,7 @@ func (s *IntegrationTestSuite) TestGov() { s.GovSoftwareUpgrade() s.GovCancelSoftwareUpgrade() s.GovCommunityPoolSpend() - // s.AddRemoveConsumerChain() + s.AddRemoveConsumerChain() } func (s *IntegrationTestSuite) TestIBC() {