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: migration to gov v1 #4620

Merged
merged 46 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
51417ee
Add proto message, implement sdk.Msg for Recover Client. (#4494)
DimitrisJim Aug 29, 2023
35909f6
add protos, msgs, keeper handler to upgrade clients using v1 governan…
charleenfei Aug 29, 2023
3b528db
update to 0.47.5 release branch
charleenfei Aug 29, 2023
e30e1bd
Move signer as last proto field. (#4510)
DimitrisJim Aug 30, 2023
d9f6200
msg server function and tests for MsgScheduleIBCClientUpgrade (#4442)
charleenfei Aug 30, 2023
9c5499e
Add 02-client implementation for Recover client. (#4499)
DimitrisJim Aug 31, 2023
016e092
Add implementation for recover client on message server. (#4503)
DimitrisJim Aug 31, 2023
aaee1e3
Add cmd for submitting a recover client prop. (#4522)
DimitrisJim Aug 31, 2023
0bf6708
rename command
crodriguezvega Aug 31, 2023
8a372bd
docs: fixed broken links (#4571)
srdtrk Sep 5, 2023
a9325bb
Merge branch 'main' of github.com:cosmos/ibc-go into feat/govv1
colin-axner Sep 5, 2023
3d68136
Merge pull request #4577 from cosmos/colin/bump-feat-govv1
colin-axner Sep 5, 2023
611e69a
Add e2e test for recovering a client. (#4543)
DimitrisJim Sep 6, 2023
7f3dd42
feat: add unpacket inerfaces message assertion (#4588)
colin-axner Sep 6, 2023
a374631
add cli for MsgIBCSoftwareUpgrade (#4558)
charleenfei Sep 6, 2023
ffcb06d
docs: use MsgRecoverClient in docs (#4580)
colin-axner Sep 6, 2023
40b727a
refactor: remove legacy client update proposal (#4581)
colin-axner Sep 7, 2023
c4f947e
feat: add proposal simulator interface function and tests (#4466)
charleenfei Sep 7, 2023
386ea01
refactor!: remove UpgradeProposal type (#4602)
colin-axner Sep 8, 2023
f2e7b0d
create separate event emission for ibc software upgrades vs an upgrad…
charleenfei Sep 8, 2023
e90fddf
Merge branch 'main' of github.com:cosmos/ibc-go into feat/govv1
colin-axner Sep 11, 2023
1f6911f
fix build
colin-axner Sep 11, 2023
14e5593
remove: legacy event emissions
colin-axner Sep 11, 2023
b2a6b2b
remove: unnecessary assignments, apply suggestion from code review
colin-axner Sep 11, 2023
7585e3f
e2e: schedule IBC software upgrade (#4585)
charleenfei Sep 11, 2023
1bf1b17
chore: docs for MsgIBCSoftwareUpgrade (#4601)
colin-axner Sep 11, 2023
589f7f8
Merge branch 'feat/govv1' of github.com:cosmos/ibc-go into feat/govv1
colin-axner Sep 11, 2023
551e2cf
refactor: s.Assert -> s.Require
colin-axner Sep 11, 2023
5c69de2
Merge branch 'main' into feat/govv1
colin-axner Sep 11, 2023
1a5b274
Apply suggestions from code review
colin-axner Sep 11, 2023
132cf3f
make proto-all
colin-axner Sep 11, 2023
6569ac9
chore: update compiler assertion
colin-axner Sep 11, 2023
2cd4fe7
refactor: ordering, order as follows: create, update, upgrade, misbhe…
colin-axner Sep 11, 2023
d3a526c
refactor: simplify ibc software upgrade emitted event
colin-axner Sep 11, 2023
b6ff18b
lint lint lint
colin-axner Sep 11, 2023
46648c5
Apply suggestions from code review
colin-axner Sep 11, 2023
fd6bfd1
Merge branch 'main' into feat/govv1
colin-axner Sep 11, 2023
2e96bb7
Merge branch 'main' into feat/govv1
colin-axner Sep 12, 2023
33a4ce4
review of feat/govv1
crodriguezvega Sep 12, 2023
808613d
Merge branch 'main' into feat/govv1
crodriguezvega Sep 12, 2023
2dc0d36
Merge branch 'main' into feat/govv1
crodriguezvega Sep 12, 2023
017f21f
Merge branch 'main' into feat/govv1
crodriguezvega Sep 12, 2023
a9b7f1f
Merge branch 'main' into feat/govv1
charleenfei Sep 12, 2023
cd97b1d
pr nits
charleenfei Sep 12, 2023
c63ed18
fix tests for error wrapping
charleenfei Sep 13, 2023
448d48d
Merge branch 'main' into feat/govv1
colin-axner Sep 13, 2023
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
pr nits
  • Loading branch information
charleenfei committed Sep 12, 2023
commit cd97b1d7122f3a2dcb37f31fe23d556d72dc6e40
8 changes: 5 additions & 3 deletions e2e/tests/core/02-client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() {
cs, err := s.QueryUpgradedClientState(ctx, chainA, ibctesting.FirstClientID)
s.Require().NoError(err)

upgradedClientState := cs.(*ibctm.ClientState)
upgradedClientState, ok := cs.(*ibctm.ClientState)
s.Require().True(ok)
s.Require().Equal(upgradedClientState.ChainId, newChainID)

plan, err := s.QueryCurrentPlan(ctx, chainA)
plan, err := s.QueryCurrentUpgradePlan(ctx, chainA)
s.Require().NoError(err)

s.Require().Equal("upgrade-client", plan.Name)
Expand All @@ -142,7 +143,7 @@ func (s *ClientTestSuite) TestRecoverClient_Succeeds() {
subjectClientID string
substituteClientID string
// set the trusting period to a value which will still be valid upon client creation, but invalid before the first update
badTrustingPeriod = time.Duration(time.Second * 10)
badTrustingPeriod = time.Second * 10
)

t.Run("create substitute client with correct trusting period", func(t *testing.T) {
Expand Down Expand Up @@ -198,6 +199,7 @@ func (s *ClientTestSuite) TestRecoverClient_Succeeds() {
authority, err := s.QueryModuleAccountAddress(ctx, govtypes.ModuleName, chainA)
s.Require().NoError(err)
recoverClientMsg := clienttypes.NewMsgRecoverClient(authority.String(), subjectClientID, substituteClientID)
s.Require().NotNil(recoverClientMsg)
s.ExecuteGovV1Proposal(ctx, recoverClientMsg, chainA, chainAWallet, 1)
})

Expand Down
4 changes: 2 additions & 2 deletions e2e/testsuite/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ func (s *E2ETestSuite) QueryClientStatus(ctx context.Context, chain ibc.Chain, c
return res.Status, nil
}

// QueryCurrentPlan queries the currently scheduled plans, if any
func (s *E2ETestSuite) QueryCurrentPlan(ctx context.Context, chain ibc.Chain) (upgradetypes.Plan, error) {
// QueryCurrentUpgradePlan queries the currently scheduled upgrade plans.
func (s *E2ETestSuite) QueryCurrentUpgradePlan(ctx context.Context, chain ibc.Chain) (upgradetypes.Plan, error) {
queryClient := s.GetChainGRCPClients(chain).UpgradeQueryClient
res, err := queryClient.CurrentPlan(ctx, &upgradetypes.QueryCurrentPlanRequest{})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/27-interchain-accounts/simulation/proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func ProposalMsgs() []simtypes.WeightedProposalMsg {
}

// SimulateHostMsgUpdateParams returns a random MsgUpdateParams for the host module
func SimulateHostMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg {
func SimulateHostMsgUpdateParams(_ *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg {
var signer sdk.AccAddress = address.Module("gov")
params := types.DefaultParams()
params.HostEnabled = false
Expand All @@ -48,7 +48,7 @@ func SimulateHostMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Accou
}

// SimulateControllerMsgUpdateParams returns a random MsgUpdateParams for the controller module
func SimulateControllerMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg {
func SimulateControllerMsgUpdateParams(_ *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg {
var signer sdk.AccAddress = address.Module("gov")
params := controllertypes.DefaultParams()
params.ControllerEnabled = false
Expand Down
6 changes: 3 additions & 3 deletions modules/apps/transfer/simulation/proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ func ProposalMsgs() []simtypes.WeightedProposalMsg {
}

// SimulateMsgUpdateParams returns a random MsgUpdateParams
func SimulateMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg {
var signer sdk.AccAddress = address.Module("gov")
func SimulateMsgUpdateParams(_ *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg {
var gov sdk.AccAddress = address.Module("gov")
params := types.DefaultParams()
params.SendEnabled = false

return &types.MsgUpdateParams{
Signer: signer.String(),
Signer: gov.String(),
Params: params,
}
}
8 changes: 4 additions & 4 deletions modules/core/02-client/client/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ func NewTxCmd() *cobra.Command {
}

txCmd.AddCommand(
NewCreateClientCmd(),
NewUpdateClientCmd(),
NewSubmitMisbehaviourCmd(), // Deprecated
NewUpgradeClientCmd(),
newCreateClientCmd(),
newUpdateClientCmd(),
newSubmitMisbehaviourCmd(), // Deprecated
newUpgradeClientCmd(),
newSubmitRecoverClientProposalCmd(),
newScheduleIBCUpgradeProposalCmd(),
)
Expand Down
24 changes: 12 additions & 12 deletions modules/core/02-client/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (

const FlagAuthority = "authority"

// NewCreateClientCmd defines the command to create a new IBC light client.
func NewCreateClientCmd() *cobra.Command {
// newCreateClientCmd defines the command to create a new IBC light client.
func newCreateClientCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "create [path/to/client_state.json] [path/to/consensus_state.json]",
Short: "create new IBC client",
Expand Down Expand Up @@ -87,8 +87,8 @@ func NewCreateClientCmd() *cobra.Command {
return cmd
}

// NewUpdateClientCmd defines the command to update an IBC client.
func NewUpdateClientCmd() *cobra.Command {
// newUpdateClientCmd defines the command to update an IBC client.
func newUpdateClientCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update [client-id] [path/to/client_msg.json]",
Short: "update existing client with a client message",
Expand Down Expand Up @@ -132,11 +132,11 @@ func NewUpdateClientCmd() *cobra.Command {
return cmd
}

// NewSubmitMisbehaviourCmd defines the command to submit a misbehaviour to prevent
// newSubmitMisbehaviourCmd defines the command to submit a misbehaviour to prevent
// future updates.
// Deprecated: NewSubmitMisbehaviourCmd is deprecated and will be removed in a future release.
// Please use NewUpdateClientCmd instead.
func NewSubmitMisbehaviourCmd() *cobra.Command {
func newSubmitMisbehaviourCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "misbehaviour [clientID] [path/to/misbehaviour.json]",
Short: "submit a client misbehaviour",
Expand Down Expand Up @@ -179,8 +179,8 @@ func NewSubmitMisbehaviourCmd() *cobra.Command {
return cmd
}

// NewUpgradeClientCmd defines the command to upgrade an IBC light client.
func NewUpgradeClientCmd() *cobra.Command {
// newUpgradeClientCmd defines the command to upgrade an IBC light client.
func newUpgradeClientCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "upgrade [client-identifier] [path/to/client_state.json] [path/to/consensus_state.json] [upgrade-client-proof] [upgrade-consensus-state-proof]",
Short: "upgrade an IBC client",
Expand Down Expand Up @@ -245,15 +245,15 @@ func NewUpgradeClientCmd() *cobra.Command {
return cmd
}

// newSubmitRecoverClientProposalCmd defines the command to recover an IBC light client
// newSubmitRecoverClientProposalCmd defines the command to recover an IBC light client.
func newSubmitRecoverClientProposalCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "recover-client [subject-client-id] [substitute-client-id] [flags]",
Args: cobra.ExactArgs(2),
Short: "recover an IBC client",
Long: "Submit a recover IBC client proposal along with an initial deposit.\n" +
"Please specify a subject client identifier you want to recover.\n" +
"Please specify the substitute client the subject client will be recovered to.",
Long: `Submit a recover IBC client proposal along with an initial deposit
Please specify a subject client identifier you want to recover
Please specify the substitute client the subject client will be recovered to.`,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/keeper/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (k Keeper) RecoverClient(ctx sdk.Context, subjectClientID, substituteClient
}

if err := subjectClientState.CheckSubstituteAndUpdateState(ctx, k.cdc, subjectClientStore, substituteClientStore, substituteClientState); err != nil {
return err
return errorsmod.Wrapf(types.ErrValidatingSubstituteClient, "failed to validate substitute client: %s", err)
}

k.Logger(ctx).Info("client recovered", "client-id", subjectClientID)
Expand Down
2 changes: 2 additions & 0 deletions modules/core/02-client/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ var (
ErrClientNotActive = errorsmod.Register(SubModuleName, 29, "client state is not active")
ErrFailedMembershipVerification = errorsmod.Register(SubModuleName, 30, "membership verification failed")
ErrFailedNonMembershipVerification = errorsmod.Register(SubModuleName, 31, "non-membership verification failed")
ErrSchedulingIBCUpgrade = errorsmod.Register(SubModuleName, 32, "failed to schedule IBC upgrade")
ErrValidatingSubstituteClient = errorsmod.Register(SubModuleName, 33, "failed to validate substitute client")
)
2 changes: 1 addition & 1 deletion modules/core/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (k Keeper) IBCSoftwareUpgrade(goCtx context.Context, msg *clienttypes.MsgIB
}

if err = k.ClientKeeper.ScheduleIBCSoftwareUpgrade(ctx, msg.Plan, upgradedClientState); err != nil {
return nil, errorsmod.Wrapf(err, "cannot schedule IBC client upgrade")
return nil, errorsmod.Wrapf(clienttypes.ErrSchedulingIBCUpgrade, "cannot schedule IBC client upgrade: %s", err)
}

return &clienttypes.MsgIBCSoftwareUpgradeResponse{}, nil
Expand Down