Skip to content

Commit

Permalink
chore: add check for applied plan by verifying the height in which it…
Browse files Browse the repository at this point in the history
… was executed
  • Loading branch information
RafilxTenfen committed Jul 25, 2024
1 parent ff6532a commit 0a16ccb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/e2e/configurer/chain/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

sdkmath "cosmossdk.io/math"
upgradetypes "cosmossdk.io/x/upgrade/types"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
cmtabcitypes "github.com/cometbft/cometbft/abci/types"
cmttypes "github.com/cometbft/cometbft/types"
Expand Down Expand Up @@ -430,6 +431,18 @@ func (n *NodeConfig) QueryProposals() govtypesv1.QueryProposalsResponse {
return resp
}

func (n *NodeConfig) QueryAppliedPlan(planName string) upgradetypes.QueryAppliedPlanResponse {
path := fmt.Sprintf("cosmos/upgrade/v1beta1/applied_plan/%s", planName)
bz, err := n.QueryGRPCGateway(path, url.Values{})
require.NoError(n.t, err)

var resp upgradetypes.QueryAppliedPlanResponse
err = util.Cdc.UnmarshalJSON(bz, &resp)
require.NoError(n.t, err)

return resp
}

func (n *NodeConfig) QueryWasmSmartObject(contract string, msg string) (resultObject map[string]interface{}, err error) {
err = n.QueryWasmSmart(contract, msg, &resultObject)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/software_upgrade_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ func (s *SoftwareUpgradeVanillaTestSuite) TestUpgradeVanilla() {
n, err := chainA.GetDefaultNode()
s.NoError(err)

// makes sure that the upgrade was acutally executed
resp := n.QueryAppliedPlan("vanilla")
s.Equal(25, resp.Height, "the plan should be applied at the height 25")

fps := n.QueryFinalityProviders()
s.Len(fps, 1, "it should have one finality provider, since the vanilla upgrade just added a new one")
}

0 comments on commit 0a16ccb

Please sign in to comment.