Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: bump ics to v3.1; chore: update e2e #2663

Merged
merged 2 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ func NewAppKeeper(
// Set legacy router for backwards compatibility with gov v1beta1
govKeeper.SetLegacyRouter(govRouter)

// appKeepers.GovKeeper = *govKeeper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this ?

Suggested change
// appKeepers.GovKeeper = *govKeeper

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sry, missed the comment and merged. Will remove at a later time

appKeepers.GovKeeper = *govKeeper.SetHooks(
govtypes.NewMultiGovHooks(
// register the governance hooks
Expand Down
12 changes: 6 additions & 6 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{},
Expand All @@ -109,7 +109,7 @@ var ModuleBasics = module.NewBasicManager(
router.AppModuleBasic{},
ica.AppModuleBasic{},
globalfee.AppModule{},
ibcprovider.AppModuleBasic{},
icsprovider.AppModuleBasic{},
consensus.AppModuleBasic{},
)

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
5 changes: 5 additions & 0 deletions proto/buf.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions proto/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -48,6 +49,7 @@ func init() {

upgradetypes.RegisterInterfaces(encodingConfig.InterfaceRegistry)
distribtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry)
providertypes.RegisterInterfaces(encodingConfig.InterfaceRegistry)

cdc = encodingConfig.Marshaler
txConfig = encodingConfig.TxConfig
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/docker/hermes.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/e2e_exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
63 changes: 4 additions & 59 deletions tests/e2e/e2e_gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
139 changes: 139 additions & 0 deletions tests/e2e/e2e_ics_test.go
Original file line number Diff line number Diff line change
@@ -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
}
Loading
Loading