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

feat: add runtime Env to icacontroller and fix v0.52 e2e tests #7587

Merged
merged 34 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
346d83d
feat: adding runtime Environment
damiannolan Nov 21, 2024
29ce5f2
chore: run make lint-fix
damiannolan Nov 21, 2024
7e7d17d
chore: remove duplicate import
damiannolan Nov 21, 2024
7e2f699
chore: rm duplicate import
damiannolan Nov 22, 2024
7cb2468
chore: migrate to env KVStoreService in icacontroller
damiannolan Nov 25, 2024
cb93c24
chore: fix duplicate import
damiannolan Nov 25, 2024
f828f09
chore: rm kv store service
damiannolan Nov 25, 2024
d488054
chore: refactor events to use environment
damiannolan Nov 25, 2024
92ecec1
chore: make lint-fix
damiannolan Nov 25, 2024
4660322
chore: make tidy-all
damiannolan Nov 25, 2024
e267e42
chore: rm msg service router from icacontroller
damiannolan Nov 25, 2024
ab1f3f3
fix: remove 32 bit arm arch from callbacks ci builds
damiannolan Nov 25, 2024
8b67d8d
test: try cache false for callbacks linter
damiannolan Nov 25, 2024
e27966b
chore: pin to updated interchaintest fork
chatton Nov 26, 2024
b6fba89
chore: revert relayer count to 10
chatton Nov 26, 2024
c23234d
chore: continued work on upgrading e2e tests to 0.52
chatton Nov 26, 2024
d83116d
chore: transfer e2e passing
chatton Nov 27, 2024
82c5a66
chore: fix upgrade build errors
chatton Nov 27, 2024
06d40e4
chore: bump interchaintest
chatton Nov 27, 2024
a128c03
chore: update sample config
chatton Nov 27, 2024
55b4fbe
chore: reconfigure protoany to use gogoproto any in favour of codec t…
damiannolan Nov 27, 2024
b92bc67
chore: tidy imports in e2e
damiannolan Nov 27, 2024
f9b7314
fix: address failure in module safe query ica e2e test
damiannolan Dec 2, 2024
94a4685
bump golangci version to 1.60
Dec 2, 2024
4f37cf6
lint: remove duplicate import
damiannolan Dec 2, 2024
e24c60f
chore: use gogoprotoany in favour of codec types any. rm ProtoCodecMa…
damiannolan Dec 4, 2024
d70f0c4
chore: bump go version in Dockerfile
damiannolan Dec 4, 2024
5b89030
chore: add todo
damiannolan Dec 4, 2024
5ea5802
lint: fix unnecessary cast
damiannolan Dec 4, 2024
0e64412
deps: upgrade sdk to head of release/v0.52.x, upgrade store to latest…
damiannolan Dec 4, 2024
a0f28fc
deps: bump to head of release/v0.52
damiannolan Dec 4, 2024
785dc47
fix: add unit test to reproduce e2e test failure for ScheduleIBCUpgra…
damiannolan Dec 5, 2024
9057fcb
fix: error in tests
damiannolan Dec 5, 2024
6ad08d9
chore: address comments from pr
damiannolan Dec 6, 2024
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
Prev Previous commit
Next Next commit
fix: add unit test to reproduce e2e test failure for ScheduleIBCUpgra…
…de, update code to expect tendermint client temporarily
  • Loading branch information
damiannolan committed Dec 5, 2024
commit 785dc479aa87e77fc08b712091a41ce075684866
57 changes: 57 additions & 0 deletions modules/core/02-client/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
testifysuite "github.com/stretchr/testify/suite"

sdkmath "cosmossdk.io/math"
govtypesv1 "cosmossdk.io/x/gov/types/v1"
stakingtypes "cosmossdk.io/x/staking/types"
upgradetypes "cosmossdk.io/x/upgrade/types"

Expand Down Expand Up @@ -642,3 +643,59 @@ func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() {
})
}
}

func (suite *KeeperTestSuite) TestIBCScheduledUpgradeProposal() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This can also be deleted I think once cosmos/cosmos-sdk#22779 is solved, but its also no harm keeping around as it routes a msg for scheduleIBCUpgrade through gov

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a comment with a link to that for context?

suite.SetupTest()

path := ibctesting.NewPath(suite.chainA, suite.chainB)
path.SetupClients()

tmClientState, ok := path.EndpointB.GetClientState().(*ibctm.ClientState)
suite.Require().True(ok)

// bump the chain id revision number for the ibc client upgrade
chainID := tmClientState.ChainId
revisionNumber := types.ParseChainID(chainID)

newChainID, err := types.SetRevisionNumber(chainID, revisionNumber+1)
suite.Require().NoError(err)
suite.Require().NotEqual(chainID, newChainID)

tmClientState.ChainId = newChainID
upgradedClientState := tmClientState.ZeroCustomFields()

msg, err := types.NewMsgIBCSoftwareUpgrade(
suite.chainA.GetSimApp().IBCKeeper.GetAuthority(),
upgradetypes.Plan{
Name: "upgrade-client",
Height: 1000,
},
upgradedClientState,
)
suite.Require().NoError(err)

proposal, err := govtypesv1.NewMsgSubmitProposal(
[]sdk.Msg{msg},
sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, govtypesv1.DefaultMinDepositTokens)),
path.EndpointA.Chain.SenderAccount.GetAddress().String(),
"metadata",
"ibc client upgrade",
"gov proposal for initialising ibc client upgrade",
govtypesv1.ProposalType_PROPOSAL_TYPE_STANDARD,
)
suite.Require().NoError(err)

res, err := suite.chainA.SendMsgs(proposal)
suite.Require().NoError(err)

proposalID, err := ibctesting.ParseProposalIDFromEvents(res.Events)
suite.Require().NoError(err)

// vote and pass proposal, trigger msg execution
err = ibctesting.VoteAndCheckProposalStatus(path.EndpointA, proposalID)
suite.Require().NoError(err)

storedPlan, err := suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradePlan(suite.chainA.GetContext())
suite.Require().NoError(err)
suite.Require().Equal(msg.Plan, storedPlan)
}
17 changes: 12 additions & 5 deletions modules/core/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors"
"github.com/cosmos/ibc-go/v9/modules/core/internal/telemetry"
coretypes "github.com/cosmos/ibc-go/v9/modules/core/types"
ibctm "github.com/cosmos/ibc-go/v9/modules/light-clients/07-tendermint"
)

var (
Expand Down Expand Up @@ -122,13 +123,19 @@ func (k *Keeper) IBCSoftwareUpgrade(goCtx context.Context, msg *clienttypes.MsgI
return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Signer)
}

ctx := sdk.UnwrapSDKContext(goCtx)
upgradedClientState, err := clienttypes.UnpackClientState(msg.UpgradedClientState)
if err != nil {
return nil, errorsmod.Wrapf(clienttypes.ErrInvalidClientType, "cannot unpack client state: %s", err)
// TODO: Make decision on this. Accessing GetCachedValue returns nil due to loss of data in internal sdk msg handler.
// For now we can assume tendermint client state here as that's what we expect, but this may not always be the case for other msg handlers
// which use pb.Any encoding of msg types going through msg router service hybrid handler.
// upgradedClientState, err := clienttypes.UnpackClientState(msg.UpgradedClientState)
// if err != nil {
// return nil, errorsmod.Wrapf(clienttypes.ErrInvalidClientType, "cannot unpack client state: %s", err)
// }
var upgradedClientState ibctm.ClientState
if err := k.cdc.Unmarshal(msg.UpgradedClientState.Value, &upgradedClientState); err != nil {
return nil, err
}

if err = k.ClientKeeper.ScheduleIBCSoftwareUpgrade(ctx, msg.Plan, upgradedClientState); err != nil {
if err := k.ClientKeeper.ScheduleIBCSoftwareUpgrade(goCtx, msg.Plan, &upgradedClientState); err != nil {
return nil, errorsmod.Wrap(err, "failed to schedule upgrade")
}

Expand Down
Loading