From cf9357b79c15c4646d8af6229255e61158a46f78 Mon Sep 17 00:00:00 2001 From: Alexgao001 Date: Mon, 10 Apr 2023 10:42:57 +0800 Subject: [PATCH 01/11] crosschain gov --- proto/cosmos/gov/v1/gov.proto | 11 + proto/cosmos/gov/v1/tx.proto | 21 ++ x/gov/keeper/crosschain.go | 85 ++++++ x/gov/keeper/keeper.go | 28 +- x/gov/keeper/msg_server.go | 12 + x/gov/types/crosschain.go | 22 ++ x/gov/types/errors.go | 12 + x/gov/types/expected_keepers.go | 9 + x/gov/types/v1/codec.go | 3 + x/gov/types/v1/crosschain.go | 44 +++ x/gov/types/v1/gov.pb.go | 463 ++++++++++++++++++++++++------ x/gov/types/v1/msgs.go | 26 +- x/gov/types/v1/tx.pb.go | 486 +++++++++++++++++++++++++++----- 13 files changed, 1051 insertions(+), 171 deletions(-) create mode 100644 x/gov/keeper/crosschain.go create mode 100644 x/gov/types/crosschain.go create mode 100644 x/gov/types/v1/crosschain.go diff --git a/proto/cosmos/gov/v1/gov.proto b/proto/cosmos/gov/v1/gov.proto index 38a645f40b..29c0332950 100644 --- a/proto/cosmos/gov/v1/gov.proto +++ b/proto/cosmos/gov/v1/gov.proto @@ -253,3 +253,14 @@ message Params { // burn deposits if quorum with vote type no_veto is met bool burn_vote_veto = 15; } + +// +// Since: cosmos-sdk 0.47 +message CrossChainParamsChange { + // param to be updated or 'upgrade' + string key = 1; + // slice of + repeated string values = 2; + repeated string targets = 3; +} + diff --git a/proto/cosmos/gov/v1/tx.proto b/proto/cosmos/gov/v1/tx.proto index 76526dd211..0734bfd290 100644 --- a/proto/cosmos/gov/v1/tx.proto +++ b/proto/cosmos/gov/v1/tx.proto @@ -39,6 +39,9 @@ service Msg { // Since: cosmos-sdk 0.47 rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + rpc UpdateCrossChainParams(MsgUpdateCrossChainParams) returns (MsgUpdateCrossChainParamsResponse); + // CancelProposal defines a method to cancel governance proposal // // Since: cosmos-sdk 0.48 @@ -203,3 +206,21 @@ message MsgCancelProposalResponse { // canceled_height defines the block height at which the proposal is canceled. uint64 canceled_height = 3; } + +// MsgUpdateCrossChainParams for cross chain gov +message MsgUpdateCrossChainParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/x/gov/v1/MsgUpdateCrossChainParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // cross chain + CrossChainParamsChange params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateCrossChainParamsResponse {} diff --git a/x/gov/keeper/crosschain.go b/x/gov/keeper/crosschain.go new file mode 100644 index 0000000000..0db579e0e0 --- /dev/null +++ b/x/gov/keeper/crosschain.go @@ -0,0 +1,85 @@ +package keeper + +import ( + "encoding/hex" + "math/big" + + sdkerrors "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/bsc/rlp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) + +func (k Keeper) RegisterCrossChainSyncParamsApp() error { + return k.crossChainKeeper.RegisterChannel(types.SyncParamsChannel, types.SyncParamsChannelID, k) +} + +func (k Keeper) SyncParams(ctx sdk.Context, cpc govv1.CrossChainParamsChange) error { + // this validates content and size of changes is not empty + if err := cpc.ValidateBasic(); err != nil { + return err + } + values := make([]byte, 0) + addresses := make([]byte, 0) + + for i, v := range cpc.Values { + var value []byte + var err error + if cpc.Key == types.KeyUpgrade { + value, err = sdk.AccAddressFromHexUnsafe(v) + if err != nil { + return sdkerrors.Wrapf(types.ErrAddressNotValid, "smart contract address is not valid %s", v) + } + } else { + value, err = hex.DecodeString(v) + if err != nil { + return sdkerrors.Wrapf(types.ErrInvalidValue, "value is not valid %s", v) + } + } + values = append(values, value...) + + addr, err := sdk.AccAddressFromHexUnsafe(cpc.Targets[i]) + if err != nil { + return sdkerrors.Wrapf(types.ErrAddressNotValid, "smart contract address is not valid %s", cpc.Targets[i]) + } + addresses = append(addresses, addr.Bytes()...) + } + + pack := types.SyncParamsPackage{ + Key: cpc.Key, + Value: values, + Target: addresses, + } + + encodedPackage, err := rlp.EncodeToBytes(pack) + if err != nil { + return sdkerrors.Wrapf(types.ErrInvalidUpgradeProposal, "encode sync params package error") + } + _, err = k.crossChainKeeper.CreateRawIBCPackageWithFee( + ctx, + types.SyncParamsChannelID, + sdk.SynCrossChainPackageType, + encodedPackage, + big.NewInt(0), + big.NewInt(0), + ) + return err +} + +// Need these in order to register paramsKeeper to be a CrosschainApp so that it can register channel(3) + +func (k Keeper) ExecuteSynPackage(ctx sdk.Context, appCtx *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { + k.Logger(ctx).Error("received sync params sync package", "payload", hex.EncodeToString(payload)) + return sdk.ExecuteResult{} +} + +func (k Keeper) ExecuteAckPackage(ctx sdk.Context, header *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { + k.Logger(ctx).Error("received sync params in ack package", "payload", hex.EncodeToString(payload)) + return sdk.ExecuteResult{} +} + +func (k Keeper) ExecuteFailAckPackage(ctx sdk.Context, header *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { + k.Logger(ctx).Error("received sync params fail ack package", "payload", hex.EncodeToString(payload)) + return sdk.ExecuteResult{} +} diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index 18c009ee81..19e21bff30 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -17,9 +17,10 @@ import ( // Keeper defines the governance module Keeper type Keeper struct { - authKeeper types.AccountKeeper - bankKeeper types.BankKeeper - distrkeeper types.DistributionKeeper + authKeeper types.AccountKeeper + bankKeeper types.BankKeeper + distrkeeper types.DistributionKeeper + crossChainKeeper types.CrossChainKeeper // The reference to the DelegationSet and ValidatorSet to get information about validators and delegators sk types.StakingKeeper @@ -61,7 +62,7 @@ func (k Keeper) GetAuthority() string { func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, sk types.StakingKeeper, distrkeeper types.DistributionKeeper, - router baseapp.MessageRouter, config types.Config, authority string, + crossChainKeeper types.CrossChainKeeper, router baseapp.MessageRouter, config types.Config, authority string, ) *Keeper { // ensure governance module account is set if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil { @@ -78,15 +79,16 @@ func NewKeeper( } return &Keeper{ - storeKey: key, - authKeeper: authKeeper, - bankKeeper: bankKeeper, - distrkeeper: distrkeeper, - sk: sk, - cdc: cdc, - router: router, - config: config, - authority: authority, + storeKey: key, + authKeeper: authKeeper, + bankKeeper: bankKeeper, + distrkeeper: distrkeeper, + crossChainKeeper: crossChainKeeper, + sk: sk, + cdc: cdc, + router: router, + config: config, + authority: authority, } } diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 87d51cb3a6..1d049cc9e6 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -229,6 +229,18 @@ func (k msgServer) UpdateParams(goCtx context.Context, msg *v1.MsgUpdateParams) return &v1.MsgUpdateParamsResponse{}, nil } +// UpdateCrossChainParams implements the MsgServer.UpdateCrossChainParams method. +func (k msgServer) UpdateCrossChainParams(goCtx context.Context, msg *v1.MsgUpdateCrossChainParams) (*v1.MsgUpdateCrossChainParams, error) { + if k.authority != msg.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SyncParams(ctx, msg.Params); err != nil { + return nil, err + } + return &v1.MsgUpdateCrossChainParams{}, nil +} + type legacyMsgServer struct { govAcct string server v1.MsgServer diff --git a/x/gov/types/crosschain.go b/x/gov/types/crosschain.go new file mode 100644 index 0000000000..35eab03954 --- /dev/null +++ b/x/gov/types/crosschain.go @@ -0,0 +1,22 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + SyncParamsChannel = "syncParametersChange" + SyncParamsChannelID sdk.ChannelID = 3 + KeyUpgrade = "upgrade" +) + +var KeySyncParamsRelayerFee = []byte("SyncParamsRelayerFee") + +// SyncParamsPackage is the payload be relayed to BSC +type SyncParamsPackage struct { + Key string + // new parameter or new smart contract address(es) if is ungraded proposal + Value []byte + // smart contract address(es) + Target []byte +} diff --git a/x/gov/types/errors.go b/x/gov/types/errors.go index ae9142c92c..af366d1489 100644 --- a/x/gov/types/errors.go +++ b/x/gov/types/errors.go @@ -28,3 +28,15 @@ var ( ErrVotingPeriodEnded = errors.Register(ModuleName, 20, "voting period already ended") ErrInvalidProposal = errors.Register(ModuleName, 21, "invalid proposal") ) + +var ( + ErrEmptyChange = errors.Register(ModuleName, 22, "crosschain: change is empty") + ErrEmptyValue = errors.Register(ModuleName, 23, "crosschain: value is empty") + ErrEmptyTarget = errors.Register(ModuleName, 24, "crosschain: target is empty") + + ErrAddressSizeNotMatch = errors.Register(ModuleName, 25, "number of old address not equal to new addresses") + ErrAddressNotValid = errors.Register(ModuleName, 26, "address format is not valid") + ErrExceedParamsChangeLimit = errors.Register(ModuleName, 27, "exceed params change limit") + ErrInvalidUpgradeProposal = errors.Register(ModuleName, 28, "invalid sync params package") + ErrInvalidValue = errors.Register(ModuleName, 29, "decode hex value failed") +) diff --git a/x/gov/types/expected_keepers.go b/x/gov/types/expected_keepers.go index 81e4888510..01e65c4d9c 100644 --- a/x/gov/types/expected_keepers.go +++ b/x/gov/types/expected_keepers.go @@ -2,6 +2,7 @@ package types import ( "context" + "math/big" "cosmossdk.io/math" @@ -57,6 +58,14 @@ type BankKeeper interface { BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error } +type CrossChainKeeper interface { + CreateRawIBCPackageWithFee(ctx sdk.Context, channelID sdk.ChannelID, packageType sdk.CrossChainPackageType, + packageLoad []byte, relayerFee *big.Int, ackRelayerFee *big.Int, + ) (uint64, error) + + RegisterChannel(name string, id sdk.ChannelID, app sdk.CrossChainApplication) error +} + // Event Hooks // These can be utilized to communicate between a governance keeper and another // keepers. diff --git a/x/gov/types/v1/codec.go b/x/gov/types/v1/codec.go index 1a0031578c..2849275d60 100644 --- a/x/gov/types/v1/codec.go +++ b/x/gov/types/v1/codec.go @@ -20,6 +20,8 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgVoteWeighted{}, "cosmos-sdk/v1/MsgVoteWeighted") legacy.RegisterAminoMsg(cdc, &MsgExecLegacyContent{}, "cosmos-sdk/v1/MsgExecLegacyContent") legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/gov/v1/MsgUpdateParams") + legacy.RegisterAminoMsg(cdc, &MsgUpdateCrossChainParams{}, "cosmos-sdk/x/gov/v1/MsgUpdateCrossChainParams") + } // RegisterInterfaces registers the interfaces types with the Interface Registry. @@ -31,6 +33,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &MsgDeposit{}, &MsgExecLegacyContent{}, &MsgUpdateParams{}, + &MsgUpdateCrossChainParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/gov/types/v1/crosschain.go b/x/gov/types/v1/crosschain.go new file mode 100644 index 0000000000..8d457bf351 --- /dev/null +++ b/x/gov/types/v1/crosschain.go @@ -0,0 +1,44 @@ +package v1 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +func NewCrossChainParamsChange(key string, values, targets []string) *CrossChainParamsChange { + return &CrossChainParamsChange{Key: key, Values: values, Targets: targets} +} + +func (m *CrossChainParamsChange) ValidateBasic() error { + if m.Key == "" || len(m.Values) == 0 || len(m.Targets) == 0 { + return types.ErrEmptyChange + } + if len(m.Values) != len(m.Targets) { + return types.ErrAddressSizeNotMatch + } + if m.Key != types.KeyUpgrade && len(m.Values) > 1 { + return types.ErrExceedParamsChangeLimit + } + + for i := 0; i < len(m.Values); i++ { + value := m.Values[i] + target := m.Targets[i] + if len(value) == 0 { + return types.ErrEmptyValue + } + if len(target) == 0 { + return types.ErrEmptyTarget + } + if m.Key == types.KeyUpgrade { + _, err := sdk.AccAddressFromHexUnsafe(value) + if err != nil { + return types.ErrAddressNotValid + } + } + _, err := sdk.AccAddressFromHexUnsafe(target) + if err != nil { + return types.ErrAddressNotValid + } + } + return nil +} diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 8384b8f1df..0c44f731b2 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -921,6 +921,69 @@ func (m *Params) GetBurnVoteVeto() bool { return false } +// Since: cosmos-sdk 0.47 +type CrossChainParamsChange struct { + // param to be updated or 'upgrade' + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // slice of + Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` + Targets []string `protobuf:"bytes,3,rep,name=targets,proto3" json:"targets,omitempty"` +} + +func (m *CrossChainParamsChange) Reset() { *m = CrossChainParamsChange{} } +func (m *CrossChainParamsChange) String() string { return proto.CompactTextString(m) } +func (*CrossChainParamsChange) ProtoMessage() {} +func (*CrossChainParamsChange) Descriptor() ([]byte, []int) { + return fileDescriptor_e05cb1c0d030febb, []int{9} +} +func (m *CrossChainParamsChange) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CrossChainParamsChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CrossChainParamsChange.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CrossChainParamsChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_CrossChainParamsChange.Merge(m, src) +} +func (m *CrossChainParamsChange) XXX_Size() int { + return m.Size() +} +func (m *CrossChainParamsChange) XXX_DiscardUnknown() { + xxx_messageInfo_CrossChainParamsChange.DiscardUnknown(m) +} + +var xxx_messageInfo_CrossChainParamsChange proto.InternalMessageInfo + +func (m *CrossChainParamsChange) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *CrossChainParamsChange) GetValues() []string { + if m != nil { + return m.Values + } + return nil +} + +func (m *CrossChainParamsChange) GetTargets() []string { + if m != nil { + return m.Targets + } + return nil +} + func init() { proto.RegisterEnum("cosmos.gov.v1.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("cosmos.gov.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) @@ -933,99 +996,104 @@ func init() { proto.RegisterType((*VotingParams)(nil), "cosmos.gov.v1.VotingParams") proto.RegisterType((*TallyParams)(nil), "cosmos.gov.v1.TallyParams") proto.RegisterType((*Params)(nil), "cosmos.gov.v1.Params") + proto.RegisterType((*CrossChainParamsChange)(nil), "cosmos.gov.v1.CrossChainParamsChange") } func init() { proto.RegisterFile("cosmos/gov/v1/gov.proto", fileDescriptor_e05cb1c0d030febb) } var fileDescriptor_e05cb1c0d030febb = []byte{ - // 1389 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcb, 0x6e, 0xdb, 0x46, - 0x17, 0x36, 0x75, 0xd7, 0xd1, 0xc5, 0xca, 0xd8, 0x89, 0x69, 0x27, 0x96, 0x1c, 0x21, 0x08, 0xfc, - 0xe7, 0x22, 0xfd, 0x4e, 0x9a, 0x2e, 0x9a, 0x02, 0x85, 0x64, 0x31, 0x0d, 0x8d, 0xc4, 0x52, 0x29, - 0x45, 0x4e, 0xba, 0x21, 0x28, 0x71, 0x22, 0x13, 0x15, 0x39, 0x2a, 0x39, 0x52, 0xac, 0x47, 0xe8, - 0x2e, 0xcb, 0xae, 0x8a, 0x2e, 0xbb, 0xec, 0x22, 0xe8, 0x33, 0x64, 0x55, 0x04, 0xe9, 0xa2, 0xdd, - 0x34, 0x29, 0x92, 0x45, 0x81, 0x3c, 0x45, 0xc1, 0xe1, 0x50, 0x94, 0x64, 0xb5, 0xb6, 0xb3, 0xb1, - 0xc5, 0x73, 0xbe, 0xef, 0x9b, 0x33, 0xe7, 0x32, 0x43, 0xc2, 0x5a, 0x97, 0x38, 0x26, 0x71, 0xca, - 0x3d, 0x32, 0x2a, 0x8f, 0x76, 0xdc, 0x7f, 0xa5, 0x81, 0x4d, 0x28, 0x41, 0x19, 0xcf, 0x51, 0x72, - 0x2d, 0xa3, 0x9d, 0x8d, 0x3c, 0xc7, 0x75, 0x34, 0x07, 0x97, 0x47, 0x3b, 0x1d, 0x4c, 0xb5, 0x9d, - 0x72, 0x97, 0x18, 0x96, 0x07, 0xdf, 0x58, 0xed, 0x91, 0x1e, 0x61, 0x3f, 0xcb, 0xee, 0x2f, 0x6e, - 0x2d, 0xf4, 0x08, 0xe9, 0xf5, 0x71, 0x99, 0x3d, 0x75, 0x86, 0x4f, 0xcb, 0xd4, 0x30, 0xb1, 0x43, - 0x35, 0x73, 0xc0, 0x01, 0xeb, 0xf3, 0x00, 0xcd, 0x1a, 0x73, 0x57, 0x7e, 0xde, 0xa5, 0x0f, 0x6d, - 0x8d, 0x1a, 0xc4, 0x5f, 0x71, 0xdd, 0x8b, 0x48, 0xf5, 0x16, 0xe5, 0xd1, 0x7a, 0xae, 0x73, 0x9a, - 0x69, 0x58, 0xa4, 0xcc, 0xfe, 0x7a, 0xa6, 0x22, 0x01, 0x74, 0x80, 0x8d, 0xde, 0x21, 0xc5, 0x7a, - 0x9b, 0x50, 0x5c, 0x1f, 0xb8, 0x4a, 0x68, 0x07, 0x62, 0x84, 0xfd, 0x12, 0x85, 0x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, 0x11, 0x7d, 0x02, 0x09, 0x6f, - 0x22, 0xb0, 0x2d, 0x66, 0x4e, 0x18, 0x81, 0x09, 0x12, 0x5d, 0x82, 0x24, 0x3e, 0x1a, 0x60, 0xdd, - 0xa0, 0x58, 0x17, 0xb3, 0x5b, 0xc2, 0x76, 0x42, 0x09, 0x0c, 0xc5, 0xdf, 0x05, 0x48, 0x4d, 0x77, - 0xc8, 0x75, 0x48, 0x8e, 0xb1, 0xa3, 0x76, 0xd9, 0xc8, 0x08, 0xc7, 0xe6, 0x57, 0xb6, 0xa8, 0x92, - 0x18, 0x63, 0x67, 0xd7, 0xf5, 0xa3, 0xdb, 0x90, 0xd1, 0x3a, 0x0e, 0xd5, 0x0c, 0x8b, 0x13, 0x42, - 0x0b, 0x09, 0x69, 0x0e, 0xf2, 0x48, 0xff, 0x83, 0x84, 0x45, 0x38, 0x3e, 0xbc, 0x10, 0x1f, 0xb7, - 0x88, 0x07, 0xbd, 0x0b, 0xc8, 0x22, 0xea, 0x33, 0x83, 0x1e, 0xaa, 0x23, 0x4c, 0x7d, 0x52, 0x64, - 0x21, 0x69, 0xd9, 0x22, 0x07, 0x06, 0x3d, 0x6c, 0x63, 0xea, 0x91, 0x8b, 0xbf, 0x08, 0x10, 0x71, - 0x4f, 0xa7, 0x93, 0xcf, 0x96, 0x12, 0x44, 0x47, 0x84, 0xe2, 0x93, 0xcf, 0x15, 0x0f, 0x86, 0xee, - 0x42, 0xdc, 0x3b, 0xea, 0x1c, 0x31, 0xc2, 0x1a, 0xf6, 0xf2, 0xdc, 0x10, 0x1e, 0x3f, 0x47, 0x15, - 0x9f, 0x31, 0xd3, 0x10, 0xd1, 0xd9, 0x86, 0xd8, 0x8b, 0x24, 0xc2, 0xb9, 0x48, 0xf1, 0x4f, 0x01, - 0x32, 0xbc, 0xad, 0x1b, 0x9a, 0xad, 0x99, 0x0e, 0x7a, 0x02, 0x29, 0xd3, 0xb0, 0x26, 0x53, 0x22, - 0x9c, 0x34, 0x25, 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xf3, 0x4b, 0xaf, 0xde, 0xe7, 0x97, 0xfe, 0x78, 0x9f, 0x5f, 0xfa, 0xfa, 0x7a, - 0xcf, 0xa0, 0x87, 0xc3, 0x4e, 0xa9, 0x4b, 0x4c, 0xfe, 0x71, 0xc3, 0xff, 0xdd, 0x74, 0xf4, 0x6f, - 0xca, 0x47, 0xec, 0x83, 0x8d, 0x8e, 0x07, 0xd8, 0x71, 0xbf, 0xc6, 0x62, 0x6c, 0x02, 0x6e, 0xff, - 0x13, 0x00, 0x00, 0xff, 0xff, 0xba, 0xe0, 0x97, 0xe3, 0xce, 0x0d, 0x00, 0x00, + // 1446 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcf, 0x6f, 0x1a, 0xc7, + 0x17, 0xf7, 0x02, 0xc6, 0xf0, 0x30, 0x98, 0x8c, 0x1d, 0x7b, 0xed, 0xc4, 0xd8, 0x41, 0x51, 0xe4, + 0x6f, 0x7e, 0xc0, 0xd7, 0x49, 0xd3, 0x43, 0x53, 0xa9, 0xc2, 0xb0, 0x69, 0xb0, 0x12, 0x43, 0x17, + 0x62, 0x27, 0x55, 0xa5, 0xd5, 0xda, 0x3b, 0x81, 0x55, 0xd8, 0x1d, 0xba, 0x33, 0x10, 0xf3, 0x27, + 0xf4, 0x96, 0x63, 0x4f, 0x55, 0x8f, 0x3d, 0xf6, 0x10, 0xf5, 0x6f, 0xc8, 0xa9, 0x8a, 0xd2, 0x43, + 0x7b, 0x69, 0x52, 0x25, 0x87, 0x4a, 0xf9, 0x2b, 0xaa, 0x99, 0x9d, 0x65, 0x31, 0xa6, 0xb5, 0x9d, + 0x0b, 0xec, 0xbc, 0xf7, 0xf9, 0xbc, 0x79, 0xf3, 0x7e, 0xcd, 0x2e, 0x2c, 0x1d, 0x10, 0xea, 0x10, + 0x5a, 0x6c, 0x91, 0x7e, 0xb1, 0xbf, 0xc9, 0xff, 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, + 0x85, 0xa4, 0xe5, 0x63, 0x89, 0x27, 0xed, 0xaa, 0xaf, 0x5f, 0xdc, 0x58, 0x90, 0x76, 0x4b, 0x96, + 0xe5, 0x61, 0x4a, 0x1b, 0xcc, 0xb3, 0xdd, 0x96, 0x1e, 0x42, 0xd1, 0xe7, 0x10, 0x37, 0x1d, 0xd2, + 0x73, 0x99, 0x1a, 0x5d, 0x8f, 0x6e, 0xa4, 0x42, 0xff, 0x79, 0x9a, 0x0a, 0x32, 0x4d, 0x85, 0x32, + 0xb1, 0xdd, 0xad, 0xe4, 0xcb, 0x37, 0x6b, 0x53, 0x3f, 0xfd, 0xfd, 0xf3, 0x55, 0x45, 0x97, 0x9c, + 0xfc, 0xdb, 0x69, 0x48, 0xd4, 0xa5, 0x13, 0x28, 0x03, 0x91, 0xa1, 0x6b, 0x11, 0xdb, 0x42, 0xff, + 0x87, 0x84, 0x83, 0x29, 0x35, 0x5b, 0x98, 0xaa, 0x11, 0x61, 0x7c, 0xa1, 0xe0, 0x67, 0xa4, 0x10, + 0x64, 0xa4, 0x50, 0x72, 0x07, 0xfa, 0x10, 0x85, 0x6e, 0x43, 0x9c, 0x32, 0x93, 0xf5, 0xa8, 0x1a, + 0x15, 0xc1, 0x5c, 0x1d, 0x0b, 0x66, 0xb0, 0x55, 0x43, 0x80, 0x74, 0x09, 0x46, 0xf7, 0x00, 0x3d, + 0xb1, 0x5d, 0xb3, 0x63, 0x30, 0xb3, 0xd3, 0x19, 0x18, 0x1e, 0xa6, 0xbd, 0x0e, 0x53, 0x63, 0xeb, + 0xca, 0x46, 0xea, 0xe6, 0xca, 0x98, 0x89, 0x26, 0x87, 0xe8, 0x02, 0xa1, 0x67, 0x05, 0x6b, 0x44, + 0x82, 0x4a, 0x90, 0xa2, 0xbd, 0x7d, 0xc7, 0x66, 0x06, 0x2f, 0x33, 0x75, 0x5a, 0x9a, 0x18, 0xf7, + 0xba, 0x19, 0xd4, 0xe0, 0x56, 0xec, 0xf9, 0xdb, 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5a, 0xcb, 0x66, 0xed, 0xde, 0x7e, 0xe1, 0x80, + 0x38, 0xf2, 0xd3, 0x49, 0xfe, 0xdd, 0xa0, 0xd6, 0xd3, 0xe2, 0xa1, 0xf8, 0x1c, 0x64, 0x83, 0x2e, + 0xa6, 0xfc, 0x5b, 0x2f, 0x2e, 0xfa, 0xeb, 0xd6, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x7c, + 0x8a, 0xfb, 0x2c, 0x0e, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { @@ -1654,6 +1722,54 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *CrossChainParamsChange) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CrossChainParamsChange) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CrossChainParamsChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Targets) > 0 { + for iNdEx := len(m.Targets) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Targets[iNdEx]) + copy(dAtA[i:], m.Targets[iNdEx]) + i = encodeVarintGov(dAtA, i, uint64(len(m.Targets[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Values) > 0 { + for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Values[iNdEx]) + copy(dAtA[i:], m.Values[iNdEx]) + i = encodeVarintGov(dAtA, i, uint64(len(m.Values[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintGov(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintGov(dAtA []byte, offset int, v uint64) int { offset -= sovGov(v) base := offset @@ -1943,6 +2059,31 @@ func (m *Params) Size() (n int) { return n } +func (m *CrossChainParamsChange) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.Values) > 0 { + for _, s := range m.Values { + l = len(s) + n += 1 + l + sovGov(uint64(l)) + } + } + if len(m.Targets) > 0 { + for _, s := range m.Targets { + l = len(s) + n += 1 + l + sovGov(uint64(l)) + } + } + return n +} + func sovGov(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3876,6 +4017,152 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } +func (m *CrossChainParamsChange) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CrossChainParamsChange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CrossChainParamsChange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Values = append(m.Values, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Targets", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Targets = append(m.Targets, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipGov(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/gov/types/v1/msgs.go b/x/gov/types/v1/msgs.go index 0248befd38..eb30601b08 100644 --- a/x/gov/types/v1/msgs.go +++ b/x/gov/types/v1/msgs.go @@ -17,9 +17,9 @@ import ( ) var ( - _, _, _, _, _, _, _ sdk.Msg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{}, &MsgExecLegacyContent{}, &MsgUpdateParams{}, &MsgCancelProposal{} - _, _, _, _, _, _, _ legacytx.LegacyMsg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{}, &MsgExecLegacyContent{}, &MsgUpdateParams{}, &MsgCancelProposal{} - _, _ codectypes.UnpackInterfacesMessage = &MsgSubmitProposal{}, &MsgExecLegacyContent{} + _, _, _, _, _, _, _, _ sdk.Msg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{}, &MsgExecLegacyContent{}, &MsgUpdateParams{}, &MsgUpdateCrossChainParams{}, &MsgCancelProposal{} + _, _, _, _, _, _, _, _ legacytx.LegacyMsg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{}, &MsgExecLegacyContent{}, &MsgUpdateParams{}, &MsgUpdateCrossChainParams{}, &MsgCancelProposal{} + _, _ codectypes.UnpackInterfacesMessage = &MsgSubmitProposal{}, &MsgExecLegacyContent{} ) // NewMsgSubmitProposal creates a new MsgSubmitProposal. @@ -307,6 +307,26 @@ func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{authority} } +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgUpdateCrossChainParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid authority address: %s", err) + } + return msg.Params.ValidateBasic() +} + +// GetSignBytes returns the message bytes to sign over. +func (msg MsgUpdateCrossChainParams) GetSignBytes() []byte { + bz := codec.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners returns the expected signers for a MsgUpdateCrossChainParams. +func (msg MsgUpdateCrossChainParams) GetSigners() []sdk.AccAddress { + authority, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{authority} +} + // NewMsgCancelProposal creates a new MsgCancelProposal instance // //nolint:interfacer diff --git a/x/gov/types/v1/tx.pb.go b/x/gov/types/v1/tx.pb.go index 3ab042b178..21da4b4c4f 100644 --- a/x/gov/types/v1/tx.pb.go +++ b/x/gov/types/v1/tx.pb.go @@ -824,6 +824,101 @@ func (m *MsgCancelProposalResponse) GetCanceledHeight() uint64 { return 0 } +// MsgUpdateCrossChainParams for cross chain gov +type MsgUpdateCrossChainParams struct { + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // cross chain + Params CrossChainParamsChange `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateCrossChainParams) Reset() { *m = MsgUpdateCrossChainParams{} } +func (m *MsgUpdateCrossChainParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateCrossChainParams) ProtoMessage() {} +func (*MsgUpdateCrossChainParams) Descriptor() ([]byte, []int) { + return fileDescriptor_9ff8f4a63b6fc9a9, []int{14} +} +func (m *MsgUpdateCrossChainParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateCrossChainParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateCrossChainParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateCrossChainParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateCrossChainParams.Merge(m, src) +} +func (m *MsgUpdateCrossChainParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateCrossChainParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateCrossChainParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateCrossChainParams proto.InternalMessageInfo + +func (m *MsgUpdateCrossChainParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateCrossChainParams) GetParams() CrossChainParamsChange { + if m != nil { + return m.Params + } + return CrossChainParamsChange{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateCrossChainParamsResponse struct { +} + +func (m *MsgUpdateCrossChainParamsResponse) Reset() { *m = MsgUpdateCrossChainParamsResponse{} } +func (m *MsgUpdateCrossChainParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateCrossChainParamsResponse) ProtoMessage() {} +func (*MsgUpdateCrossChainParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9ff8f4a63b6fc9a9, []int{15} +} +func (m *MsgUpdateCrossChainParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateCrossChainParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateCrossChainParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateCrossChainParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateCrossChainParamsResponse.Merge(m, src) +} +func (m *MsgUpdateCrossChainParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateCrossChainParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateCrossChainParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateCrossChainParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos.gov.v1.MsgSubmitProposal") proto.RegisterType((*MsgSubmitProposalResponse)(nil), "cosmos.gov.v1.MsgSubmitProposalResponse") @@ -839,78 +934,83 @@ func init() { proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.gov.v1.MsgUpdateParamsResponse") proto.RegisterType((*MsgCancelProposal)(nil), "cosmos.gov.v1.MsgCancelProposal") proto.RegisterType((*MsgCancelProposalResponse)(nil), "cosmos.gov.v1.MsgCancelProposalResponse") + proto.RegisterType((*MsgUpdateCrossChainParams)(nil), "cosmos.gov.v1.MsgUpdateCrossChainParams") + proto.RegisterType((*MsgUpdateCrossChainParamsResponse)(nil), "cosmos.gov.v1.MsgUpdateCrossChainParamsResponse") } func init() { proto.RegisterFile("cosmos/gov/v1/tx.proto", fileDescriptor_9ff8f4a63b6fc9a9) } var fileDescriptor_9ff8f4a63b6fc9a9 = []byte{ - // 1042 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0xe6, 0xc3, 0x4e, 0x26, 0x4d, 0xa2, 0xac, 0xdc, 0x76, 0xbd, 0x2a, 0x6b, 0x77, 0x8b, - 0xc0, 0x4a, 0xc8, 0x2e, 0x0e, 0xb4, 0x42, 0xa6, 0x42, 0xaa, 0x43, 0x05, 0x95, 0x30, 0x54, 0x5b, - 0x28, 0x12, 0x42, 0x8a, 0xc6, 0xde, 0x61, 0xb3, 0xc2, 0xbb, 0xb3, 0xf2, 0x8c, 0xad, 0xf8, 0x86, - 0x38, 0xf6, 0xd4, 0x3f, 0x83, 0x63, 0x0e, 0xbd, 0xf5, 0xc4, 0xad, 0xe2, 0x54, 0x71, 0xe2, 0x54, - 0x50, 0x22, 0x08, 0xe2, 0x9f, 0x00, 0xcd, 0xc7, 0xae, 0xf7, 0x2b, 0x1f, 0x70, 0xe0, 0x62, 0xed, - 0xfc, 0xde, 0xc7, 0xbc, 0xf7, 0x7b, 0xf3, 0xde, 0x33, 0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0xf5, 0x1c, 0x94, 0x90, 0xf3, - 0x87, 0x02, 0x40, 0x8f, 0x78, 0xf1, 0x54, 0xf8, 0x8f, 0xbc, 0xdc, 0x01, 0x2b, 0x72, 0x26, 0xe1, - 0x8b, 0xb9, 0x99, 0xa9, 0xaa, 0x77, 0x41, 0x05, 0x06, 0x78, 0x1c, 0x52, 0x49, 0xcf, 0xe5, 0x46, - 0x99, 0xb4, 0xe9, 0x6c, 0xf3, 0x56, 0x49, 0xbc, 0x31, 0x22, 0xb4, 0x02, 0x11, 0x32, 0x33, 0xb3, - 0x06, 0xd4, 0xd9, 0x29, 0x49, 0xff, 0xb9, 0x78, 0x1b, 0x5f, 0x44, 0x2e, 0xa4, 0xe8, 0x21, 0x1c, - 0xc1, 0x80, 0xb0, 0x64, 0x66, 0xfd, 0xa9, 0x5c, 0x94, 0x4c, 0xa2, 0xaa, 0xbe, 0x07, 0x2a, 0x11, - 0xf7, 0xc0, 0x19, 0x58, 0xdd, 0xbd, 0x9a, 0xab, 0xb5, 0x70, 0x9f, 0x49, 0x44, 0xe8, 0x77, 0xee, - 0x14, 0x7b, 0xfe, 0x56, 0x2a, 0x91, 0xc3, 0x78, 0xdb, 0xe5, 0x22, 0x95, 0x75, 0x4d, 0x43, 0x49, - 0x62, 0x4f, 0x14, 0xbe, 0x75, 0xf6, 0x60, 0x38, 0x40, 0xc3, 0xd4, 0xd6, 0x29, 0x29, 0xef, 0x46, - 0xae, 0xbc, 0x99, 0xca, 0xa6, 0xd7, 0xc4, 0xfc, 0x65, 0xd7, 0x44, 0x67, 0x2d, 0x33, 0xbc, 0xcd, - 0x1f, 0x15, 0x3e, 0x99, 0xb3, 0xc1, 0x24, 0x93, 0xf9, 0xdf, 0x07, 0xf5, 0x00, 0xac, 0x0d, 0xb8, - 0x2f, 0xe4, 0xee, 0xb3, 0x75, 0x2b, 0x09, 0xd7, 0x0b, 0x73, 0xf9, 0xf3, 0x78, 0x17, 0x77, 0x97, - 0x19, 0xeb, 0x4f,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, 0xd3, 0x08, 0x11, 0xf6, 0xd7, 0xb9, - 0xc2, 0xdb, 0xe0, 0x9d, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xda, 0xbe, 0x64, 0x9b, 0x7a, 0x0b, - 0x00, 0x00, + // 1096 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6f, 0xdc, 0xc4, + 0x17, 0x8f, 0xf3, 0x6b, 0x93, 0x49, 0x93, 0x28, 0xd6, 0xb6, 0x75, 0xac, 0x7e, 0xbd, 0x89, 0xf3, + 0x05, 0xa2, 0x84, 0xd8, 0x6c, 0xa0, 0x15, 0x5a, 0x2a, 0x44, 0x77, 0xa9, 0x68, 0x25, 0x16, 0x2a, + 0x17, 0x8a, 0x84, 0x90, 0xa2, 0xc9, 0x7a, 0xf0, 0x5a, 0xac, 0x3d, 0x96, 0x67, 0x76, 0x95, 0xbd, + 0x21, 0x8e, 0x3d, 0xf5, 0xcf, 0xe0, 0x98, 0x43, 0x6f, 0x3d, 0x71, 0xab, 0x38, 0x55, 0x9c, 0x38, + 0xb5, 0x28, 0x11, 0x04, 0xf1, 0x4f, 0x80, 0xe6, 0x87, 0xbd, 0xeb, 0x1f, 0xd9, 0x04, 0x90, 0xb8, + 0x44, 0x9e, 0xcf, 0xfb, 0x31, 0xef, 0x7d, 0xde, 0x9b, 0xf7, 0x36, 0xe0, 0x5a, 0x07, 0x93, 0x00, + 0x13, 0xdb, 0xc3, 0x03, 0x7b, 0x50, 0xb7, 0xe9, 0x91, 0x15, 0xc5, 0x98, 0x62, 0x75, 0x59, 0xe0, + 0x96, 0x87, 0x07, 0xd6, 0xa0, 0xae, 0x1b, 0x52, 0xed, 0x10, 0x12, 0x64, 0x0f, 0xea, 0x87, 0x88, + 0xc2, 0xba, 0xdd, 0xc1, 0x7e, 0x28, 0xd4, 0xf5, 0xeb, 0x59, 0x37, 0xcc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x28, 0xc3, 0x93, 0xf4, 0xcd, 0x5f, + 0x15, 0x50, 0x69, 0x13, 0xef, 0x11, 0xa6, 0x48, 0xbd, 0x59, 0x42, 0x45, 0xb3, 0xfa, 0xc7, 0xcb, + 0xda, 0x38, 0x2c, 0xba, 0x66, 0x8c, 0x20, 0xd5, 0x02, 0x73, 0x03, 0x4c, 0x51, 0x2c, 0x62, 0x9e, + 0xd0, 0x2e, 0x42, 0x4d, 0xad, 0x83, 0x79, 0x1c, 0x51, 0x1f, 0x87, 0xbc, 0xbf, 0x56, 0x46, 0x7d, + 0x2a, 0xd8, 0xb1, 0x58, 0x2c, 0x9f, 0x72, 0x05, 0x47, 0x2a, 0x4e, 0x6a, 0xaf, 0xc6, 0xff, 0x19, + 0x31, 0xc2, 0x35, 0x23, 0xe5, 0x6a, 0x81, 0x14, 0xe6, 0xcf, 0x5c, 0x03, 0xab, 0xf2, 0x33, 0x4d, + 0xfd, 0x4f, 0x25, 0xc5, 0xbe, 0x40, 0xbe, 0xd7, 0xa5, 0xc8, 0xfd, 0xaf, 0x28, 0x78, 0x0f, 0x54, + 0x44, 0x66, 0x44, 0x9b, 0xe1, 0x6f, 0x75, 0x33, 0xc7, 0x41, 0x12, 0xd0, 0x18, 0x17, 0x89, 0xc5, + 0x44, 0x32, 0xde, 0xcc, 0x92, 0xf1, 0xbf, 0x52, 0x32, 0x12, 0xe7, 0xe6, 0x3a, 0xb8, 0x9e, 0x83, + 0x52, 0x72, 0x7e, 0x53, 0x00, 0x68, 0x13, 0x2f, 0x99, 0x0a, 0xff, 0x90, 0x97, 0x5b, 0x60, 0x51, + 0xce, 0x24, 0x7c, 0x31, 0x37, 0x23, 0x55, 0xf5, 0x36, 0x98, 0x87, 0x01, 0xee, 0x87, 0x54, 0xd2, + 0x73, 0xb9, 0x51, 0x26, 0x6d, 0x1a, 0xbb, 0xfc, 0xa9, 0xa4, 0xde, 0x18, 0x11, 0x5a, 0x81, 0x08, + 0x99, 0x99, 0x59, 0x05, 0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a, 0x1d, + 0x46, 0x88, 0xb0, 0xff, 0x20, 0xe6, 0xf9, 0x34, 0x78, 0xfb, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x3a, 0xf9, 0x4f, 0x6e, 0x81, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1777,6 +1877,69 @@ func (m *MsgCancelProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *MsgUpdateCrossChainParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateCrossChainParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateCrossChainParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateCrossChainParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateCrossChainParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateCrossChainParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -2021,6 +2184,30 @@ func (m *MsgCancelProposalResponse) Size() (n int) { return n } +func (m *MsgUpdateCrossChainParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateCrossChainParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3521,6 +3708,171 @@ func (m *MsgCancelProposalResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateCrossChainParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateCrossChainParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateCrossChainParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateCrossChainParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateCrossChainParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateCrossChainParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 810596e2e52d2a3029c7ca7f5251272c4bbc2efb Mon Sep 17 00:00:00 2001 From: Alexgao001 Date: Mon, 10 Apr 2023 11:26:40 +0800 Subject: [PATCH 02/11] crosschain gov --- x/gov/keeper/msg_server.go | 7 +++++++ x/gov/types/v1/msgs.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 1d049cc9e6..04e5e80324 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -235,6 +235,13 @@ func (k msgServer) UpdateCrossChainParams(goCtx context.Context, msg *v1.MsgUpda return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) + + signers := msg.GetSigners() + govAcct := k.GetGovernanceAccount(ctx).GetAddress() + if len(signers) != 1 || !signers[0].Equals(govAcct) { + return nil, govtypes.ErrInvalidSigner + } + if err := k.SyncParams(ctx, msg.Params); err != nil { return nil, err } diff --git a/x/gov/types/v1/msgs.go b/x/gov/types/v1/msgs.go index eb30601b08..7ae2729f7d 100644 --- a/x/gov/types/v1/msgs.go +++ b/x/gov/types/v1/msgs.go @@ -323,7 +323,7 @@ func (msg MsgUpdateCrossChainParams) GetSignBytes() []byte { // GetSigners returns the expected signers for a MsgUpdateCrossChainParams. func (msg MsgUpdateCrossChainParams) GetSigners() []sdk.AccAddress { - authority, _ := sdk.AccAddressFromBech32(msg.Authority) + authority, _ := sdk.AccAddressFromHexUnsafe(msg.Authority) return []sdk.AccAddress{authority} } From f2082c85eb30b5313333d8bc088a9644b08a0e1c Mon Sep 17 00:00:00 2001 From: Alexgao001 Date: Tue, 11 Apr 2023 12:03:40 +0800 Subject: [PATCH 03/11] make test passed --- proto/cosmos/gov/v1/gov.proto | 8 +- proto/cosmos/gov/v1/tx.proto | 9 +- x/gov/keeper/common_test.go | 6 +- x/gov/keeper/deposit_test.go | 6 +- x/gov/keeper/hooks_test.go | 2 +- x/gov/keeper/keeper_test.go | 7 +- x/gov/keeper/msg_server.go | 6 +- x/gov/keeper/proposal_test.go | 64 ++++++++ x/gov/keeper/vote_test.go | 2 +- x/gov/module.go | 2 + x/gov/testutil/expected_keepers.go | 10 ++ x/gov/testutil/expected_keepers_mocks.go | 54 +++++++ x/gov/types/crosschain.go | 7 +- x/gov/types/v1/codec.go | 1 - x/gov/types/v1/gov.pb.go | 9 +- x/gov/types/v1/tx.pb.go | 186 ++++++++++++++--------- 16 files changed, 273 insertions(+), 106 deletions(-) diff --git a/proto/cosmos/gov/v1/gov.proto b/proto/cosmos/gov/v1/gov.proto index 29c0332950..4146ddd2db 100644 --- a/proto/cosmos/gov/v1/gov.proto +++ b/proto/cosmos/gov/v1/gov.proto @@ -254,13 +254,13 @@ message Params { bool burn_vote_veto = 15; } -// -// Since: cosmos-sdk 0.47 +// CrossChainParamsChange defines the parameter change or contract upgrade message CrossChainParamsChange { - // param to be updated or 'upgrade' + // parameter to be updated or 'upgrade' for contract upgrade string key = 1; - // slice of + // values is a new parameter or slice of new contract addresses in hex format repeated string values = 2; + // targets defines a slice of addresses string in hex format repeated string targets = 3; } diff --git a/proto/cosmos/gov/v1/tx.proto b/proto/cosmos/gov/v1/tx.proto index 0734bfd290..18c5467563 100644 --- a/proto/cosmos/gov/v1/tx.proto +++ b/proto/cosmos/gov/v1/tx.proto @@ -39,7 +39,7 @@ service Msg { // Since: cosmos-sdk 0.47 rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); - + // UpdateCrossChainParams defines a method to send IBC package to update cross-chain params rpc UpdateCrossChainParams(MsgUpdateCrossChainParams) returns (MsgUpdateCrossChainParamsResponse); // CancelProposal defines a method to cancel governance proposal @@ -215,12 +215,9 @@ message MsgUpdateCrossChainParams { // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // cross chain + // for cross chain param change or contract upgrade CrossChainParamsChange params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// -// Since: cosmos-sdk 0.47 +// MsgUpdateCrossChainParamsResponse defines the response structure for executing a MsgUpdateCrossChainParams message. message MsgUpdateCrossChainParamsResponse {} diff --git a/x/gov/keeper/common_test.go b/x/gov/keeper/common_test.go index 3c1af49a2a..c630cd8802 100644 --- a/x/gov/keeper/common_test.go +++ b/x/gov/keeper/common_test.go @@ -54,6 +54,7 @@ func setupGovKeeper(t *testing.T) ( *govtestutil.MockBankKeeper, *govtestutil.MockStakingKeeper, *govtestutil.MockDistributionKeeper, + *govtestutil.MockCrossChainKeeper, moduletestutil.TestEncodingConfig, sdk.Context, ) { @@ -75,6 +76,7 @@ func setupGovKeeper(t *testing.T) ( bankKeeper := govtestutil.NewMockBankKeeper(ctrl) stakingKeeper := govtestutil.NewMockStakingKeeper(ctrl) distributionKeeper := govtestutil.NewMockDistributionKeeper(ctrl) + crossChainKeeper := govtestutil.NewMockCrossChainKeeper(ctrl) acctKeeper.EXPECT().GetModuleAddress(types.ModuleName).Return(govAcct).AnyTimes() acctKeeper.EXPECT().GetModuleAddress(disttypes.ModuleName).Return(distAcct).AnyTimes() @@ -90,7 +92,7 @@ func setupGovKeeper(t *testing.T) ( distributionKeeper.EXPECT().FundCommunityPool(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() // Gov keeper initializations - govKeeper := keeper.NewKeeper(encCfg.Codec, key, acctKeeper, bankKeeper, stakingKeeper, distributionKeeper, msr, types.DefaultConfig(), govAcct.String()) + govKeeper := keeper.NewKeeper(encCfg.Codec, key, acctKeeper, bankKeeper, stakingKeeper, distributionKeeper, crossChainKeeper, msr, types.DefaultConfig(), govAcct.String()) govKeeper.SetProposalID(ctx, 1) govRouter := v1beta1.NewRouter() // Also register legacy gov handlers to test them too. govRouter.AddRoute(types.RouterKey, v1beta1.ProposalHandler) @@ -102,7 +104,7 @@ func setupGovKeeper(t *testing.T) ( v1.RegisterMsgServer(msr, keeper.NewMsgServerImpl(govKeeper)) banktypes.RegisterMsgServer(msr, nil) // Nil is fine here as long as we never execute the proposal's Msgs. - return govKeeper, acctKeeper, bankKeeper, stakingKeeper, distributionKeeper, encCfg, ctx + return govKeeper, acctKeeper, bankKeeper, stakingKeeper, distributionKeeper, crossChainKeeper, encCfg, ctx } // trackMockBalances sets up expected calls on the Mock BankKeeper, and also diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index 30218e8f40..95f3875823 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -35,7 +35,7 @@ func TestDeposits(t *testing.T) { for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { - govKeeper, _, bankKeeper, stakingKeeper, distKeeper, _, ctx := setupGovKeeper(t) + govKeeper, _, bankKeeper, stakingKeeper, distKeeper, _, _, ctx := setupGovKeeper(t) trackMockBalances(bankKeeper, distKeeper) // With expedited proposals the minimum deposit is higher, so we must @@ -235,7 +235,7 @@ func TestValidateInitialDeposit(t *testing.T) { for name, tc := range testcases { t.Run(name, func(t *testing.T) { - govKeeper, _, _, _, _, _, ctx := setupGovKeeper(t) + govKeeper, _, _, _, _, _, _, ctx := setupGovKeeper(t) params := v1.DefaultParams() if tc.expedited { @@ -297,7 +297,7 @@ func TestChargeDeposit(t *testing.T) { } t.Run(testName(i), func(t *testing.T) { - govKeeper, _, bankKeeper, stakingKeeper, _, _, ctx := setupGovKeeper(t) + govKeeper, _, bankKeeper, stakingKeeper, _, _, _, ctx := setupGovKeeper(t) params := v1.DefaultParams() params.ProposalCancelRatio = tc.proposalCancelRatio TestAddrs := simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 2, sdk.NewInt(10000000000)) diff --git a/x/gov/keeper/hooks_test.go b/x/gov/keeper/hooks_test.go index c4aa2b6b06..583104a1a4 100644 --- a/x/gov/keeper/hooks_test.go +++ b/x/gov/keeper/hooks_test.go @@ -47,7 +47,7 @@ func (h *MockGovHooksReceiver) AfterProposalVotingPeriodEnded(ctx sdk.Context, p func TestHooks(t *testing.T) { minDeposit := v1.DefaultParams().MinDeposit - govKeeper, _, bankKeeper, stakingKeeper, _, _, ctx := setupGovKeeper(t) + govKeeper, _, bankKeeper, stakingKeeper, _, _, _, ctx := setupGovKeeper(t) addrs := simtestutil.AddTestAddrs(bankKeeper, stakingKeeper, ctx, 1, minDeposit[0].Amount) govHooksReceiver := MockGovHooksReceiver{} diff --git a/x/gov/keeper/keeper_test.go b/x/gov/keeper/keeper_test.go index bf4bc71edb..03db4e8aeb 100644 --- a/x/gov/keeper/keeper_test.go +++ b/x/gov/keeper/keeper_test.go @@ -28,6 +28,7 @@ type KeeperTestSuite struct { bankKeeper *govtestutil.MockBankKeeper stakingKeeper *govtestutil.MockStakingKeeper distKeeper *govtestutil.MockDistributionKeeper + crossChainKeeper *govtestutil.MockCrossChainKeeper queryClient v1.QueryClient legacyQueryClient v1beta1.QueryClient addrs []sdk.AccAddress @@ -40,7 +41,7 @@ func (suite *KeeperTestSuite) SetupSuite() { } func (suite *KeeperTestSuite) reset() { - govKeeper, acctKeeper, bankKeeper, stakingKeeper, distKeeper, encCfg, ctx := setupGovKeeper(suite.T()) + govKeeper, acctKeeper, bankKeeper, stakingKeeper, distKeeper, _, encCfg, ctx := setupGovKeeper(suite.T()) // Populate the gov account with some coins, as the TestProposal we have // is a MsgSend from the gov account. @@ -73,7 +74,7 @@ func (suite *KeeperTestSuite) reset() { } func TestIncrementProposalNumber(t *testing.T) { - govKeeper, _, _, _, _, _, ctx := setupGovKeeper(t) //nolint:dogsled + govKeeper, _, _, _, _, _, _, ctx := setupGovKeeper(t) //nolint:dogsled tp := TestProposal _, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("0x45f3624b98fCfc4D7A6b37B0957b656878636773"), false) @@ -93,7 +94,7 @@ func TestIncrementProposalNumber(t *testing.T) { } func TestProposalQueues(t *testing.T) { - govKeeper, _, _, _, _, _, ctx := setupGovKeeper(t) //nolint:dogsled + govKeeper, _, _, _, _, _, _, ctx := setupGovKeeper(t) //nolint:dogsled // create test proposals tp := TestProposal diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 04e5e80324..c11968e37f 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -83,7 +83,7 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos }, nil } -// CancelProposals implements the MsgServer.CancelProposal method. +// CancelProposal CancelProposals implements the MsgServer.CancelProposal method. func (k msgServer) CancelProposal(goCtx context.Context, msg *v1.MsgCancelProposal) (*v1.MsgCancelProposalResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) _, err := sdk.AccAddressFromHexUnsafe(msg.Proposer) @@ -230,7 +230,7 @@ func (k msgServer) UpdateParams(goCtx context.Context, msg *v1.MsgUpdateParams) } // UpdateCrossChainParams implements the MsgServer.UpdateCrossChainParams method. -func (k msgServer) UpdateCrossChainParams(goCtx context.Context, msg *v1.MsgUpdateCrossChainParams) (*v1.MsgUpdateCrossChainParams, error) { +func (k msgServer) UpdateCrossChainParams(goCtx context.Context, msg *v1.MsgUpdateCrossChainParams) (*v1.MsgUpdateCrossChainParamsResponse, error) { if k.authority != msg.Authority { return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) } @@ -245,7 +245,7 @@ func (k msgServer) UpdateCrossChainParams(goCtx context.Context, msg *v1.MsgUpda if err := k.SyncParams(ctx, msg.Params); err != nil { return nil, err } - return &v1.MsgUpdateCrossChainParams{}, nil + return &v1.MsgUpdateCrossChainParamsResponse{}, nil } type legacyMsgServer struct { diff --git a/x/gov/keeper/proposal_test.go b/x/gov/keeper/proposal_test.go index fe71431b9a..78b7f14343 100644 --- a/x/gov/keeper/proposal_test.go +++ b/x/gov/keeper/proposal_test.go @@ -325,3 +325,67 @@ func TestMigrateProposalMessages(t *testing.T) { require.Equal(t, "Test", content.GetTitle()) require.Equal(t, "description", content.GetDescription()) } + +func (suite *KeeperTestSuite) TestUpdateCrossChainParams() { + testCases := []struct { + name string + request *v1.MsgUpdateCrossChainParams + expectErr bool + }{ + { + name: "set invalid authority", + request: &v1.MsgUpdateCrossChainParams{ + Authority: "foo", + }, + expectErr: true, + }, + { + name: "more than 1 parameter change is not allowed", + request: &v1.MsgUpdateCrossChainParams{ + Authority: suite.govKeeper.GetAuthority(), + Params: v1.CrossChainParamsChange{ + Key: "change_1", + Values: []string{"new_change_1"}, + Targets: []string{"0x76d244CE05c3De4BbC6fDd7F56379B145709ade9"}, + }, + }, + expectErr: true, + }, + { + name: "'values' and 'targets' should all be hex address for contract upgrade", + request: &v1.MsgUpdateCrossChainParams{ + Authority: suite.govKeeper.GetAuthority(), + Params: v1.CrossChainParamsChange{ + Key: "upgrade", + Values: []string{"not_an_address"}, + Targets: []string{"not_an_address"}, + }, + }, + expectErr: true, + }, + { + name: "'values' and 'targets' size not match", + request: &v1.MsgUpdateCrossChainParams{ + Authority: suite.govKeeper.GetAuthority(), + Params: v1.CrossChainParamsChange{ + Key: "upgrade", + Values: []string{"not_an_address", "not_an_address"}, + Targets: []string{"not_an_address"}, + }, + }, + expectErr: true, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + _, err := suite.msgSrvr.UpdateCrossChainParams(suite.ctx, tc.request) + if tc.expectErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + } + }) + } +} diff --git a/x/gov/keeper/vote_test.go b/x/gov/keeper/vote_test.go index 435b251a27..4b20eef771 100644 --- a/x/gov/keeper/vote_test.go +++ b/x/gov/keeper/vote_test.go @@ -11,7 +11,7 @@ import ( ) func TestVotes(t *testing.T) { - govKeeper, _, bankKeeper, stakingKeeper, _, _, ctx := setupGovKeeper(t) + govKeeper, _, bankKeeper, stakingKeeper, _, _, _, ctx := setupGovKeeper(t) addrs := simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 2, sdk.NewInt(10000000)) tp := TestProposal diff --git a/x/gov/module.go b/x/gov/module.go index bab185aaf0..cbbebfb36a 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -177,6 +177,7 @@ type GovInputs struct { BankKeeper govtypes.BankKeeper StakingKeeper govtypes.StakingKeeper DistributionKeeper govtypes.DistributionKeeper + CrossChainKeeper govtypes.CrossChainKeeper // LegacySubspace is used solely for migration of x/params managed parameters LegacySubspace govtypes.ParamSubspace @@ -210,6 +211,7 @@ func ProvideModule(in GovInputs) GovOutputs { in.BankKeeper, in.StakingKeeper, in.DistributionKeeper, + in.CrossChainKeeper, in.MsgServiceRouter, defaultConfig, authority.String(), diff --git a/x/gov/testutil/expected_keepers.go b/x/gov/testutil/expected_keepers.go index 9652b94602..0f9445d507 100644 --- a/x/gov/testutil/expected_keepers.go +++ b/x/gov/testutil/expected_keepers.go @@ -4,6 +4,7 @@ package testutil import ( context "context" + "math/big" math "cosmossdk.io/math" @@ -39,3 +40,12 @@ type StakingKeeper interface { type DistributionKeeper interface { FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error } + +// CrossChainKeeper defines the expected distribution keeper +type CrossChainKeeper interface { + RegisterChannel(name string, id sdk.ChannelID, app sdk.CrossChainApplication) error + + CreateRawIBCPackageWithFee(ctx sdk.Context, channelID sdk.ChannelID, packageType sdk.CrossChainPackageType, + packageLoad []byte, relayerFee *big.Int, ackRelayerFee *big.Int, + ) (uint64, error) +} diff --git a/x/gov/testutil/expected_keepers_mocks.go b/x/gov/testutil/expected_keepers_mocks.go index e59d2a5656..e2a8e57827 100644 --- a/x/gov/testutil/expected_keepers_mocks.go +++ b/x/gov/testutil/expected_keepers_mocks.go @@ -6,6 +6,7 @@ package testutil import ( context "context" + "math/big" reflect "reflect" math "cosmossdk.io/math" @@ -1071,3 +1072,56 @@ func (mr *MockDistributionKeeperMockRecorder) FundCommunityPool(ctx, amount, sen mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FundCommunityPool", reflect.TypeOf((*MockDistributionKeeper)(nil).FundCommunityPool), ctx, amount, sender) } + +// MockCrossChainKeeper is a mock of CrossChainKeeper interface. +type MockCrossChainKeeper struct { + ctrl *gomock.Controller + recorder *MockCrossChainKeeperMockRecorder +} + +// MockCrossChainKeeperMockRecorder is the mock recorder for MockCrossChainKeeper. +type MockCrossChainKeeperMockRecorder struct { + mock *MockCrossChainKeeper +} + +// NewMockCrossChainKeeper creates a new mock instance. +func NewMockCrossChainKeeper(ctrl *gomock.Controller) *MockCrossChainKeeper { + mock := &MockCrossChainKeeper{ctrl: ctrl} + mock.recorder = &MockCrossChainKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockCrossChainKeeper) EXPECT() *MockCrossChainKeeperMockRecorder { + return m.recorder +} + +// RegisterChannel mocks base method. +func (m *MockCrossChainKeeper) RegisterChannel(name string, id types.ChannelID, app types.CrossChainApplication) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RegisterChannel", name, id, app) + ret0, _ := ret[0].(error) + return ret0 +} + +// RegisterChannel indicates an expected call of RegisterChannel. +func (mr *MockCrossChainKeeperMockRecorder) RegisterChannel(name, id, app interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterChannel", reflect.TypeOf((*MockCrossChainKeeper)(nil).RegisterChannel), name, id, app) +} + +// CreateRawIBCPackageWithFee mocks base method. +func (m *MockCrossChainKeeper) CreateRawIBCPackageWithFee(ctx types.Context, channelID types.ChannelID, packageType types.CrossChainPackageType, + packageLoad []byte, relayerFee, ackRelayerFee *big.Int) (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateRawIBCPackageWithFee", ctx, channelID, packageType, packageLoad, relayerFee, ackRelayerFee) + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateRawIBCPackageWithFee indicates an expected call of CreateRawIBCPackageWithFee. +func (mr *MockCrossChainKeeperMockRecorder) CreateRawIBCPackageWithFee(ctx, channelID, packageType, packageLoad, relayerFee, ackRelayerFee interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRawIBCPackageWithFee", reflect.TypeOf((*MockCrossChainKeeper)(nil).CreateRawIBCPackageWithFee), ctx, channelID, packageType, packageLoad, relayerFee, ackRelayerFee) +} diff --git a/x/gov/types/crosschain.go b/x/gov/types/crosschain.go index 35eab03954..6a487aa7e4 100644 --- a/x/gov/types/crosschain.go +++ b/x/gov/types/crosschain.go @@ -12,11 +12,12 @@ const ( var KeySyncParamsRelayerFee = []byte("SyncParamsRelayerFee") -// SyncParamsPackage is the payload be relayed to BSC +// SyncParamsPackage is the payload to be encoded for cross-chain IBC package type SyncParamsPackage struct { + // Key is the parameter to be changed Key string - // new parameter or new smart contract address(es) if is ungraded proposal + // Value is either new parameter or new smart contract address(es) if it is an upgrade proposal Value []byte - // smart contract address(es) + // Target is the smart contract address(es) Target []byte } diff --git a/x/gov/types/v1/codec.go b/x/gov/types/v1/codec.go index 2849275d60..eb297cf28a 100644 --- a/x/gov/types/v1/codec.go +++ b/x/gov/types/v1/codec.go @@ -20,7 +20,6 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgVoteWeighted{}, "cosmos-sdk/v1/MsgVoteWeighted") legacy.RegisterAminoMsg(cdc, &MsgExecLegacyContent{}, "cosmos-sdk/v1/MsgExecLegacyContent") legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/gov/v1/MsgUpdateParams") - legacy.RegisterAminoMsg(cdc, &MsgUpdateCrossChainParams{}, "cosmos-sdk/x/gov/v1/MsgUpdateCrossChainParams") } diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 0c44f731b2..1745ca715d 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -921,12 +921,13 @@ func (m *Params) GetBurnVoteVeto() bool { return false } -// Since: cosmos-sdk 0.47 +// CrossChainParamsChange defines the parameter change or contract upgrade type CrossChainParamsChange struct { - // param to be updated or 'upgrade' + // parameter to be updated or 'upgrade' for contract upgrade Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // slice of - Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` + // values is a new parameter or slice of new contract addresses in hex format + Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` + // targets defines a slice of addresses string in hex format Targets []string `protobuf:"bytes,3,rep,name=targets,proto3" json:"targets,omitempty"` } diff --git a/x/gov/types/v1/tx.pb.go b/x/gov/types/v1/tx.pb.go index 21da4b4c4f..60a5d77e26 100644 --- a/x/gov/types/v1/tx.pb.go +++ b/x/gov/types/v1/tx.pb.go @@ -828,7 +828,7 @@ func (m *MsgCancelProposalResponse) GetCanceledHeight() uint64 { type MsgUpdateCrossChainParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // cross chain + // for cross chain param change or contract upgrade Params CrossChainParamsChange `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` } @@ -879,10 +879,7 @@ func (m *MsgUpdateCrossChainParams) GetParams() CrossChainParamsChange { return CrossChainParamsChange{} } -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// -// Since: cosmos-sdk 0.47 +// MsgUpdateCrossChainParamsResponse defines the response structure for executing a MsgUpdateCrossChainParams message. type MsgUpdateCrossChainParamsResponse struct { } @@ -941,76 +938,77 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1/tx.proto", fileDescriptor_9ff8f4a63b6fc9a9) } var fileDescriptor_9ff8f4a63b6fc9a9 = []byte{ - // 1096 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6f, 0xdc, 0xc4, - 0x17, 0x8f, 0xf3, 0x6b, 0x93, 0x49, 0x93, 0x28, 0xd6, 0xb6, 0x75, 0xac, 0x7e, 0xbd, 0x89, 0xf3, - 0x05, 0xa2, 0x84, 0xd8, 0x6c, 0xa0, 0x15, 0x5a, 0x2a, 0x44, 0x77, 0xa9, 0x68, 0x25, 0x16, 0x2a, - 0x17, 0x8a, 0x84, 0x90, 0xa2, 0xc9, 0x7a, 0xf0, 0x5a, 0xac, 0x3d, 0x96, 0x67, 0x76, 0x95, 0xbd, - 0x21, 0x8e, 0x3d, 0xf5, 0xcf, 0xe0, 0x98, 0x43, 0x6f, 0x3d, 0x71, 0xab, 0x38, 0x55, 0x9c, 0x38, - 0xb5, 0x28, 0x11, 0x04, 0xf1, 0x4f, 0x80, 0xe6, 0x87, 0xbd, 0xeb, 0x1f, 0xd9, 0x04, 0x90, 0xb8, - 0x44, 0x9e, 0xcf, 0xfb, 0x31, 0xef, 0x7d, 0xde, 0x9b, 0xf7, 0x36, 0xe0, 0x5a, 0x07, 0x93, 0x00, - 0x13, 0xdb, 0xc3, 0x03, 0x7b, 0x50, 0xb7, 0xe9, 0x91, 0x15, 0xc5, 0x98, 0x62, 0x75, 0x59, 0xe0, - 0x96, 0x87, 0x07, 0xd6, 0xa0, 0xae, 0x1b, 0x52, 0xed, 0x10, 0x12, 0x64, 0x0f, 0xea, 0x87, 0x88, - 0xc2, 0xba, 0xdd, 0xc1, 0x7e, 0x28, 0xd4, 0xf5, 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, 0x4d, 0x03, 0xdc, 0x28, 0xc3, 0x93, 0xf4, 0xcd, 0x5f, - 0x15, 0x50, 0x69, 0x13, 0xef, 0x11, 0xa6, 0x48, 0xbd, 0x59, 0x42, 0x45, 0xb3, 0xfa, 0xc7, 0xcb, - 0xda, 0x38, 0x2c, 0xba, 0x66, 0x8c, 0x20, 0xd5, 0x02, 0x73, 0x03, 0x4c, 0x51, 0x2c, 0x62, 0x9e, - 0xd0, 0x2e, 0x42, 0x4d, 0xad, 0x83, 0x79, 0x1c, 0x51, 0x1f, 0x87, 0xbc, 0xbf, 0x56, 0x46, 0x7d, - 0x2a, 0xd8, 0xb1, 0x58, 0x2c, 0x9f, 0x72, 0x05, 0x47, 0x2a, 0x4e, 0x6a, 0xaf, 0xc6, 0xff, 0x19, - 0x31, 0xc2, 0x35, 0x23, 0xe5, 0x6a, 0x81, 0x14, 0xe6, 0xcf, 0x5c, 0x03, 0xab, 0xf2, 0x33, 0x4d, - 0xfd, 0x4f, 0x25, 0xc5, 0xbe, 0x40, 0xbe, 0xd7, 0xa5, 0xc8, 0xfd, 0xaf, 0x28, 0x78, 0x0f, 0x54, - 0x44, 0x66, 0x44, 0x9b, 0xe1, 0x6f, 0x75, 0x33, 0xc7, 0x41, 0x12, 0xd0, 0x18, 0x17, 0x89, 0xc5, - 0x44, 0x32, 0xde, 0xcc, 0x92, 0xf1, 0xbf, 0x52, 0x32, 0x12, 0xe7, 0xe6, 0x3a, 0xb8, 0x9e, 0x83, - 0x52, 0x72, 0x7e, 0x53, 0x00, 0x68, 0x13, 0x2f, 0x99, 0x0a, 0xff, 0x90, 0x97, 0x5b, 0x60, 0x51, - 0xce, 0x24, 0x7c, 0x31, 0x37, 0x23, 0x55, 0xf5, 0x36, 0x98, 0x87, 0x01, 0xee, 0x87, 0x54, 0xd2, - 0x73, 0xb9, 0x51, 0x26, 0x6d, 0x1a, 0xbb, 0xfc, 0xa9, 0xa4, 0xde, 0x18, 0x11, 0x5a, 0x81, 0x08, - 0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0xde, 0x2e, 0xb4, 0x3a, 0x1d, - 0x46, 0x88, 0xb0, 0xff, 0x20, 0xe6, 0xf9, 0x34, 0x78, 0xfb, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x3a, 0xf9, 0x4f, 0x6e, 0x81, 0x0c, 0x00, 0x00, + // 1114 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcd, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xe6, 0xcb, 0xc9, 0xb4, 0x49, 0x94, 0x95, 0x9b, 0x6e, 0x56, 0xc5, 0x4e, 0x36, 0x7c, + 0x58, 0x09, 0xd9, 0xad, 0x03, 0xad, 0x90, 0xa9, 0x10, 0xb5, 0xa9, 0x68, 0x25, 0x0c, 0xd5, 0x16, + 0x8a, 0x84, 0x2a, 0x45, 0x13, 0xef, 0xb0, 0x5e, 0x91, 0xdd, 0x59, 0xed, 0x8c, 0xad, 0xf8, 0x86, + 0x38, 0xf6, 0xd4, 0x3f, 0x83, 0x63, 0x0e, 0xbd, 0xf5, 0xc4, 0xad, 0xe2, 0x54, 0x71, 0xe2, 0x94, + 0xa2, 0x44, 0x10, 0x89, 0x7f, 0x02, 0x34, 0x1f, 0xbb, 0xf6, 0x7e, 0xd8, 0x09, 0x20, 0x71, 0x89, + 0x76, 0xde, 0xfb, 0xbd, 0x37, 0xef, 0xfd, 0xde, 0x9b, 0xf7, 0x62, 0xb0, 0xd6, 0xc1, 0xc4, 0xc7, + 0xc4, 0x72, 0x71, 0xdf, 0xea, 0xd7, 0x2d, 0x7a, 0x64, 0x86, 0x11, 0xa6, 0x58, 0x5d, 0x12, 0x72, + 0xd3, 0xc5, 0x7d, 0xb3, 0x5f, 0xd7, 0x2b, 0x12, 0x76, 0x00, 0x09, 0xb2, 0xfa, 0xf5, 0x03, 0x44, + 0x61, 0xdd, 0xea, 0x60, 0x2f, 0x10, 0x70, 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xb7, 0xd3, 0x8a, 0xf2, 0xec, 0xac, 0x32, 0xf5, 0xea, 0xac, 0x32, 0xf5, 0xeb, 0x59, 0x65, + 0xea, 0x9b, 0x1d, 0xd7, 0xa3, 0xdd, 0xde, 0x81, 0xd9, 0xc1, 0xbe, 0xfc, 0x25, 0x61, 0xe5, 0x1e, + 0x18, 0x1d, 0x84, 0x88, 0xb0, 0xdf, 0x2d, 0xf3, 0x7c, 0x06, 0xbd, 0xf7, 0x77, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x56, 0x44, 0xd1, 0xd4, 0xf7, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1041,6 +1039,8 @@ type MsgClient interface { // // Since: cosmos-sdk 0.47 UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // UpdateCrossChainParams defines a method to send IBC package to update cross-chain params + UpdateCrossChainParams(ctx context.Context, in *MsgUpdateCrossChainParams, opts ...grpc.CallOption) (*MsgUpdateCrossChainParamsResponse, error) // CancelProposal defines a method to cancel governance proposal // // Since: cosmos-sdk 0.48 @@ -1109,6 +1109,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) UpdateCrossChainParams(ctx context.Context, in *MsgUpdateCrossChainParams, opts ...grpc.CallOption) (*MsgUpdateCrossChainParamsResponse, error) { + out := new(MsgUpdateCrossChainParamsResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1.Msg/UpdateCrossChainParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) CancelProposal(ctx context.Context, in *MsgCancelProposal, opts ...grpc.CallOption) (*MsgCancelProposalResponse, error) { out := new(MsgCancelProposalResponse) err := c.cc.Invoke(ctx, "/cosmos.gov.v1.Msg/CancelProposal", in, out, opts...) @@ -1136,6 +1145,8 @@ type MsgServer interface { // // Since: cosmos-sdk 0.47 UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // UpdateCrossChainParams defines a method to send IBC package to update cross-chain params + UpdateCrossChainParams(context.Context, *MsgUpdateCrossChainParams) (*MsgUpdateCrossChainParamsResponse, error) // CancelProposal defines a method to cancel governance proposal // // Since: cosmos-sdk 0.48 @@ -1164,6 +1175,9 @@ func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *MsgDeposit) (*M func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) UpdateCrossChainParams(ctx context.Context, req *MsgUpdateCrossChainParams) (*MsgUpdateCrossChainParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateCrossChainParams not implemented") +} func (*UnimplementedMsgServer) CancelProposal(ctx context.Context, req *MsgCancelProposal) (*MsgCancelProposalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelProposal not implemented") } @@ -1280,6 +1294,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_UpdateCrossChainParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateCrossChainParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateCrossChainParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1.Msg/UpdateCrossChainParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateCrossChainParams(ctx, req.(*MsgUpdateCrossChainParams)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_CancelProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgCancelProposal) if err := dec(in); err != nil { @@ -1326,6 +1358,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "UpdateCrossChainParams", + Handler: _Msg_UpdateCrossChainParams_Handler, + }, { MethodName: "CancelProposal", Handler: _Msg_CancelProposal_Handler, From c0ba54b0885a63dbe329de475edda3c0b3f887f1 Mon Sep 17 00:00:00 2001 From: Alexgao001 Date: Tue, 11 Apr 2023 12:31:44 +0800 Subject: [PATCH 04/11] make test passed --- x/gov/keeper/crosschain.go | 3 --- x/gov/keeper/keeper_test.go | 3 ++- x/gov/keeper/proposal_test.go | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/x/gov/keeper/crosschain.go b/x/gov/keeper/crosschain.go index 0db579e0e0..bd4ca71d7d 100644 --- a/x/gov/keeper/crosschain.go +++ b/x/gov/keeper/crosschain.go @@ -16,7 +16,6 @@ func (k Keeper) RegisterCrossChainSyncParamsApp() error { } func (k Keeper) SyncParams(ctx sdk.Context, cpc govv1.CrossChainParamsChange) error { - // this validates content and size of changes is not empty if err := cpc.ValidateBasic(); err != nil { return err } @@ -67,8 +66,6 @@ func (k Keeper) SyncParams(ctx sdk.Context, cpc govv1.CrossChainParamsChange) er return err } -// Need these in order to register paramsKeeper to be a CrosschainApp so that it can register channel(3) - func (k Keeper) ExecuteSynPackage(ctx sdk.Context, appCtx *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { k.Logger(ctx).Error("received sync params sync package", "payload", hex.EncodeToString(payload)) return sdk.ExecuteResult{} diff --git a/x/gov/keeper/keeper_test.go b/x/gov/keeper/keeper_test.go index 03db4e8aeb..45d36c4e70 100644 --- a/x/gov/keeper/keeper_test.go +++ b/x/gov/keeper/keeper_test.go @@ -41,7 +41,7 @@ func (suite *KeeperTestSuite) SetupSuite() { } func (suite *KeeperTestSuite) reset() { - govKeeper, acctKeeper, bankKeeper, stakingKeeper, distKeeper, _, encCfg, ctx := setupGovKeeper(suite.T()) + govKeeper, acctKeeper, bankKeeper, stakingKeeper, distKeeper, crossChainKeeper, encCfg, ctx := setupGovKeeper(suite.T()) // Populate the gov account with some coins, as the TestProposal we have // is a MsgSend from the gov account. @@ -64,6 +64,7 @@ func (suite *KeeperTestSuite) reset() { suite.bankKeeper = bankKeeper suite.stakingKeeper = stakingKeeper suite.distKeeper = distKeeper + suite.crossChainKeeper = crossChainKeeper suite.cdc = encCfg.Codec suite.queryClient = queryClient suite.legacyQueryClient = legacyQueryClient diff --git a/x/gov/keeper/proposal_test.go b/x/gov/keeper/proposal_test.go index 78b7f14343..5080671d4b 100644 --- a/x/gov/keeper/proposal_test.go +++ b/x/gov/keeper/proposal_test.go @@ -369,12 +369,24 @@ func (suite *KeeperTestSuite) TestUpdateCrossChainParams() { Authority: suite.govKeeper.GetAuthority(), Params: v1.CrossChainParamsChange{ Key: "upgrade", - Values: []string{"not_an_address", "not_an_address"}, - Targets: []string{"not_an_address"}, + Values: []string{"0x76d244CE05c3De4BbC6fDd7F56379B145709ade9", "0xeAE67217D95E786a9309A363437066428b97c046"}, + Targets: []string{"0xeAE67217D95E786a9309A363437066428b97c046"}, }, }, expectErr: true, }, + { + name: "single parameter change should work", + request: &v1.MsgUpdateCrossChainParams{ + Authority: suite.govKeeper.GetAuthority(), + Params: v1.CrossChainParamsChange{ + Key: "param_1", + Values: []string{"new_param_1"}, + Targets: []string{"0x76d244CE05c3De4BbC6fDd7F56379B145709ade9"}, + }, + }, + expectErr: false, + }, } for _, tc := range testCases { From 0f9d1a04139a733344d355f7861593191ef05473 Mon Sep 17 00:00:00 2001 From: Alexgao001 Date: Wed, 12 Apr 2023 22:00:32 +0800 Subject: [PATCH 05/11] make test passed --- x/gov/keeper/common_test.go | 2 ++ x/gov/keeper/msg_server.go | 7 ------- x/gov/keeper/proposal_test.go | 30 +++++++++++++++++++++--------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/x/gov/keeper/common_test.go b/x/gov/keeper/common_test.go index c630cd8802..5de5087462 100644 --- a/x/gov/keeper/common_test.go +++ b/x/gov/keeper/common_test.go @@ -99,6 +99,8 @@ func setupGovKeeper(t *testing.T) ( govKeeper.SetLegacyRouter(govRouter) govKeeper.SetParams(ctx, v1.DefaultParams()) + crossChainKeeper.EXPECT().CreateRawIBCPackageWithFee(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(uint64(0), nil).AnyTimes() + // Register all handlers for the MegServiceRouter. msr.SetInterfaceRegistry(encCfg.InterfaceRegistry) v1.RegisterMsgServer(msr, keeper.NewMsgServerImpl(govKeeper)) diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index c11968e37f..644f341bf4 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -235,13 +235,6 @@ func (k msgServer) UpdateCrossChainParams(goCtx context.Context, msg *v1.MsgUpda return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) - - signers := msg.GetSigners() - govAcct := k.GetGovernanceAccount(ctx).GetAddress() - if len(signers) != 1 || !signers[0].Equals(govAcct) { - return nil, govtypes.ErrInvalidSigner - } - if err := k.SyncParams(ctx, msg.Params); err != nil { return nil, err } diff --git a/x/gov/keeper/proposal_test.go b/x/gov/keeper/proposal_test.go index 5080671d4b..568b4f65e9 100644 --- a/x/gov/keeper/proposal_test.go +++ b/x/gov/keeper/proposal_test.go @@ -335,18 +335,18 @@ func (suite *KeeperTestSuite) TestUpdateCrossChainParams() { { name: "set invalid authority", request: &v1.MsgUpdateCrossChainParams{ - Authority: "foo", + Authority: "0x76d244CE05c3De4BbC6fDd7F56379B145709ade9", }, expectErr: true, }, { - name: "more than 1 parameter change is not allowed", + name: "parameter change should restrict values and targets only be size 1", request: &v1.MsgUpdateCrossChainParams{ Authority: suite.govKeeper.GetAuthority(), Params: v1.CrossChainParamsChange{ - Key: "change_1", - Values: []string{"new_change_1"}, - Targets: []string{"0x76d244CE05c3De4BbC6fDd7F56379B145709ade9"}, + Key: "batchSizeForOracle", + Values: []string{"0000000000000000000000000000000000000000000000000000000000000033", "0000000000000000000000000000000000000000000000000000000000000034"}, + Targets: []string{"0x76d244CE05c3De4BbC6fDd7F56379B145709ade9", "0x76d244CE05c3De4BbC6fDd7F56379B145709ade9"}, }, }, expectErr: true, @@ -357,8 +357,8 @@ func (suite *KeeperTestSuite) TestUpdateCrossChainParams() { Authority: suite.govKeeper.GetAuthority(), Params: v1.CrossChainParamsChange{ Key: "upgrade", - Values: []string{"not_an_address"}, - Targets: []string{"not_an_address"}, + Values: []string{"not_an_hex_address"}, + Targets: []string{"not_an_hex_address"}, }, }, expectErr: true, @@ -380,8 +380,20 @@ func (suite *KeeperTestSuite) TestUpdateCrossChainParams() { request: &v1.MsgUpdateCrossChainParams{ Authority: suite.govKeeper.GetAuthority(), Params: v1.CrossChainParamsChange{ - Key: "param_1", - Values: []string{"new_param_1"}, + Key: "batchSizeForOracle", + Values: []string{"0000000000000000000000000000000000000000000000000000000000000033"}, + Targets: []string{"0x76d244CE05c3De4BbC6fDd7F56379B145709ade9"}, + }, + }, + expectErr: false, + }, + { + name: "upgrade smart contract", + request: &v1.MsgUpdateCrossChainParams{ + Authority: suite.govKeeper.GetAuthority(), + Params: v1.CrossChainParamsChange{ + Key: "upgrade", + Values: []string{"0xeAE67217D95E786a9309A363437066428b97c046"}, Targets: []string{"0x76d244CE05c3De4BbC6fDd7F56379B145709ade9"}, }, }, From 55ad39faeb7d1e6dcb8e4f7576dfbce666eccce9 Mon Sep 17 00:00:00 2001 From: Alexgao001 Date: Wed, 12 Apr 2023 22:19:05 +0800 Subject: [PATCH 06/11] fix DI --- simapp/app.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/simapp/app.go b/simapp/app.go index 7b55d53e64..23cd0fd00d 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -346,6 +346,7 @@ func NewSimApp( // set the governance module account as the authority for conducting upgrades app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.CrossChainKeeper = crosschainkeeper.NewKeeper(appCodec, keys[crosschaintypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) // Register the proposal types // Deprecated: Avoid adding new handlers, instead use the new proposal flow // by granting the governance module the right to execute the message. @@ -361,7 +362,7 @@ func NewSimApp( */ govKeeper := govkeeper.NewKeeper( appCodec, keys[govtypes.StoreKey], app.AccountKeeper, app.BankKeeper, - app.StakingKeeper, app.DistrKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + app.StakingKeeper, app.DistrKeeper, app.CrossChainKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // Set legacy router for backwards compatibility with gov v1beta1 @@ -369,13 +370,11 @@ func NewSimApp( app.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( - // register the governance hooks + // register the governance hooks ), ) app.NFTKeeper = nftkeeper.NewKeeper(runtime.NewKVStoreService(keys[nftkeeper.StoreKey]), appCodec, app.AccountKeeper, app.BankKeeper) - app.CrossChainKeeper = crosschainkeeper.NewKeeper(appCodec, keys[crosschaintypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) - // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( appCodec, keys[evidencetypes.StoreKey], app.StakingKeeper, app.SlashingKeeper, From 26d2f16e787c1a6fc45aba28823566e1d17904c7 Mon Sep 17 00:00:00 2001 From: yutianwu Date: Thu, 13 Apr 2023 09:45:58 +0800 Subject: [PATCH 07/11] fix some test cases --- tests/integration/gov/genesis_test.go | 2 ++ tests/integration/gov/module_test.go | 2 ++ testutil/configurator/configurator.go | 27 +++++++++++++++++++++++++++ x/bank/app_test.go | 2 ++ x/gov/common_test.go | 2 ++ x/gov/simulation/operations_test.go | 7 ++++++- 6 files changed, 41 insertions(+), 1 deletion(-) diff --git a/tests/integration/gov/genesis_test.go b/tests/integration/gov/genesis_test.go index eb6d00848c..32e643d94c 100644 --- a/tests/integration/gov/genesis_test.go +++ b/tests/integration/gov/genesis_test.go @@ -21,6 +21,7 @@ import ( bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" _ "github.com/cosmos/cosmos-sdk/x/consensus" + _ "github.com/cosmos/cosmos-sdk/x/crosschain" _ "github.com/cosmos/cosmos-sdk/x/distribution" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -52,6 +53,7 @@ var appConfig = configurator.NewAppConfig( configurator.StakingModule(), configurator.BankModule(), configurator.GovModule(), + configurator.CrossChainModule(), configurator.DistributionModule(), configurator.MintModule(), configurator.ConsensusModule(), diff --git a/tests/integration/gov/module_test.go b/tests/integration/gov/module_test.go index 50404579f3..4f9c368504 100644 --- a/tests/integration/gov/module_test.go +++ b/tests/integration/gov/module_test.go @@ -11,6 +11,7 @@ import ( authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" _ "github.com/cosmos/cosmos-sdk/x/authz/module" + _ "github.com/cosmos/cosmos-sdk/x/crosschain" _ "github.com/cosmos/cosmos-sdk/x/distribution" "github.com/cosmos/cosmos-sdk/x/gov/types" _ "github.com/cosmos/cosmos-sdk/x/mint" @@ -26,6 +27,7 @@ func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { configurator.StakingModule(), configurator.BankModule(), configurator.GovModule(), + configurator.CrossChainModule(), configurator.DistributionModule(), configurator.ConsensusModule(), ), diff --git a/testutil/configurator/configurator.go b/testutil/configurator/configurator.go index a1f8401b0f..39dff244a4 100644 --- a/testutil/configurator/configurator.go +++ b/testutil/configurator/configurator.go @@ -7,6 +7,7 @@ import ( authzmodulev1 "cosmossdk.io/api/cosmos/authz/module/v1" bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1" consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" + crosschainmodulev1 "cosmossdk.io/api/cosmos/crosschain/module/v1" distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1" evidencemodulev1 "cosmossdk.io/api/cosmos/evidence/module/v1" feegrantmodulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1" @@ -15,6 +16,7 @@ import ( groupmodulev1 "cosmossdk.io/api/cosmos/group/module/v1" mintmodulev1 "cosmossdk.io/api/cosmos/mint/module/v1" nftmodulev1 "cosmossdk.io/api/cosmos/nft/module/v1" + oraclemodulev1 "cosmossdk.io/api/cosmos/oracle/module/v1" paramsmodulev1 "cosmossdk.io/api/cosmos/params/module/v1" slashingmodulev1 "cosmossdk.io/api/cosmos/slashing/module/v1" stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1" @@ -43,6 +45,8 @@ var beginBlockOrder = []string{ "params", "consensus", "vesting", + "crosschain", + "oracle", } var endBlockersOrder = []string{ @@ -64,6 +68,8 @@ var endBlockersOrder = []string{ "consensus", "upgrade", "vesting", + "crosschain", + "oracle", } var initGenesisOrder = []string{ @@ -85,6 +91,8 @@ var initGenesisOrder = []string{ "consensus", "upgrade", "vesting", + "crosschain", + "oracle", } type appConfig struct { @@ -117,6 +125,7 @@ func AuthModule() ModuleOption { {Account: "not_bonded_tokens_pool", Permissions: []string{"burner", "staking"}}, {Account: "gov", Permissions: []string{"burner"}}, {Account: "nft"}, + {Account: "crosschain", Permissions: []string{"minter"}}, }, }), } @@ -264,6 +273,24 @@ func NFTModule() ModuleOption { } } +func CrossChainModule() ModuleOption { + return func(config *appConfig) { + config.moduleConfigs["crosschain"] = &appv1alpha1.ModuleConfig{ + Name: "crosschain", + Config: appconfig.WrapAny(&crosschainmodulev1.Module{}), + } + } +} + +func OracleModule() ModuleOption { + return func(config *appConfig) { + config.moduleConfigs["oracle"] = &appv1alpha1.ModuleConfig{ + Name: "oracle", + Config: appconfig.WrapAny(&oraclemodulev1.Module{}), + } + } +} + func OmitInitGenesis() ModuleOption { return func(config *appConfig) { config.setInitGenesis = false diff --git a/x/bank/app_test.go b/x/bank/app_test.go index 2061c6c615..6350690051 100644 --- a/x/bank/app_test.go +++ b/x/bank/app_test.go @@ -23,6 +23,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank/testutil" "github.com/cosmos/cosmos-sdk/x/bank/types" _ "github.com/cosmos/cosmos-sdk/x/consensus" + _ "github.com/cosmos/cosmos-sdk/x/crosschain" _ "github.com/cosmos/cosmos-sdk/x/distribution" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" _ "github.com/cosmos/cosmos-sdk/x/gov" @@ -118,6 +119,7 @@ func createTestSuite(t *testing.T, genesisAccounts []authtypes.GenesisAccount) s configurator.ConsensusModule(), configurator.BankModule(), configurator.GovModule(), + configurator.CrossChainModule(), configurator.DistributionModule(), ), startupCfg, &res.BankKeeper, &res.AccountKeeper, &res.DistributionKeeper) diff --git a/x/gov/common_test.go b/x/gov/common_test.go index a66259ec8a..b5a8598bee 100644 --- a/x/gov/common_test.go +++ b/x/gov/common_test.go @@ -23,6 +23,7 @@ import ( _ "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" _ "github.com/cosmos/cosmos-sdk/x/consensus" + _ "github.com/cosmos/cosmos-sdk/x/crosschain" _ "github.com/cosmos/cosmos-sdk/x/distribution" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" "github.com/cosmos/cosmos-sdk/x/gov/keeper" @@ -123,6 +124,7 @@ func createTestSuite(t *testing.T) suite { configurator.BankModule(), configurator.AuthzModule(), configurator.GovModule(), + configurator.CrossChainModule(), configurator.ConsensusModule(), configurator.DistributionModule(), ), diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index e89969d3ed..943b8dd258 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -10,6 +10,8 @@ import ( cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" + crosschainkeeper "github.com/cosmos/cosmos-sdk/x/crosschain/keeper" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil/configurator" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -24,6 +26,7 @@ import ( bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/cosmos/cosmos-sdk/x/bank/testutil" _ "github.com/cosmos/cosmos-sdk/x/consensus" + _ "github.com/cosmos/cosmos-sdk/x/crosschain" _ "github.com/cosmos/cosmos-sdk/x/distribution" dk "github.com/cosmos/cosmos-sdk/x/distribution/keeper" govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" @@ -374,6 +377,7 @@ type suite struct { AuthzKeeper authzkeeper.Keeper BankKeeper bankkeeper.Keeper GovKeeper *keeper.Keeper + CrossChainKeeper crosschainkeeper.Keeper StakingKeeper *stakingkeeper.Keeper DistributionKeeper dk.Keeper App *runtime.App @@ -393,7 +397,8 @@ func createTestSuite(t *testing.T, isCheckTx bool) (suite, sdk.Context) { configurator.ConsensusModule(), configurator.DistributionModule(), configurator.GovModule(), - ), &res.AccountKeeper, &res.AuthzKeeper, &res.BankKeeper, &res.GovKeeper, &res.StakingKeeper, &res.DistributionKeeper) + configurator.CrossChainModule(), + ), &res.AccountKeeper, &res.AuthzKeeper, &res.BankKeeper, &res.GovKeeper, &res.StakingKeeper, &res.DistributionKeeper, &res.CrossChainKeeper) require.NoError(t, err) ctx := app.BaseApp.NewContext(isCheckTx, cmtproto.Header{}) From d99054414509e0912b4a60816d2533028a310912 Mon Sep 17 00:00:00 2001 From: Alexgao001 Date: Thu, 13 Apr 2023 10:10:32 +0800 Subject: [PATCH 08/11] fix comments --- x/gov/testutil/expected_keepers.go | 2 +- x/gov/types/crosschain.go | 2 -- x/gov/types/v1/msgs.go | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/x/gov/testutil/expected_keepers.go b/x/gov/testutil/expected_keepers.go index 0f9445d507..ea07f6d2e1 100644 --- a/x/gov/testutil/expected_keepers.go +++ b/x/gov/testutil/expected_keepers.go @@ -41,7 +41,7 @@ type DistributionKeeper interface { FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error } -// CrossChainKeeper defines the expected distribution keeper +// CrossChainKeeper defines the expected crossChain keeper type CrossChainKeeper interface { RegisterChannel(name string, id sdk.ChannelID, app sdk.CrossChainApplication) error diff --git a/x/gov/types/crosschain.go b/x/gov/types/crosschain.go index 6a487aa7e4..7c33fb8ff2 100644 --- a/x/gov/types/crosschain.go +++ b/x/gov/types/crosschain.go @@ -10,8 +10,6 @@ const ( KeyUpgrade = "upgrade" ) -var KeySyncParamsRelayerFee = []byte("SyncParamsRelayerFee") - // SyncParamsPackage is the payload to be encoded for cross-chain IBC package type SyncParamsPackage struct { // Key is the parameter to be changed diff --git a/x/gov/types/v1/msgs.go b/x/gov/types/v1/msgs.go index 7ae2729f7d..c586c0b25b 100644 --- a/x/gov/types/v1/msgs.go +++ b/x/gov/types/v1/msgs.go @@ -309,7 +309,7 @@ func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { // ValidateBasic implements the sdk.Msg interface. func (msg MsgUpdateCrossChainParams) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + if _, err := sdk.AccAddressFromHexUnsafe(msg.Authority); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid authority address: %s", err) } return msg.Params.ValidateBasic() From e1fffcac993633d500af1e63c4b4f3ff12cacb5e Mon Sep 17 00:00:00 2001 From: Alexgao001 Date: Thu, 13 Apr 2023 10:43:03 +0800 Subject: [PATCH 09/11] change address conversion method since already validated --- x/gov/keeper/crosschain.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/x/gov/keeper/crosschain.go b/x/gov/keeper/crosschain.go index bd4ca71d7d..7f514e6ec5 100644 --- a/x/gov/keeper/crosschain.go +++ b/x/gov/keeper/crosschain.go @@ -26,10 +26,7 @@ func (k Keeper) SyncParams(ctx sdk.Context, cpc govv1.CrossChainParamsChange) er var value []byte var err error if cpc.Key == types.KeyUpgrade { - value, err = sdk.AccAddressFromHexUnsafe(v) - if err != nil { - return sdkerrors.Wrapf(types.ErrAddressNotValid, "smart contract address is not valid %s", v) - } + value = sdk.MustAccAddressFromHex(v) } else { value, err = hex.DecodeString(v) if err != nil { @@ -37,11 +34,7 @@ func (k Keeper) SyncParams(ctx sdk.Context, cpc govv1.CrossChainParamsChange) er } } values = append(values, value...) - - addr, err := sdk.AccAddressFromHexUnsafe(cpc.Targets[i]) - if err != nil { - return sdkerrors.Wrapf(types.ErrAddressNotValid, "smart contract address is not valid %s", cpc.Targets[i]) - } + addr := sdk.MustAccAddressFromHex(cpc.Targets[i]) addresses = append(addresses, addr.Bytes()...) } @@ -66,17 +59,17 @@ func (k Keeper) SyncParams(ctx sdk.Context, cpc govv1.CrossChainParamsChange) er return err } -func (k Keeper) ExecuteSynPackage(ctx sdk.Context, appCtx *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { +func (k Keeper) ExecuteSynPackage(ctx sdk.Context, _ *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { k.Logger(ctx).Error("received sync params sync package", "payload", hex.EncodeToString(payload)) return sdk.ExecuteResult{} } -func (k Keeper) ExecuteAckPackage(ctx sdk.Context, header *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { +func (k Keeper) ExecuteAckPackage(ctx sdk.Context, _ *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { k.Logger(ctx).Error("received sync params in ack package", "payload", hex.EncodeToString(payload)) return sdk.ExecuteResult{} } -func (k Keeper) ExecuteFailAckPackage(ctx sdk.Context, header *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { +func (k Keeper) ExecuteFailAckPackage(ctx sdk.Context, _ *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { k.Logger(ctx).Error("received sync params fail ack package", "payload", hex.EncodeToString(payload)) return sdk.ExecuteResult{} } From 3edbf773a66a12486e2485326ccef3ecdef1acf8 Mon Sep 17 00:00:00 2001 From: Alexgao001 Date: Thu, 13 Apr 2023 11:05:16 +0800 Subject: [PATCH 10/11] check space for string --- x/gov/types/v1/crosschain.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x/gov/types/v1/crosschain.go b/x/gov/types/v1/crosschain.go index 8d457bf351..1d1925b33e 100644 --- a/x/gov/types/v1/crosschain.go +++ b/x/gov/types/v1/crosschain.go @@ -3,6 +3,7 @@ package v1 import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" + "strings" ) func NewCrossChainParamsChange(key string, values, targets []string) *CrossChainParamsChange { @@ -23,10 +24,10 @@ func (m *CrossChainParamsChange) ValidateBasic() error { for i := 0; i < len(m.Values); i++ { value := m.Values[i] target := m.Targets[i] - if len(value) == 0 { + if len(strings.TrimSpace(value)) == 0 { return types.ErrEmptyValue } - if len(target) == 0 { + if len(strings.TrimSpace(target)) == 0 { return types.ErrEmptyTarget } if m.Key == types.KeyUpgrade { From 3b5620898d859d79fef008c7c798d163d7110a87 Mon Sep 17 00:00:00 2001 From: Alexgao001 Date: Thu, 13 Apr 2023 13:47:45 +0800 Subject: [PATCH 11/11] fix comments --- x/gov/keeper/msg_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 644f341bf4..8977f03e27 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -83,7 +83,7 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos }, nil } -// CancelProposal CancelProposals implements the MsgServer.CancelProposal method. +// CancelProposal implements the MsgServer.CancelProposal method. func (k msgServer) CancelProposal(goCtx context.Context, msg *v1.MsgCancelProposal) (*v1.MsgCancelProposalResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) _, err := sdk.AccAddressFromHexUnsafe(msg.Proposer)