From 0339832b68b8e66d7edcc947bf7aeff920a69804 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Fri, 23 Jun 2023 10:06:52 +0200 Subject: [PATCH 1/2] tests: fix broken sovereign app.go (#1068) * fix: fix broken sovereign app.go * chore: fix upgrade proposals for sovereign * chore: fix sovereign app.go * chore: re-enable all tests * fix: update democ and throttle tests --- app/consumer-democracy/app.go | 3 -- app/consumer/app.go | 2 -- app/provider/app.go | 3 -- app/sovereign/app.go | 28 +++++++++++++++---- go.sum | 1 + tests/e2e/actions.go | 5 ++-- tests/e2e/actions_sovereign_chain.go | 10 ++++--- tests/e2e/config.go | 8 +++--- tests/e2e/main.go | 4 +-- tests/e2e/state.go | 4 +-- tests/e2e/steps_democracy.go | 2 +- tests/e2e/steps_reward_denom.go | 4 +-- tests/e2e/steps_sovereign_changeover.go | 2 +- .../testnet-scripts/sovereign-genesis.json | 24 ++++++++++++---- 14 files changed, 64 insertions(+), 36 deletions(-) diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index 298087262d..6b3078212b 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -116,9 +116,6 @@ import ( consumer "github.com/cosmos/interchain-security/v3/x/ccv/consumer" consumerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper" consumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" - - // unnamed import of statik for swagger UI support - _ "github.com/cosmos/cosmos-sdk/client/docs/statik" ) const ( diff --git a/app/consumer/app.go b/app/consumer/app.go index 20b6695dfa..17c15c2c86 100644 --- a/app/consumer/app.go +++ b/app/consumer/app.go @@ -91,8 +91,6 @@ import ( ibcconsumerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper" ibcconsumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" - // unnamed import of statik for swagger UI support - _ "github.com/cosmos/cosmos-sdk/client/docs/statik" testutil "github.com/cosmos/interchain-security/v3/testutil/integration" ) diff --git a/app/provider/app.go b/app/provider/app.go index 3fefd34daa..d810ff360f 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -109,9 +109,6 @@ import ( providertypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" testutil "github.com/cosmos/interchain-security/v3/testutil/integration" - - // unnamed import of statik for swagger UI support - _ "github.com/cosmos/cosmos-sdk/client/docs/statik" ) const ( diff --git a/app/sovereign/app.go b/app/sovereign/app.go index e616b92514..b1049255f9 100644 --- a/app/sovereign/app.go +++ b/app/sovereign/app.go @@ -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" @@ -27,8 +30,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/cosmos-sdk/x/auth" + "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/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" @@ -44,7 +51,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/capability" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" "github.com/cosmos/cosmos-sdk/x/crisis" crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" @@ -108,6 +114,7 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + tendermint "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ) const ( @@ -125,7 +132,7 @@ var ( // and genesis verification. ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, - genutil.AppModuleBasic{}, + genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), bank.AppModuleBasic{}, capability.AppModuleBasic{}, sdkstaking.AppModuleBasic{}, @@ -148,6 +155,8 @@ var ( evidence.AppModuleBasic{}, transfer.AppModuleBasic{}, vesting.AppModuleBasic{}, + tendermint.AppModuleBasic{}, + consensus.AppModuleBasic{}, ) // module account permissions @@ -246,11 +255,11 @@ func New( bApp.SetInterfaceRegistry(interfaceRegistry) keys := sdk.NewKVStoreKeys( - authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, + authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, 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, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -263,6 +272,7 @@ func New( keys: keys, tkeys: tkeys, memKeys: memKeys, + txConfig: encodingConfig.TxConfig, } app.ParamsKeeper = initParamsKeeper( @@ -623,6 +633,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 } diff --git a/go.sum b/go.sum index b79f6784cb..cafdd80e8c 100644 --- a/go.sum +++ b/go.sum @@ -1129,6 +1129,7 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1 github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 2e8cd38a9b..719e5d7517 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -1395,7 +1395,7 @@ func (tr TestRun) delegateTokens( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.chain, 1, 10*time.Second) + tr.waitBlocks(action.chain, 2, 10*time.Second) } type unbondTokensAction struct { @@ -1760,7 +1760,6 @@ func (tr TestRun) registerConsumerRewardDenom(action registerConsumerRewardDenom `--node`, tr.getValidatorNode(action.chain, action.from), `--gas`, "9000000", `--keyring-backend`, `test`, - `-b`, `block`, `-y`, ).CombinedOutput() @@ -1771,6 +1770,8 @@ func (tr TestRun) registerConsumerRewardDenom(action registerConsumerRewardDenom if err != nil { log.Fatal(err, "\n", string(bz)) } + + tr.waitBlocks(action.chain, 2, 10*time.Second) } // Creates an additional node on selected chain diff --git a/tests/e2e/actions_sovereign_chain.go b/tests/e2e/actions_sovereign_chain.go index c61a2a9a38..cf2d6288e8 100644 --- a/tests/e2e/actions_sovereign_chain.go +++ b/tests/e2e/actions_sovereign_chain.go @@ -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 \ @@ -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, @@ -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 { diff --git a/tests/e2e/config.go b/tests/e2e/config.go index df54cbd4f4..373281162d 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -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\"", @@ -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 }, diff --git a/tests/e2e/main.go b/tests/e2e/main.go index 00967dfcac..9943d6f9bd 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -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: diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 0c2573574f..5464b291ac 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -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, diff --git a/tests/e2e/steps_democracy.go b/tests/e2e/steps_democracy.go index 3c80818a24..7264c44341 100644 --- a/tests/e2e/steps_democracy.go +++ b/tests/e2e/steps_democracy.go @@ -100,7 +100,7 @@ func stepsDemocracy(consumerName string) []Step { state: State{ chainID(consumerName): ChainState{ ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9899999999, + validatorID("alice"): 9889999998, validatorID("bob"): 9960000001, }, // Check that the parameter is changed on gov-consumer chain diff --git a/tests/e2e/steps_reward_denom.go b/tests/e2e/steps_reward_denom.go index cb557f0471..9aad8ec7a8 100644 --- a/tests/e2e/steps_reward_denom.go +++ b/tests/e2e/steps_reward_denom.go @@ -98,11 +98,11 @@ func stepsRewardDenomConsumer(consumerName string) []Step { state: State{ chainID(consumerName): ChainState{ ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9899999999, + validatorID("alice"): 9889999998, 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"}}), }, }, }, diff --git a/tests/e2e/steps_sovereign_changeover.go b/tests/e2e/steps_sovereign_changeover.go index 71daad684b..c02b2c4d43 100644 --- a/tests/e2e/steps_sovereign_changeover.go +++ b/tests/e2e/steps_sovereign_changeover.go @@ -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"), diff --git a/tests/e2e/testnet-scripts/sovereign-genesis.json b/tests/e2e/testnet-scripts/sovereign-genesis.json index 6c34a0ec1c..c3ae9da36c 100644 --- a/tests/e2e/testnet-scripts/sovereign-genesis.json +++ b/tests/e2e/testnet-scripts/sovereign-genesis.json @@ -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": { @@ -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": [], @@ -99,6 +102,9 @@ "evidence": { "evidence": [] }, + "feegrant": { + "allowances": [] + }, "genutil": { "gen_txs": [ { @@ -160,7 +166,7 @@ "tip": null }, "signatures": [ - "D06i2qqq2HathlT7cy+PDLTDuYKAmzw5Ne+Ehvzr9bVy3jpm2h8deDGeSXTSrhdP04UpFXerSn+zIPth5TKNrg==" + "c7aD9dWzb85fn+Aq0ijMdhyJNJSOsOcFLvJt8ctvdxAAbwdrzKPVFbq9IYf1qCwKmfmQUrlFy40qiuQeXaZ8pg==" ] } ] @@ -199,7 +205,8 @@ "params": { "allowed_clients": [ "06-solomachine", - "07-tendermint" + "07-tendermint", + "09-localhost" ] }, "create_localhost": false, @@ -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", @@ -273,7 +286,8 @@ "params": { "send_enabled": true, "receive_enabled": true - } + }, + "total_escrowed": [] }, "upgrade": {}, "vesting": {} From 6e3164cb695de004207b54fa36878f0b2f8412aa Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Fri, 23 Jun 2023 22:32:59 +0200 Subject: [PATCH 2/2] ci: add lint and check-breakage to gh actions (#1066) add lint and check-breakage to gh actions Co-authored-by: MSalopek Co-authored-by: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> --- .github/workflows/proto.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/proto.yml diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml new file mode 100644 index 0000000000..601310a793 --- /dev/null +++ b/.github/workflows/proto.yml @@ -0,0 +1,31 @@ +name: Protobuf +# Protobuf runs buf (https://buf.build/) lint and check-breakage +# This workflow is only run when a .proto file has been changed +on: + pull_request: + paths: + - "proto/**" + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - uses: bufbuild/buf-setup-action@v1.9.0 + - uses: bufbuild/buf-lint-action@v1 + with: + input: "proto" + + break-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: bufbuild/buf-setup-action@v1.9.0 + - uses: bufbuild/buf-breaking-action@v1 + with: + input: "proto" + against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},ref=HEAD~1,subdir=proto"