Skip to content

Commit

Permalink
chore: fix upgrade proposals for sovereign
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalopek committed Jun 22, 2023
1 parent 0cf3855 commit bf1f220
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 22 deletions.
11 changes: 11 additions & 0 deletions app/sovereign/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (
"os"
"path/filepath"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
appparams "github.com/cosmos/interchain-security/v3/app/params"

"github.com/cosmos/cosmos-sdk/baseapp"
Expand Down Expand Up @@ -626,6 +629,14 @@ func New(
app.ScopedIBCKeeper = scopedIBCKeeper
app.ScopedTransferKeeper = scopedTransferKeeper

autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.MM.Modules))

reflectionSvc, err := runtimeservices.NewReflectionService()
if err != nil {
panic(err)
}
reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc)

return app
}

Expand Down
10 changes: 6 additions & 4 deletions tests/e2e/actions_sovereign_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,16 @@ func (tr TestRun) startSovereignChain(
}, verbose)
}

type UpgradeProposalAction struct {
type LegacyUpgradeProposalAction struct {
chainID chainID
upgradeTitle string
proposer validatorID
upgradeHeight uint64
}

func (tr *TestRun) submitUpgradeProposal(action UpgradeProposalAction, verbose bool) {
func (tr *TestRun) submitLegacyUpgradeProposal(action LegacyUpgradeProposalAction, verbose bool) {
submit := fmt.Sprintf(
`%s tx gov submit-proposal software-upgrade %s \
`%s tx gov submit-legacy-proposal software-upgrade %s \
--title %s \
--deposit 10000000stake \
--upgrade-height %s \
Expand All @@ -126,7 +126,7 @@ func (tr *TestRun) submitUpgradeProposal(action UpgradeProposalAction, verbose b
--chain-id %s \
--home %s \
--node %s \
-b block \
--no-validate \
-y`,
tr.chainConfigs[chainID("sover")].binaryName,
action.upgradeTitle,
Expand All @@ -152,6 +152,8 @@ func (tr *TestRun) submitUpgradeProposal(action UpgradeProposalAction, verbose b
if err != nil {
log.Fatal(err, "\n", string(bz))
}

tr.waitBlocks(action.chainID, 1, 15*time.Second)
}

type waitUntilBlockAction struct {
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,12 @@ func ChangeoverTestRun() TestRun {
binaryName: "interchain-security-pd",
ipPrefix: "7.7.7",
votingWaitTime: 20,
genesisChanges: ".app_state.gov.voting_params.voting_period = \"20s\" | " +
genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
// Custom slashing parameters for testing validator downtime functionality
// See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking
".app_state.slashing.params.signed_blocks_window = \"10\" | " +
".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " +
".app_state.slashing.params.downtime_jail_duration = \"2s\" | " +
".app_state.slashing.params.downtime_jail_duration = \"60s\" | " +
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " +
".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling
".app_state.provider.params.slash_meter_replenish_period = \"3s\"",
Expand All @@ -380,10 +380,10 @@ func ChangeoverTestRun() TestRun {
upgradeBinary: "interchain-security-cdd",
ipPrefix: "7.7.8",
votingWaitTime: 20,
genesisChanges: ".app_state.gov.voting_params.voting_period = \"20s\" | " +
genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
".app_state.slashing.params.signed_blocks_window = \"15\" | " +
".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " +
".app_state.slashing.params.downtime_jail_duration = \"2s\" | " +
".app_state.slashing.params.downtime_jail_duration = \"60s\" | " +
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " +
".app_state.staking.params.unbonding_time = \"1728000s\"", // making the genesis unbonding time equal to unbonding time in the consumer addition proposal
},
Expand Down
12 changes: 6 additions & 6 deletions tests/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ func main() {

testRuns := []testRunWithSteps{
{ChangeoverTestRun(), changeoverSteps},
{DefaultTestRun(), happyPathSteps},
{DemocracyTestRun(true), democracySteps},
{DemocracyTestRun(false), rewardDenomConsumerSteps},
{SlashThrottleTestRun(), slashThrottleSteps},
// {DefaultTestRun(), happyPathSteps},
// {DemocracyTestRun(true), democracySteps},
// {DemocracyTestRun(false), rewardDenomConsumerSteps},
// {SlashThrottleTestRun(), slashThrottleSteps},
}
if includeMultiConsumer != nil && *includeMultiConsumer {
testRuns = append(testRuns, testRunWithSteps{MultiConsumerTestRun(), multipleConsumers})
Expand Down Expand Up @@ -115,8 +115,8 @@ func (tr *TestRun) runStep(step Step, verbose bool) {
tr.startChain(action, verbose)
case StartSovereignChainAction:
tr.startSovereignChain(action, verbose)
case UpgradeProposalAction:
tr.submitUpgradeProposal(action, verbose)
case LegacyUpgradeProposalAction:
tr.submitLegacyUpgradeProposal(action, verbose)
case waitUntilBlockAction:
tr.waitUntilBlockOnChain(action)
case ChangeoverChainAction:
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ func (tr TestRun) getProposal(chain chainID, proposal uint) Proposal {
},
}
case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal":
height := gjson.Get(string(bz), `content.plan.height`).Uint()
title := gjson.Get(string(bz), `content.plan.name`).String()
height := gjson.Get(string(bz), `messages.0.content.plan.height`).Uint()
title := gjson.Get(string(bz), `messages.0.content.plan.name`).String()
return UpgradeProposal{
Deposit: uint(deposit),
Status: status,
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/steps_sovereign_changeover.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func stepRunSovereignChain() []Step {
func stepsUpgradeChain() []Step {
return []Step{
{
action: UpgradeProposalAction{
action: LegacyUpgradeProposalAction{
chainID: chainID("sover"),
upgradeTitle: "sovereign-changeover",
proposer: validatorID("alice"),
Expand Down
24 changes: 19 additions & 5 deletions tests/e2e/testnet-scripts/sovereign-genesis.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"genesis_time": "2023-06-19T21:06:09.696739416Z",
"genesis_time": "2023-06-22T15:55:00.982713586Z",
"chain_id": "sover",
"initial_height": "1",
"consensus_params": {
Expand Down Expand Up @@ -35,13 +35,16 @@
"accounts": [
{
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"address": "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la",
"address": "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm",
"pub_key": null,
"account_number": "0",
"sequence": "0"
}
]
},
"authz": {
"authorization": []
},
"bank": {
"params": {
"send_enabled": [],
Expand Down Expand Up @@ -99,6 +102,9 @@
"evidence": {
"evidence": []
},
"feegrant": {
"allowances": []
},
"genutil": {
"gen_txs": [
{
Expand Down Expand Up @@ -160,7 +166,7 @@
"tip": null
},
"signatures": [
"D06i2qqq2HathlT7cy+PDLTDuYKAmzw5Ne+Ehvzr9bVy3jpm2h8deDGeSXTSrhdP04UpFXerSn+zIPth5TKNrg=="
"c7aD9dWzb85fn+Aq0ijMdhyJNJSOsOcFLvJt8ctvdxAAbwdrzKPVFbq9IYf1qCwKmfmQUrlFy40qiuQeXaZ8pg=="
]
}
]
Expand Down Expand Up @@ -199,7 +205,8 @@
"params": {
"allowed_clients": [
"06-solomachine",
"07-tendermint"
"07-tendermint",
"09-localhost"
]
},
"create_localhost": false,
Expand Down Expand Up @@ -239,6 +246,12 @@
}
},
"params": null,
"provider": {
"params": {
"slash_meter_replenish_fraction": "1.0",
"slash_meter_replenish_period": "3s"
}
},
"slashing": {
"params": {
"signed_blocks_window": "10",
Expand Down Expand Up @@ -273,7 +286,8 @@
"params": {
"send_enabled": true,
"receive_enabled": true
}
},
"total_escrowed": []
},
"upgrade": {},
"vesting": {}
Expand Down

0 comments on commit bf1f220

Please sign in to comment.