Skip to content

Commit

Permalink
fix: test changing params using legacy proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalopek committed May 17, 2023
1 parent c6f74f5 commit cb5fb2a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
15 changes: 9 additions & 6 deletions app/consumer-democracy/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import (
"github.com/cosmos/cosmos-sdk/client/flags"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/x/consensus"
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
appparams "github.com/cosmos/interchain-security/app/params"
Expand Down Expand Up @@ -165,6 +167,7 @@ var (
tendermint.AppModuleBasic{},
// router.AppModuleBasic{},
consumer.AppModuleBasic{},
consensus.AppModuleBasic{},
)

// module account permissions
Expand Down Expand Up @@ -270,7 +273,7 @@ func New(
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey,
capabilitytypes.StoreKey, authzkeeper.StoreKey,
capabilitytypes.StoreKey, authzkeeper.StoreKey, consensusparamtypes.StoreKey,
consumertypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -428,11 +431,7 @@ func New(

govKeeper.SetLegacyRouter(ccvgovRouter)

app.GovKeeper = *govKeeper.SetHooks(
govtypes.NewMultiGovHooks(
// register the governance hooks
),
)
app.GovKeeper = *govKeeper

// pre-initialize ConsumerKeeper to satsfy ibckeeper.NewKeeper
// which would panic on nil or zero keeper
Expand Down Expand Up @@ -556,6 +555,7 @@ func New(
ibc.NewAppModule(app.IBCKeeper),
transferModule,
consumerModule,
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand All @@ -582,6 +582,7 @@ func New(
paramstypes.ModuleName,
vestingtypes.ModuleName,
genutiltypes.ModuleName,
consensusparamtypes.ModuleName,
ibctransfertypes.ModuleName,
ibchost.ModuleName,
consumertypes.ModuleName,
Expand All @@ -602,6 +603,7 @@ func New(
paramstypes.ModuleName,
upgradetypes.ModuleName,
genutiltypes.ModuleName,
consensusparamtypes.ModuleName,
vestingtypes.ModuleName,
ibctransfertypes.ModuleName,
ibchost.ModuleName,
Expand Down Expand Up @@ -631,6 +633,7 @@ func New(
upgradetypes.ModuleName,
vestingtypes.ModuleName,
genutiltypes.ModuleName,
consensusparamtypes.ModuleName,
ibchost.ModuleName,
ibctransfertypes.ModuleName,
consumertypes.ModuleName,
Expand Down
13 changes: 6 additions & 7 deletions tests/e2e/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func (tr TestRun) submitConsumerRemovalProposal(
tr.waitBlocks(chainID("provi"), 2, 20*time.Second)
}

type submitParamChangeProposalAction struct {
type submitParamChangeLegacyProposalAction struct {
chain chainID
from validatorID
deposit uint
Expand All @@ -355,13 +355,13 @@ type paramChangeJSON struct {
}

func (tr TestRun) submitParamChangeProposal(
action submitParamChangeProposalAction,
action submitParamChangeLegacyProposalAction,
verbose bool,
) {
prop := paramChangeProposalJSON{
Title: "Param change",
Summary: "Changing module params",
Description: "Changing module params",
Title: "Legacy Param change",
Summary: "Changing legacy module params",
Description: "Changing legacy module params",
Changes: []paramChangeJSON{{Subspace: action.subspace, Key: action.key, Value: action.value}},
Deposit: fmt.Sprint(action.deposit) + `stake`,
}
Expand Down Expand Up @@ -396,9 +396,8 @@ func (tr TestRun) submitParamChangeProposal(
`--keyring-backend`, `test`,
`-y`,
)
fmt.Println("#", cmd.String())

bz, err = cmd.CombinedOutput()
fmt.Println("BZ", string(bz))
if err != nil {
log.Fatal(err, "\n", string(bz))
}
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ func main() {
}

testRuns := []testRunWithSteps{
{DefaultTestRun(), happyPathSteps},
// {DefaultTestRun(), happyPathSteps},
{DemocracyTestRun(), democracySteps},
{SlashThrottleTestRun(), slashThrottleSteps},
// {SlashThrottleTestRun(), slashThrottleSteps},
}
if includeMultiConsumer != nil && *includeMultiConsumer {
testRuns = append(testRuns, testRunWithSteps{MultiConsumerTestRun(), multipleConsumers})
Expand Down Expand Up @@ -105,7 +105,7 @@ func (tr *TestRun) runStep(step Step, verbose bool) {
tr.submitConsumerRemovalProposal(action, verbose)
case submitEquivocationProposalAction:
tr.submitEquivocationProposal(action, verbose)
case submitParamChangeProposalAction:
case submitParamChangeLegacyProposalAction:
tr.submitParamChangeProposal(action, verbose)
case voteGovProposalAction:
tr.voteGovProposal(action, verbose)
Expand Down
17 changes: 9 additions & 8 deletions tests/e2e/steps_democracy.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ func stepsDemocracy(consumerName string) []Step {
},
},
{
action: submitParamChangeProposalAction{
// whitelisted legacy proposal can only handle ibctransfer.SendEnabled/ReceiveEnabled
action: submitParamChangeLegacyProposalAction{
chain: chainID(consumerName),
from: validatorID("alice"),
deposit: 10000001,
subspace: "staking",
key: "MaxValidators",
value: 105,
subspace: "transfer",
key: "SendEnabled",
value: true,
},
state: State{
chainID(consumerName): ChainState{
Expand All @@ -78,9 +79,9 @@ func stepsDemocracy(consumerName string) []Step {
1: ParamsProposal{
Deposit: 10000001,
Status: "PROPOSAL_STATUS_VOTING_PERIOD",
Subspace: "staking",
Key: "MaxValidators",
Value: "105",
Subspace: "transfer",
Key: "SendEnabled",
Value: "true",
},
},
},
Expand All @@ -101,7 +102,7 @@ func stepsDemocracy(consumerName string) []Step {
validatorID("bob"): 9960000001,
},
// Check that the parameter is changed on gov-consumer chain
Params: &([]Param{{Subspace: "staking", Key: "MaxValidators", Value: "105"}}),
Params: &([]Param{{Subspace: "transfer", Key: "SendEnabled", Value: "true"}}),
},
},
},
Expand Down

0 comments on commit cb5fb2a

Please sign in to comment.