diff --git a/Makefile b/Makefile index ce8dcb908570..da1c820c8dcd 100644 --- a/Makefile +++ b/Makefile @@ -301,6 +301,20 @@ proto-update-deps: @sed -i '' '9 s|proto/crypto/merkle/types.proto|third_party/proto/tendermint/proto/crypto/merkle/types.proto|g' $(TM_PROTO)/types/types.proto @sed -i '' '10 s|proto/version/version.proto|third_party/proto/tendermint/proto/version/version.proto|g' $(TM_PROTO)/types/types.proto + @curl -sSL $(TM_URL)/proto/types/evidence.proto > $(TM_PROTO)/types/evidence.proto + @sed -i '' '7 s|proto/types/types.proto|third_party/proto/tendermint/proto/types/types.proto|g' $(TM_PROTO)/types/evidence.proto + + @mkdir -p $(TM_PROTO)/evidence + @curl -sSL $(TM_URL)/proto/evidence/msgs.proto > $(TM_PROTO)/evidence/msgs.proto + @sed -i '' '7 s|proto/types/evidence.proto|third_party/proto/tendermint/proto/types/evidence.proto|g' $(TM_PROTO)/evidence/msgs.proto + + @curl -sSL $(TM_URL)/proto/types/block.proto > $(TM_PROTO)/types/block.proto + @sed -i '' '7 s|proto/types/types.proto|third_party/proto/tendermint/proto/types/types.proto|g' $(TM_PROTO)/types/block.proto + @sed -i '' '8 s|proto/types/evidence.proto|third_party/proto/tendermint/proto/types/evidence.proto|g' $(TM_PROTO)/types/block.proto + + @curl -sSL $(TM_URL)/proto/types/validator.proto > $(TM_PROTO)/types/validator.proto + @sed -i '' '7 s|proto/crypto/keys/types.proto|third_party/proto/tendermint/proto/crypto/keys/types.proto|g' $(TM_PROTO)/types/validator.proto + @mkdir -p $(TM_PROTO)/libs/bits @curl -sSL $(TM_URL)/proto/libs/bits/types.proto > $(TM_PROTO)/libs/bits/types.proto diff --git a/buf.yaml b/buf.yaml index a0b081889b21..b56b6c3c0b85 100644 --- a/buf.yaml +++ b/buf.yaml @@ -10,6 +10,8 @@ lint: - UNARY_RPC - COMMENT_FIELD - PACKAGE_DIRECTORY_MATCH + - ENUM_VALUE_PREFIX + - ENUM_ZERO_VALUE_SUFFIX ignore: - third_party - codec/testdata diff --git a/codec/amino.go b/codec/amino.go index c0936e70460b..aee2d42e24ae 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -7,6 +7,7 @@ import ( amino "github.com/tendermint/go-amino" cryptoamino "github.com/tendermint/tendermint/crypto/encoding/amino" + protokeys "github.com/tendermint/tendermint/proto/crypto/keys" tmtypes "github.com/tendermint/tendermint/types" ) @@ -34,6 +35,8 @@ func New() *Codec { // codec. func RegisterCrypto(cdc *Codec) { cryptoamino.RegisterAmino(cdc) + cryptoamino.RegisterKeyType(protokeys.PrivateKey{}, "tendermint/proto/PrivateKey") + cryptoamino.RegisterKeyType(protokeys.PublicKey{}, "tendermint/proto/PublicKey") } // RegisterEvidences registers Tendermint evidence types with the provided Amino diff --git a/crypto/hd/fundraiser_test.go b/crypto/hd/fundraiser_test.go index 9806e7117066..40526077d954 100644 --- a/crypto/hd/fundraiser_test.go +++ b/crypto/hd/fundraiser_test.go @@ -65,7 +65,7 @@ func TestFundraiserCompatibility(t *testing.T) { master, ch := hd.ComputeMastersFromSeed(seed) priv, err := hd.DerivePrivateKeyForPath(master, ch, "44'/118'/0'/0/0") require.NoError(t, err) - pub := secp256k1.PrivKey(priv).PubKey() + pub := secp256k1.PrivKey(priv[:]).PubKey() t.Log("\tNODEJS GOLANG\n") t.Logf("SEED \t%X %X\n", seedB, seed) @@ -78,7 +78,7 @@ func TestFundraiserCompatibility(t *testing.T) { require.Equal(t, priv[:], privB, "Expected priv keys to match") var pubBFixed [33]byte copy(pubBFixed[:], pubB) - require.Equal(t, pub, secp256k1.PubKey(pubBFixed), fmt.Sprintf("Expected pub keys to match for %d", i)) + require.Equal(t, pub, secp256k1.PubKey(pubBFixed[:]), fmt.Sprintf("Expected pub keys to match for %d", i)) addr := pub.Address() t.Logf("ADDR \t%X %X\n", addrB, addr) diff --git a/docs/architecture/adr-015-ibc-packet-receiver.md b/docs/architecture/adr-015-ibc-packet-receiver.md index 924ddc7eb648..4cf33d5fca90 100644 --- a/docs/architecture/adr-015-ibc-packet-receiver.md +++ b/docs/architecture/adr-015-ibc-packet-receiver.md @@ -248,7 +248,7 @@ func handleMsgTransfer(ctx Context, k Keeper, msg MsgTransfer) Result { } func handlePacketDataTransfer(ctx Context, k Keeper, packet Packet, data PacketDataTransfer) Result { - err := k.ReceiveTransfer(ctx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetDestinationPort(), packet.GetDestinationChannel(), data) + err := k.ReceiveTransfer(ctx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetDestPort(), packet.GetDestChannel(), data) if err != nil { // TODO: Source chain sent invalid packet, shutdown channel } @@ -257,7 +257,7 @@ func handlePacketDataTransfer(ctx Context, k Keeper, packet Packet, data PacketD } func handleCustomTimeoutPacket(ctx Context, k Keeper, packet CustomPacket) Result { - err := k.RecoverTransfer(ctx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetDestinationPort(), packet.GetDestinationChannel(), data) + err := k.RecoverTransfer(ctx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetDestPort(), packet.GetDestChannel(), data) if err != nil { // This chain sent invalid packet or cannot recover the funds panic(err) diff --git a/std/codec.go b/std/codec.go index ef439745e7ea..ead67cff4567 100644 --- a/std/codec.go +++ b/std/codec.go @@ -19,6 +19,7 @@ var ( _ bank.Codec = (*Codec)(nil) _ evidence.Codec = (*Codec)(nil) _ gov.Codec = (*Codec)(nil) + // _ clienttypes.Codec = (*Codec)(nil) ) // Codec defines the application-level codec. This codec contains all the diff --git a/std/codec.pb.go b/std/codec.pb.go index 269f6706fd48..fc8762dce946 100644 --- a/std/codec.pb.go +++ b/std/codec.pb.go @@ -6,22 +6,27 @@ package std import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types10 "github.com/cosmos/cosmos-sdk/types" + types14 "github.com/cosmos/cosmos-sdk/types" github_com_cosmos_cosmos_sdk_x_auth_exported "github.com/cosmos/cosmos-sdk/x/auth/exported" types "github.com/cosmos/cosmos-sdk/x/auth/types" types1 "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" github_com_cosmos_cosmos_sdk_x_bank_exported "github.com/cosmos/cosmos-sdk/x/bank/exported" types2 "github.com/cosmos/cosmos-sdk/x/bank/types" - types7 "github.com/cosmos/cosmos-sdk/x/crisis/types" - types6 "github.com/cosmos/cosmos-sdk/x/distribution/types" + types8 "github.com/cosmos/cosmos-sdk/x/crisis/types" + types7 "github.com/cosmos/cosmos-sdk/x/distribution/types" github_com_cosmos_cosmos_sdk_x_evidence_exported "github.com/cosmos/cosmos-sdk/x/evidence/exported" types3 "github.com/cosmos/cosmos-sdk/x/evidence/types" github_com_cosmos_cosmos_sdk_x_gov_types "github.com/cosmos/cosmos-sdk/x/gov/types" - types4 "github.com/cosmos/cosmos-sdk/x/gov/types" + types5 "github.com/cosmos/cosmos-sdk/x/gov/types" + github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" + types11 "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" + types12 "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" + types4 "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" + types13 "github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types" proposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - types8 "github.com/cosmos/cosmos-sdk/x/slashing/types" - types9 "github.com/cosmos/cosmos-sdk/x/staking/types" - types5 "github.com/cosmos/cosmos-sdk/x/upgrade/types" + types9 "github.com/cosmos/cosmos-sdk/x/slashing/types" + types10 "github.com/cosmos/cosmos-sdk/x/staking/types" + types6 "github.com/cosmos/cosmos-sdk/x/upgrade/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" _ "github.com/regen-network/cosmos-proto" @@ -251,6 +256,7 @@ type Evidence struct { // // Types that are valid to be assigned to Sum: // *Evidence_Equivocation + // *Evidence_ClientMisbehaviour Sum isEvidence_Sum `protobuf_oneof:"sum"` } @@ -297,8 +303,12 @@ type isEvidence_Sum interface { type Evidence_Equivocation struct { Equivocation *types3.Equivocation `protobuf:"bytes,1,opt,name=equivocation,proto3,oneof" json:"equivocation,omitempty"` } +type Evidence_ClientMisbehaviour struct { + ClientMisbehaviour *types4.Evidence `protobuf:"bytes,2,opt,name=client_misbehaviour,json=clientMisbehaviour,proto3,oneof" json:"client_misbehaviour,omitempty"` +} -func (*Evidence_Equivocation) isEvidence_Sum() {} +func (*Evidence_Equivocation) isEvidence_Sum() {} +func (*Evidence_ClientMisbehaviour) isEvidence_Sum() {} func (m *Evidence) GetSum() isEvidence_Sum { if m != nil { @@ -314,10 +324,18 @@ func (m *Evidence) GetEquivocation() *types3.Equivocation { return nil } +func (m *Evidence) GetClientMisbehaviour() *types4.Evidence { + if x, ok := m.GetSum().(*Evidence_ClientMisbehaviour); ok { + return x.ClientMisbehaviour + } + return nil +} + // XXX_OneofWrappers is for the internal use of the proto package. func (*Evidence) XXX_OneofWrappers() []interface{} { return []interface{}{ (*Evidence_Equivocation)(nil), + (*Evidence_ClientMisbehaviour)(nil), } } @@ -364,7 +382,7 @@ var xxx_messageInfo_MsgSubmitEvidence proto.InternalMessageInfo // MsgSubmitProposal defines the application-level message type for handling // governance proposals. type MsgSubmitProposal struct { - types4.MsgSubmitProposalBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` + types5.MsgSubmitProposalBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` Content *Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` } @@ -401,10 +419,10 @@ func (m *MsgSubmitProposal) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSubmitProposal proto.InternalMessageInfo -// Proposal defines the application-level concrete proposal type used in governance -// proposals. +// Proposal defines the application-level concrete proposal type used in +// governance proposals. type Proposal struct { - types4.ProposalBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` + types5.ProposalBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` Content Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content"` } @@ -451,7 +469,8 @@ func (m *Proposal) GetContent() Content { // Content defines the application-level allowed Content to be included in a // governance proposal. type Content struct { - // sum defines a set of all acceptable concrete governance proposal Content types. + // sum defines a set of all acceptable concrete governance proposal Content + // types. // // Types that are valid to be assigned to Sum: // *Content_Text @@ -503,19 +522,19 @@ type isContent_Sum interface { } type Content_Text struct { - Text *types4.TextProposal `protobuf:"bytes,1,opt,name=text,proto3,oneof" json:"text,omitempty"` + Text *types5.TextProposal `protobuf:"bytes,1,opt,name=text,proto3,oneof" json:"text,omitempty"` } type Content_ParameterChange struct { ParameterChange *proposal.ParameterChangeProposal `protobuf:"bytes,2,opt,name=parameter_change,json=parameterChange,proto3,oneof" json:"parameter_change,omitempty"` } type Content_SoftwareUpgrade struct { - SoftwareUpgrade *types5.SoftwareUpgradeProposal `protobuf:"bytes,3,opt,name=software_upgrade,json=softwareUpgrade,proto3,oneof" json:"software_upgrade,omitempty"` + SoftwareUpgrade *types6.SoftwareUpgradeProposal `protobuf:"bytes,3,opt,name=software_upgrade,json=softwareUpgrade,proto3,oneof" json:"software_upgrade,omitempty"` } type Content_CancelSoftwareUpgrade struct { - CancelSoftwareUpgrade *types5.CancelSoftwareUpgradeProposal `protobuf:"bytes,4,opt,name=cancel_software_upgrade,json=cancelSoftwareUpgrade,proto3,oneof" json:"cancel_software_upgrade,omitempty"` + CancelSoftwareUpgrade *types6.CancelSoftwareUpgradeProposal `protobuf:"bytes,4,opt,name=cancel_software_upgrade,json=cancelSoftwareUpgrade,proto3,oneof" json:"cancel_software_upgrade,omitempty"` } type Content_CommunityPoolSpend struct { - CommunityPoolSpend *types6.CommunityPoolSpendProposal `protobuf:"bytes,5,opt,name=community_pool_spend,json=communityPoolSpend,proto3,oneof" json:"community_pool_spend,omitempty"` + CommunityPoolSpend *types7.CommunityPoolSpendProposal `protobuf:"bytes,5,opt,name=community_pool_spend,json=communityPoolSpend,proto3,oneof" json:"community_pool_spend,omitempty"` } func (*Content_Text) isContent_Sum() {} @@ -531,7 +550,7 @@ func (m *Content) GetSum() isContent_Sum { return nil } -func (m *Content) GetText() *types4.TextProposal { +func (m *Content) GetText() *types5.TextProposal { if x, ok := m.GetSum().(*Content_Text); ok { return x.Text } @@ -545,21 +564,21 @@ func (m *Content) GetParameterChange() *proposal.ParameterChangeProposal { return nil } -func (m *Content) GetSoftwareUpgrade() *types5.SoftwareUpgradeProposal { +func (m *Content) GetSoftwareUpgrade() *types6.SoftwareUpgradeProposal { if x, ok := m.GetSum().(*Content_SoftwareUpgrade); ok { return x.SoftwareUpgrade } return nil } -func (m *Content) GetCancelSoftwareUpgrade() *types5.CancelSoftwareUpgradeProposal { +func (m *Content) GetCancelSoftwareUpgrade() *types6.CancelSoftwareUpgradeProposal { if x, ok := m.GetSum().(*Content_CancelSoftwareUpgrade); ok { return x.CancelSoftwareUpgrade } return nil } -func (m *Content) GetCommunityPoolSpend() *types6.CommunityPoolSpendProposal { +func (m *Content) GetCommunityPoolSpend() *types7.CommunityPoolSpendProposal { if x, ok := m.GetSum().(*Content_CommunityPoolSpend); ok { return x.CommunityPoolSpend } @@ -577,26 +596,26 @@ func (*Content) XXX_OneofWrappers() []interface{} { } } -// Transaction defines the application-level transaction that can be signed and -// processed by the state-machine. It contains a base of common fields and -// repeated set of Message types. -type Transaction struct { - StdTxBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:""` - Msgs []Message `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs"` +type ClientState struct { + // sum defines a set of all acceptable concrete ClientState implementations. + // + // Types that are valid to be assigned to Sum: + // *ClientState_Tendermint + Sum isClientState_Sum `protobuf_oneof:"sum"` } -func (m *Transaction) Reset() { *m = Transaction{} } -func (m *Transaction) String() string { return proto.CompactTextString(m) } -func (*Transaction) ProtoMessage() {} -func (*Transaction) Descriptor() ([]byte, []int) { +func (m *ClientState) Reset() { *m = ClientState{} } +func (m *ClientState) String() string { return proto.CompactTextString(m) } +func (*ClientState) ProtoMessage() {} +func (*ClientState) Descriptor() ([]byte, []int) { return fileDescriptor_ff851c3a98ef46f7, []int{7} } -func (m *Transaction) XXX_Unmarshal(b []byte) error { +func (m *ClientState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ClientState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Transaction.Marshal(b, m, deterministic) + return xxx_messageInfo_ClientState.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -606,56 +625,72 @@ func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *Transaction) XXX_Merge(src proto.Message) { - xxx_messageInfo_Transaction.Merge(m, src) +func (m *ClientState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientState.Merge(m, src) } -func (m *Transaction) XXX_Size() int { +func (m *ClientState) XXX_Size() int { return m.Size() } -func (m *Transaction) XXX_DiscardUnknown() { - xxx_messageInfo_Transaction.DiscardUnknown(m) +func (m *ClientState) XXX_DiscardUnknown() { + xxx_messageInfo_ClientState.DiscardUnknown(m) } -var xxx_messageInfo_Transaction proto.InternalMessageInfo +var xxx_messageInfo_ClientState proto.InternalMessageInfo -// Message defines the set of valid concrete message types that can be used to -// construct a transaction. -type Message struct { - // sum defines the set of all allowed valid messages defined in modules. +type isClientState_Sum interface { + isClientState_Sum() + MarshalTo([]byte) (int, error) + Size() int +} + +type ClientState_Tendermint struct { + Tendermint *types4.ClientState `protobuf:"bytes,1,opt,name=tendermint,proto3,oneof" json:"tendermint,omitempty"` +} + +func (*ClientState_Tendermint) isClientState_Sum() {} + +func (m *ClientState) GetSum() isClientState_Sum { + if m != nil { + return m.Sum + } + return nil +} + +func (m *ClientState) GetTendermint() *types4.ClientState { + if x, ok := m.GetSum().(*ClientState_Tendermint); ok { + return x.Tendermint + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ClientState) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*ClientState_Tendermint)(nil), + } +} + +type ConsensusState struct { + // sum defines a set of all acceptable concrete ConsensusState + // implementations. // // Types that are valid to be assigned to Sum: - // *Message_MsgSend - // *Message_MsgMultiSend - // *Message_MsgVerifyInvariant - // *Message_MsgSetWithdrawAddress - // *Message_MsgWithdrawDelegatorReward - // *Message_MsgWithdrawValidatorCommission - // *Message_MsgFundCommunityPool - // *Message_MsgSubmitEvidence - // *Message_MsgSubmitProposal - // *Message_MsgVote - // *Message_MsgDeposit - // *Message_MsgUnjail - // *Message_MsgCreateValidator - // *Message_MsgEditValidator - // *Message_MsgDelegate - // *Message_MsgBeginRedelegate - // *Message_MsgUndelegate - Sum isMessage_Sum `protobuf_oneof:"sum"` + // *ConsensusState_Tendermint + Sum isConsensusState_Sum `protobuf_oneof:"sum"` } -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto.CompactTextString(m) } -func (*Message) ProtoMessage() {} -func (*Message) Descriptor() ([]byte, []int) { +func (m *ConsensusState) Reset() { *m = ConsensusState{} } +func (m *ConsensusState) String() string { return proto.CompactTextString(m) } +func (*ConsensusState) ProtoMessage() {} +func (*ConsensusState) Descriptor() ([]byte, []int) { return fileDescriptor_ff851c3a98ef46f7, []int{8} } -func (m *Message) XXX_Unmarshal(b []byte) error { +func (m *ConsensusState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Message.Marshal(b, m, deterministic) + return xxx_messageInfo_ConsensusState.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -665,262 +700,292 @@ func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Message) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message.Merge(m, src) +func (m *ConsensusState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsensusState.Merge(m, src) } -func (m *Message) XXX_Size() int { +func (m *ConsensusState) XXX_Size() int { return m.Size() } -func (m *Message) XXX_DiscardUnknown() { - xxx_messageInfo_Message.DiscardUnknown(m) +func (m *ConsensusState) XXX_DiscardUnknown() { + xxx_messageInfo_ConsensusState.DiscardUnknown(m) } -var xxx_messageInfo_Message proto.InternalMessageInfo +var xxx_messageInfo_ConsensusState proto.InternalMessageInfo -type isMessage_Sum interface { - isMessage_Sum() +type isConsensusState_Sum interface { + isConsensusState_Sum() MarshalTo([]byte) (int, error) Size() int } -type Message_MsgSend struct { - MsgSend *types2.MsgSend `protobuf:"bytes,1,opt,name=msg_send,json=msgSend,proto3,oneof" json:"msg_send,omitempty"` +type ConsensusState_Tendermint struct { + Tendermint *types4.ConsensusState `protobuf:"bytes,1,opt,name=tendermint,proto3,oneof" json:"tendermint,omitempty"` } -type Message_MsgMultiSend struct { - MsgMultiSend *types2.MsgMultiSend `protobuf:"bytes,2,opt,name=msg_multi_send,json=msgMultiSend,proto3,oneof" json:"msg_multi_send,omitempty"` -} -type Message_MsgVerifyInvariant struct { - MsgVerifyInvariant *types7.MsgVerifyInvariant `protobuf:"bytes,3,opt,name=msg_verify_invariant,json=msgVerifyInvariant,proto3,oneof" json:"msg_verify_invariant,omitempty"` -} -type Message_MsgSetWithdrawAddress struct { - MsgSetWithdrawAddress *types6.MsgSetWithdrawAddress `protobuf:"bytes,4,opt,name=msg_set_withdraw_address,json=msgSetWithdrawAddress,proto3,oneof" json:"msg_set_withdraw_address,omitempty"` -} -type Message_MsgWithdrawDelegatorReward struct { - MsgWithdrawDelegatorReward *types6.MsgWithdrawDelegatorReward `protobuf:"bytes,5,opt,name=msg_withdraw_delegator_reward,json=msgWithdrawDelegatorReward,proto3,oneof" json:"msg_withdraw_delegator_reward,omitempty"` + +func (*ConsensusState_Tendermint) isConsensusState_Sum() {} + +func (m *ConsensusState) GetSum() isConsensusState_Sum { + if m != nil { + return m.Sum + } + return nil } -type Message_MsgWithdrawValidatorCommission struct { - MsgWithdrawValidatorCommission *types6.MsgWithdrawValidatorCommission `protobuf:"bytes,6,opt,name=msg_withdraw_validator_commission,json=msgWithdrawValidatorCommission,proto3,oneof" json:"msg_withdraw_validator_commission,omitempty"` + +func (m *ConsensusState) GetTendermint() *types4.ConsensusState { + if x, ok := m.GetSum().(*ConsensusState_Tendermint); ok { + return x.Tendermint + } + return nil } -type Message_MsgFundCommunityPool struct { - MsgFundCommunityPool *types6.MsgFundCommunityPool `protobuf:"bytes,7,opt,name=msg_fund_community_pool,json=msgFundCommunityPool,proto3,oneof" json:"msg_fund_community_pool,omitempty"` + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ConsensusState) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*ConsensusState_Tendermint)(nil), + } } -type Message_MsgSubmitEvidence struct { - MsgSubmitEvidence *MsgSubmitEvidence `protobuf:"bytes,8,opt,name=msg_submit_evidence,json=msgSubmitEvidence,proto3,oneof" json:"msg_submit_evidence,omitempty"` + +type Misbehaviour struct { + // sum defines a set of all acceptable concrete Misbehaviour implementations. + // + // Types that are valid to be assigned to Sum: + // *Misbehaviour_Tendermint + Sum isMisbehaviour_Sum `protobuf_oneof:"sum"` } -type Message_MsgSubmitProposal struct { - MsgSubmitProposal *MsgSubmitProposal `protobuf:"bytes,9,opt,name=msg_submit_proposal,json=msgSubmitProposal,proto3,oneof" json:"msg_submit_proposal,omitempty"` + +func (m *Misbehaviour) Reset() { *m = Misbehaviour{} } +func (m *Misbehaviour) String() string { return proto.CompactTextString(m) } +func (*Misbehaviour) ProtoMessage() {} +func (*Misbehaviour) Descriptor() ([]byte, []int) { + return fileDescriptor_ff851c3a98ef46f7, []int{9} } -type Message_MsgVote struct { - MsgVote *types4.MsgVote `protobuf:"bytes,10,opt,name=msg_vote,json=msgVote,proto3,oneof" json:"msg_vote,omitempty"` +func (m *Misbehaviour) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -type Message_MsgDeposit struct { - MsgDeposit *types4.MsgDeposit `protobuf:"bytes,11,opt,name=msg_deposit,json=msgDeposit,proto3,oneof" json:"msg_deposit,omitempty"` +func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Misbehaviour.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } -type Message_MsgUnjail struct { - MsgUnjail *types8.MsgUnjail `protobuf:"bytes,12,opt,name=msg_unjail,json=msgUnjail,proto3,oneof" json:"msg_unjail,omitempty"` +func (m *Misbehaviour) XXX_Merge(src proto.Message) { + xxx_messageInfo_Misbehaviour.Merge(m, src) } -type Message_MsgCreateValidator struct { - MsgCreateValidator *types9.MsgCreateValidator `protobuf:"bytes,13,opt,name=msg_create_validator,json=msgCreateValidator,proto3,oneof" json:"msg_create_validator,omitempty"` +func (m *Misbehaviour) XXX_Size() int { + return m.Size() } -type Message_MsgEditValidator struct { - MsgEditValidator *types9.MsgEditValidator `protobuf:"bytes,14,opt,name=msg_edit_validator,json=msgEditValidator,proto3,oneof" json:"msg_edit_validator,omitempty"` +func (m *Misbehaviour) XXX_DiscardUnknown() { + xxx_messageInfo_Misbehaviour.DiscardUnknown(m) } -type Message_MsgDelegate struct { - MsgDelegate *types9.MsgDelegate `protobuf:"bytes,15,opt,name=msg_delegate,json=msgDelegate,proto3,oneof" json:"msg_delegate,omitempty"` + +var xxx_messageInfo_Misbehaviour proto.InternalMessageInfo + +type isMisbehaviour_Sum interface { + isMisbehaviour_Sum() + MarshalTo([]byte) (int, error) + Size() int } -type Message_MsgBeginRedelegate struct { - MsgBeginRedelegate *types9.MsgBeginRedelegate `protobuf:"bytes,16,opt,name=msg_begin_redelegate,json=msgBeginRedelegate,proto3,oneof" json:"msg_begin_redelegate,omitempty"` + +type Misbehaviour_Tendermint struct { + Tendermint *types4.Evidence `protobuf:"bytes,1,opt,name=tendermint,proto3,oneof" json:"tendermint,omitempty"` } -type Message_MsgUndelegate struct { - MsgUndelegate *types9.MsgUndelegate `protobuf:"bytes,17,opt,name=msg_undelegate,json=msgUndelegate,proto3,oneof" json:"msg_undelegate,omitempty"` -} - -func (*Message_MsgSend) isMessage_Sum() {} -func (*Message_MsgMultiSend) isMessage_Sum() {} -func (*Message_MsgVerifyInvariant) isMessage_Sum() {} -func (*Message_MsgSetWithdrawAddress) isMessage_Sum() {} -func (*Message_MsgWithdrawDelegatorReward) isMessage_Sum() {} -func (*Message_MsgWithdrawValidatorCommission) isMessage_Sum() {} -func (*Message_MsgFundCommunityPool) isMessage_Sum() {} -func (*Message_MsgSubmitEvidence) isMessage_Sum() {} -func (*Message_MsgSubmitProposal) isMessage_Sum() {} -func (*Message_MsgVote) isMessage_Sum() {} -func (*Message_MsgDeposit) isMessage_Sum() {} -func (*Message_MsgUnjail) isMessage_Sum() {} -func (*Message_MsgCreateValidator) isMessage_Sum() {} -func (*Message_MsgEditValidator) isMessage_Sum() {} -func (*Message_MsgDelegate) isMessage_Sum() {} -func (*Message_MsgBeginRedelegate) isMessage_Sum() {} -func (*Message_MsgUndelegate) isMessage_Sum() {} -func (m *Message) GetSum() isMessage_Sum { +func (*Misbehaviour_Tendermint) isMisbehaviour_Sum() {} + +func (m *Misbehaviour) GetSum() isMisbehaviour_Sum { if m != nil { return m.Sum } return nil } -func (m *Message) GetMsgSend() *types2.MsgSend { - if x, ok := m.GetSum().(*Message_MsgSend); ok { - return x.MsgSend +func (m *Misbehaviour) GetTendermint() *types4.Evidence { + if x, ok := m.GetSum().(*Misbehaviour_Tendermint); ok { + return x.Tendermint } return nil } -func (m *Message) GetMsgMultiSend() *types2.MsgMultiSend { - if x, ok := m.GetSum().(*Message_MsgMultiSend); ok { - return x.MsgMultiSend +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Misbehaviour) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Misbehaviour_Tendermint)(nil), } - return nil } -func (m *Message) GetMsgVerifyInvariant() *types7.MsgVerifyInvariant { - if x, ok := m.GetSum().(*Message_MsgVerifyInvariant); ok { - return x.MsgVerifyInvariant - } - return nil +type Header struct { + // sum defines a set of all acceptable concrete Header implementations. + // + // Types that are valid to be assigned to Sum: + // *Header_Tendermint + Sum isHeader_Sum `protobuf_oneof:"sum"` } -func (m *Message) GetMsgSetWithdrawAddress() *types6.MsgSetWithdrawAddress { - if x, ok := m.GetSum().(*Message_MsgSetWithdrawAddress); ok { - return x.MsgSetWithdrawAddress - } - return nil +func (m *Header) Reset() { *m = Header{} } +func (m *Header) String() string { return proto.CompactTextString(m) } +func (*Header) ProtoMessage() {} +func (*Header) Descriptor() ([]byte, []int) { + return fileDescriptor_ff851c3a98ef46f7, []int{10} } - -func (m *Message) GetMsgWithdrawDelegatorReward() *types6.MsgWithdrawDelegatorReward { - if x, ok := m.GetSum().(*Message_MsgWithdrawDelegatorReward); ok { - return x.MsgWithdrawDelegatorReward - } - return nil +func (m *Header) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (m *Message) GetMsgWithdrawValidatorCommission() *types6.MsgWithdrawValidatorCommission { - if x, ok := m.GetSum().(*Message_MsgWithdrawValidatorCommission); ok { - return x.MsgWithdrawValidatorCommission +func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Header.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return nil +} +func (m *Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_Header.Merge(m, src) +} +func (m *Header) XXX_Size() int { + return m.Size() +} +func (m *Header) XXX_DiscardUnknown() { + xxx_messageInfo_Header.DiscardUnknown(m) } -func (m *Message) GetMsgFundCommunityPool() *types6.MsgFundCommunityPool { - if x, ok := m.GetSum().(*Message_MsgFundCommunityPool); ok { - return x.MsgFundCommunityPool - } - return nil +var xxx_messageInfo_Header proto.InternalMessageInfo + +type isHeader_Sum interface { + isHeader_Sum() + MarshalTo([]byte) (int, error) + Size() int } -func (m *Message) GetMsgSubmitEvidence() *MsgSubmitEvidence { - if x, ok := m.GetSum().(*Message_MsgSubmitEvidence); ok { - return x.MsgSubmitEvidence - } - return nil +type Header_Tendermint struct { + Tendermint *types4.Header `protobuf:"bytes,1,opt,name=tendermint,proto3,oneof" json:"tendermint,omitempty"` } -func (m *Message) GetMsgSubmitProposal() *MsgSubmitProposal { - if x, ok := m.GetSum().(*Message_MsgSubmitProposal); ok { - return x.MsgSubmitProposal +func (*Header_Tendermint) isHeader_Sum() {} + +func (m *Header) GetSum() isHeader_Sum { + if m != nil { + return m.Sum } return nil } -func (m *Message) GetMsgVote() *types4.MsgVote { - if x, ok := m.GetSum().(*Message_MsgVote); ok { - return x.MsgVote +func (m *Header) GetTendermint() *types4.Header { + if x, ok := m.GetSum().(*Header_Tendermint); ok { + return x.Tendermint } return nil } -func (m *Message) GetMsgDeposit() *types4.MsgDeposit { - if x, ok := m.GetSum().(*Message_MsgDeposit); ok { - return x.MsgDeposit +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Header) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Header_Tendermint)(nil), } - return nil } -func (m *Message) GetMsgUnjail() *types8.MsgUnjail { - if x, ok := m.GetSum().(*Message_MsgUnjail); ok { - return x.MsgUnjail - } - return nil +type MsgCreateClient struct { + // Types that are valid to be assigned to Sum: + // *MsgCreateClient_Tendermint + Sum isMsgCreateClient_Sum `protobuf_oneof:"sum"` } -func (m *Message) GetMsgCreateValidator() *types9.MsgCreateValidator { - if x, ok := m.GetSum().(*Message_MsgCreateValidator); ok { - return x.MsgCreateValidator +func (m *MsgCreateClient) Reset() { *m = MsgCreateClient{} } +func (m *MsgCreateClient) String() string { return proto.CompactTextString(m) } +func (*MsgCreateClient) ProtoMessage() {} +func (*MsgCreateClient) Descriptor() ([]byte, []int) { + return fileDescriptor_ff851c3a98ef46f7, []int{11} +} +func (m *MsgCreateClient) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateClient) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateClient.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return nil +} +func (m *MsgCreateClient) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateClient.Merge(m, src) +} +func (m *MsgCreateClient) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateClient) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateClient.DiscardUnknown(m) } -func (m *Message) GetMsgEditValidator() *types9.MsgEditValidator { - if x, ok := m.GetSum().(*Message_MsgEditValidator); ok { - return x.MsgEditValidator - } - return nil +var xxx_messageInfo_MsgCreateClient proto.InternalMessageInfo + +type isMsgCreateClient_Sum interface { + isMsgCreateClient_Sum() + MarshalTo([]byte) (int, error) + Size() int } -func (m *Message) GetMsgDelegate() *types9.MsgDelegate { - if x, ok := m.GetSum().(*Message_MsgDelegate); ok { - return x.MsgDelegate - } - return nil +type MsgCreateClient_Tendermint struct { + Tendermint *types4.MsgCreateClient `protobuf:"bytes,1,opt,name=tendermint,proto3,oneof" json:"tendermint,omitempty"` } -func (m *Message) GetMsgBeginRedelegate() *types9.MsgBeginRedelegate { - if x, ok := m.GetSum().(*Message_MsgBeginRedelegate); ok { - return x.MsgBeginRedelegate +func (*MsgCreateClient_Tendermint) isMsgCreateClient_Sum() {} + +func (m *MsgCreateClient) GetSum() isMsgCreateClient_Sum { + if m != nil { + return m.Sum } return nil } -func (m *Message) GetMsgUndelegate() *types9.MsgUndelegate { - if x, ok := m.GetSum().(*Message_MsgUndelegate); ok { - return x.MsgUndelegate +func (m *MsgCreateClient) GetTendermint() *types4.MsgCreateClient { + if x, ok := m.GetSum().(*MsgCreateClient_Tendermint); ok { + return x.Tendermint } return nil } // XXX_OneofWrappers is for the internal use of the proto package. -func (*Message) XXX_OneofWrappers() []interface{} { +func (*MsgCreateClient) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*Message_MsgSend)(nil), - (*Message_MsgMultiSend)(nil), - (*Message_MsgVerifyInvariant)(nil), - (*Message_MsgSetWithdrawAddress)(nil), - (*Message_MsgWithdrawDelegatorReward)(nil), - (*Message_MsgWithdrawValidatorCommission)(nil), - (*Message_MsgFundCommunityPool)(nil), - (*Message_MsgSubmitEvidence)(nil), - (*Message_MsgSubmitProposal)(nil), - (*Message_MsgVote)(nil), - (*Message_MsgDeposit)(nil), - (*Message_MsgUnjail)(nil), - (*Message_MsgCreateValidator)(nil), - (*Message_MsgEditValidator)(nil), - (*Message_MsgDelegate)(nil), - (*Message_MsgBeginRedelegate)(nil), - (*Message_MsgUndelegate)(nil), + (*MsgCreateClient_Tendermint)(nil), } } -// SignDoc defines a standard application-level signing document to compose -// signatures for a Transaction. -type SignDoc struct { - StdSignDocBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:""` - Msgs []Message `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs"` +type MsgUpdateClient struct { + // sum defines a set of all acceptable concrete MsgUpdateClient + // implementations. + // + // Types that are valid to be assigned to Sum: + // *MsgUpdateClient_Tendermint + Sum isMsgUpdateClient_Sum `protobuf_oneof:"sum"` } -func (m *SignDoc) Reset() { *m = SignDoc{} } -func (m *SignDoc) String() string { return proto.CompactTextString(m) } -func (*SignDoc) ProtoMessage() {} -func (*SignDoc) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{9} +func (m *MsgUpdateClient) Reset() { *m = MsgUpdateClient{} } +func (m *MsgUpdateClient) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateClient) ProtoMessage() {} +func (*MsgUpdateClient) Descriptor() ([]byte, []int) { + return fileDescriptor_ff851c3a98ef46f7, []int{12} } -func (m *SignDoc) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateClient) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *SignDoc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateClient) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_SignDoc.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateClient.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -930,45 +995,71 @@ func (m *SignDoc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *SignDoc) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignDoc.Merge(m, src) +func (m *MsgUpdateClient) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateClient.Merge(m, src) } -func (m *SignDoc) XXX_Size() int { +func (m *MsgUpdateClient) XXX_Size() int { return m.Size() } -func (m *SignDoc) XXX_DiscardUnknown() { - xxx_messageInfo_SignDoc.DiscardUnknown(m) +func (m *MsgUpdateClient) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateClient.DiscardUnknown(m) } -var xxx_messageInfo_SignDoc proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateClient proto.InternalMessageInfo -func (m *SignDoc) GetMsgs() []Message { +type isMsgUpdateClient_Sum interface { + isMsgUpdateClient_Sum() + MarshalTo([]byte) (int, error) + Size() int +} + +type MsgUpdateClient_Tendermint struct { + Tendermint *types4.MsgUpdateClient `protobuf:"bytes,1,opt,name=tendermint,proto3,oneof" json:"tendermint,omitempty"` +} + +func (*MsgUpdateClient_Tendermint) isMsgUpdateClient_Sum() {} + +func (m *MsgUpdateClient) GetSum() isMsgUpdateClient_Sum { if m != nil { - return m.Msgs + return m.Sum } return nil } -// StdFee includes the amount of coins paid in fees and the maximum -// gas to be used by the transaction. The ratio yields an effective "gasprice", -// which must be above some miminum to be accepted into the mempool. -type StdFee struct { - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` - Gas uint64 `protobuf:"varint,2,opt,name=gas,proto3" json:"gas,omitempty"` +func (m *MsgUpdateClient) GetTendermint() *types4.MsgUpdateClient { + if x, ok := m.GetSum().(*MsgUpdateClient_Tendermint); ok { + return x.Tendermint + } + return nil } -func (m *StdFee) Reset() { *m = StdFee{} } -func (m *StdFee) String() string { return proto.CompactTextString(m) } -func (*StdFee) ProtoMessage() {} -func (*StdFee) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{10} +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MsgUpdateClient) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*MsgUpdateClient_Tendermint)(nil), + } } -func (m *StdFee) XXX_Unmarshal(b []byte) error { + +// Transaction defines the application-level transaction that can be signed and +// processed by the state-machine. It contains a base of common fields and +// repeated set of Message types. +type Transaction struct { + StdTxBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:""` + Msgs []Message `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs"` +} + +func (m *Transaction) Reset() { *m = Transaction{} } +func (m *Transaction) String() string { return proto.CompactTextString(m) } +func (*Transaction) ProtoMessage() {} +func (*Transaction) Descriptor() ([]byte, []int) { + return fileDescriptor_ff851c3a98ef46f7, []int{13} +} +func (m *Transaction) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *StdFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_StdFee.Marshal(b, m, deterministic) + return xxx_messageInfo_Transaction.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -978,37 +1069,72 @@ func (m *StdFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *StdFee) XXX_Merge(src proto.Message) { - xxx_messageInfo_StdFee.Merge(m, src) +func (m *Transaction) XXX_Merge(src proto.Message) { + xxx_messageInfo_Transaction.Merge(m, src) } -func (m *StdFee) XXX_Size() int { +func (m *Transaction) XXX_Size() int { return m.Size() } -func (m *StdFee) XXX_DiscardUnknown() { - xxx_messageInfo_StdFee.DiscardUnknown(m) +func (m *Transaction) XXX_DiscardUnknown() { + xxx_messageInfo_Transaction.DiscardUnknown(m) } -var xxx_messageInfo_StdFee proto.InternalMessageInfo +var xxx_messageInfo_Transaction proto.InternalMessageInfo -// StdSignature defines a signature structure that contains the signature of a -// transaction and an optional public key. -type StdSignature struct { - PubKey []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"public_key,omitempty" yaml:"public_key"` - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +// Message defines the set of valid concrete message types that can be used to +// construct a transaction. +type Message struct { + // sum defines the set of all allowed valid messages defined in modules. + // + // Types that are valid to be assigned to Sum: + // *Message_MsgSend + // *Message_MsgMultiSend + // *Message_MsgVerifyInvariant + // *Message_MsgSetWithdrawAddress + // *Message_MsgWithdrawDelegatorReward + // *Message_MsgWithdrawValidatorCommission + // *Message_MsgFundCommunityPool + // *Message_MsgSubmitEvidence + // *Message_MsgSubmitProposal + // *Message_MsgVote + // *Message_MsgDeposit + // *Message_MsgUnjail + // *Message_MsgCreateValidator + // *Message_MsgEditValidator + // *Message_MsgDelegate + // *Message_MsgBeginRedelegate + // *Message_MsgUndelegate + // *Message_MsgConnectionOpenInit + // *Message_MsgConnectionOpenTry + // *Message_MsgConnectionOpenAck + // *Message_MsgConnectionOpenConfirm + // *Message_MsgChannelOpenInit + // *Message_MsgChannelOpenTry + // *Message_MsgChannelOpenAck + // *Message_MsgChannelOpenConfirm + // *Message_MsgChannelCloseInit + // *Message_MsgChannelCloseConfirm + // *Message_MsgPacket + // *Message_MsgAcknowledgement + // *Message_MsgCreateClientTendermint + // *Message_MsgUpdateClientTendermint + // *Message_MsgSubmitClientMisbehaviourTendermint + // *Message_MsgTransfer + Sum isMessage_Sum `protobuf_oneof:"sum"` } -func (m *StdSignature) Reset() { *m = StdSignature{} } -func (m *StdSignature) String() string { return proto.CompactTextString(m) } -func (*StdSignature) ProtoMessage() {} -func (*StdSignature) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{11} +func (m *Message) Reset() { *m = Message{} } +func (m *Message) String() string { return proto.CompactTextString(m) } +func (*Message) ProtoMessage() {} +func (*Message) Descriptor() ([]byte, []int) { + return fileDescriptor_ff851c3a98ef46f7, []int{14} } -func (m *StdSignature) XXX_Unmarshal(b []byte) error { +func (m *Message) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *StdSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_StdSignature.Marshal(b, m, deterministic) + return xxx_messageInfo_Message.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1018,615 +1144,892 @@ func (m *StdSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *StdSignature) XXX_Merge(src proto.Message) { - xxx_messageInfo_StdSignature.Merge(m, src) +func (m *Message) XXX_Merge(src proto.Message) { + xxx_messageInfo_Message.Merge(m, src) } -func (m *StdSignature) XXX_Size() int { +func (m *Message) XXX_Size() int { return m.Size() } -func (m *StdSignature) XXX_DiscardUnknown() { - xxx_messageInfo_StdSignature.DiscardUnknown(m) +func (m *Message) XXX_DiscardUnknown() { + xxx_messageInfo_Message.DiscardUnknown(m) } -var xxx_messageInfo_StdSignature proto.InternalMessageInfo +var xxx_messageInfo_Message proto.InternalMessageInfo -// StdTxBase defines a transaction base which application-level concrete transaction -// types can extend. -type StdTxBase struct { - Fee StdFee `protobuf:"bytes,1,opt,name=fee,proto3" json:"fee"` - Signatures []StdSignature `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures"` - Memo string `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty"` +type isMessage_Sum interface { + isMessage_Sum() + MarshalTo([]byte) (int, error) + Size() int } -func (m *StdTxBase) Reset() { *m = StdTxBase{} } -func (m *StdTxBase) String() string { return proto.CompactTextString(m) } -func (*StdTxBase) ProtoMessage() {} -func (*StdTxBase) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{12} +type Message_MsgSend struct { + MsgSend *types2.MsgSend `protobuf:"bytes,1,opt,name=msg_send,json=msgSend,proto3,oneof" json:"msg_send,omitempty"` } -func (m *StdTxBase) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) +type Message_MsgMultiSend struct { + MsgMultiSend *types2.MsgMultiSend `protobuf:"bytes,2,opt,name=msg_multi_send,json=msgMultiSend,proto3,oneof" json:"msg_multi_send,omitempty"` } -func (m *StdTxBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StdTxBase.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } +type Message_MsgVerifyInvariant struct { + MsgVerifyInvariant *types8.MsgVerifyInvariant `protobuf:"bytes,3,opt,name=msg_verify_invariant,json=msgVerifyInvariant,proto3,oneof" json:"msg_verify_invariant,omitempty"` } -func (m *StdTxBase) XXX_Merge(src proto.Message) { - xxx_messageInfo_StdTxBase.Merge(m, src) +type Message_MsgSetWithdrawAddress struct { + MsgSetWithdrawAddress *types7.MsgSetWithdrawAddress `protobuf:"bytes,4,opt,name=msg_set_withdraw_address,json=msgSetWithdrawAddress,proto3,oneof" json:"msg_set_withdraw_address,omitempty"` } -func (m *StdTxBase) XXX_Size() int { - return m.Size() +type Message_MsgWithdrawDelegatorReward struct { + MsgWithdrawDelegatorReward *types7.MsgWithdrawDelegatorReward `protobuf:"bytes,5,opt,name=msg_withdraw_delegator_reward,json=msgWithdrawDelegatorReward,proto3,oneof" json:"msg_withdraw_delegator_reward,omitempty"` } -func (m *StdTxBase) XXX_DiscardUnknown() { - xxx_messageInfo_StdTxBase.DiscardUnknown(m) +type Message_MsgWithdrawValidatorCommission struct { + MsgWithdrawValidatorCommission *types7.MsgWithdrawValidatorCommission `protobuf:"bytes,6,opt,name=msg_withdraw_validator_commission,json=msgWithdrawValidatorCommission,proto3,oneof" json:"msg_withdraw_validator_commission,omitempty"` } +type Message_MsgFundCommunityPool struct { + MsgFundCommunityPool *types7.MsgFundCommunityPool `protobuf:"bytes,7,opt,name=msg_fund_community_pool,json=msgFundCommunityPool,proto3,oneof" json:"msg_fund_community_pool,omitempty"` +} +type Message_MsgSubmitEvidence struct { + MsgSubmitEvidence *MsgSubmitEvidence `protobuf:"bytes,8,opt,name=msg_submit_evidence,json=msgSubmitEvidence,proto3,oneof" json:"msg_submit_evidence,omitempty"` +} +type Message_MsgSubmitProposal struct { + MsgSubmitProposal *MsgSubmitProposal `protobuf:"bytes,9,opt,name=msg_submit_proposal,json=msgSubmitProposal,proto3,oneof" json:"msg_submit_proposal,omitempty"` +} +type Message_MsgVote struct { + MsgVote *types5.MsgVote `protobuf:"bytes,10,opt,name=msg_vote,json=msgVote,proto3,oneof" json:"msg_vote,omitempty"` +} +type Message_MsgDeposit struct { + MsgDeposit *types5.MsgDeposit `protobuf:"bytes,11,opt,name=msg_deposit,json=msgDeposit,proto3,oneof" json:"msg_deposit,omitempty"` +} +type Message_MsgUnjail struct { + MsgUnjail *types9.MsgUnjail `protobuf:"bytes,12,opt,name=msg_unjail,json=msgUnjail,proto3,oneof" json:"msg_unjail,omitempty"` +} +type Message_MsgCreateValidator struct { + MsgCreateValidator *types10.MsgCreateValidator `protobuf:"bytes,13,opt,name=msg_create_validator,json=msgCreateValidator,proto3,oneof" json:"msg_create_validator,omitempty"` +} +type Message_MsgEditValidator struct { + MsgEditValidator *types10.MsgEditValidator `protobuf:"bytes,14,opt,name=msg_edit_validator,json=msgEditValidator,proto3,oneof" json:"msg_edit_validator,omitempty"` +} +type Message_MsgDelegate struct { + MsgDelegate *types10.MsgDelegate `protobuf:"bytes,15,opt,name=msg_delegate,json=msgDelegate,proto3,oneof" json:"msg_delegate,omitempty"` +} +type Message_MsgBeginRedelegate struct { + MsgBeginRedelegate *types10.MsgBeginRedelegate `protobuf:"bytes,16,opt,name=msg_begin_redelegate,json=msgBeginRedelegate,proto3,oneof" json:"msg_begin_redelegate,omitempty"` +} +type Message_MsgUndelegate struct { + MsgUndelegate *types10.MsgUndelegate `protobuf:"bytes,17,opt,name=msg_undelegate,json=msgUndelegate,proto3,oneof" json:"msg_undelegate,omitempty"` +} +type Message_MsgConnectionOpenInit struct { + MsgConnectionOpenInit *types11.MsgConnectionOpenInit `protobuf:"bytes,18,opt,name=msg_connection_open_init,json=msgConnectionOpenInit,proto3,oneof" json:"msg_connection_open_init,omitempty"` +} +type Message_MsgConnectionOpenTry struct { + MsgConnectionOpenTry *types11.MsgConnectionOpenTry `protobuf:"bytes,19,opt,name=msg_connection_open_try,json=msgConnectionOpenTry,proto3,oneof" json:"msg_connection_open_try,omitempty"` +} +type Message_MsgConnectionOpenAck struct { + MsgConnectionOpenAck *types11.MsgConnectionOpenAck `protobuf:"bytes,20,opt,name=msg_connection_open_ack,json=msgConnectionOpenAck,proto3,oneof" json:"msg_connection_open_ack,omitempty"` +} +type Message_MsgConnectionOpenConfirm struct { + MsgConnectionOpenConfirm *types11.MsgConnectionOpenConfirm `protobuf:"bytes,21,opt,name=msg_connection_open_confirm,json=msgConnectionOpenConfirm,proto3,oneof" json:"msg_connection_open_confirm,omitempty"` +} +type Message_MsgChannelOpenInit struct { + MsgChannelOpenInit *types12.MsgChannelOpenInit `protobuf:"bytes,22,opt,name=msg_channel_open_init,json=msgChannelOpenInit,proto3,oneof" json:"msg_channel_open_init,omitempty"` +} +type Message_MsgChannelOpenTry struct { + MsgChannelOpenTry *types12.MsgChannelOpenTry `protobuf:"bytes,23,opt,name=msg_channel_open_try,json=msgChannelOpenTry,proto3,oneof" json:"msg_channel_open_try,omitempty"` +} +type Message_MsgChannelOpenAck struct { + MsgChannelOpenAck *types12.MsgChannelOpenAck `protobuf:"bytes,24,opt,name=msg_channel_open_ack,json=msgChannelOpenAck,proto3,oneof" json:"msg_channel_open_ack,omitempty"` +} +type Message_MsgChannelOpenConfirm struct { + MsgChannelOpenConfirm *types12.MsgChannelOpenConfirm `protobuf:"bytes,25,opt,name=msg_channel_open_confirm,json=msgChannelOpenConfirm,proto3,oneof" json:"msg_channel_open_confirm,omitempty"` +} +type Message_MsgChannelCloseInit struct { + MsgChannelCloseInit *types12.MsgChannelCloseInit `protobuf:"bytes,26,opt,name=msg_channel_close_init,json=msgChannelCloseInit,proto3,oneof" json:"msg_channel_close_init,omitempty"` +} +type Message_MsgChannelCloseConfirm struct { + MsgChannelCloseConfirm *types12.MsgChannelCloseConfirm `protobuf:"bytes,27,opt,name=msg_channel_close_confirm,json=msgChannelCloseConfirm,proto3,oneof" json:"msg_channel_close_confirm,omitempty"` +} +type Message_MsgPacket struct { + MsgPacket *types12.MsgPacket `protobuf:"bytes,28,opt,name=msg_packet,json=msgPacket,proto3,oneof" json:"msg_packet,omitempty"` +} +type Message_MsgAcknowledgement struct { + MsgAcknowledgement *types12.MsgAcknowledgement `protobuf:"bytes,29,opt,name=msg_acknowledgement,json=msgAcknowledgement,proto3,oneof" json:"msg_acknowledgement,omitempty"` +} +type Message_MsgCreateClientTendermint struct { + MsgCreateClientTendermint *types4.MsgCreateClient `protobuf:"bytes,30,opt,name=msg_create_client_tendermint,json=msgCreateClientTendermint,proto3,oneof" json:"msg_create_client_tendermint,omitempty"` +} +type Message_MsgUpdateClientTendermint struct { + MsgUpdateClientTendermint *types4.MsgUpdateClient `protobuf:"bytes,31,opt,name=msg_update_client_tendermint,json=msgUpdateClientTendermint,proto3,oneof" json:"msg_update_client_tendermint,omitempty"` +} +type Message_MsgSubmitClientMisbehaviourTendermint struct { + MsgSubmitClientMisbehaviourTendermint *types4.MsgSubmitClientMisbehaviour `protobuf:"bytes,32,opt,name=msg_submit_client_misbehaviour_tendermint,json=msgSubmitClientMisbehaviourTendermint,proto3,oneof" json:"msg_submit_client_misbehaviour_tendermint,omitempty"` +} +type Message_MsgTransfer struct { + MsgTransfer *types13.MsgTransfer `protobuf:"bytes,33,opt,name=msg_transfer,json=msgTransfer,proto3,oneof" json:"msg_transfer,omitempty"` +} + +func (*Message_MsgSend) isMessage_Sum() {} +func (*Message_MsgMultiSend) isMessage_Sum() {} +func (*Message_MsgVerifyInvariant) isMessage_Sum() {} +func (*Message_MsgSetWithdrawAddress) isMessage_Sum() {} +func (*Message_MsgWithdrawDelegatorReward) isMessage_Sum() {} +func (*Message_MsgWithdrawValidatorCommission) isMessage_Sum() {} +func (*Message_MsgFundCommunityPool) isMessage_Sum() {} +func (*Message_MsgSubmitEvidence) isMessage_Sum() {} +func (*Message_MsgSubmitProposal) isMessage_Sum() {} +func (*Message_MsgVote) isMessage_Sum() {} +func (*Message_MsgDeposit) isMessage_Sum() {} +func (*Message_MsgUnjail) isMessage_Sum() {} +func (*Message_MsgCreateValidator) isMessage_Sum() {} +func (*Message_MsgEditValidator) isMessage_Sum() {} +func (*Message_MsgDelegate) isMessage_Sum() {} +func (*Message_MsgBeginRedelegate) isMessage_Sum() {} +func (*Message_MsgUndelegate) isMessage_Sum() {} +func (*Message_MsgConnectionOpenInit) isMessage_Sum() {} +func (*Message_MsgConnectionOpenTry) isMessage_Sum() {} +func (*Message_MsgConnectionOpenAck) isMessage_Sum() {} +func (*Message_MsgConnectionOpenConfirm) isMessage_Sum() {} +func (*Message_MsgChannelOpenInit) isMessage_Sum() {} +func (*Message_MsgChannelOpenTry) isMessage_Sum() {} +func (*Message_MsgChannelOpenAck) isMessage_Sum() {} +func (*Message_MsgChannelOpenConfirm) isMessage_Sum() {} +func (*Message_MsgChannelCloseInit) isMessage_Sum() {} +func (*Message_MsgChannelCloseConfirm) isMessage_Sum() {} +func (*Message_MsgPacket) isMessage_Sum() {} +func (*Message_MsgAcknowledgement) isMessage_Sum() {} +func (*Message_MsgCreateClientTendermint) isMessage_Sum() {} +func (*Message_MsgUpdateClientTendermint) isMessage_Sum() {} +func (*Message_MsgSubmitClientMisbehaviourTendermint) isMessage_Sum() {} +func (*Message_MsgTransfer) isMessage_Sum() {} -var xxx_messageInfo_StdTxBase proto.InternalMessageInfo - -func (m *StdTxBase) GetFee() StdFee { +func (m *Message) GetSum() isMessage_Sum { if m != nil { - return m.Fee + return m.Sum } - return StdFee{} + return nil } -func (m *StdTxBase) GetSignatures() []StdSignature { - if m != nil { - return m.Signatures +func (m *Message) GetMsgSend() *types2.MsgSend { + if x, ok := m.GetSum().(*Message_MsgSend); ok { + return x.MsgSend } return nil } -func (m *StdTxBase) GetMemo() string { - if m != nil { - return m.Memo +func (m *Message) GetMsgMultiSend() *types2.MsgMultiSend { + if x, ok := m.GetSum().(*Message_MsgMultiSend); ok { + return x.MsgMultiSend } - return "" + return nil } -// StdSignDocBase defines the base structure for which applications can extend -// to define the concrete structure that signers sign over. -type StdSignDocBase struct { - ChainID string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` - AccountNumber uint64 `protobuf:"varint,2,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty" yaml:"account_number"` - Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` - Memo string `protobuf:"bytes,4,opt,name=memo,proto3" json:"memo,omitempty"` - Fee StdFee `protobuf:"bytes,5,opt,name=fee,proto3" json:"fee"` +func (m *Message) GetMsgVerifyInvariant() *types8.MsgVerifyInvariant { + if x, ok := m.GetSum().(*Message_MsgVerifyInvariant); ok { + return x.MsgVerifyInvariant + } + return nil } -func (m *StdSignDocBase) Reset() { *m = StdSignDocBase{} } -func (m *StdSignDocBase) String() string { return proto.CompactTextString(m) } -func (*StdSignDocBase) ProtoMessage() {} -func (*StdSignDocBase) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{13} -} -func (m *StdSignDocBase) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StdSignDocBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StdSignDocBase.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 *Message) GetMsgSetWithdrawAddress() *types7.MsgSetWithdrawAddress { + if x, ok := m.GetSum().(*Message_MsgSetWithdrawAddress); ok { + return x.MsgSetWithdrawAddress } + return nil } -func (m *StdSignDocBase) XXX_Merge(src proto.Message) { - xxx_messageInfo_StdSignDocBase.Merge(m, src) -} -func (m *StdSignDocBase) XXX_Size() int { - return m.Size() -} -func (m *StdSignDocBase) XXX_DiscardUnknown() { - xxx_messageInfo_StdSignDocBase.DiscardUnknown(m) + +func (m *Message) GetMsgWithdrawDelegatorReward() *types7.MsgWithdrawDelegatorReward { + if x, ok := m.GetSum().(*Message_MsgWithdrawDelegatorReward); ok { + return x.MsgWithdrawDelegatorReward + } + return nil } -var xxx_messageInfo_StdSignDocBase proto.InternalMessageInfo +func (m *Message) GetMsgWithdrawValidatorCommission() *types7.MsgWithdrawValidatorCommission { + if x, ok := m.GetSum().(*Message_MsgWithdrawValidatorCommission); ok { + return x.MsgWithdrawValidatorCommission + } + return nil +} -func (m *StdSignDocBase) GetChainID() string { - if m != nil { - return m.ChainID +func (m *Message) GetMsgFundCommunityPool() *types7.MsgFundCommunityPool { + if x, ok := m.GetSum().(*Message_MsgFundCommunityPool); ok { + return x.MsgFundCommunityPool } - return "" + return nil } -func (m *StdSignDocBase) GetAccountNumber() uint64 { - if m != nil { - return m.AccountNumber +func (m *Message) GetMsgSubmitEvidence() *MsgSubmitEvidence { + if x, ok := m.GetSum().(*Message_MsgSubmitEvidence); ok { + return x.MsgSubmitEvidence } - return 0 + return nil } -func (m *StdSignDocBase) GetSequence() uint64 { - if m != nil { - return m.Sequence +func (m *Message) GetMsgSubmitProposal() *MsgSubmitProposal { + if x, ok := m.GetSum().(*Message_MsgSubmitProposal); ok { + return x.MsgSubmitProposal } - return 0 + return nil } -func (m *StdSignDocBase) GetMemo() string { - if m != nil { - return m.Memo +func (m *Message) GetMsgVote() *types5.MsgVote { + if x, ok := m.GetSum().(*Message_MsgVote); ok { + return x.MsgVote } - return "" + return nil } -func (m *StdSignDocBase) GetFee() StdFee { - if m != nil { - return m.Fee +func (m *Message) GetMsgDeposit() *types5.MsgDeposit { + if x, ok := m.GetSum().(*Message_MsgDeposit); ok { + return x.MsgDeposit } - return StdFee{} + return nil } -func init() { - proto.RegisterType((*Account)(nil), "cosmos_sdk.std.v1.Account") - proto.RegisterType((*Supply)(nil), "cosmos_sdk.std.v1.Supply") - proto.RegisterType((*Evidence)(nil), "cosmos_sdk.std.v1.Evidence") - proto.RegisterType((*MsgSubmitEvidence)(nil), "cosmos_sdk.std.v1.MsgSubmitEvidence") - proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos_sdk.std.v1.MsgSubmitProposal") - proto.RegisterType((*Proposal)(nil), "cosmos_sdk.std.v1.Proposal") - proto.RegisterType((*Content)(nil), "cosmos_sdk.std.v1.Content") - proto.RegisterType((*Transaction)(nil), "cosmos_sdk.std.v1.Transaction") - proto.RegisterType((*Message)(nil), "cosmos_sdk.std.v1.Message") - proto.RegisterType((*SignDoc)(nil), "cosmos_sdk.std.v1.SignDoc") - proto.RegisterType((*StdFee)(nil), "cosmos_sdk.std.v1.StdFee") - proto.RegisterType((*StdSignature)(nil), "cosmos_sdk.std.v1.StdSignature") - proto.RegisterType((*StdTxBase)(nil), "cosmos_sdk.std.v1.StdTxBase") - proto.RegisterType((*StdSignDocBase)(nil), "cosmos_sdk.std.v1.StdSignDocBase") +func (m *Message) GetMsgUnjail() *types9.MsgUnjail { + if x, ok := m.GetSum().(*Message_MsgUnjail); ok { + return x.MsgUnjail + } + return nil } -func init() { proto.RegisterFile("std/codec.proto", fileDescriptor_ff851c3a98ef46f7) } +func (m *Message) GetMsgCreateValidator() *types10.MsgCreateValidator { + if x, ok := m.GetSum().(*Message_MsgCreateValidator); ok { + return x.MsgCreateValidator + } + return nil +} -var fileDescriptor_ff851c3a98ef46f7 = []byte{ - // 1746 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcf, 0x6f, 0x1b, 0xc7, - 0x15, 0xde, 0x8d, 0x68, 0x91, 0x1a, 0xd1, 0xb2, 0x34, 0xb1, 0x6b, 0x46, 0x71, 0x48, 0x9b, 0x29, - 0x8c, 0xd4, 0xa9, 0xc9, 0x38, 0x4e, 0x93, 0x9a, 0xe8, 0x2f, 0x93, 0xb2, 0x40, 0xb5, 0x51, 0x6b, - 0xac, 0x6c, 0x15, 0x2d, 0xda, 0x2e, 0x86, 0xbb, 0xe3, 0xd5, 0x54, 0x9c, 0x9d, 0xcd, 0xce, 0x2c, - 0x45, 0x16, 0xe8, 0xa9, 0x45, 0xd1, 0x1c, 0x0a, 0xf4, 0xda, 0x43, 0x81, 0xb4, 0x40, 0x2f, 0x3d, - 0xe7, 0x94, 0xbf, 0x20, 0xc8, 0xc9, 0xc7, 0x9e, 0xd4, 0x42, 0xbe, 0x14, 0x39, 0x15, 0xfe, 0x0b, - 0x8a, 0x99, 0x9d, 0x5d, 0xee, 0x92, 0x4b, 0x4a, 0x05, 0x7a, 0x21, 0x76, 0xe6, 0xbd, 0xef, 0x7b, - 0xdf, 0xce, 0xbc, 0x37, 0x6f, 0x96, 0xe0, 0x0a, 0x17, 0x6e, 0xdb, 0x61, 0x2e, 0x76, 0x5a, 0x41, - 0xc8, 0x04, 0x83, 0x5b, 0x0e, 0xe3, 0x94, 0x71, 0x9b, 0xbb, 0xc7, 0x2d, 0x2e, 0xdc, 0xd6, 0xe8, - 0xde, 0xf6, 0xdb, 0xe2, 0x88, 0x84, 0xae, 0x1d, 0xa0, 0x50, 0x4c, 0xda, 0xca, 0xab, 0x1d, 0x3b, - 0xdd, 0xcd, 0x0e, 0x62, 0xfc, 0xf6, 0xed, 0x79, 0x67, 0x8f, 0x79, 0x6c, 0xfa, 0xa4, 0xfd, 0xb6, - 0xc4, 0x24, 0xc0, 0xbc, 0xad, 0x7e, 0xf5, 0x54, 0x6d, 0xdc, 0x46, 0x91, 0x38, 0x6a, 0xcf, 0x5b, - 0x6e, 0x6a, 0xcb, 0x08, 0x73, 0x41, 0x7c, 0xaf, 0x5d, 0x88, 0x1d, 0x20, 0xff, 0xb8, 0xc0, 0xb2, - 0x3d, 0x6e, 0x3b, 0x21, 0xe1, 0x84, 0x17, 0xf3, 0xba, 0x84, 0x8b, 0x90, 0x0c, 0x22, 0x41, 0x98, - 0x5f, 0xe0, 0x71, 0x63, 0xdc, 0xc6, 0x23, 0xe2, 0x62, 0xdf, 0xc1, 0x05, 0xd6, 0xeb, 0xe3, 0xb6, - 0xc7, 0x46, 0xc5, 0x30, 0x3e, 0x44, 0xfc, 0xa8, 0x58, 0xec, 0xeb, 0xe3, 0x36, 0x17, 0xe8, 0xb8, - 0xd8, 0xf8, 0xe6, 0xb8, 0x1d, 0xa0, 0x10, 0xd1, 0x44, 0x6f, 0x10, 0xb2, 0x80, 0x71, 0x34, 0x9c, - 0x65, 0x88, 0x02, 0x2f, 0x44, 0x6e, 0x81, 0xaa, 0xe6, 0x67, 0x25, 0x50, 0x7e, 0xe8, 0x38, 0x2c, - 0xf2, 0x05, 0xdc, 0x05, 0xd5, 0x01, 0xe2, 0xd8, 0x46, 0xf1, 0xb8, 0x66, 0xde, 0x34, 0xdf, 0x5a, - 0x7f, 0xf7, 0x56, 0x2b, 0xb3, 0xcb, 0xe3, 0x96, 0x5c, 0xdb, 0xd6, 0xe8, 0x5e, 0xab, 0x8b, 0x38, - 0xd6, 0xc0, 0xbe, 0x61, 0xad, 0x0f, 0xa6, 0x43, 0x38, 0x02, 0xdb, 0x0e, 0xf3, 0x05, 0xf1, 0x23, - 0x16, 0x71, 0x5b, 0xef, 0x43, 0xca, 0xfa, 0x8a, 0x62, 0x7d, 0xbf, 0x88, 0x35, 0xf6, 0x94, 0xec, - 0xbd, 0x14, 0x7f, 0x18, 0x4f, 0x4e, 0x43, 0xd5, 0x9c, 0x05, 0x36, 0x48, 0xc1, 0x75, 0x17, 0x0f, - 0xd1, 0x04, 0xbb, 0x73, 0x41, 0x57, 0x54, 0xd0, 0xfb, 0xcb, 0x83, 0xee, 0xc4, 0xe0, 0xb9, 0x88, - 0xd7, 0xdc, 0x22, 0x03, 0x0c, 0x40, 0x2d, 0xc0, 0x21, 0x61, 0x2e, 0x71, 0xe6, 0xe2, 0x95, 0x54, - 0xbc, 0xf7, 0x96, 0xc7, 0x7b, 0xac, 0xd1, 0x73, 0x01, 0xbf, 0x12, 0x14, 0x5a, 0xe0, 0x87, 0x60, - 0x83, 0x32, 0x37, 0x1a, 0x4e, 0xb7, 0xe8, 0x92, 0x8a, 0xf3, 0x66, 0xf1, 0x16, 0xed, 0x2b, 0xdf, - 0x29, 0xed, 0x65, 0x9a, 0x9d, 0xe8, 0x3c, 0xf8, 0xe2, 0xd3, 0xbb, 0xdf, 0xb8, 0xe3, 0x11, 0x71, - 0x14, 0x0d, 0x5a, 0x0e, 0xa3, 0xba, 0x36, 0x93, 0x7a, 0xe5, 0xee, 0x71, 0x5b, 0x97, 0x12, 0x1e, - 0x07, 0x2c, 0x14, 0xd8, 0x6d, 0x69, 0x68, 0xf7, 0x12, 0x58, 0xe1, 0x11, 0x6d, 0xfe, 0xce, 0x04, - 0xab, 0x07, 0x51, 0x10, 0x0c, 0x27, 0xf0, 0x7d, 0xb0, 0xca, 0xd5, 0x93, 0xce, 0x9a, 0x1b, 0x79, - 0x49, 0xb2, 0xde, 0xa4, 0xa4, 0xd8, 0xbb, 0x6f, 0x58, 0xda, 0xbb, 0xf3, 0xed, 0x7f, 0x7f, 0xd2, - 0x30, 0x2f, 0x22, 0x44, 0x55, 0x6c, 0x2a, 0x24, 0xe6, 0xd9, 0x4b, 0x84, 0xfc, 0xd5, 0x04, 0x95, - 0x47, 0xba, 0xf4, 0xe0, 0x87, 0xa0, 0x8a, 0x3f, 0x8a, 0xc8, 0x88, 0x39, 0x48, 0x16, 0xaa, 0x16, - 0x74, 0x3b, 0x2f, 0x28, 0x29, 0x54, 0x29, 0xea, 0x51, 0xc6, 0xbb, 0x6f, 0x58, 0x39, 0x74, 0xe7, - 0xa1, 0x16, 0xf8, 0xe0, 0x1c, 0x7d, 0x69, 0xe5, 0xa7, 0x1a, 0x13, 0x41, 0x89, 0xc8, 0xbf, 0x99, - 0x60, 0x6b, 0x9f, 0x7b, 0x07, 0xd1, 0x80, 0x12, 0x91, 0xaa, 0xdd, 0x07, 0x25, 0x59, 0x3b, 0x5a, - 0x65, 0x7b, 0xb1, 0xca, 0x39, 0xa8, 0xac, 0xc0, 0x6e, 0xe5, 0xf3, 0xd3, 0x86, 0xf1, 0xfc, 0xb4, - 0x61, 0x5a, 0x8a, 0x06, 0x7e, 0x00, 0x2a, 0x09, 0x48, 0x57, 0xda, 0xeb, 0xad, 0xb9, 0x53, 0x3a, - 0x95, 0x66, 0xa5, 0xce, 0x9d, 0xca, 0xef, 0x3f, 0x69, 0x18, 0xf2, 0x5d, 0x9b, 0x7f, 0xce, 0xea, - 0x7c, 0xac, 0x4f, 0x14, 0xd8, 0xcf, 0xe9, 0xbc, 0x93, 0xd7, 0xe9, 0xb1, 0x51, 0x4e, 0x62, 0x82, - 0x2a, 0x94, 0xf8, 0x1e, 0x28, 0xcb, 0x12, 0xc6, 0xe9, 0x59, 0xb0, 0x5d, 0xa0, 0xb0, 0x17, 0x7b, - 0x58, 0x89, 0x6b, 0x46, 0xdf, 0x1f, 0x4c, 0x50, 0x49, 0x65, 0x7d, 0x37, 0x27, 0xeb, 0x56, 0xa1, - 0xac, 0xa5, 0x6a, 0x3a, 0xff, 0x83, 0x9a, 0x6e, 0x49, 0x82, 0xa7, 0x9a, 0x4a, 0x4a, 0xcf, 0x5f, - 0x4a, 0xa0, 0xac, 0x1d, 0xe0, 0x07, 0xa0, 0x24, 0xf0, 0x58, 0x2c, 0x95, 0xf3, 0x04, 0x8f, 0xd3, - 0x05, 0xea, 0x1b, 0x96, 0x02, 0xc0, 0x9f, 0x81, 0x4d, 0x75, 0x92, 0x63, 0x81, 0x43, 0xdb, 0x39, - 0x42, 0xbe, 0x97, 0xec, 0xdf, 0x4c, 0x4a, 0xc4, 0xe7, 0xbd, 0x7a, 0xad, 0xc4, 0xbf, 0xa7, 0xdc, - 0x33, 0x94, 0x57, 0x82, 0xbc, 0x09, 0xfe, 0x1c, 0x6c, 0x72, 0xf6, 0x4c, 0x9c, 0xa0, 0x10, 0xdb, - 0xba, 0x17, 0xe8, 0x23, 0xf1, 0x9d, 0x3c, 0xbb, 0x36, 0xaa, 0x52, 0xd5, 0x80, 0xa7, 0xf1, 0x54, - 0x96, 0x9e, 0xe7, 0x4d, 0x30, 0x00, 0xd7, 0x1d, 0xe4, 0x3b, 0x78, 0x68, 0xcf, 0x45, 0x29, 0x15, - 0x9d, 0xf6, 0x99, 0x28, 0x3d, 0x85, 0x5b, 0x1c, 0xeb, 0x9a, 0x53, 0xe4, 0x00, 0x87, 0xe0, 0xaa, - 0xc3, 0x28, 0x8d, 0x7c, 0x22, 0x26, 0x76, 0xc0, 0xd8, 0xd0, 0xe6, 0x01, 0xf6, 0x5d, 0x7d, 0x1e, - 0x7e, 0x33, 0x1f, 0x2e, 0xdb, 0xb6, 0xe3, 0xdd, 0xd4, 0xc8, 0xc7, 0x8c, 0x0d, 0x0f, 0x24, 0x2e, - 0x13, 0x10, 0x3a, 0x73, 0xd6, 0xce, 0x03, 0x7d, 0x06, 0xdc, 0x3b, 0xef, 0x90, 0x4a, 0x1b, 0x7c, - 0x9a, 0x31, 0xba, 0xf6, 0x3f, 0x36, 0xc1, 0xfa, 0x93, 0x10, 0xf9, 0x1c, 0x39, 0x52, 0x05, 0xfc, - 0x4e, 0x2e, 0x6d, 0x6f, 0x14, 0xa4, 0xdc, 0x81, 0x70, 0x9f, 0x8c, 0x55, 0xc6, 0x56, 0x93, 0x8c, - 0xfd, 0x52, 0x26, 0x5f, 0x52, 0x43, 0x25, 0xca, 0x3d, 0x5e, 0x7b, 0xe5, 0xe6, 0xca, 0x82, 0x94, - 0xdd, 0xc7, 0x9c, 0x23, 0x0f, 0xeb, 0x94, 0x55, 0xde, 0x9d, 0x92, 0xac, 0xa1, 0xe6, 0x67, 0x55, - 0x50, 0xd6, 0x56, 0xd8, 0x01, 0x15, 0xca, 0x3d, 0x9b, 0xcb, 0xb5, 0x8b, 0xb5, 0xbc, 0x51, 0x7c, - 0x70, 0xcb, 0xd2, 0xc6, 0xbe, 0xdb, 0x37, 0xac, 0x32, 0x8d, 0x1f, 0xe1, 0xf7, 0xc1, 0x86, 0xc4, - 0xd2, 0x68, 0x28, 0x48, 0xcc, 0x10, 0x27, 0x6c, 0x73, 0x21, 0xc3, 0xbe, 0x74, 0xd5, 0x34, 0x55, - 0x9a, 0x19, 0xc3, 0x5f, 0x80, 0xab, 0x92, 0x6b, 0x84, 0x43, 0xf2, 0x6c, 0x62, 0x13, 0x7f, 0x84, - 0x42, 0x82, 0xd2, 0xbe, 0x3d, 0x73, 0xda, 0xc4, 0x57, 0x34, 0xcd, 0x79, 0xa8, 0x20, 0x7b, 0x09, - 0x42, 0xee, 0x20, 0x9d, 0x9b, 0x85, 0x3e, 0xa8, 0xc5, 0xef, 0x29, 0xec, 0x13, 0x22, 0x8e, 0xdc, - 0x10, 0x9d, 0xd8, 0xc8, 0x75, 0x43, 0xcc, 0xb9, 0x4e, 0xd1, 0xfb, 0xcb, 0x73, 0x46, 0xbd, 0xbf, - 0xf8, 0xb1, 0xc6, 0x3e, 0x8c, 0xa1, 0x32, 0x3f, 0x69, 0x91, 0x01, 0xfe, 0x1a, 0xbc, 0x21, 0xe3, - 0xa5, 0xb1, 0x5c, 0x3c, 0xc4, 0x1e, 0x12, 0x2c, 0xb4, 0x43, 0x7c, 0x82, 0xc2, 0x0b, 0x26, 0xea, - 0x3e, 0xf7, 0x12, 0xe2, 0x9d, 0x84, 0xc0, 0x52, 0xf8, 0xbe, 0x61, 0x6d, 0xd3, 0x85, 0x56, 0xf8, - 0xb1, 0x09, 0x6e, 0xe5, 0xe2, 0x8f, 0xd0, 0x90, 0xb8, 0x2a, 0xbe, 0x4c, 0x6f, 0xc2, 0xb9, 0x6c, - 0x8c, 0xab, 0x4a, 0xc3, 0xb7, 0x2e, 0xac, 0xe1, 0x30, 0x21, 0xe9, 0xa5, 0x1c, 0x7d, 0xc3, 0xaa, - 0xd3, 0xa5, 0x1e, 0xf0, 0x18, 0x5c, 0x97, 0x52, 0x9e, 0x45, 0xbe, 0x6b, 0xe7, 0x6b, 0xb6, 0x56, - 0x56, 0x02, 0xde, 0x3d, 0x57, 0xc0, 0x6e, 0xe4, 0xbb, 0xb9, 0xa2, 0xed, 0x1b, 0x96, 0xcc, 0x97, - 0xb9, 0x79, 0x78, 0x08, 0x5e, 0x55, 0xfb, 0xac, 0xba, 0x90, 0x9d, 0x76, 0xc2, 0x8a, 0x0a, 0xf4, - 0xd5, 0xa2, 0x32, 0x99, 0xed, 0xaa, 0x7d, 0xc3, 0xda, 0xa2, 0x73, 0x5d, 0x3a, 0xcf, 0x9b, 0x5c, - 0xb3, 0x6b, 0x6b, 0xe7, 0xf3, 0x66, 0x8e, 0x96, 0x29, 0x6f, 0xda, 0xbe, 0x1e, 0xc4, 0xf5, 0x37, - 0x62, 0x02, 0xd7, 0x40, 0xd1, 0xc5, 0x69, 0xda, 0x59, 0x0f, 0x99, 0xc0, 0xba, 0xfc, 0xe4, 0x23, - 0xec, 0x82, 0x75, 0x09, 0x75, 0x71, 0xc0, 0x38, 0x11, 0xb5, 0x75, 0x85, 0x6e, 0x2c, 0x42, 0xef, - 0xc4, 0x6e, 0x7d, 0xc3, 0x02, 0x34, 0x1d, 0xc1, 0x1d, 0x20, 0x47, 0x76, 0xe4, 0xff, 0x12, 0x91, - 0x61, 0xad, 0x5a, 0x74, 0x99, 0x4c, 0x3e, 0x4d, 0x34, 0xcf, 0x53, 0xe5, 0xda, 0x37, 0xac, 0x35, - 0x9a, 0x0c, 0xa0, 0x1d, 0x17, 0xaf, 0x13, 0x62, 0x24, 0xf0, 0x34, 0xd5, 0x6a, 0x97, 0x15, 0xdf, - 0xdb, 0x33, 0x7c, 0xf1, 0xc7, 0x8c, 0xa6, 0xeb, 0x29, 0x4c, 0x9a, 0x36, 0xba, 0x7a, 0x67, 0x66, - 0xe1, 0x4f, 0x80, 0x9c, 0xb5, 0xb1, 0x4b, 0x44, 0x86, 0x7e, 0x43, 0xd1, 0x7f, 0x6d, 0x19, 0xfd, - 0x23, 0x97, 0x88, 0x2c, 0xf9, 0x26, 0x9d, 0x99, 0x83, 0x7b, 0xa0, 0x1a, 0xaf, 0xa2, 0x2a, 0x20, - 0x5c, 0xbb, 0x32, 0xbf, 0xa3, 0xb3, 0xa4, 0xba, 0xd8, 0xe4, 0x66, 0xac, 0xd3, 0xe9, 0x30, 0x59, - 0x86, 0x01, 0xf6, 0x88, 0x6f, 0x87, 0x38, 0xa5, 0xdc, 0x3c, 0x7f, 0x19, 0xba, 0x12, 0x63, 0xa5, - 0x10, 0xbd, 0x0c, 0x33, 0xb3, 0xf0, 0x47, 0xf1, 0x81, 0x1b, 0xf9, 0x29, 0xf5, 0x56, 0xd1, 0xd5, - 0x36, 0x4f, 0xfd, 0xd4, 0xcf, 0xb0, 0x5e, 0xa6, 0xd9, 0x89, 0xce, 0x9d, 0x2f, 0x3e, 0xbd, 0x7b, - 0x7b, 0x69, 0x4b, 0x8b, 0x9b, 0x99, 0x54, 0xa8, 0x1b, 0xd9, 0x6f, 0x4d, 0x50, 0x3e, 0x20, 0x9e, - 0xbf, 0xc3, 0x1c, 0xd8, 0x5b, 0x7c, 0xf7, 0x9a, 0x36, 0x31, 0xed, 0xfc, 0xff, 0xed, 0x64, 0xcd, - 0xdf, 0xc8, 0x2f, 0x0f, 0xe1, 0xee, 0x62, 0x79, 0xb7, 0x59, 0x45, 0x54, 0x7f, 0xaf, 0x4a, 0x8a, - 0x57, 0xb3, 0x14, 0xaa, 0xdb, 0x13, 0xbf, 0xfb, 0x8e, 0xc4, 0xfe, 0xfd, 0x9f, 0x8d, 0xb7, 0x2e, - 0xf0, 0xb6, 0x12, 0xc0, 0x2d, 0x4d, 0x0a, 0x37, 0xc1, 0x8a, 0x87, 0xb8, 0x6a, 0x6d, 0x25, 0x4b, - 0x3e, 0x66, 0x6e, 0xa2, 0xbf, 0x02, 0x55, 0xfd, 0x86, 0x48, 0x44, 0x21, 0x86, 0xbb, 0xa0, 0x1c, - 0x44, 0x03, 0xfb, 0x18, 0xc7, 0x5f, 0x41, 0xd5, 0xee, 0xdd, 0x2f, 0x4f, 0x1b, 0x57, 0x83, 0x68, - 0x30, 0x24, 0x8e, 0x9c, 0xfd, 0x3a, 0xa3, 0x44, 0x60, 0x1a, 0x88, 0xc9, 0xcb, 0xd3, 0xc6, 0xd6, - 0x04, 0xd1, 0x61, 0xa7, 0x39, 0xb5, 0x36, 0xad, 0xd5, 0x20, 0x1a, 0xfc, 0x00, 0x4f, 0xe0, 0x0d, - 0xb0, 0xc6, 0x13, 0x52, 0x15, 0xb9, 0x6a, 0x4d, 0x27, 0x74, 0x17, 0xff, 0x93, 0x09, 0xd6, 0xd2, - 0x3b, 0x02, 0xbc, 0x07, 0x56, 0x9e, 0xe1, 0x64, 0x27, 0x5e, 0x2b, 0xde, 0x89, 0x5d, 0x9c, 0xac, - 0xa1, 0xf4, 0x85, 0x8f, 0x00, 0x48, 0x39, 0x93, 0xe5, 0x6f, 0x2c, 0xde, 0x43, 0xe5, 0xa7, 0xf1, - 0x19, 0x20, 0x84, 0xa0, 0x44, 0x31, 0x65, 0xaa, 0x53, 0xaf, 0x59, 0xea, 0xb9, 0xf9, 0x1f, 0x13, - 0x6c, 0xe4, 0xb7, 0x5e, 0x1e, 0x74, 0xce, 0x11, 0x22, 0xbe, 0x4d, 0xe2, 0x8b, 0xc6, 0x5a, 0xb7, - 0x7e, 0x76, 0xda, 0x28, 0xf7, 0xe4, 0xdc, 0xde, 0xce, 0xcb, 0xd3, 0xc6, 0x95, 0x78, 0x39, 0x12, - 0xa7, 0xa6, 0x55, 0x56, 0x8f, 0x7b, 0x2e, 0xfc, 0x1e, 0xd8, 0xd0, 0x9f, 0xbb, 0xb6, 0x1f, 0xd1, - 0x01, 0x0e, 0xe3, 0xcd, 0xe8, 0xbe, 0xf6, 0xf2, 0xb4, 0x71, 0x2d, 0x46, 0xe5, 0xed, 0x4d, 0xeb, - 0xb2, 0x9e, 0xf8, 0xa1, 0x1a, 0xc3, 0x6d, 0x50, 0xe1, 0xf8, 0xa3, 0x48, 0xb5, 0x82, 0x15, 0xb5, - 0x91, 0xe9, 0x38, 0xd5, 0x5f, 0x9a, 0xea, 0x4f, 0x56, 0xf3, 0xd2, 0xc5, 0x57, 0xb3, 0xdb, 0xf9, - 0xfc, 0xac, 0x6e, 0x3e, 0x3f, 0xab, 0x9b, 0xff, 0x3a, 0xab, 0x9b, 0x7f, 0x7c, 0x51, 0x37, 0x9e, - 0xbf, 0xa8, 0x1b, 0xff, 0x78, 0x51, 0x37, 0x7e, 0x7a, 0x73, 0x69, 0xca, 0x71, 0xe1, 0x0e, 0x56, - 0xd5, 0x5f, 0x31, 0xf7, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x66, 0xa7, 0xb1, 0x54, 0x60, 0x13, - 0x00, 0x00, +func (m *Message) GetMsgEditValidator() *types10.MsgEditValidator { + if x, ok := m.GetSum().(*Message_MsgEditValidator); ok { + return x.MsgEditValidator + } + return nil } -func (this *Supply) Equal(that interface{}) bool { - if that == nil { - return this == nil +func (m *Message) GetMsgDelegate() *types10.MsgDelegate { + if x, ok := m.GetSum().(*Message_MsgDelegate); ok { + return x.MsgDelegate } + return nil +} - that1, ok := that.(*Supply) - if !ok { - that2, ok := that.(Supply) - if ok { - that1 = &that2 - } else { - return false - } +func (m *Message) GetMsgBeginRedelegate() *types10.MsgBeginRedelegate { + if x, ok := m.GetSum().(*Message_MsgBeginRedelegate); ok { + return x.MsgBeginRedelegate } - if that1 == nil { - return this == nil - } else if this == nil { - return false + return nil +} + +func (m *Message) GetMsgUndelegate() *types10.MsgUndelegate { + if x, ok := m.GetSum().(*Message_MsgUndelegate); ok { + return x.MsgUndelegate } - if that1.Sum == nil { - if this.Sum != nil { - return false - } - } else if this.Sum == nil { - return false - } else if !this.Sum.Equal(that1.Sum) { - return false + return nil +} + +func (m *Message) GetMsgConnectionOpenInit() *types11.MsgConnectionOpenInit { + if x, ok := m.GetSum().(*Message_MsgConnectionOpenInit); ok { + return x.MsgConnectionOpenInit } - return true + return nil } -func (this *Supply_Supply) Equal(that interface{}) bool { - if that == nil { - return this == nil + +func (m *Message) GetMsgConnectionOpenTry() *types11.MsgConnectionOpenTry { + if x, ok := m.GetSum().(*Message_MsgConnectionOpenTry); ok { + return x.MsgConnectionOpenTry } + return nil +} - that1, ok := that.(*Supply_Supply) - if !ok { - that2, ok := that.(Supply_Supply) - if ok { - that1 = &that2 - } else { - return false - } +func (m *Message) GetMsgConnectionOpenAck() *types11.MsgConnectionOpenAck { + if x, ok := m.GetSum().(*Message_MsgConnectionOpenAck); ok { + return x.MsgConnectionOpenAck } - if that1 == nil { - return this == nil - } else if this == nil { - return false + return nil +} + +func (m *Message) GetMsgConnectionOpenConfirm() *types11.MsgConnectionOpenConfirm { + if x, ok := m.GetSum().(*Message_MsgConnectionOpenConfirm); ok { + return x.MsgConnectionOpenConfirm } - if !this.Supply.Equal(that1.Supply) { - return false + return nil +} + +func (m *Message) GetMsgChannelOpenInit() *types12.MsgChannelOpenInit { + if x, ok := m.GetSum().(*Message_MsgChannelOpenInit); ok { + return x.MsgChannelOpenInit } - return true + return nil } -func (this *Evidence) Equal(that interface{}) bool { - if that == nil { - return this == nil + +func (m *Message) GetMsgChannelOpenTry() *types12.MsgChannelOpenTry { + if x, ok := m.GetSum().(*Message_MsgChannelOpenTry); ok { + return x.MsgChannelOpenTry } + return nil +} - that1, ok := that.(*Evidence) - if !ok { - that2, ok := that.(Evidence) - if ok { - that1 = &that2 - } else { - return false - } +func (m *Message) GetMsgChannelOpenAck() *types12.MsgChannelOpenAck { + if x, ok := m.GetSum().(*Message_MsgChannelOpenAck); ok { + return x.MsgChannelOpenAck } - if that1 == nil { - return this == nil - } else if this == nil { - return false + return nil +} + +func (m *Message) GetMsgChannelOpenConfirm() *types12.MsgChannelOpenConfirm { + if x, ok := m.GetSum().(*Message_MsgChannelOpenConfirm); ok { + return x.MsgChannelOpenConfirm } - if that1.Sum == nil { - if this.Sum != nil { - return false - } - } else if this.Sum == nil { - return false - } else if !this.Sum.Equal(that1.Sum) { - return false + return nil +} + +func (m *Message) GetMsgChannelCloseInit() *types12.MsgChannelCloseInit { + if x, ok := m.GetSum().(*Message_MsgChannelCloseInit); ok { + return x.MsgChannelCloseInit } - return true + return nil } -func (this *Evidence_Equivocation) Equal(that interface{}) bool { - if that == nil { - return this == nil + +func (m *Message) GetMsgChannelCloseConfirm() *types12.MsgChannelCloseConfirm { + if x, ok := m.GetSum().(*Message_MsgChannelCloseConfirm); ok { + return x.MsgChannelCloseConfirm } + return nil +} - that1, ok := that.(*Evidence_Equivocation) - if !ok { - that2, ok := that.(Evidence_Equivocation) - if ok { - that1 = &that2 - } else { - return false - } +func (m *Message) GetMsgPacket() *types12.MsgPacket { + if x, ok := m.GetSum().(*Message_MsgPacket); ok { + return x.MsgPacket } - if that1 == nil { - return this == nil - } else if this == nil { - return false + return nil +} + +func (m *Message) GetMsgAcknowledgement() *types12.MsgAcknowledgement { + if x, ok := m.GetSum().(*Message_MsgAcknowledgement); ok { + return x.MsgAcknowledgement } - if !this.Equivocation.Equal(that1.Equivocation) { - return false + return nil +} + +func (m *Message) GetMsgCreateClientTendermint() *types4.MsgCreateClient { + if x, ok := m.GetSum().(*Message_MsgCreateClientTendermint); ok { + return x.MsgCreateClientTendermint } - return true + return nil } -func (this *MsgSubmitEvidence) Equal(that interface{}) bool { - if that == nil { - return this == nil + +func (m *Message) GetMsgUpdateClientTendermint() *types4.MsgUpdateClient { + if x, ok := m.GetSum().(*Message_MsgUpdateClientTendermint); ok { + return x.MsgUpdateClientTendermint } + return nil +} - that1, ok := that.(*MsgSubmitEvidence) - if !ok { - that2, ok := that.(MsgSubmitEvidence) - if ok { - that1 = &that2 - } else { - return false - } +func (m *Message) GetMsgSubmitClientMisbehaviourTendermint() *types4.MsgSubmitClientMisbehaviour { + if x, ok := m.GetSum().(*Message_MsgSubmitClientMisbehaviourTendermint); ok { + return x.MsgSubmitClientMisbehaviourTendermint } - if that1 == nil { - return this == nil - } else if this == nil { - return false + return nil +} + +func (m *Message) GetMsgTransfer() *types13.MsgTransfer { + if x, ok := m.GetSum().(*Message_MsgTransfer); ok { + return x.MsgTransfer } - if !this.MsgSubmitEvidenceBase.Equal(&that1.MsgSubmitEvidenceBase) { - return false - } - if !this.Evidence.Equal(that1.Evidence) { - return false - } - return true + return nil } -func (this *MsgSubmitProposal) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*MsgSubmitProposal) - if !ok { - that2, ok := that.(MsgSubmitProposal) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.MsgSubmitProposalBase.Equal(&that1.MsgSubmitProposalBase) { - return false - } - if !this.Content.Equal(that1.Content) { - return false +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Message) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Message_MsgSend)(nil), + (*Message_MsgMultiSend)(nil), + (*Message_MsgVerifyInvariant)(nil), + (*Message_MsgSetWithdrawAddress)(nil), + (*Message_MsgWithdrawDelegatorReward)(nil), + (*Message_MsgWithdrawValidatorCommission)(nil), + (*Message_MsgFundCommunityPool)(nil), + (*Message_MsgSubmitEvidence)(nil), + (*Message_MsgSubmitProposal)(nil), + (*Message_MsgVote)(nil), + (*Message_MsgDeposit)(nil), + (*Message_MsgUnjail)(nil), + (*Message_MsgCreateValidator)(nil), + (*Message_MsgEditValidator)(nil), + (*Message_MsgDelegate)(nil), + (*Message_MsgBeginRedelegate)(nil), + (*Message_MsgUndelegate)(nil), + (*Message_MsgConnectionOpenInit)(nil), + (*Message_MsgConnectionOpenTry)(nil), + (*Message_MsgConnectionOpenAck)(nil), + (*Message_MsgConnectionOpenConfirm)(nil), + (*Message_MsgChannelOpenInit)(nil), + (*Message_MsgChannelOpenTry)(nil), + (*Message_MsgChannelOpenAck)(nil), + (*Message_MsgChannelOpenConfirm)(nil), + (*Message_MsgChannelCloseInit)(nil), + (*Message_MsgChannelCloseConfirm)(nil), + (*Message_MsgPacket)(nil), + (*Message_MsgAcknowledgement)(nil), + (*Message_MsgCreateClientTendermint)(nil), + (*Message_MsgUpdateClientTendermint)(nil), + (*Message_MsgSubmitClientMisbehaviourTendermint)(nil), + (*Message_MsgTransfer)(nil), } - return true } -func (this *Proposal) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*Proposal) - if !ok { - that2, ok := that.(Proposal) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.ProposalBase.Equal(&that1.ProposalBase) { - return false - } - if !this.Content.Equal(&that1.Content) { - return false - } - return true +// SignDoc defines a standard application-level signing document to compose +// signatures for a Transaction. +type SignDoc struct { + StdSignDocBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:""` + Msgs []Message `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs"` } -func (this *Content) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*Content) - if !ok { - that2, ok := that.(Content) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if that1.Sum == nil { - if this.Sum != nil { - return false - } - } else if this.Sum == nil { - return false - } else if !this.Sum.Equal(that1.Sum) { - return false - } - return true +func (m *SignDoc) Reset() { *m = SignDoc{} } +func (m *SignDoc) String() string { return proto.CompactTextString(m) } +func (*SignDoc) ProtoMessage() {} +func (*SignDoc) Descriptor() ([]byte, []int) { + return fileDescriptor_ff851c3a98ef46f7, []int{15} } -func (this *Content_Text) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Content_Text) - if !ok { - that2, ok := that.(Content_Text) - if ok { - that1 = &that2 - } else { - return false +func (m *SignDoc) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SignDoc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SignDoc.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Text.Equal(that1.Text) { - return false - } - return true } -func (this *Content_ParameterChange) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *SignDoc) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignDoc.Merge(m, src) +} +func (m *SignDoc) XXX_Size() int { + return m.Size() +} +func (m *SignDoc) XXX_DiscardUnknown() { + xxx_messageInfo_SignDoc.DiscardUnknown(m) +} - that1, ok := that.(*Content_ParameterChange) - if !ok { - that2, ok := that.(Content_ParameterChange) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.ParameterChange.Equal(that1.ParameterChange) { - return false +var xxx_messageInfo_SignDoc proto.InternalMessageInfo + +func (m *SignDoc) GetMsgs() []Message { + if m != nil { + return m.Msgs } - return true + return nil } -func (this *Content_SoftwareUpgrade) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*Content_SoftwareUpgrade) - if !ok { - that2, ok := that.(Content_SoftwareUpgrade) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.SoftwareUpgrade.Equal(that1.SoftwareUpgrade) { - return false - } - return true +// StdFee includes the amount of coins paid in fees and the maximum +// gas to be used by the transaction. The ratio yields an effective "gasprice", +// which must be above some miminum to be accepted into the mempool. +type StdFee struct { + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` + Gas uint64 `protobuf:"varint,2,opt,name=gas,proto3" json:"gas,omitempty"` } -func (this *Content_CancelSoftwareUpgrade) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*Content_CancelSoftwareUpgrade) - if !ok { - that2, ok := that.(Content_CancelSoftwareUpgrade) - if ok { - that1 = &that2 - } else { - return false +func (m *StdFee) Reset() { *m = StdFee{} } +func (m *StdFee) String() string { return proto.CompactTextString(m) } +func (*StdFee) ProtoMessage() {} +func (*StdFee) Descriptor() ([]byte, []int) { + return fileDescriptor_ff851c3a98ef46f7, []int{16} +} +func (m *StdFee) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StdFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StdFee.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.CancelSoftwareUpgrade.Equal(that1.CancelSoftwareUpgrade) { - return false - } - return true } -func (this *Content_CommunityPoolSpend) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Content_CommunityPoolSpend) - if !ok { - that2, ok := that.(Content_CommunityPoolSpend) - if ok { +func (m *StdFee) XXX_Merge(src proto.Message) { + xxx_messageInfo_StdFee.Merge(m, src) +} +func (m *StdFee) XXX_Size() int { + return m.Size() +} +func (m *StdFee) XXX_DiscardUnknown() { + xxx_messageInfo_StdFee.DiscardUnknown(m) +} + +var xxx_messageInfo_StdFee proto.InternalMessageInfo + +// StdSignature defines a signature structure that contains the signature of a +// transaction and an optional public key. +type StdSignature struct { + PubKey []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"public_key,omitempty" yaml:"public_key"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *StdSignature) Reset() { *m = StdSignature{} } +func (m *StdSignature) String() string { return proto.CompactTextString(m) } +func (*StdSignature) ProtoMessage() {} +func (*StdSignature) Descriptor() ([]byte, []int) { + return fileDescriptor_ff851c3a98ef46f7, []int{17} +} +func (m *StdSignature) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StdSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StdSignature.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 *StdSignature) XXX_Merge(src proto.Message) { + xxx_messageInfo_StdSignature.Merge(m, src) +} +func (m *StdSignature) XXX_Size() int { + return m.Size() +} +func (m *StdSignature) XXX_DiscardUnknown() { + xxx_messageInfo_StdSignature.DiscardUnknown(m) +} + +var xxx_messageInfo_StdSignature proto.InternalMessageInfo + +// StdTxBase defines a transaction base which application-level concrete transaction +// types can extend. +type StdTxBase struct { + Fee StdFee `protobuf:"bytes,1,opt,name=fee,proto3" json:"fee"` + Signatures []StdSignature `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures"` + Memo string `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty"` +} + +func (m *StdTxBase) Reset() { *m = StdTxBase{} } +func (m *StdTxBase) String() string { return proto.CompactTextString(m) } +func (*StdTxBase) ProtoMessage() {} +func (*StdTxBase) Descriptor() ([]byte, []int) { + return fileDescriptor_ff851c3a98ef46f7, []int{18} +} +func (m *StdTxBase) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StdTxBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StdTxBase.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 *StdTxBase) XXX_Merge(src proto.Message) { + xxx_messageInfo_StdTxBase.Merge(m, src) +} +func (m *StdTxBase) XXX_Size() int { + return m.Size() +} +func (m *StdTxBase) XXX_DiscardUnknown() { + xxx_messageInfo_StdTxBase.DiscardUnknown(m) +} + +var xxx_messageInfo_StdTxBase proto.InternalMessageInfo + +func (m *StdTxBase) GetFee() StdFee { + if m != nil { + return m.Fee + } + return StdFee{} +} + +func (m *StdTxBase) GetSignatures() []StdSignature { + if m != nil { + return m.Signatures + } + return nil +} + +func (m *StdTxBase) GetMemo() string { + if m != nil { + return m.Memo + } + return "" +} + +// StdSignDocBase defines the base structure for which applications can extend +// to define the concrete structure that signers sign over. +type StdSignDocBase struct { + ChainID string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` + AccountNumber uint64 `protobuf:"varint,2,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty" yaml:"account_number"` + Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` + Memo string `protobuf:"bytes,4,opt,name=memo,proto3" json:"memo,omitempty"` + Fee StdFee `protobuf:"bytes,5,opt,name=fee,proto3" json:"fee"` +} + +func (m *StdSignDocBase) Reset() { *m = StdSignDocBase{} } +func (m *StdSignDocBase) String() string { return proto.CompactTextString(m) } +func (*StdSignDocBase) ProtoMessage() {} +func (*StdSignDocBase) Descriptor() ([]byte, []int) { + return fileDescriptor_ff851c3a98ef46f7, []int{19} +} +func (m *StdSignDocBase) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StdSignDocBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StdSignDocBase.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 *StdSignDocBase) XXX_Merge(src proto.Message) { + xxx_messageInfo_StdSignDocBase.Merge(m, src) +} +func (m *StdSignDocBase) XXX_Size() int { + return m.Size() +} +func (m *StdSignDocBase) XXX_DiscardUnknown() { + xxx_messageInfo_StdSignDocBase.DiscardUnknown(m) +} + +var xxx_messageInfo_StdSignDocBase proto.InternalMessageInfo + +func (m *StdSignDocBase) GetChainID() string { + if m != nil { + return m.ChainID + } + return "" +} + +func (m *StdSignDocBase) GetAccountNumber() uint64 { + if m != nil { + return m.AccountNumber + } + return 0 +} + +func (m *StdSignDocBase) GetSequence() uint64 { + if m != nil { + return m.Sequence + } + return 0 +} + +func (m *StdSignDocBase) GetMemo() string { + if m != nil { + return m.Memo + } + return "" +} + +func (m *StdSignDocBase) GetFee() StdFee { + if m != nil { + return m.Fee + } + return StdFee{} +} + +func init() { + proto.RegisterType((*Account)(nil), "cosmos_sdk.std.v1.Account") + proto.RegisterType((*Supply)(nil), "cosmos_sdk.std.v1.Supply") + proto.RegisterType((*Evidence)(nil), "cosmos_sdk.std.v1.Evidence") + proto.RegisterType((*MsgSubmitEvidence)(nil), "cosmos_sdk.std.v1.MsgSubmitEvidence") + proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos_sdk.std.v1.MsgSubmitProposal") + proto.RegisterType((*Proposal)(nil), "cosmos_sdk.std.v1.Proposal") + proto.RegisterType((*Content)(nil), "cosmos_sdk.std.v1.Content") + proto.RegisterType((*ClientState)(nil), "cosmos_sdk.std.v1.ClientState") + proto.RegisterType((*ConsensusState)(nil), "cosmos_sdk.std.v1.ConsensusState") + proto.RegisterType((*Misbehaviour)(nil), "cosmos_sdk.std.v1.Misbehaviour") + proto.RegisterType((*Header)(nil), "cosmos_sdk.std.v1.Header") + proto.RegisterType((*MsgCreateClient)(nil), "cosmos_sdk.std.v1.MsgCreateClient") + proto.RegisterType((*MsgUpdateClient)(nil), "cosmos_sdk.std.v1.MsgUpdateClient") + proto.RegisterType((*Transaction)(nil), "cosmos_sdk.std.v1.Transaction") + proto.RegisterType((*Message)(nil), "cosmos_sdk.std.v1.Message") + proto.RegisterType((*SignDoc)(nil), "cosmos_sdk.std.v1.SignDoc") + proto.RegisterType((*StdFee)(nil), "cosmos_sdk.std.v1.StdFee") + proto.RegisterType((*StdSignature)(nil), "cosmos_sdk.std.v1.StdSignature") + proto.RegisterType((*StdTxBase)(nil), "cosmos_sdk.std.v1.StdTxBase") + proto.RegisterType((*StdSignDocBase)(nil), "cosmos_sdk.std.v1.StdSignDocBase") +} + +func init() { proto.RegisterFile("std/codec.proto", fileDescriptor_ff851c3a98ef46f7) } + +var fileDescriptor_ff851c3a98ef46f7 = []byte{ + // 2415 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x59, 0xcd, 0x6f, 0x1b, 0xc7, + 0x15, 0xe7, 0x46, 0xb4, 0x3e, 0x46, 0xb2, 0x6c, 0x8d, 0x2d, 0x9b, 0x92, 0x65, 0xd1, 0x66, 0x1a, + 0xc3, 0x71, 0x4a, 0xd2, 0x5f, 0x89, 0x6b, 0xb6, 0x69, 0x2b, 0x52, 0x56, 0x28, 0x37, 0x4a, 0xdc, + 0x95, 0xec, 0xa2, 0x1f, 0xe9, 0x62, 0xb9, 0x3b, 0xa2, 0xb6, 0xe4, 0xec, 0x6e, 0x76, 0x66, 0x69, + 0xb2, 0x40, 0x4f, 0x2d, 0x8a, 0xe6, 0x50, 0xa0, 0xb7, 0xa2, 0x40, 0x0b, 0xa4, 0x87, 0x5e, 0xd2, + 0xab, 0x80, 0x02, 0xfd, 0x0b, 0x02, 0x9d, 0x7c, 0xec, 0x49, 0x2d, 0xec, 0x4b, 0x91, 0x53, 0xe1, + 0x63, 0x2f, 0x2d, 0xe6, 0x63, 0x97, 0xbb, 0xe4, 0x90, 0x92, 0x95, 0x5c, 0x88, 0x9d, 0x99, 0xf7, + 0x7e, 0xbf, 0xdf, 0xce, 0x9b, 0x79, 0x6f, 0x66, 0x09, 0xce, 0x10, 0x6a, 0x97, 0x2d, 0xcf, 0x46, + 0x56, 0xc9, 0x0f, 0x3c, 0xea, 0xc1, 0x05, 0xcb, 0x23, 0xd8, 0x23, 0x06, 0xb1, 0x5b, 0x25, 0x42, + 0xed, 0x52, 0xe7, 0xd6, 0xf2, 0x5b, 0x74, 0xcf, 0x09, 0x6c, 0xc3, 0x37, 0x03, 0xda, 0x2b, 0x73, + 0xab, 0xb2, 0x30, 0x2a, 0x26, 0x1b, 0xc2, 0x7f, 0xf9, 0xda, 0xb0, 0x71, 0xd3, 0x6b, 0x7a, 0xfd, + 0x27, 0x69, 0xb7, 0x40, 0x7b, 0x3e, 0x22, 0x65, 0xfe, 0x2b, 0xbb, 0x72, 0xdd, 0xb2, 0x19, 0xd2, + 0xbd, 0xf2, 0xf0, 0xc8, 0x15, 0x39, 0xd2, 0x41, 0x84, 0x3a, 0x6e, 0xb3, 0xac, 0xf4, 0x6d, 0x98, + 0x6e, 0x4b, 0x31, 0xb2, 0xdc, 0x2d, 0x5b, 0x81, 0x43, 0x1c, 0xa2, 0xc6, 0xb5, 0x1d, 0x42, 0x03, + 0xa7, 0x11, 0x52, 0xc7, 0x73, 0x15, 0x16, 0x2b, 0xdd, 0x32, 0xea, 0x38, 0x36, 0x72, 0x2d, 0xa4, + 0x18, 0xbd, 0xd8, 0x2d, 0x37, 0xbd, 0x8e, 0xda, 0x8d, 0xb4, 0x4d, 0xb2, 0xa7, 0x16, 0x7b, 0xa9, + 0x5b, 0x26, 0xd4, 0x6c, 0xa9, 0x07, 0x5f, 0xef, 0x96, 0x7d, 0x33, 0x30, 0x71, 0xa4, 0xd7, 0x0f, + 0x3c, 0xdf, 0x23, 0x66, 0x7b, 0x10, 0x21, 0xf4, 0x9b, 0x81, 0x69, 0xab, 0x54, 0xbd, 0xd1, 0x2d, + 0x3b, 0x0d, 0xab, 0x7c, 0xf3, 0x4e, 0xd1, 0xf2, 0x5c, 0x17, 0x59, 0x23, 0x5e, 0xad, 0x20, 0xcd, + 0xee, 0x16, 0xad, 0x3d, 0xd3, 0x75, 0x51, 0x7b, 0x0c, 0xd4, 0xbd, 0x22, 0x45, 0xae, 0x8d, 0x02, + 0xec, 0xb8, 0x54, 0xad, 0x99, 0x99, 0xdd, 0xbe, 0x59, 0xa4, 0x81, 0xe9, 0x92, 0x5d, 0x14, 0x0c, + 0x1b, 0x15, 0xfe, 0x9e, 0x05, 0x53, 0x6b, 0x96, 0xe5, 0x85, 0x2e, 0x85, 0x1b, 0x60, 0xae, 0x61, + 0x12, 0x64, 0x98, 0xa2, 0x9d, 0xd3, 0xae, 0x68, 0xd7, 0x67, 0x6f, 0x5f, 0x2d, 0x25, 0x16, 0x5f, + 0xb7, 0xc4, 0x42, 0x5e, 0xea, 0xdc, 0x2a, 0x55, 0x4d, 0x82, 0xa4, 0x63, 0x3d, 0xa3, 0xcf, 0x36, + 0xfa, 0x4d, 0xd8, 0x01, 0xcb, 0x96, 0xe7, 0x52, 0xc7, 0x0d, 0xbd, 0x90, 0x18, 0x72, 0x79, 0xc4, + 0xa8, 0xaf, 0x71, 0xd4, 0x77, 0x54, 0xa8, 0xc2, 0x92, 0xa1, 0xd7, 0x62, 0xff, 0x27, 0xa2, 0xb3, + 0x4f, 0x95, 0xb3, 0x46, 0x8c, 0x41, 0x0c, 0x2e, 0xda, 0xa8, 0x6d, 0xf6, 0x90, 0x3d, 0x44, 0x3a, + 0xc1, 0x49, 0xef, 0x8c, 0x27, 0x5d, 0x17, 0xce, 0x43, 0x8c, 0x8b, 0xb6, 0x6a, 0x00, 0xfa, 0x20, + 0xe7, 0xa3, 0xc0, 0xf1, 0x6c, 0xc7, 0x1a, 0xe2, 0xcb, 0x72, 0xbe, 0xbb, 0xe3, 0xf9, 0x1e, 0x49, + 0xef, 0x21, 0xc2, 0x0b, 0xbe, 0x72, 0x04, 0xbe, 0x0f, 0xe6, 0xb1, 0x67, 0x87, 0xed, 0x7e, 0x88, + 0x4e, 0x71, 0x9e, 0xd7, 0xd5, 0x21, 0xda, 0xe2, 0xb6, 0x7d, 0xd8, 0xd3, 0x38, 0xd9, 0x51, 0xb9, + 0x7f, 0xb0, 0x5f, 0x7c, 0xfb, 0x46, 0xd3, 0xa1, 0x7b, 0x61, 0xa3, 0x64, 0x79, 0x58, 0xa6, 0x8c, + 0x28, 0x8d, 0x10, 0xbb, 0x55, 0x96, 0x3b, 0x1c, 0x75, 0x7d, 0x2f, 0xa0, 0xc8, 0x2e, 0x49, 0xd7, + 0xea, 0x29, 0x30, 0x41, 0x42, 0x5c, 0xf8, 0xb5, 0x06, 0x26, 0xb7, 0x43, 0xdf, 0x6f, 0xf7, 0xe0, + 0x3b, 0x60, 0x92, 0xf0, 0x27, 0xb9, 0x6a, 0x56, 0xd2, 0x92, 0x58, 0x1a, 0x60, 0x92, 0x84, 0x75, + 0x3d, 0xa3, 0x4b, 0xeb, 0xca, 0xbb, 0xff, 0xfe, 0x34, 0xaf, 0x1d, 0x47, 0x08, 0x4f, 0x24, 0xb1, + 0x10, 0x81, 0xb3, 0x19, 0x09, 0xf9, 0x9f, 0x06, 0xa6, 0x1f, 0xc8, 0x8c, 0x00, 0xdf, 0x07, 0x73, + 0xe8, 0xe3, 0xd0, 0xe9, 0x78, 0x96, 0xc9, 0x36, 0x99, 0x14, 0x74, 0x2d, 0x2d, 0x28, 0xca, 0x1f, + 0x4c, 0xd4, 0x83, 0x84, 0x75, 0x3d, 0xa3, 0xa7, 0xbc, 0xe1, 0x8f, 0xc1, 0x39, 0xab, 0xed, 0x20, + 0x97, 0x1a, 0xd8, 0x21, 0x0d, 0xb4, 0x67, 0x76, 0x1c, 0x2f, 0x0c, 0xe4, 0x2a, 0xbe, 0x9e, 0x06, + 0x75, 0x1a, 0x56, 0xa9, 0xbf, 0x25, 0x39, 0xb4, 0xa4, 0xa9, 0x67, 0x74, 0x28, 0x60, 0xb6, 0x12, + 0x28, 0x95, 0x35, 0xf9, 0xf6, 0xf7, 0x8f, 0x78, 0xf9, 0x38, 0xdb, 0xc5, 0x13, 0x10, 0x01, 0x47, + 0x33, 0xf0, 0x17, 0x0d, 0x2c, 0x6c, 0x91, 0xe6, 0x76, 0xd8, 0xc0, 0x0e, 0x8d, 0xa7, 0x62, 0x0b, + 0x64, 0xd9, 0xc6, 0x94, 0x53, 0x50, 0x1e, 0x3d, 0x05, 0x43, 0xae, 0x6c, 0x7b, 0x57, 0xa7, 0x3f, + 0x3f, 0xcc, 0x67, 0x9e, 0x1d, 0xe6, 0x35, 0x9d, 0xc3, 0xc0, 0x7b, 0x60, 0x3a, 0x72, 0x92, 0x13, + 0x70, 0xa9, 0x34, 0x54, 0x99, 0x62, 0x69, 0x7a, 0x6c, 0x5c, 0x99, 0xfe, 0xcd, 0xa7, 0xf9, 0x0c, + 0x7b, 0xd7, 0xc2, 0x9f, 0x92, 0x3a, 0x1f, 0xc9, 0x2c, 0x0a, 0xeb, 0x29, 0x9d, 0x37, 0xd2, 0x3a, + 0x9b, 0x5e, 0x27, 0x25, 0x31, 0xf2, 0x52, 0x4a, 0xbc, 0x0b, 0xa6, 0x58, 0x7e, 0x40, 0x71, 0xa2, + 0x59, 0x56, 0x28, 0xac, 0x09, 0x0b, 0x3d, 0x32, 0x4d, 0xe8, 0xfb, 0xad, 0x06, 0xa6, 0x63, 0x59, + 0xdf, 0x49, 0xc9, 0xba, 0xaa, 0x94, 0x35, 0x56, 0x4d, 0xe5, 0x15, 0xd4, 0x54, 0xb3, 0xcc, 0xb9, + 0xaf, 0x29, 0xcb, 0xf5, 0xfc, 0x39, 0x0b, 0xa6, 0xa4, 0x01, 0xbc, 0x07, 0xb2, 0x14, 0x75, 0xe9, + 0x58, 0x39, 0x3b, 0xa8, 0x1b, 0x4f, 0x50, 0x3d, 0xa3, 0x73, 0x07, 0xf8, 0x13, 0x70, 0x96, 0x57, + 0x2f, 0x44, 0x51, 0x60, 0xb0, 0xba, 0xd2, 0x8c, 0xe2, 0x37, 0xb0, 0x24, 0x44, 0x8d, 0xe3, 0xaf, + 0x15, 0xd9, 0xd7, 0xb8, 0x79, 0x02, 0xf2, 0x8c, 0x9f, 0x1e, 0x82, 0x1f, 0x81, 0xb3, 0xc4, 0xdb, + 0xa5, 0x4f, 0xcd, 0x00, 0x19, 0xb2, 0xfe, 0xc9, 0x7c, 0x7b, 0x33, 0x8d, 0x2e, 0x07, 0x79, 0x1e, + 0x90, 0x0e, 0x8f, 0x45, 0x57, 0x12, 0x9e, 0xa4, 0x87, 0xa0, 0x0f, 0x2e, 0x5a, 0xa6, 0x6b, 0xa1, + 0xb6, 0x31, 0xc4, 0x92, 0x55, 0x95, 0x92, 0x04, 0x4b, 0x8d, 0xfb, 0x8d, 0xe6, 0x5a, 0xb4, 0x54, + 0x06, 0xb0, 0x0d, 0xce, 0x5b, 0x1e, 0xc6, 0xa1, 0xeb, 0xd0, 0x9e, 0xe1, 0x7b, 0x5e, 0xdb, 0x20, + 0x3e, 0x72, 0x6d, 0x99, 0x6c, 0xbf, 0x91, 0xa6, 0x4b, 0x1e, 0x55, 0x44, 0x34, 0xa5, 0xe7, 0x23, + 0xcf, 0x6b, 0x6f, 0x33, 0xbf, 0x04, 0x21, 0xb4, 0x86, 0x46, 0x2b, 0xf7, 0x65, 0x0e, 0xb8, 0x75, + 0x54, 0x06, 0x8c, 0x0f, 0x35, 0xf1, 0x8a, 0x91, 0x7b, 0xff, 0xaf, 0x1a, 0x98, 0xad, 0xf1, 0xe4, + 0xb2, 0x4d, 0x4d, 0xca, 0x76, 0x3d, 0xe8, 0x67, 0x21, 0xb9, 0x5a, 0xde, 0x3a, 0x2a, 0x53, 0x25, + 0x00, 0xea, 0x19, 0x3d, 0x01, 0x50, 0xd9, 0x38, 0xd8, 0x2f, 0x56, 0x8f, 0x12, 0xc7, 0x0f, 0x24, + 0xb7, 0x8b, 0x22, 0xc7, 0xf5, 0xd3, 0x54, 0x02, 0x35, 0x52, 0xbb, 0xaf, 0x81, 0xf9, 0x9a, 0xe7, + 0x12, 0xe4, 0x92, 0x90, 0x08, 0xc1, 0x8f, 0x14, 0x82, 0x4b, 0x47, 0x0a, 0x4e, 0x61, 0x0c, 0x68, + 0xde, 0x3c, 0xd8, 0x2f, 0x3e, 0x38, 0xa9, 0xe6, 0x14, 0x70, 0x24, 0xfb, 0x33, 0x0d, 0xcc, 0x25, + 0x73, 0x37, 0x7c, 0xa8, 0x10, 0xfd, 0x2a, 0xf5, 0x20, 0x29, 0xf7, 0xbd, 0x83, 0xfd, 0x62, 0xed, + 0x84, 0x72, 0x93, 0xa2, 0x22, 0xb1, 0x7f, 0xd4, 0xc0, 0x64, 0x1d, 0x99, 0x36, 0x0a, 0x60, 0x5d, + 0x21, 0xf3, 0xda, 0x51, 0x32, 0x85, 0xef, 0x80, 0xc8, 0xb5, 0x83, 0xfd, 0xe2, 0xbb, 0x27, 0x14, + 0x29, 0x00, 0x23, 0x79, 0x7f, 0xd3, 0xc0, 0x99, 0x2d, 0xd2, 0xac, 0x05, 0xc8, 0xa4, 0x48, 0x2c, + 0x11, 0xf8, 0x7d, 0x85, 0xce, 0xf2, 0x51, 0x3a, 0x07, 0x40, 0x06, 0x04, 0x3f, 0x3c, 0xd8, 0x2f, + 0x6e, 0x9c, 0x74, 0x56, 0xd3, 0xc8, 0x03, 0xca, 0x1f, 0xfb, 0xf6, 0x97, 0x57, 0x9e, 0x04, 0xf9, + 0x6a, 0x95, 0x27, 0x91, 0x23, 0xe5, 0x9f, 0x68, 0x60, 0x76, 0x87, 0xdd, 0x03, 0x4c, 0x7e, 0xf5, + 0x80, 0xdf, 0x4e, 0xd5, 0xb6, 0x15, 0x45, 0x5d, 0xda, 0xa6, 0xf6, 0x4e, 0x97, 0x97, 0xb5, 0xb9, + 0xa8, 0xac, 0x7d, 0xc1, 0x2a, 0x54, 0x54, 0x68, 0xb3, 0x98, 0x34, 0x49, 0xee, 0xb5, 0x2b, 0x13, + 0x23, 0xea, 0xda, 0x16, 0x22, 0xc4, 0x6c, 0x22, 0x59, 0xd7, 0xb8, 0x75, 0x25, 0xcb, 0x0a, 0x6d, + 0xe1, 0xbf, 0x4b, 0x60, 0x4a, 0x8e, 0xc2, 0x0a, 0x98, 0xc6, 0xa4, 0x69, 0x10, 0x96, 0x60, 0x85, + 0x96, 0xcb, 0xea, 0xa3, 0x23, 0xab, 0xff, 0xc8, 0xb5, 0xeb, 0x19, 0x7d, 0x0a, 0x8b, 0x47, 0xf8, + 0x10, 0xcc, 0x33, 0x5f, 0x1c, 0xb6, 0xa9, 0x23, 0x10, 0x44, 0x55, 0x2b, 0x8c, 0x44, 0xd8, 0x62, + 0xa6, 0x12, 0x66, 0x0e, 0x27, 0xda, 0xf0, 0xa7, 0xe0, 0x3c, 0xc3, 0xea, 0xa0, 0xc0, 0xd9, 0xed, + 0x19, 0x8e, 0xdb, 0x31, 0x03, 0xc7, 0x8c, 0x6f, 0x0e, 0x03, 0x47, 0x12, 0x71, 0x77, 0x95, 0x98, + 0x4f, 0xb8, 0xcb, 0x66, 0xe4, 0xc1, 0xd2, 0x3c, 0x1e, 0xea, 0x85, 0x2e, 0xc8, 0x89, 0xf7, 0xa4, + 0xc6, 0x53, 0x87, 0xee, 0xd9, 0x81, 0xf9, 0xd4, 0x30, 0x6d, 0x3b, 0x40, 0x84, 0xc8, 0x3a, 0x76, + 0x67, 0x7c, 0x61, 0xe1, 0xef, 0x4f, 0x7f, 0x20, 0x7d, 0xd7, 0x84, 0x2b, 0x2b, 0x62, 0x58, 0x35, + 0x00, 0x7f, 0x01, 0x2e, 0x33, 0xbe, 0x98, 0xcb, 0x46, 0x6d, 0xd4, 0x34, 0xa9, 0x17, 0x18, 0x01, + 0x7a, 0x6a, 0x06, 0xc7, 0xac, 0x66, 0x5b, 0xa4, 0x19, 0x01, 0xaf, 0x47, 0x00, 0x3a, 0xf7, 0xaf, + 0x67, 0xf4, 0x65, 0x3c, 0x72, 0x14, 0x7e, 0xa2, 0x81, 0xab, 0x29, 0xfe, 0x8e, 0xd9, 0x76, 0x6c, + 0xce, 0xcf, 0x6a, 0xa0, 0x43, 0x08, 0x3b, 0x9a, 0x4f, 0x72, 0x0d, 0xdf, 0x3a, 0xb6, 0x86, 0x27, + 0x11, 0x48, 0x2d, 0xc6, 0xa8, 0x67, 0xf4, 0x55, 0x3c, 0xd6, 0x02, 0xb6, 0xc0, 0x45, 0x26, 0x65, + 0x37, 0x74, 0x6d, 0x23, 0x5d, 0xd8, 0x73, 0x53, 0x5c, 0xc0, 0xed, 0x23, 0x05, 0x6c, 0x84, 0xae, + 0x9d, 0xaa, 0xec, 0xf5, 0x8c, 0xce, 0xd6, 0xcb, 0x50, 0x3f, 0x7c, 0x02, 0xce, 0xf1, 0x38, 0xf3, + 0xa3, 0xaa, 0x11, 0x1f, 0x97, 0xa7, 0x39, 0xd1, 0xd7, 0x54, 0xdb, 0x64, 0xf0, 0xe8, 0x5d, 0xcf, + 0xe8, 0x0b, 0x78, 0xe8, 0x28, 0x9f, 0xc6, 0x8d, 0xbe, 0x3f, 0xe4, 0x66, 0x8e, 0xc6, 0x4d, 0x9c, + 0x3f, 0xfa, 0xb8, 0xf1, 0x19, 0xf7, 0xbe, 0xd8, 0x7f, 0x1d, 0x8f, 0xa2, 0x1c, 0x50, 0x5d, 0xdd, + 0xfa, 0xc7, 0xef, 0x27, 0x1e, 0xaf, 0xb3, 0x6c, 0xfb, 0xb1, 0x47, 0x58, 0x05, 0xb3, 0xcc, 0xd5, + 0x46, 0xbe, 0x47, 0x1c, 0x9a, 0x9b, 0xe5, 0xde, 0xf9, 0x51, 0xde, 0xeb, 0xc2, 0x8c, 0x65, 0x3a, + 0x1c, 0xb7, 0xe0, 0x3a, 0x60, 0x2d, 0x23, 0x74, 0x7f, 0x66, 0x3a, 0xed, 0xdc, 0x9c, 0xea, 0x3a, + 0x1b, 0x7d, 0xb3, 0x89, 0xd2, 0x26, 0x37, 0xad, 0x67, 0xf4, 0x19, 0x1c, 0x35, 0xa0, 0x21, 0x36, + 0xaf, 0xc5, 0x33, 0x76, 0x7f, 0xa9, 0xe5, 0x4e, 0xab, 0xce, 0x3e, 0xf2, 0x2b, 0x4f, 0xaa, 0x7e, + 0xc4, 0xcb, 0x46, 0xee, 0xde, 0x81, 0x5e, 0xf8, 0x43, 0xc0, 0x7a, 0x0d, 0x64, 0x3b, 0x34, 0x01, + 0x3f, 0xcf, 0xe1, 0xdf, 0x1c, 0x07, 0xff, 0xc0, 0x76, 0x68, 0x12, 0xfc, 0x2c, 0x1e, 0xe8, 0x83, + 0x9b, 0x60, 0x4e, 0xcc, 0x22, 0xdf, 0x40, 0x28, 0x77, 0x66, 0x38, 0xa2, 0x83, 0xa0, 0x72, 0xb3, + 0xb1, 0x60, 0xcc, 0xe2, 0x7e, 0x33, 0x9a, 0x86, 0x06, 0x6a, 0x3a, 0xae, 0x11, 0xa0, 0x18, 0xf2, + 0xec, 0xd1, 0xd3, 0x50, 0x65, 0x3e, 0x7a, 0xec, 0x22, 0xa7, 0x61, 0xa0, 0x17, 0x7e, 0x28, 0x12, + 0x6e, 0xe8, 0xc6, 0xd0, 0x0b, 0xaa, 0x03, 0x45, 0x1a, 0xfa, 0xb1, 0x9b, 0x40, 0x3d, 0x8d, 0x93, + 0x1d, 0xd0, 0x17, 0x59, 0xb1, 0xff, 0x49, 0xcc, 0xf0, 0x7c, 0xe4, 0x1a, 0x8e, 0xeb, 0xd0, 0x1c, + 0xe4, 0xd0, 0x6f, 0x0f, 0x57, 0xd2, 0xbe, 0x75, 0x14, 0xc3, 0xb8, 0xe3, 0x43, 0x1f, 0xb9, 0x9b, + 0x2e, 0x5f, 0x65, 0x2c, 0x2f, 0x0e, 0x0f, 0x40, 0x2c, 0x92, 0xc1, 0x20, 0x23, 0x0d, 0x7a, 0xb9, + 0x73, 0xaa, 0x8f, 0x36, 0xc7, 0x20, 0xdc, 0x09, 0x7a, 0x32, 0x1d, 0x0c, 0xf5, 0x8f, 0xa2, 0x33, + 0xad, 0x56, 0xee, 0xfc, 0x09, 0xe9, 0xd6, 0xac, 0x96, 0x92, 0x6e, 0xcd, 0x6a, 0xc1, 0x1e, 0xb8, + 0xa4, 0xa2, 0xb3, 0x3c, 0x77, 0xd7, 0x09, 0x70, 0x6e, 0x51, 0x95, 0xf3, 0x8f, 0x41, 0x59, 0x13, + 0xfe, 0xf5, 0x8c, 0x9e, 0xc3, 0x23, 0xc6, 0xa0, 0x0d, 0x16, 0x39, 0xb5, 0xf8, 0x6c, 0x99, 0x88, + 0xe3, 0x85, 0x51, 0x27, 0x22, 0x69, 0x1a, 0x31, 0x8a, 0x56, 0x22, 0x82, 0x7c, 0x23, 0xa6, 0x7b, + 0xa1, 0x29, 0x77, 0x7a, 0x92, 0x85, 0xc5, 0xee, 0xe2, 0xa8, 0x4b, 0xc3, 0x48, 0x12, 0x11, 0xb5, + 0x05, 0x3c, 0xd8, 0xa9, 0xa4, 0x60, 0xf1, 0xca, 0xbd, 0x32, 0x85, 0x88, 0xd4, 0x00, 0x05, 0x0b, + 0x13, 0x96, 0xcb, 0x3e, 0x49, 0x11, 0xc5, 0x68, 0x49, 0x55, 0x92, 0xc6, 0xd2, 0xf4, 0xa3, 0xb3, + 0x88, 0x55, 0x03, 0xb0, 0x09, 0x2e, 0x24, 0xe9, 0xac, 0xb6, 0x47, 0x90, 0x88, 0xcd, 0xb2, 0xea, + 0x9e, 0x3e, 0x92, 0xac, 0xc6, 0x1c, 0x65, 0x70, 0xce, 0xe1, 0xe1, 0x6e, 0xe8, 0x83, 0xa5, 0x61, + 0xa2, 0xe8, 0xc5, 0x2e, 0xa9, 0x4e, 0x39, 0xe3, 0xb9, 0xfa, 0x6f, 0x76, 0x01, 0x2b, 0x47, 0xe0, + 0x7b, 0xa2, 0x7e, 0xf8, 0xa6, 0xd5, 0x42, 0x34, 0xb7, 0x32, 0xea, 0x7a, 0x93, 0xa6, 0x78, 0xc4, + 0xad, 0x65, 0x09, 0x11, 0x0d, 0xd8, 0x10, 0xf5, 0xd5, 0xb4, 0x5a, 0xae, 0xf7, 0xb4, 0x8d, 0xec, + 0x26, 0xc2, 0xc8, 0xa5, 0xb9, 0xcb, 0xc7, 0x5b, 0xbc, 0x6b, 0x69, 0x37, 0xb9, 0x78, 0x07, 0x7a, + 0x61, 0x00, 0x56, 0x12, 0x65, 0x4a, 0x7e, 0x56, 0x4c, 0xdc, 0x1d, 0x56, 0x4f, 0x7a, 0xeb, 0x59, + 0xc2, 0xe9, 0xae, 0x9d, 0xd8, 0x3e, 0xe2, 0x0c, 0xf9, 0x95, 0x40, 0xc1, 0x99, 0x3f, 0xe9, 0x7d, + 0x85, 0x71, 0x26, 0xbb, 0x12, 0x9c, 0xbf, 0xd7, 0xc0, 0x9b, 0x89, 0xc3, 0x8a, 0xe2, 0xfb, 0x69, + 0x52, 0xc1, 0x15, 0xae, 0xe0, 0x9b, 0xc7, 0x50, 0x20, 0x8e, 0x2e, 0xb5, 0xa1, 0xef, 0xa8, 0xf5, + 0x8c, 0xfe, 0x06, 0x1e, 0x3d, 0x9c, 0x50, 0xf6, 0x81, 0x28, 0xb6, 0xd1, 0x1f, 0x22, 0xb9, 0xab, + 0xaa, 0x0a, 0xce, 0xb9, 0xa5, 0x85, 0x64, 0xde, 0x91, 0x4d, 0x59, 0x71, 0xa3, 0x66, 0xe5, 0xc6, + 0xc1, 0x7e, 0xf1, 0xda, 0xd8, 0x7b, 0x9a, 0xf8, 0x62, 0xc3, 0x2a, 0xac, 0xbc, 0x88, 0xfd, 0x4a, + 0x03, 0x53, 0xdb, 0x4e, 0xd3, 0x5d, 0xf7, 0x2c, 0x58, 0x1b, 0xfd, 0x81, 0xb1, 0x7f, 0x09, 0x93, + 0xc6, 0x5f, 0xed, 0x4d, 0xac, 0xf0, 0x4b, 0x0d, 0x4c, 0x6e, 0x53, 0x7b, 0x03, 0x21, 0xf8, 0x11, + 0x98, 0x34, 0xb1, 0xfc, 0xc7, 0x87, 0x41, 0x9c, 0x4b, 0x42, 0xf0, 0x2f, 0x2d, 0x8e, 0x5b, 0xbd, + 0xc9, 0x7c, 0x3f, 0xfb, 0x67, 0xfe, 0xfa, 0x31, 0xde, 0x96, 0x39, 0x10, 0x5d, 0x82, 0xc2, 0xb3, + 0x60, 0xa2, 0x69, 0x12, 0x7e, 0x35, 0xcb, 0xea, 0xec, 0x31, 0xf1, 0xb9, 0xf5, 0xe7, 0x60, 0x4e, + 0xbe, 0xa1, 0x49, 0xc3, 0x00, 0xc1, 0x0d, 0x30, 0xe5, 0x87, 0x0d, 0xa3, 0x85, 0xc4, 0xff, 0x08, + 0x73, 0xd5, 0xe2, 0x17, 0x87, 0xf9, 0xf3, 0x7e, 0xd8, 0x68, 0x3b, 0x16, 0xeb, 0xfd, 0xba, 0x87, + 0x1d, 0x8a, 0xb0, 0x4f, 0x7b, 0x2f, 0x0f, 0xf3, 0x0b, 0x3d, 0x13, 0xb7, 0x2b, 0x85, 0xfe, 0x68, + 0x41, 0x9f, 0xf4, 0xc3, 0xc6, 0xf7, 0x50, 0x0f, 0xae, 0x80, 0x19, 0x12, 0x81, 0x72, 0xe6, 0x39, + 0xbd, 0xdf, 0x21, 0x6f, 0xa1, 0x7f, 0xd0, 0xc0, 0x4c, 0x7c, 0xc7, 0x85, 0xb7, 0xc0, 0xc4, 0x2e, + 0x8a, 0x22, 0xb1, 0xa4, 0x8e, 0xc4, 0x06, 0x8a, 0xe6, 0x90, 0xd9, 0xc2, 0x07, 0x00, 0xc4, 0x98, + 0xd1, 0xf4, 0xe7, 0x47, 0xc7, 0x90, 0xdb, 0x49, 0xff, 0x84, 0x23, 0x84, 0x20, 0x8b, 0x11, 0xf6, + 0xf8, 0x4d, 0x73, 0x46, 0xe7, 0xcf, 0x85, 0xff, 0x68, 0x60, 0x3e, 0x1d, 0x7a, 0x76, 0x50, 0xb7, + 0xf6, 0x4c, 0xc7, 0x35, 0x1c, 0x71, 0x51, 0x9e, 0xa9, 0xae, 0x3e, 0x3f, 0xcc, 0x4f, 0xd5, 0x58, + 0xdf, 0xe6, 0xfa, 0xcb, 0xc3, 0xfc, 0x19, 0x31, 0x1d, 0x91, 0x51, 0x41, 0x9f, 0xe2, 0x8f, 0x9b, + 0x36, 0xfc, 0x2e, 0x98, 0x97, 0x7f, 0x18, 0x19, 0x6e, 0x88, 0x1b, 0x48, 0xfc, 0x7d, 0x91, 0xad, + 0x2e, 0xbd, 0x3c, 0xcc, 0x2f, 0x0a, 0xaf, 0xf4, 0x78, 0x41, 0x3f, 0x2d, 0x3b, 0x3e, 0xe0, 0x6d, + 0xb8, 0x0c, 0xa6, 0x09, 0xfa, 0x38, 0xe4, 0x57, 0x99, 0x09, 0x1e, 0xc8, 0xb8, 0x1d, 0xeb, 0xcf, + 0xf6, 0xf5, 0x47, 0xb3, 0x79, 0xea, 0xf8, 0xb3, 0x59, 0xad, 0x7c, 0xfe, 0x7c, 0x55, 0x7b, 0xf6, + 0x7c, 0x55, 0xfb, 0xd7, 0xf3, 0x55, 0xed, 0x77, 0x2f, 0x56, 0x33, 0xcf, 0x5e, 0xac, 0x66, 0xfe, + 0xf1, 0x62, 0x35, 0xf3, 0xa3, 0x2b, 0x63, 0x97, 0x1c, 0xa1, 0x76, 0x63, 0x92, 0xff, 0x99, 0x79, + 0xe7, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0x70, 0x0f, 0xcc, 0x39, 0x1f, 0x00, 0x00, +} + +func (this *Supply) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Supply) + if !ok { + that2, ok := that.(Supply) + if ok { that1 = &that2 } else { return false @@ -1637,19 +2040,25 @@ func (this *Content_CommunityPoolSpend) Equal(that interface{}) bool { } else if this == nil { return false } - if !this.CommunityPoolSpend.Equal(that1.CommunityPoolSpend) { + if that1.Sum == nil { + if this.Sum != nil { + return false + } + } else if this.Sum == nil { + return false + } else if !this.Sum.Equal(that1.Sum) { return false } return true } -func (this *StdFee) Equal(that interface{}) bool { +func (this *Supply_Supply) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*StdFee) + that1, ok := that.(*Supply_Supply) if !ok { - that2, ok := that.(StdFee) + that2, ok := that.(Supply_Supply) if ok { that1 = &that2 } else { @@ -1661,508 +2070,924 @@ func (this *StdFee) Equal(that interface{}) bool { } else if this == nil { return false } - if len(this.Amount) != len(that1.Amount) { + if !this.Supply.Equal(that1.Supply) { return false } - for i := range this.Amount { - if !this.Amount[i].Equal(&that1.Amount[i]) { + return true +} +func (this *Evidence) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Evidence) + if !ok { + that2, ok := that.(Evidence) + if ok { + that1 = &that2 + } else { return false } } - if this.Gas != that1.Gas { + if that1 == nil { + return this == nil + } else if this == nil { return false } - return true -} -func (this *Account) GetAccount() github_com_cosmos_cosmos_sdk_x_auth_exported.Account { - if x := this.GetBaseAccount(); x != nil { - return x - } - if x := this.GetContinuousVestingAccount(); x != nil { - return x - } - if x := this.GetDelayedVestingAccount(); x != nil { - return x - } - if x := this.GetPeriodicVestingAccount(); x != nil { - return x - } - if x := this.GetModuleAccount(); x != nil { - return x + if that1.Sum == nil { + if this.Sum != nil { + return false + } + } else if this.Sum == nil { + return false + } else if !this.Sum.Equal(that1.Sum) { + return false } - return nil + return true } - -func (this *Account) SetAccount(value github_com_cosmos_cosmos_sdk_x_auth_exported.Account) error { - if value == nil { - this.Sum = nil - return nil - } - switch vt := value.(type) { - case *types.BaseAccount: - this.Sum = &Account_BaseAccount{vt} - return nil - case *types1.ContinuousVestingAccount: - this.Sum = &Account_ContinuousVestingAccount{vt} - return nil - case *types1.DelayedVestingAccount: - this.Sum = &Account_DelayedVestingAccount{vt} - return nil - case *types1.PeriodicVestingAccount: - this.Sum = &Account_PeriodicVestingAccount{vt} - return nil - case *types.ModuleAccount: - this.Sum = &Account_ModuleAccount{vt} - return nil +func (this *Evidence_Equivocation) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return fmt.Errorf("can't encode value of type %T as message Account", value) -} -func (this *Supply) GetSupplyI() github_com_cosmos_cosmos_sdk_x_bank_exported.SupplyI { - if x := this.GetSupply(); x != nil { - return x + that1, ok := that.(*Evidence_Equivocation) + if !ok { + that2, ok := that.(Evidence_Equivocation) + if ok { + that1 = &that2 + } else { + return false + } } - return nil -} - -func (this *Supply) SetSupplyI(value github_com_cosmos_cosmos_sdk_x_bank_exported.SupplyI) error { - if value == nil { - this.Sum = nil - return nil + if that1 == nil { + return this == nil + } else if this == nil { + return false } - switch vt := value.(type) { - case *types2.Supply: - this.Sum = &Supply_Supply{vt} - return nil + if !this.Equivocation.Equal(that1.Equivocation) { + return false } - return fmt.Errorf("can't encode value of type %T as message Supply", value) + return true } - -func (this *Evidence) GetEvidence() github_com_cosmos_cosmos_sdk_x_evidence_exported.Evidence { - if x := this.GetEquivocation(); x != nil { - return x +func (this *Evidence_ClientMisbehaviour) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return nil -} -func (this *Evidence) SetEvidence(value github_com_cosmos_cosmos_sdk_x_evidence_exported.Evidence) error { - if value == nil { - this.Sum = nil - return nil + that1, ok := that.(*Evidence_ClientMisbehaviour) + if !ok { + that2, ok := that.(Evidence_ClientMisbehaviour) + if ok { + that1 = &that2 + } else { + return false + } } - switch vt := value.(type) { - case *types3.Equivocation: - this.Sum = &Evidence_Equivocation{vt} - return nil - case types3.Equivocation: - this.Sum = &Evidence_Equivocation{&vt} - return nil + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return fmt.Errorf("can't encode value of type %T as message Evidence", value) + if !this.ClientMisbehaviour.Equal(that1.ClientMisbehaviour) { + return false + } + return true } - -func (this *Content) GetContent() github_com_cosmos_cosmos_sdk_x_gov_types.Content { - if x := this.GetText(); x != nil { - return x +func (this *MsgSubmitEvidence) Equal(that interface{}) bool { + if that == nil { + return this == nil } - if x := this.GetParameterChange(); x != nil { - return x + + that1, ok := that.(*MsgSubmitEvidence) + if !ok { + that2, ok := that.(MsgSubmitEvidence) + if ok { + that1 = &that2 + } else { + return false + } } - if x := this.GetSoftwareUpgrade(); x != nil { - return x + if that1 == nil { + return this == nil + } else if this == nil { + return false } - if x := this.GetCancelSoftwareUpgrade(); x != nil { - return x + if !this.MsgSubmitEvidenceBase.Equal(&that1.MsgSubmitEvidenceBase) { + return false } - if x := this.GetCommunityPoolSpend(); x != nil { - return x + if !this.Evidence.Equal(that1.Evidence) { + return false } - return nil + return true } - -func (this *Content) SetContent(value github_com_cosmos_cosmos_sdk_x_gov_types.Content) error { - if value == nil { - this.Sum = nil - return nil - } - switch vt := value.(type) { - case *types4.TextProposal: - this.Sum = &Content_Text{vt} - return nil - case *proposal.ParameterChangeProposal: - this.Sum = &Content_ParameterChange{vt} - return nil - case *types5.SoftwareUpgradeProposal: - this.Sum = &Content_SoftwareUpgrade{vt} - return nil - case *types5.CancelSoftwareUpgradeProposal: - this.Sum = &Content_CancelSoftwareUpgrade{vt} - return nil - case *types6.CommunityPoolSpendProposal: - this.Sum = &Content_CommunityPoolSpend{vt} - return nil +func (this *MsgSubmitProposal) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return fmt.Errorf("can't encode value of type %T as message Content", value) -} -func (this *Message) GetMsg() github_com_cosmos_cosmos_sdk_types.Msg { - if x := this.GetMsgSend(); x != nil { - return x + that1, ok := that.(*MsgSubmitProposal) + if !ok { + that2, ok := that.(MsgSubmitProposal) + if ok { + that1 = &that2 + } else { + return false + } } - if x := this.GetMsgMultiSend(); x != nil { - return x + if that1 == nil { + return this == nil + } else if this == nil { + return false } - if x := this.GetMsgVerifyInvariant(); x != nil { - return x + if !this.MsgSubmitProposalBase.Equal(&that1.MsgSubmitProposalBase) { + return false } - if x := this.GetMsgSetWithdrawAddress(); x != nil { - return x + if !this.Content.Equal(that1.Content) { + return false } - if x := this.GetMsgWithdrawDelegatorReward(); x != nil { - return x + return true +} +func (this *Proposal) Equal(that interface{}) bool { + if that == nil { + return this == nil } - if x := this.GetMsgWithdrawValidatorCommission(); x != nil { - return x + + that1, ok := that.(*Proposal) + if !ok { + that2, ok := that.(Proposal) + if ok { + that1 = &that2 + } else { + return false + } } - if x := this.GetMsgFundCommunityPool(); x != nil { - return x + if that1 == nil { + return this == nil + } else if this == nil { + return false } - if x := this.GetMsgSubmitEvidence(); x != nil { - return x + if !this.ProposalBase.Equal(&that1.ProposalBase) { + return false } - if x := this.GetMsgSubmitProposal(); x != nil { - return x + if !this.Content.Equal(&that1.Content) { + return false } - if x := this.GetMsgVote(); x != nil { - return x + return true +} +func (this *Content) Equal(that interface{}) bool { + if that == nil { + return this == nil } - if x := this.GetMsgDeposit(); x != nil { - return x + + that1, ok := that.(*Content) + if !ok { + that2, ok := that.(Content) + if ok { + that1 = &that2 + } else { + return false + } } - if x := this.GetMsgUnjail(); x != nil { - return x + if that1 == nil { + return this == nil + } else if this == nil { + return false } - if x := this.GetMsgCreateValidator(); x != nil { - return x + if that1.Sum == nil { + if this.Sum != nil { + return false + } + } else if this.Sum == nil { + return false + } else if !this.Sum.Equal(that1.Sum) { + return false } - if x := this.GetMsgEditValidator(); x != nil { + return true +} +func (this *Content_Text) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Content_Text) + if !ok { + that2, ok := that.(Content_Text) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Text.Equal(that1.Text) { + return false + } + return true +} +func (this *Content_ParameterChange) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Content_ParameterChange) + if !ok { + that2, ok := that.(Content_ParameterChange) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.ParameterChange.Equal(that1.ParameterChange) { + return false + } + return true +} +func (this *Content_SoftwareUpgrade) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Content_SoftwareUpgrade) + if !ok { + that2, ok := that.(Content_SoftwareUpgrade) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.SoftwareUpgrade.Equal(that1.SoftwareUpgrade) { + return false + } + return true +} +func (this *Content_CancelSoftwareUpgrade) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Content_CancelSoftwareUpgrade) + if !ok { + that2, ok := that.(Content_CancelSoftwareUpgrade) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.CancelSoftwareUpgrade.Equal(that1.CancelSoftwareUpgrade) { + return false + } + return true +} +func (this *Content_CommunityPoolSpend) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Content_CommunityPoolSpend) + if !ok { + that2, ok := that.(Content_CommunityPoolSpend) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.CommunityPoolSpend.Equal(that1.CommunityPoolSpend) { + return false + } + return true +} +func (this *StdFee) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*StdFee) + if !ok { + that2, ok := that.(StdFee) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Amount) != len(that1.Amount) { + return false + } + for i := range this.Amount { + if !this.Amount[i].Equal(&that1.Amount[i]) { + return false + } + } + if this.Gas != that1.Gas { + return false + } + return true +} +func (this *Account) GetAccount() github_com_cosmos_cosmos_sdk_x_auth_exported.Account { + if x := this.GetBaseAccount(); x != nil { return x } - if x := this.GetMsgDelegate(); x != nil { + if x := this.GetContinuousVestingAccount(); x != nil { return x } - if x := this.GetMsgBeginRedelegate(); x != nil { + if x := this.GetDelayedVestingAccount(); x != nil { return x } - if x := this.GetMsgUndelegate(); x != nil { + if x := this.GetPeriodicVestingAccount(); x != nil { + return x + } + if x := this.GetModuleAccount(); x != nil { return x } return nil } -func (this *Message) SetMsg(value github_com_cosmos_cosmos_sdk_types.Msg) error { +func (this *Account) SetAccount(value github_com_cosmos_cosmos_sdk_x_auth_exported.Account) error { if value == nil { this.Sum = nil return nil } switch vt := value.(type) { - case *types2.MsgSend: - this.Sum = &Message_MsgSend{vt} - return nil - case types2.MsgSend: - this.Sum = &Message_MsgSend{&vt} - return nil - case *types2.MsgMultiSend: - this.Sum = &Message_MsgMultiSend{vt} - return nil - case types2.MsgMultiSend: - this.Sum = &Message_MsgMultiSend{&vt} - return nil - case *types7.MsgVerifyInvariant: - this.Sum = &Message_MsgVerifyInvariant{vt} - return nil - case types7.MsgVerifyInvariant: - this.Sum = &Message_MsgVerifyInvariant{&vt} + case *types.BaseAccount: + this.Sum = &Account_BaseAccount{vt} return nil - case *types6.MsgSetWithdrawAddress: - this.Sum = &Message_MsgSetWithdrawAddress{vt} + case *types1.ContinuousVestingAccount: + this.Sum = &Account_ContinuousVestingAccount{vt} return nil - case types6.MsgSetWithdrawAddress: - this.Sum = &Message_MsgSetWithdrawAddress{&vt} + case *types1.DelayedVestingAccount: + this.Sum = &Account_DelayedVestingAccount{vt} return nil - case *types6.MsgWithdrawDelegatorReward: - this.Sum = &Message_MsgWithdrawDelegatorReward{vt} + case *types1.PeriodicVestingAccount: + this.Sum = &Account_PeriodicVestingAccount{vt} return nil - case types6.MsgWithdrawDelegatorReward: - this.Sum = &Message_MsgWithdrawDelegatorReward{&vt} + case *types.ModuleAccount: + this.Sum = &Account_ModuleAccount{vt} return nil - case *types6.MsgWithdrawValidatorCommission: - this.Sum = &Message_MsgWithdrawValidatorCommission{vt} + } + return fmt.Errorf("can't encode value of type %T as message Account", value) +} + +func (this *Supply) GetSupplyI() github_com_cosmos_cosmos_sdk_x_bank_exported.SupplyI { + if x := this.GetSupply(); x != nil { + return x + } + return nil +} + +func (this *Supply) SetSupplyI(value github_com_cosmos_cosmos_sdk_x_bank_exported.SupplyI) error { + if value == nil { + this.Sum = nil return nil - case types6.MsgWithdrawValidatorCommission: - this.Sum = &Message_MsgWithdrawValidatorCommission{&vt} + } + switch vt := value.(type) { + case *types2.Supply: + this.Sum = &Supply_Supply{vt} return nil - case *types6.MsgFundCommunityPool: - this.Sum = &Message_MsgFundCommunityPool{vt} + } + return fmt.Errorf("can't encode value of type %T as message Supply", value) +} + +func (this *Evidence) GetEvidence() github_com_cosmos_cosmos_sdk_x_evidence_exported.Evidence { + if x := this.GetEquivocation(); x != nil { + return x + } + if x := this.GetClientMisbehaviour(); x != nil { + return x + } + return nil +} + +func (this *Evidence) SetEvidence(value github_com_cosmos_cosmos_sdk_x_evidence_exported.Evidence) error { + if value == nil { + this.Sum = nil return nil - case types6.MsgFundCommunityPool: - this.Sum = &Message_MsgFundCommunityPool{&vt} + } + switch vt := value.(type) { + case *types3.Equivocation: + this.Sum = &Evidence_Equivocation{vt} return nil - case *MsgSubmitEvidence: - this.Sum = &Message_MsgSubmitEvidence{vt} + case types3.Equivocation: + this.Sum = &Evidence_Equivocation{&vt} return nil - case MsgSubmitEvidence: - this.Sum = &Message_MsgSubmitEvidence{&vt} + case *types4.Evidence: + this.Sum = &Evidence_ClientMisbehaviour{vt} return nil - case *MsgSubmitProposal: - this.Sum = &Message_MsgSubmitProposal{vt} + case types4.Evidence: + this.Sum = &Evidence_ClientMisbehaviour{&vt} return nil - case MsgSubmitProposal: - this.Sum = &Message_MsgSubmitProposal{&vt} - return nil - case *types4.MsgVote: - this.Sum = &Message_MsgVote{vt} - return nil - case types4.MsgVote: - this.Sum = &Message_MsgVote{&vt} - return nil - case *types4.MsgDeposit: - this.Sum = &Message_MsgDeposit{vt} - return nil - case types4.MsgDeposit: - this.Sum = &Message_MsgDeposit{&vt} - return nil - case *types8.MsgUnjail: - this.Sum = &Message_MsgUnjail{vt} - return nil - case types8.MsgUnjail: - this.Sum = &Message_MsgUnjail{&vt} - return nil - case *types9.MsgCreateValidator: - this.Sum = &Message_MsgCreateValidator{vt} - return nil - case types9.MsgCreateValidator: - this.Sum = &Message_MsgCreateValidator{&vt} - return nil - case *types9.MsgEditValidator: - this.Sum = &Message_MsgEditValidator{vt} - return nil - case types9.MsgEditValidator: - this.Sum = &Message_MsgEditValidator{&vt} - return nil - case *types9.MsgDelegate: - this.Sum = &Message_MsgDelegate{vt} + } + return fmt.Errorf("can't encode value of type %T as message Evidence", value) +} + +func (this *Content) GetContent() github_com_cosmos_cosmos_sdk_x_gov_types.Content { + if x := this.GetText(); x != nil { + return x + } + if x := this.GetParameterChange(); x != nil { + return x + } + if x := this.GetSoftwareUpgrade(); x != nil { + return x + } + if x := this.GetCancelSoftwareUpgrade(); x != nil { + return x + } + if x := this.GetCommunityPoolSpend(); x != nil { + return x + } + return nil +} + +func (this *Content) SetContent(value github_com_cosmos_cosmos_sdk_x_gov_types.Content) error { + if value == nil { + this.Sum = nil return nil - case types9.MsgDelegate: - this.Sum = &Message_MsgDelegate{&vt} + } + switch vt := value.(type) { + case *types5.TextProposal: + this.Sum = &Content_Text{vt} return nil - case *types9.MsgBeginRedelegate: - this.Sum = &Message_MsgBeginRedelegate{vt} + case *proposal.ParameterChangeProposal: + this.Sum = &Content_ParameterChange{vt} return nil - case types9.MsgBeginRedelegate: - this.Sum = &Message_MsgBeginRedelegate{&vt} + case *types6.SoftwareUpgradeProposal: + this.Sum = &Content_SoftwareUpgrade{vt} return nil - case *types9.MsgUndelegate: - this.Sum = &Message_MsgUndelegate{vt} + case *types6.CancelSoftwareUpgradeProposal: + this.Sum = &Content_CancelSoftwareUpgrade{vt} return nil - case types9.MsgUndelegate: - this.Sum = &Message_MsgUndelegate{&vt} + case *types7.CommunityPoolSpendProposal: + this.Sum = &Content_CommunityPoolSpend{vt} return nil } - return fmt.Errorf("can't encode value of type %T as message Message", value) + return fmt.Errorf("can't encode value of type %T as message Content", value) } -func (m *Account) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (this *ClientState) GetClientState() github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported.ClientState { + if x := this.GetTendermint(); x != nil { + return x } - return dAtA[:n], nil + return nil } -func (m *Account) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (this *ClientState) SetClientState(value github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported.ClientState) error { + if value == nil { + this.Sum = nil + return nil + } + switch vt := value.(type) { + case *types4.ClientState: + this.Sum = &ClientState_Tendermint{vt} + return nil + } + return fmt.Errorf("can't encode value of type %T as message ClientState", value) } -func (m *Account) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sum != nil { - { - size := m.Sum.Size() - i -= size - if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } +func (this *ConsensusState) GetConsensusState() github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported.ConsensusState { + if x := this.GetTendermint(); x != nil { + return x } - return len(dAtA) - i, nil + return nil } -func (m *Account_BaseAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (this *ConsensusState) SetConsensusState(value github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported.ConsensusState) error { + if value == nil { + this.Sum = nil + return nil + } + switch vt := value.(type) { + case *types4.ConsensusState: + this.Sum = &ConsensusState_Tendermint{vt} + return nil + } + return fmt.Errorf("can't encode value of type %T as message ConsensusState", value) } -func (m *Account_BaseAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.BaseAccount != nil { - { - size, err := m.BaseAccount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func (this *Misbehaviour) GetMisbehaviour() github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported.Misbehaviour { + if x := this.GetTendermint(); x != nil { + return x } - return len(dAtA) - i, nil -} -func (m *Account_ContinuousVestingAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return nil } -func (m *Account_ContinuousVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ContinuousVestingAccount != nil { - { - size, err := m.ContinuousVestingAccount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 +func (this *Misbehaviour) SetMisbehaviour(value github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported.Misbehaviour) error { + if value == nil { + this.Sum = nil + return nil } - return len(dAtA) - i, nil -} -func (m *Account_DelayedVestingAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + switch vt := value.(type) { + case *types4.Evidence: + this.Sum = &Misbehaviour_Tendermint{vt} + return nil + } + return fmt.Errorf("can't encode value of type %T as message Misbehaviour", value) } -func (m *Account_DelayedVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.DelayedVestingAccount != nil { - { - size, err := m.DelayedVestingAccount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a +func (this *Header) GetHeader() github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported.Header { + if x := this.GetTendermint(); x != nil { + return x } - return len(dAtA) - i, nil -} -func (m *Account_PeriodicVestingAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return nil } -func (m *Account_PeriodicVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.PeriodicVestingAccount != nil { - { - size, err := m.PeriodicVestingAccount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 +func (this *Header) SetHeader(value github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported.Header) error { + if value == nil { + this.Sum = nil + return nil } - return len(dAtA) - i, nil -} -func (m *Account_ModuleAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + switch vt := value.(type) { + case *types4.Header: + this.Sum = &Header_Tendermint{vt} + return nil + } + return fmt.Errorf("can't encode value of type %T as message Header", value) } -func (m *Account_ModuleAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ModuleAccount != nil { - { - size, err := m.ModuleAccount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a +func (this *MsgCreateClient) GetMsgCreateClient() github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported.MsgCreateClient { + if x := this.GetTendermint(); x != nil { + return x } - return len(dAtA) - i, nil + return nil } -func (m *Supply) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + +func (this *MsgCreateClient) SetMsgCreateClient(value github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported.MsgCreateClient) error { + if value == nil { + this.Sum = nil + return nil } - return dAtA[:n], nil + switch vt := value.(type) { + case *types4.MsgCreateClient: + this.Sum = &MsgCreateClient_Tendermint{vt} + return nil + } + return fmt.Errorf("can't encode value of type %T as message MsgCreateClient", value) } -func (m *Supply) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (this *MsgUpdateClient) GetMsgUpdateClient() github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported.MsgUpdateClient { + if x := this.GetTendermint(); x != nil { + return x + } + return nil } -func (m *Supply) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sum != nil { - { - size := m.Sum.Size() - i -= size - if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } +func (this *MsgUpdateClient) SetMsgUpdateClient(value github_com_cosmos_cosmos_sdk_x_ibc_02_client_exported.MsgUpdateClient) error { + if value == nil { + this.Sum = nil + return nil } - return len(dAtA) - i, nil + switch vt := value.(type) { + case *types4.MsgUpdateClient: + this.Sum = &MsgUpdateClient_Tendermint{vt} + return nil + } + return fmt.Errorf("can't encode value of type %T as message MsgUpdateClient", value) } -func (m *Supply_Supply) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (this *Message) GetMsg() github_com_cosmos_cosmos_sdk_types.Msg { + if x := this.GetMsgSend(); x != nil { + return x + } + if x := this.GetMsgMultiSend(); x != nil { + return x + } + if x := this.GetMsgVerifyInvariant(); x != nil { + return x + } + if x := this.GetMsgSetWithdrawAddress(); x != nil { + return x + } + if x := this.GetMsgWithdrawDelegatorReward(); x != nil { + return x + } + if x := this.GetMsgWithdrawValidatorCommission(); x != nil { + return x + } + if x := this.GetMsgFundCommunityPool(); x != nil { + return x + } + if x := this.GetMsgSubmitEvidence(); x != nil { + return x + } + if x := this.GetMsgSubmitProposal(); x != nil { + return x + } + if x := this.GetMsgVote(); x != nil { + return x + } + if x := this.GetMsgDeposit(); x != nil { + return x + } + if x := this.GetMsgUnjail(); x != nil { + return x + } + if x := this.GetMsgCreateValidator(); x != nil { + return x + } + if x := this.GetMsgEditValidator(); x != nil { + return x + } + if x := this.GetMsgDelegate(); x != nil { + return x + } + if x := this.GetMsgBeginRedelegate(); x != nil { + return x + } + if x := this.GetMsgUndelegate(); x != nil { + return x + } + if x := this.GetMsgConnectionOpenInit(); x != nil { + return x + } + if x := this.GetMsgConnectionOpenTry(); x != nil { + return x + } + if x := this.GetMsgConnectionOpenAck(); x != nil { + return x + } + if x := this.GetMsgConnectionOpenConfirm(); x != nil { + return x + } + if x := this.GetMsgChannelOpenInit(); x != nil { + return x + } + if x := this.GetMsgChannelOpenTry(); x != nil { + return x + } + if x := this.GetMsgChannelOpenAck(); x != nil { + return x + } + if x := this.GetMsgChannelOpenConfirm(); x != nil { + return x + } + if x := this.GetMsgChannelCloseInit(); x != nil { + return x + } + if x := this.GetMsgChannelCloseConfirm(); x != nil { + return x + } + if x := this.GetMsgPacket(); x != nil { + return x + } + if x := this.GetMsgAcknowledgement(); x != nil { + return x + } + if x := this.GetMsgCreateClientTendermint(); x != nil { + return x + } + if x := this.GetMsgUpdateClientTendermint(); x != nil { + return x + } + if x := this.GetMsgSubmitClientMisbehaviourTendermint(); x != nil { + return x + } + if x := this.GetMsgTransfer(); x != nil { + return x + } + return nil } -func (m *Supply_Supply) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Supply != nil { - { - size, err := m.Supply.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func (this *Message) SetMsg(value github_com_cosmos_cosmos_sdk_types.Msg) error { + if value == nil { + this.Sum = nil + return nil } - return len(dAtA) - i, nil + switch vt := value.(type) { + case *types2.MsgSend: + this.Sum = &Message_MsgSend{vt} + return nil + case types2.MsgSend: + this.Sum = &Message_MsgSend{&vt} + return nil + case *types2.MsgMultiSend: + this.Sum = &Message_MsgMultiSend{vt} + return nil + case types2.MsgMultiSend: + this.Sum = &Message_MsgMultiSend{&vt} + return nil + case *types8.MsgVerifyInvariant: + this.Sum = &Message_MsgVerifyInvariant{vt} + return nil + case types8.MsgVerifyInvariant: + this.Sum = &Message_MsgVerifyInvariant{&vt} + return nil + case *types7.MsgSetWithdrawAddress: + this.Sum = &Message_MsgSetWithdrawAddress{vt} + return nil + case types7.MsgSetWithdrawAddress: + this.Sum = &Message_MsgSetWithdrawAddress{&vt} + return nil + case *types7.MsgWithdrawDelegatorReward: + this.Sum = &Message_MsgWithdrawDelegatorReward{vt} + return nil + case types7.MsgWithdrawDelegatorReward: + this.Sum = &Message_MsgWithdrawDelegatorReward{&vt} + return nil + case *types7.MsgWithdrawValidatorCommission: + this.Sum = &Message_MsgWithdrawValidatorCommission{vt} + return nil + case types7.MsgWithdrawValidatorCommission: + this.Sum = &Message_MsgWithdrawValidatorCommission{&vt} + return nil + case *types7.MsgFundCommunityPool: + this.Sum = &Message_MsgFundCommunityPool{vt} + return nil + case types7.MsgFundCommunityPool: + this.Sum = &Message_MsgFundCommunityPool{&vt} + return nil + case *MsgSubmitEvidence: + this.Sum = &Message_MsgSubmitEvidence{vt} + return nil + case MsgSubmitEvidence: + this.Sum = &Message_MsgSubmitEvidence{&vt} + return nil + case *MsgSubmitProposal: + this.Sum = &Message_MsgSubmitProposal{vt} + return nil + case MsgSubmitProposal: + this.Sum = &Message_MsgSubmitProposal{&vt} + return nil + case *types5.MsgVote: + this.Sum = &Message_MsgVote{vt} + return nil + case types5.MsgVote: + this.Sum = &Message_MsgVote{&vt} + return nil + case *types5.MsgDeposit: + this.Sum = &Message_MsgDeposit{vt} + return nil + case types5.MsgDeposit: + this.Sum = &Message_MsgDeposit{&vt} + return nil + case *types9.MsgUnjail: + this.Sum = &Message_MsgUnjail{vt} + return nil + case types9.MsgUnjail: + this.Sum = &Message_MsgUnjail{&vt} + return nil + case *types10.MsgCreateValidator: + this.Sum = &Message_MsgCreateValidator{vt} + return nil + case types10.MsgCreateValidator: + this.Sum = &Message_MsgCreateValidator{&vt} + return nil + case *types10.MsgEditValidator: + this.Sum = &Message_MsgEditValidator{vt} + return nil + case types10.MsgEditValidator: + this.Sum = &Message_MsgEditValidator{&vt} + return nil + case *types10.MsgDelegate: + this.Sum = &Message_MsgDelegate{vt} + return nil + case types10.MsgDelegate: + this.Sum = &Message_MsgDelegate{&vt} + return nil + case *types10.MsgBeginRedelegate: + this.Sum = &Message_MsgBeginRedelegate{vt} + return nil + case types10.MsgBeginRedelegate: + this.Sum = &Message_MsgBeginRedelegate{&vt} + return nil + case *types10.MsgUndelegate: + this.Sum = &Message_MsgUndelegate{vt} + return nil + case types10.MsgUndelegate: + this.Sum = &Message_MsgUndelegate{&vt} + return nil + case *types11.MsgConnectionOpenInit: + this.Sum = &Message_MsgConnectionOpenInit{vt} + return nil + case types11.MsgConnectionOpenInit: + this.Sum = &Message_MsgConnectionOpenInit{&vt} + return nil + case *types11.MsgConnectionOpenTry: + this.Sum = &Message_MsgConnectionOpenTry{vt} + return nil + case types11.MsgConnectionOpenTry: + this.Sum = &Message_MsgConnectionOpenTry{&vt} + return nil + case *types11.MsgConnectionOpenAck: + this.Sum = &Message_MsgConnectionOpenAck{vt} + return nil + case types11.MsgConnectionOpenAck: + this.Sum = &Message_MsgConnectionOpenAck{&vt} + return nil + case *types11.MsgConnectionOpenConfirm: + this.Sum = &Message_MsgConnectionOpenConfirm{vt} + return nil + case types11.MsgConnectionOpenConfirm: + this.Sum = &Message_MsgConnectionOpenConfirm{&vt} + return nil + case *types12.MsgChannelOpenInit: + this.Sum = &Message_MsgChannelOpenInit{vt} + return nil + case types12.MsgChannelOpenInit: + this.Sum = &Message_MsgChannelOpenInit{&vt} + return nil + case *types12.MsgChannelOpenTry: + this.Sum = &Message_MsgChannelOpenTry{vt} + return nil + case types12.MsgChannelOpenTry: + this.Sum = &Message_MsgChannelOpenTry{&vt} + return nil + case *types12.MsgChannelOpenAck: + this.Sum = &Message_MsgChannelOpenAck{vt} + return nil + case types12.MsgChannelOpenAck: + this.Sum = &Message_MsgChannelOpenAck{&vt} + return nil + case *types12.MsgChannelOpenConfirm: + this.Sum = &Message_MsgChannelOpenConfirm{vt} + return nil + case types12.MsgChannelOpenConfirm: + this.Sum = &Message_MsgChannelOpenConfirm{&vt} + return nil + case *types12.MsgChannelCloseInit: + this.Sum = &Message_MsgChannelCloseInit{vt} + return nil + case types12.MsgChannelCloseInit: + this.Sum = &Message_MsgChannelCloseInit{&vt} + return nil + case *types12.MsgChannelCloseConfirm: + this.Sum = &Message_MsgChannelCloseConfirm{vt} + return nil + case types12.MsgChannelCloseConfirm: + this.Sum = &Message_MsgChannelCloseConfirm{&vt} + return nil + case *types12.MsgPacket: + this.Sum = &Message_MsgPacket{vt} + return nil + case types12.MsgPacket: + this.Sum = &Message_MsgPacket{&vt} + return nil + case *types12.MsgAcknowledgement: + this.Sum = &Message_MsgAcknowledgement{vt} + return nil + case types12.MsgAcknowledgement: + this.Sum = &Message_MsgAcknowledgement{&vt} + return nil + case *types4.MsgCreateClient: + this.Sum = &Message_MsgCreateClientTendermint{vt} + return nil + case types4.MsgCreateClient: + this.Sum = &Message_MsgCreateClientTendermint{&vt} + return nil + case *types4.MsgUpdateClient: + this.Sum = &Message_MsgUpdateClientTendermint{vt} + return nil + case types4.MsgUpdateClient: + this.Sum = &Message_MsgUpdateClientTendermint{&vt} + return nil + case *types4.MsgSubmitClientMisbehaviour: + this.Sum = &Message_MsgSubmitClientMisbehaviourTendermint{vt} + return nil + case types4.MsgSubmitClientMisbehaviour: + this.Sum = &Message_MsgSubmitClientMisbehaviourTendermint{&vt} + return nil + case *types13.MsgTransfer: + this.Sum = &Message_MsgTransfer{vt} + return nil + case types13.MsgTransfer: + this.Sum = &Message_MsgTransfer{&vt} + return nil + } + return fmt.Errorf("can't encode value of type %T as message Message", value) } -func (m *Evidence) Marshal() (dAtA []byte, err error) { + +func (m *Account) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2172,12 +2997,12 @@ func (m *Evidence) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Evidence) MarshalTo(dAtA []byte) (int, error) { +func (m *Account) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Evidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Account) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2194,16 +3019,16 @@ func (m *Evidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Evidence_Equivocation) MarshalTo(dAtA []byte) (int, error) { +func (m *Account_BaseAccount) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Evidence_Equivocation) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Account_BaseAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.Equivocation != nil { + if m.BaseAccount != nil { { - size, err := m.Equivocation.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.BaseAccount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2215,29 +3040,16 @@ func (m *Evidence_Equivocation) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } -func (m *MsgSubmitEvidence) 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 *MsgSubmitEvidence) MarshalTo(dAtA []byte) (int, error) { +func (m *Account_ContinuousVestingAccount) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSubmitEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Account_ContinuousVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - _ = i - var l int - _ = l - if m.Evidence != nil { + if m.ContinuousVestingAccount != nil { { - size, err := m.Evidence.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ContinuousVestingAccount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2247,12 +3059,236 @@ func (m *MsgSubmitEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - { - size, err := m.MsgSubmitEvidenceBase.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size + return len(dAtA) - i, nil +} +func (m *Account_DelayedVestingAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Account_DelayedVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.DelayedVestingAccount != nil { + { + size, err := m.DelayedVestingAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *Account_PeriodicVestingAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Account_PeriodicVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.PeriodicVestingAccount != nil { + { + size, err := m.PeriodicVestingAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + return len(dAtA) - i, nil +} +func (m *Account_ModuleAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Account_ModuleAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.ModuleAccount != nil { + { + size, err := m.ModuleAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + return len(dAtA) - i, nil +} +func (m *Supply) 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 *Supply) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Supply) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Sum != nil { + { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *Supply_Supply) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Supply_Supply) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Supply != nil { + { + size, err := m.Supply.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *Evidence) 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 *Evidence) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Evidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Sum != nil { + { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *Evidence_Equivocation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Evidence_Equivocation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Equivocation != nil { + { + size, err := m.Equivocation.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *Evidence_ClientMisbehaviour) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Evidence_ClientMisbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.ClientMisbehaviour != nil { + { + size, err := m.ClientMisbehaviour.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *MsgSubmitEvidence) 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 *MsgSubmitEvidence) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Evidence != nil { + { + size, err := m.Evidence.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.MsgSubmitEvidenceBase.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size i = encodeVarintCodec(dAtA, i, uint64(size)) } i-- @@ -2485,7 +3521,7 @@ func (m *Content_CommunityPoolSpend) MarshalToSizedBuffer(dAtA []byte) (int, err } return len(dAtA) - i, nil } -func (m *Transaction) Marshal() (dAtA []byte, err error) { +func (m *ClientState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2495,44 +3531,50 @@ func (m *Transaction) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Transaction) MarshalTo(dAtA []byte) (int, error) { +func (m *ClientState) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Msgs) > 0 { - for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) + if m.Sum != nil { + { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { + return 0, err } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.StdTxBase.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *Message) Marshal() (dAtA []byte, err error) { +func (m *ClientState_Tendermint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClientState_Tendermint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Tendermint != nil { + { + size, err := m.Tendermint.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *ConsensusState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2542,12 +3584,12 @@ func (m *Message) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Message) MarshalTo(dAtA []byte) (int, error) { +func (m *ConsensusState) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2564,16 +3606,16 @@ func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Message_MsgSend) MarshalTo(dAtA []byte) (int, error) { +func (m *ConsensusState_Tendermint) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ConsensusState_Tendermint) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgSend != nil { + if m.Tendermint != nil { { - size, err := m.MsgSend.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Tendermint.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2585,37 +3627,48 @@ func (m *Message_MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } -func (m *Message_MsgMultiSend) MarshalTo(dAtA []byte) (int, error) { +func (m *Misbehaviour) 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 *Misbehaviour) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgMultiSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Misbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgMultiSend != nil { + _ = i + var l int + _ = l + if m.Sum != nil { { - size, err := m.MsgMultiSend.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x12 } return len(dAtA) - i, nil } -func (m *Message_MsgVerifyInvariant) MarshalTo(dAtA []byte) (int, error) { + +func (m *Misbehaviour_Tendermint) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgVerifyInvariant) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Misbehaviour_Tendermint) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgVerifyInvariant != nil { + if m.Tendermint != nil { { - size, err := m.MsgVerifyInvariant.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Tendermint.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2623,41 +3676,52 @@ func (m *Message_MsgVerifyInvariant) MarshalToSizedBuffer(dAtA []byte) (int, err i = encodeVarintCodec(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *Message_MsgSetWithdrawAddress) MarshalTo(dAtA []byte) (int, error) { +func (m *Header) 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 *Header) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgSetWithdrawAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgSetWithdrawAddress != nil { + _ = i + var l int + _ = l + if m.Sum != nil { { - size, err := m.MsgSetWithdrawAddress.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x22 } return len(dAtA) - i, nil } -func (m *Message_MsgWithdrawDelegatorReward) MarshalTo(dAtA []byte) (int, error) { + +func (m *Header_Tendermint) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgWithdrawDelegatorReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Header_Tendermint) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgWithdrawDelegatorReward != nil { + if m.Tendermint != nil { { - size, err := m.MsgWithdrawDelegatorReward.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Tendermint.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2665,41 +3729,52 @@ func (m *Message_MsgWithdrawDelegatorReward) MarshalToSizedBuffer(dAtA []byte) ( i = encodeVarintCodec(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *Message_MsgWithdrawValidatorCommission) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCreateClient) 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 *MsgCreateClient) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgWithdrawValidatorCommission) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreateClient) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgWithdrawValidatorCommission != nil { + _ = i + var l int + _ = l + if m.Sum != nil { { - size, err := m.MsgWithdrawValidatorCommission.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x32 } return len(dAtA) - i, nil } -func (m *Message_MsgFundCommunityPool) MarshalTo(dAtA []byte) (int, error) { + +func (m *MsgCreateClient_Tendermint) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreateClient_Tendermint) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgFundCommunityPool != nil { + if m.Tendermint != nil { { - size, err := m.MsgFundCommunityPool.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Tendermint.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2707,41 +3782,52 @@ func (m *Message_MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, e i = encodeVarintCodec(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x3a + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *Message_MsgSubmitEvidence) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateClient) 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 *MsgUpdateClient) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgSubmitEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateClient) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgSubmitEvidence != nil { + _ = i + var l int + _ = l + if m.Sum != nil { { - size, err := m.MsgSubmitEvidence.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x42 } return len(dAtA) - i, nil } -func (m *Message_MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { + +func (m *MsgUpdateClient_Tendermint) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateClient_Tendermint) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgSubmitProposal != nil { + if m.Tendermint != nil { { - size, err := m.MsgSubmitProposal.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Tendermint.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2749,62 +3835,99 @@ func (m *Message_MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, erro i = encodeVarintCodec(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x4a + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *Message_MsgVote) MarshalTo(dAtA []byte) (int, error) { +func (m *Transaction) 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 *Transaction) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgVote != nil { - { - size, err := m.MsgVote.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + _ = i + var l int + _ = l + if len(m.Msgs) > 0 { + for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x52 } + { + size, err := m.StdTxBase.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *Message_MsgDeposit) MarshalTo(dAtA []byte) (int, error) { + +func (m *Message) 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 *Message) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgDeposit != nil { + _ = i + var l int + _ = l + if m.Sum != nil { { - size, err := m.MsgDeposit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x5a } return len(dAtA) - i, nil } -func (m *Message_MsgUnjail) MarshalTo(dAtA []byte) (int, error) { + +func (m *Message_MsgSend) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgUnjail) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgUnjail != nil { + if m.MsgSend != nil { { - size, err := m.MsgUnjail.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.MsgSend.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2812,20 +3935,20 @@ func (m *Message_MsgUnjail) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintCodec(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x62 + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *Message_MsgCreateValidator) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgMultiSend) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgCreateValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgMultiSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgCreateValidator != nil { + if m.MsgMultiSend != nil { { - size, err := m.MsgCreateValidator.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.MsgMultiSend.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2833,20 +3956,20 @@ func (m *Message_MsgCreateValidator) MarshalToSizedBuffer(dAtA []byte) (int, err i = encodeVarintCodec(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x6a + dAtA[i] = 0x12 } return len(dAtA) - i, nil } -func (m *Message_MsgEditValidator) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgVerifyInvariant) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgEditValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgVerifyInvariant) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgEditValidator != nil { + if m.MsgVerifyInvariant != nil { { - size, err := m.MsgEditValidator.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.MsgVerifyInvariant.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2854,20 +3977,20 @@ func (m *Message_MsgEditValidator) MarshalToSizedBuffer(dAtA []byte) (int, error i = encodeVarintCodec(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x72 + dAtA[i] = 0x1a } return len(dAtA) - i, nil } -func (m *Message_MsgDelegate) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgSetWithdrawAddress) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgDelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgSetWithdrawAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgDelegate != nil { + if m.MsgSetWithdrawAddress != nil { { - size, err := m.MsgDelegate.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.MsgSetWithdrawAddress.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2875,20 +3998,20 @@ func (m *Message_MsgDelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintCodec(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x7a + dAtA[i] = 0x22 } return len(dAtA) - i, nil } -func (m *Message_MsgBeginRedelegate) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgWithdrawDelegatorReward) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgBeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgWithdrawDelegatorReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgBeginRedelegate != nil { + if m.MsgWithdrawDelegatorReward != nil { { - size, err := m.MsgBeginRedelegate.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.MsgWithdrawDelegatorReward.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2896,22 +4019,20 @@ func (m *Message_MsgBeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, err i = encodeVarintCodec(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 + dAtA[i] = 0x2a } return len(dAtA) - i, nil } -func (m *Message_MsgUndelegate) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgWithdrawValidatorCommission) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgUndelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgWithdrawValidatorCommission) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.MsgUndelegate != nil { + if m.MsgWithdrawValidatorCommission != nil { { - size, err := m.MsgUndelegate.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.MsgWithdrawValidatorCommission.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2919,833 +4040,2812 @@ func (m *Message_MsgUndelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintCodec(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x8a + dAtA[i] = 0x32 } return len(dAtA) - i, nil } -func (m *SignDoc) 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 *SignDoc) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgFundCommunityPool) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *SignDoc) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Msgs) > 0 { - for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) + if m.MsgFundCommunityPool != nil { + { + size, err := m.MsgFundCommunityPool.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.StdSignDocBase.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x3a } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } - -func (m *StdFee) 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 *StdFee) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgSubmitEvidence) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *StdFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgSubmitEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - _ = i - var l int - _ = l - if m.Gas != 0 { - i = encodeVarintCodec(dAtA, i, uint64(m.Gas)) - i-- - dAtA[i] = 0x10 - } - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) + if m.MsgSubmitEvidence != nil { + { + size, err := m.MsgSubmitEvidence.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x42 } return len(dAtA) - i, nil } - -func (m *StdSignature) 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 *StdSignature) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *StdSignature) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintCodec(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x12 - } - if len(m.PubKey) > 0 { - i -= len(m.PubKey) - copy(dAtA[i:], m.PubKey) - i = encodeVarintCodec(dAtA, i, uint64(len(m.PubKey))) + if m.MsgSubmitProposal != nil { + { + size, err := m.MsgSubmitProposal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0xa + dAtA[i] = 0x4a } return len(dAtA) - i, nil } - -func (m *StdTxBase) 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 *StdTxBase) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgVote) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *StdTxBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Memo) > 0 { - i -= len(m.Memo) - copy(dAtA[i:], m.Memo) - i = encodeVarintCodec(dAtA, i, uint64(len(m.Memo))) - i-- - dAtA[i] = 0x1a - } - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) + if m.MsgVote != nil { + { + size, err := m.MsgVote.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x52 } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } - -func (m *StdSignDocBase) Marshal() (dAtA []byte, err error) { +func (m *Message_MsgDeposit) MarshalTo(dAtA []byte) (int, error) { size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *StdSignDocBase) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgDeposit != nil { + { + size, err := m.MsgDeposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + return len(dAtA) - i, nil +} +func (m *Message_MsgUnjail) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *StdSignDocBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgUnjail) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.MsgUnjail != nil { + { + size, err := m.MsgUnjail.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if len(m.Memo) > 0 { - i -= len(m.Memo) - copy(dAtA[i:], m.Memo) - i = encodeVarintCodec(dAtA, i, uint64(len(m.Memo))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x62 } - if m.Sequence != 0 { - i = encodeVarintCodec(dAtA, i, uint64(m.Sequence)) + return len(dAtA) - i, nil +} +func (m *Message_MsgCreateValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgCreateValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgCreateValidator != nil { + { + size, err := m.MsgCreateValidator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x18 + dAtA[i] = 0x6a } - if m.AccountNumber != 0 { - i = encodeVarintCodec(dAtA, i, uint64(m.AccountNumber)) + return len(dAtA) - i, nil +} +func (m *Message_MsgEditValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgEditValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgEditValidator != nil { + { + size, err := m.MsgEditValidator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x10 + dAtA[i] = 0x72 } - if len(m.ChainID) > 0 { - i -= len(m.ChainID) - copy(dAtA[i:], m.ChainID) - i = encodeVarintCodec(dAtA, i, uint64(len(m.ChainID))) + return len(dAtA) - i, nil +} +func (m *Message_MsgDelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgDelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgDelegate != nil { + { + size, err := m.MsgDelegate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0xa + dAtA[i] = 0x7a } return len(dAtA) - i, nil } +func (m *Message_MsgBeginRedelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} -func encodeVarintCodec(dAtA []byte, offset int, v uint64) int { - offset -= sovCodec(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *Message_MsgBeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgBeginRedelegate != nil { + { + size, err := m.MsgBeginRedelegate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 } - dAtA[offset] = uint8(v) - return base + return len(dAtA) - i, nil } -func (m *Account) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Sum != nil { - n += m.Sum.Size() - } - return n +func (m *Message_MsgUndelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Account_BaseAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BaseAccount != nil { - l = m.BaseAccount.Size() - n += 1 + l + sovCodec(uint64(l)) +func (m *Message_MsgUndelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgUndelegate != nil { + { + size, err := m.MsgUndelegate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a } - return n + return len(dAtA) - i, nil } -func (m *Account_ContinuousVestingAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ContinuousVestingAccount != nil { - l = m.ContinuousVestingAccount.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n +func (m *Message_MsgConnectionOpenInit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Account_DelayedVestingAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.DelayedVestingAccount != nil { - l = m.DelayedVestingAccount.Size() - n += 1 + l + sovCodec(uint64(l)) + +func (m *Message_MsgConnectionOpenInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgConnectionOpenInit != nil { + { + size, err := m.MsgConnectionOpenInit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 } - return n + return len(dAtA) - i, nil } -func (m *Account_PeriodicVestingAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PeriodicVestingAccount != nil { - l = m.PeriodicVestingAccount.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n +func (m *Message_MsgConnectionOpenTry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Account_ModuleAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ModuleAccount != nil { - l = m.ModuleAccount.Size() - n += 1 + l + sovCodec(uint64(l)) + +func (m *Message_MsgConnectionOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgConnectionOpenTry != nil { + { + size, err := m.MsgConnectionOpenTry.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a } - return n + return len(dAtA) - i, nil } -func (m *Supply) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Sum != nil { - n += m.Sum.Size() - } - return n +func (m *Message_MsgConnectionOpenAck) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Supply_Supply) Size() (n int) { - if m == nil { - return 0 +func (m *Message_MsgConnectionOpenAck) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgConnectionOpenAck != nil { + { + size, err := m.MsgConnectionOpenAck.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa2 } - var l int - _ = l - if m.Supply != nil { - l = m.Supply.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n + return len(dAtA) - i, nil } -func (m *Evidence) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Sum != nil { - n += m.Sum.Size() - } - return n +func (m *Message_MsgConnectionOpenConfirm) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Evidence_Equivocation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Equivocation != nil { - l = m.Equivocation.Size() - n += 1 + l + sovCodec(uint64(l)) +func (m *Message_MsgConnectionOpenConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgConnectionOpenConfirm != nil { + { + size, err := m.MsgConnectionOpenConfirm.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xaa } - return n + return len(dAtA) - i, nil } -func (m *MsgSubmitEvidence) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.MsgSubmitEvidenceBase.Size() - n += 1 + l + sovCodec(uint64(l)) - if m.Evidence != nil { - l = m.Evidence.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n +func (m *Message_MsgChannelOpenInit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSubmitProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.MsgSubmitProposalBase.Size() - n += 1 + l + sovCodec(uint64(l)) - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovCodec(uint64(l)) +func (m *Message_MsgChannelOpenInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgChannelOpenInit != nil { + { + size, err := m.MsgChannelOpenInit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb2 } - return n + return len(dAtA) - i, nil } - -func (m *Proposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ProposalBase.Size() - n += 1 + l + sovCodec(uint64(l)) - l = m.Content.Size() - n += 1 + l + sovCodec(uint64(l)) - return n +func (m *Message_MsgChannelOpenTry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Content) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Sum != nil { - n += m.Sum.Size() +func (m *Message_MsgChannelOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgChannelOpenTry != nil { + { + size, err := m.MsgChannelOpenTry.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xba } - return n + return len(dAtA) - i, nil } - -func (m *Content_Text) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Text != nil { - l = m.Text.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n +func (m *Message_MsgChannelOpenAck) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Content_ParameterChange) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ParameterChange != nil { - l = m.ParameterChange.Size() - n += 1 + l + sovCodec(uint64(l)) + +func (m *Message_MsgChannelOpenAck) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgChannelOpenAck != nil { + { + size, err := m.MsgChannelOpenAck.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xc2 } - return n + return len(dAtA) - i, nil } -func (m *Content_SoftwareUpgrade) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SoftwareUpgrade != nil { - l = m.SoftwareUpgrade.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n +func (m *Message_MsgChannelOpenConfirm) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Content_CancelSoftwareUpgrade) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CancelSoftwareUpgrade != nil { - l = m.CancelSoftwareUpgrade.Size() - n += 1 + l + sovCodec(uint64(l)) + +func (m *Message_MsgChannelOpenConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgChannelOpenConfirm != nil { + { + size, err := m.MsgChannelOpenConfirm.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xca } - return n + return len(dAtA) - i, nil } -func (m *Content_CommunityPoolSpend) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CommunityPoolSpend != nil { - l = m.CommunityPoolSpend.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n +func (m *Message_MsgChannelCloseInit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Transaction) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.StdTxBase.Size() - n += 1 + l + sovCodec(uint64(l)) - if len(m.Msgs) > 0 { - for _, e := range m.Msgs { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) + +func (m *Message_MsgChannelCloseInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgChannelCloseInit != nil { + { + size, err := m.MsgChannelCloseInit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xd2 } - return n + return len(dAtA) - i, nil +} +func (m *Message_MsgChannelCloseConfirm) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Sum != nil { - n += m.Sum.Size() +func (m *Message_MsgChannelCloseConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgChannelCloseConfirm != nil { + { + size, err := m.MsgChannelCloseConfirm.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xda } - return n + return len(dAtA) - i, nil +} +func (m *Message_MsgPacket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgSend) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgSend != nil { - l = m.MsgSend.Size() - n += 1 + l + sovCodec(uint64(l)) +func (m *Message_MsgPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgPacket != nil { + { + size, err := m.MsgPacket.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xe2 } - return n + return len(dAtA) - i, nil } -func (m *Message_MsgMultiSend) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgMultiSend != nil { - l = m.MsgMultiSend.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n +func (m *Message_MsgAcknowledgement) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgVerifyInvariant) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgVerifyInvariant != nil { - l = m.MsgVerifyInvariant.Size() - n += 1 + l + sovCodec(uint64(l)) + +func (m *Message_MsgAcknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgAcknowledgement != nil { + { + size, err := m.MsgAcknowledgement.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xea } - return n + return len(dAtA) - i, nil } -func (m *Message_MsgSetWithdrawAddress) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgSetWithdrawAddress != nil { - l = m.MsgSetWithdrawAddress.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n +func (m *Message_MsgCreateClientTendermint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgWithdrawDelegatorReward) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgWithdrawDelegatorReward != nil { - l = m.MsgWithdrawDelegatorReward.Size() - n += 1 + l + sovCodec(uint64(l)) + +func (m *Message_MsgCreateClientTendermint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgCreateClientTendermint != nil { + { + size, err := m.MsgCreateClientTendermint.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xf2 } - return n + return len(dAtA) - i, nil } -func (m *Message_MsgWithdrawValidatorCommission) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgWithdrawValidatorCommission != nil { - l = m.MsgWithdrawValidatorCommission.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n +func (m *Message_MsgUpdateClientTendermint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgFundCommunityPool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgFundCommunityPool != nil { - l = m.MsgFundCommunityPool.Size() - n += 1 + l + sovCodec(uint64(l)) + +func (m *Message_MsgUpdateClientTendermint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgUpdateClientTendermint != nil { + { + size, err := m.MsgUpdateClientTendermint.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xfa } - return n + return len(dAtA) - i, nil } -func (m *Message_MsgSubmitEvidence) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgSubmitEvidence != nil { - l = m.MsgSubmitEvidence.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n +func (m *Message_MsgSubmitClientMisbehaviourTendermint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Message_MsgSubmitProposal) Size() (n int) { - if m == nil { - return 0 + +func (m *Message_MsgSubmitClientMisbehaviourTendermint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgSubmitClientMisbehaviourTendermint != nil { + { + size, err := m.MsgSubmitClientMisbehaviourTendermint.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2 + i-- + dAtA[i] = 0x82 } - var l int - _ = l - if m.MsgSubmitProposal != nil { - l = m.MsgSubmitProposal.Size() - n += 1 + l + sovCodec(uint64(l)) + return len(dAtA) - i, nil +} +func (m *Message_MsgTransfer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgTransfer != nil { + { + size, err := m.MsgTransfer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2 + i-- + dAtA[i] = 0x8a } - return n + return len(dAtA) - i, nil } -func (m *Message_MsgVote) Size() (n int) { - if m == nil { - return 0 +func (m *SignDoc) 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 *SignDoc) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SignDoc) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.MsgVote != nil { - l = m.MsgVote.Size() - n += 1 + l + sovCodec(uint64(l)) + if len(m.Msgs) > 0 { + for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } } - return n + { + size, err := m.StdSignDocBase.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *Message_MsgDeposit) Size() (n int) { - if m == nil { - return 0 + +func (m *StdFee) 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 *StdFee) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StdFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.MsgDeposit != nil { - l = m.MsgDeposit.Size() - n += 1 + l + sovCodec(uint64(l)) + if m.Gas != 0 { + i = encodeVarintCodec(dAtA, i, uint64(m.Gas)) + i-- + dAtA[i] = 0x10 } - return n + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } -func (m *Message_MsgUnjail) Size() (n int) { + +func (m *StdSignature) 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 *StdSignature) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StdSignature) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintCodec(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.PubKey) > 0 { + i -= len(m.PubKey) + copy(dAtA[i:], m.PubKey) + i = encodeVarintCodec(dAtA, i, uint64(len(m.PubKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StdTxBase) 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 *StdTxBase) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StdTxBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Memo) > 0 { + i -= len(m.Memo) + copy(dAtA[i:], m.Memo) + i = encodeVarintCodec(dAtA, i, uint64(len(m.Memo))) + i-- + dAtA[i] = 0x1a + } + if len(m.Signatures) > 0 { + for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StdSignDocBase) 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 *StdSignDocBase) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StdSignDocBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.Memo) > 0 { + i -= len(m.Memo) + copy(dAtA[i:], m.Memo) + i = encodeVarintCodec(dAtA, i, uint64(len(m.Memo))) + i-- + dAtA[i] = 0x22 + } + if m.Sequence != 0 { + i = encodeVarintCodec(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x18 + } + if m.AccountNumber != 0 { + i = encodeVarintCodec(dAtA, i, uint64(m.AccountNumber)) + i-- + dAtA[i] = 0x10 + } + if len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintCodec(dAtA, i, uint64(len(m.ChainID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintCodec(dAtA []byte, offset int, v uint64) int { + offset -= sovCodec(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Account) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MsgUnjail != nil { - l = m.MsgUnjail.Size() - n += 1 + l + sovCodec(uint64(l)) + if m.Sum != nil { + n += m.Sum.Size() } return n } -func (m *Message_MsgCreateValidator) Size() (n int) { + +func (m *Account_BaseAccount) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MsgCreateValidator != nil { - l = m.MsgCreateValidator.Size() + if m.BaseAccount != nil { + l = m.BaseAccount.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Message_MsgEditValidator) Size() (n int) { +func (m *Account_ContinuousVestingAccount) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MsgEditValidator != nil { - l = m.MsgEditValidator.Size() + if m.ContinuousVestingAccount != nil { + l = m.ContinuousVestingAccount.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Message_MsgDelegate) Size() (n int) { +func (m *Account_DelayedVestingAccount) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MsgDelegate != nil { - l = m.MsgDelegate.Size() + if m.DelayedVestingAccount != nil { + l = m.DelayedVestingAccount.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Message_MsgBeginRedelegate) Size() (n int) { +func (m *Account_PeriodicVestingAccount) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MsgBeginRedelegate != nil { - l = m.MsgBeginRedelegate.Size() - n += 2 + l + sovCodec(uint64(l)) + if m.PeriodicVestingAccount != nil { + l = m.PeriodicVestingAccount.Size() + n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Message_MsgUndelegate) Size() (n int) { +func (m *Account_ModuleAccount) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MsgUndelegate != nil { - l = m.MsgUndelegate.Size() - n += 2 + l + sovCodec(uint64(l)) + if m.ModuleAccount != nil { + l = m.ModuleAccount.Size() + n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *SignDoc) Size() (n int) { +func (m *Supply) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.StdSignDocBase.Size() - n += 1 + l + sovCodec(uint64(l)) - if len(m.Msgs) > 0 { - for _, e := range m.Msgs { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) - } + if m.Sum != nil { + n += m.Sum.Size() } return n } -func (m *StdFee) Size() (n int) { +func (m *Supply_Supply) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) - } - } - if m.Gas != 0 { - n += 1 + sovCodec(uint64(m.Gas)) + if m.Supply != nil { + l = m.Supply.Size() + n += 1 + l + sovCodec(uint64(l)) } return n } - -func (m *StdSignature) Size() (n int) { +func (m *Evidence) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.PubKey) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) + if m.Sum != nil { + n += m.Sum.Size() } return n } -func (m *StdTxBase) Size() (n int) { +func (m *Evidence_Equivocation) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.Fee.Size() + if m.Equivocation != nil { + l = m.Equivocation.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Evidence_ClientMisbehaviour) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ClientMisbehaviour != nil { + l = m.ClientMisbehaviour.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *MsgSubmitEvidence) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MsgSubmitEvidenceBase.Size() n += 1 + l + sovCodec(uint64(l)) - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) + if m.Evidence != nil { + l = m.Evidence.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} + +func (m *MsgSubmitProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MsgSubmitProposalBase.Size() + n += 1 + l + sovCodec(uint64(l)) + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} + +func (m *Proposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ProposalBase.Size() + n += 1 + l + sovCodec(uint64(l)) + l = m.Content.Size() + n += 1 + l + sovCodec(uint64(l)) + return n +} + +func (m *Content) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *Content_Text) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Text != nil { + l = m.Text.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Content_ParameterChange) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ParameterChange != nil { + l = m.ParameterChange.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Content_SoftwareUpgrade) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SoftwareUpgrade != nil { + l = m.SoftwareUpgrade.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Content_CancelSoftwareUpgrade) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CancelSoftwareUpgrade != nil { + l = m.CancelSoftwareUpgrade.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Content_CommunityPoolSpend) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CommunityPoolSpend != nil { + l = m.CommunityPoolSpend.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *ClientState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *ClientState_Tendermint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tendermint != nil { + l = m.Tendermint.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *ConsensusState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *ConsensusState_Tendermint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tendermint != nil { + l = m.Tendermint.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Misbehaviour) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *Misbehaviour_Tendermint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tendermint != nil { + l = m.Tendermint.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Header) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *Header_Tendermint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tendermint != nil { + l = m.Tendermint.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *MsgCreateClient) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *MsgCreateClient_Tendermint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tendermint != nil { + l = m.Tendermint.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *MsgUpdateClient) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *MsgUpdateClient_Tendermint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tendermint != nil { + l = m.Tendermint.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Transaction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StdTxBase.Size() + n += 1 + l + sovCodec(uint64(l)) + if len(m.Msgs) > 0 { + for _, e := range m.Msgs { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) + } + } + return n +} + +func (m *Message) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *Message_MsgSend) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgSend != nil { + l = m.MsgSend.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgMultiSend) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgMultiSend != nil { + l = m.MsgMultiSend.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgVerifyInvariant) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgVerifyInvariant != nil { + l = m.MsgVerifyInvariant.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgSetWithdrawAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgSetWithdrawAddress != nil { + l = m.MsgSetWithdrawAddress.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgWithdrawDelegatorReward) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgWithdrawDelegatorReward != nil { + l = m.MsgWithdrawDelegatorReward.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgWithdrawValidatorCommission) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgWithdrawValidatorCommission != nil { + l = m.MsgWithdrawValidatorCommission.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgFundCommunityPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgFundCommunityPool != nil { + l = m.MsgFundCommunityPool.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgSubmitEvidence) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgSubmitEvidence != nil { + l = m.MsgSubmitEvidence.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgSubmitProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgSubmitProposal != nil { + l = m.MsgSubmitProposal.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgVote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgVote != nil { + l = m.MsgVote.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgDeposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgDeposit != nil { + l = m.MsgDeposit.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgUnjail) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgUnjail != nil { + l = m.MsgUnjail.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgCreateValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgCreateValidator != nil { + l = m.MsgCreateValidator.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgEditValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgEditValidator != nil { + l = m.MsgEditValidator.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgDelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgDelegate != nil { + l = m.MsgDelegate.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgBeginRedelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgBeginRedelegate != nil { + l = m.MsgBeginRedelegate.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgUndelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgUndelegate != nil { + l = m.MsgUndelegate.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgConnectionOpenInit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgConnectionOpenInit != nil { + l = m.MsgConnectionOpenInit.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgConnectionOpenTry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgConnectionOpenTry != nil { + l = m.MsgConnectionOpenTry.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgConnectionOpenAck) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgConnectionOpenAck != nil { + l = m.MsgConnectionOpenAck.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgConnectionOpenConfirm) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgConnectionOpenConfirm != nil { + l = m.MsgConnectionOpenConfirm.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgChannelOpenInit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgChannelOpenInit != nil { + l = m.MsgChannelOpenInit.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgChannelOpenTry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgChannelOpenTry != nil { + l = m.MsgChannelOpenTry.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgChannelOpenAck) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgChannelOpenAck != nil { + l = m.MsgChannelOpenAck.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgChannelOpenConfirm) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgChannelOpenConfirm != nil { + l = m.MsgChannelOpenConfirm.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgChannelCloseInit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgChannelCloseInit != nil { + l = m.MsgChannelCloseInit.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgChannelCloseConfirm) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgChannelCloseConfirm != nil { + l = m.MsgChannelCloseConfirm.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgPacket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgPacket != nil { + l = m.MsgPacket.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgAcknowledgement) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgAcknowledgement != nil { + l = m.MsgAcknowledgement.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgCreateClientTendermint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgCreateClientTendermint != nil { + l = m.MsgCreateClientTendermint.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgUpdateClientTendermint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgUpdateClientTendermint != nil { + l = m.MsgUpdateClientTendermint.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgSubmitClientMisbehaviourTendermint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgSubmitClientMisbehaviourTendermint != nil { + l = m.MsgSubmitClientMisbehaviourTendermint.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgTransfer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgTransfer != nil { + l = m.MsgTransfer.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *SignDoc) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StdSignDocBase.Size() + n += 1 + l + sovCodec(uint64(l)) + if len(m.Msgs) > 0 { + for _, e := range m.Msgs { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) + } + } + return n +} + +func (m *StdFee) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) + } + } + if m.Gas != 0 { + n += 1 + sovCodec(uint64(m.Gas)) + } + return n +} + +func (m *StdSignature) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PubKey) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + return n +} + +func (m *StdTxBase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Fee.Size() + n += 1 + l + sovCodec(uint64(l)) + if len(m.Signatures) > 0 { + for _, e := range m.Signatures { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) + } + } + l = len(m.Memo) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + return n +} + +func (m *StdSignDocBase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + if m.AccountNumber != 0 { + n += 1 + sovCodec(uint64(m.AccountNumber)) + } + if m.Sequence != 0 { + n += 1 + sovCodec(uint64(m.Sequence)) + } + l = len(m.Memo) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + l = m.Fee.Size() + n += 1 + l + sovCodec(uint64(l)) + return n +} + +func sovCodec(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCodec(x uint64) (n int) { + return sovCodec(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Account) 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 ErrIntOverflowCodec + } + 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: Account: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Account: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types.BaseAccount{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Account_BaseAccount{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContinuousVestingAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types1.ContinuousVestingAccount{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Account_ContinuousVestingAccount{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelayedVestingAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types1.DelayedVestingAccount{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Account_DelayedVestingAccount{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PeriodicVestingAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types1.PeriodicVestingAccount{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Account_PeriodicVestingAccount{v} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types.ModuleAccount{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Account_ModuleAccount{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCodec(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Supply) 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 ErrIntOverflowCodec + } + 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: Supply: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Supply: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Supply", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types2.Supply{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Supply_Supply{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCodec(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Evidence) 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 ErrIntOverflowCodec + } + 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: Evidence: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Evidence: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Equivocation", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types3.Equivocation{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Evidence_Equivocation{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientMisbehaviour", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types4.Evidence{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Evidence_ClientMisbehaviour{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCodec(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitEvidence) 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 ErrIntOverflowCodec + } + 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: MsgSubmitEvidence: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitEvidence: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitEvidenceBase", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MsgSubmitEvidenceBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Evidence", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Evidence == nil { + m.Evidence = &Evidence{} + } + if err := m.Evidence.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCodec(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitProposal) 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 ErrIntOverflowCodec + } + 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: MsgSubmitProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitProposalBase", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MsgSubmitProposalBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Content == nil { + m.Content = &Content{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCodec(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Proposal) 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 ErrIntOverflowCodec + } + 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: Proposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalBase", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProposalBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCodec(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Content) 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 ErrIntOverflowCodec + } + 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: Content: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Content: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types5.TextProposal{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Content_Text{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParameterChange", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &proposal.ParameterChangeProposal{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Content_ParameterChange{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SoftwareUpgrade", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types6.SoftwareUpgradeProposal{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Content_SoftwareUpgrade{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CancelSoftwareUpgrade", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types6.CancelSoftwareUpgradeProposal{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Content_CancelSoftwareUpgrade{v} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommunityPoolSpend", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types7.CommunityPoolSpendProposal{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Content_CommunityPoolSpend{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCodec(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - l = len(m.Memo) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *StdSignDocBase) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainID) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - if m.AccountNumber != 0 { - n += 1 + sovCodec(uint64(m.AccountNumber)) - } - if m.Sequence != 0 { - n += 1 + sovCodec(uint64(m.Sequence)) - } - l = len(m.Memo) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) + if iNdEx > l { + return io.ErrUnexpectedEOF } - l = m.Fee.Size() - n += 1 + l + sovCodec(uint64(l)) - return n -} - -func sovCodec(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCodec(x uint64) (n int) { - return sovCodec(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *Account) Unmarshal(dAtA []byte) error { +func (m *ClientState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3768,15 +6868,15 @@ func (m *Account) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Account: wiretype end group for non-group") + return fmt.Errorf("proto: ClientState: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Account: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ClientState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tendermint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3803,15 +6903,68 @@ func (m *Account) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types.BaseAccount{} + v := &types4.ClientState{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Account_BaseAccount{v} + m.Sum = &ClientState_Tendermint{v} iNdEx = postIndex - case 2: + default: + iNdEx = preIndex + skippy, err := skipCodec(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConsensusState) 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 ErrIntOverflowCodec + } + 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: ConsensusState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsensusState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContinuousVestingAccount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tendermint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3838,15 +6991,68 @@ func (m *Account) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types1.ContinuousVestingAccount{} + v := &types4.ConsensusState{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Account_ContinuousVestingAccount{v} + m.Sum = &ConsensusState_Tendermint{v} iNdEx = postIndex - case 3: + default: + iNdEx = preIndex + skippy, err := skipCodec(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCodec + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Misbehaviour) 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 ErrIntOverflowCodec + } + 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: Misbehaviour: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Misbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelayedVestingAccount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tendermint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3873,50 +7079,68 @@ func (m *Account) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types1.DelayedVestingAccount{} + v := &types4.Evidence{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Account_DelayedVestingAccount{v} + m.Sum = &Misbehaviour_Tendermint{v} iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeriodicVestingAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipCodec(dAtA[iNdEx:]) + if err != nil { + return err } - if msglen < 0 { + if skippy < 0 { return ErrInvalidLengthCodec } - postIndex := iNdEx + msglen - if postIndex < 0 { + if (iNdEx + skippy) < 0 { return ErrInvalidLengthCodec } - if postIndex > l { + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Header) 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 ErrIntOverflowCodec + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - v := &types1.PeriodicVestingAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - m.Sum = &Account_PeriodicVestingAccount{v} - iNdEx = postIndex - case 5: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Header: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tendermint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3943,11 +7167,11 @@ func (m *Account) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types.ModuleAccount{} + v := &types4.Header{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Account_ModuleAccount{v} + m.Sum = &Header_Tendermint{v} iNdEx = postIndex default: iNdEx = preIndex @@ -3973,7 +7197,7 @@ func (m *Account) Unmarshal(dAtA []byte) error { } return nil } -func (m *Supply) Unmarshal(dAtA []byte) error { +func (m *MsgCreateClient) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3996,15 +7220,15 @@ func (m *Supply) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Supply: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateClient: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Supply: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateClient: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Supply", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tendermint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4031,11 +7255,11 @@ func (m *Supply) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types2.Supply{} + v := &types4.MsgCreateClient{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Supply_Supply{v} + m.Sum = &MsgCreateClient_Tendermint{v} iNdEx = postIndex default: iNdEx = preIndex @@ -4061,7 +7285,7 @@ func (m *Supply) Unmarshal(dAtA []byte) error { } return nil } -func (m *Evidence) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateClient) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4084,15 +7308,15 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Evidence: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateClient: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Evidence: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateClient: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Equivocation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tendermint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4119,11 +7343,11 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types3.Equivocation{} + v := &types4.MsgUpdateClient{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Evidence_Equivocation{v} + m.Sum = &MsgUpdateClient_Tendermint{v} iNdEx = postIndex default: iNdEx = preIndex @@ -4149,7 +7373,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSubmitEvidence) Unmarshal(dAtA []byte) error { +func (m *Transaction) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4172,15 +7396,15 @@ func (m *MsgSubmitEvidence) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitEvidence: wiretype end group for non-group") + return fmt.Errorf("proto: Transaction: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitEvidence: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Transaction: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitEvidenceBase", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StdTxBase", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4207,13 +7431,13 @@ func (m *MsgSubmitEvidence) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.MsgSubmitEvidenceBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.StdTxBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Evidence", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Msgs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4240,10 +7464,8 @@ func (m *MsgSubmitEvidence) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Evidence == nil { - m.Evidence = &Evidence{} - } - if err := m.Evidence.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Msgs = append(m.Msgs, Message{}) + if err := m.Msgs[len(m.Msgs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4271,7 +7493,7 @@ func (m *MsgSubmitEvidence) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { +func (m *Message) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4294,15 +7516,15 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitProposal: wiretype end group for non-group") + return fmt.Errorf("proto: Message: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitProposalBase", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgSend", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4329,13 +7551,15 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.MsgSubmitProposalBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + v := &types2.MsgSend{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } + m.Sum = &Message_MsgSend{v} iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgMultiSend", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4362,69 +7586,50 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Content == nil { - m.Content = &Content{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + v := &types2.MsgMultiSend{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } + m.Sum = &Message_MsgMultiSend{v} iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgVerifyInvariant", wireType) } - if skippy < 0 { - return ErrInvalidLengthCodec + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) < 0 { + if msglen < 0 { return ErrInvalidLengthCodec } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Proposal) 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 ErrIntOverflowCodec + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + v := &types8.MsgVerifyInvariant{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Proposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.Sum = &Message_MsgVerifyInvariant{v} + iNdEx = postIndex + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalBase", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgSetWithdrawAddress", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4451,13 +7656,15 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ProposalBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + v := &types7.MsgSetWithdrawAddress{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } + m.Sum = &Message_MsgSetWithdrawAddress{v} iNdEx = postIndex - case 2: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgWithdrawDelegatorReward", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4484,66 +7691,85 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + v := &types7.MsgWithdrawDelegatorReward{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } + m.Sum = &Message_MsgWithdrawDelegatorReward{v} iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgWithdrawValidatorCommission", wireType) } - if skippy < 0 { + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { return ErrInvalidLengthCodec } - if (iNdEx + skippy) < 0 { + postIndex := iNdEx + msglen + if postIndex < 0 { return ErrInvalidLengthCodec } - if (iNdEx + skippy) > l { + if postIndex > l { return io.ErrUnexpectedEOF } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Content) 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 ErrIntOverflowCodec + v := &types7.MsgWithdrawValidatorCommission{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - if iNdEx >= l { - return io.ErrUnexpectedEOF + m.Sum = &Message_MsgWithdrawValidatorCommission{v} + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgFundCommunityPool", wireType) } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Content: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Content: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types7.MsgFundCommunityPool{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgFundCommunityPool{v} + iNdEx = postIndex + case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitEvidence", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4570,15 +7796,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types4.TextProposal{} + v := &MsgSubmitEvidence{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_Text{v} + m.Sum = &Message_MsgSubmitEvidence{v} iNdEx = postIndex - case 2: + case 9: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParameterChange", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitProposal", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4605,15 +7831,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &proposal.ParameterChangeProposal{} + v := &MsgSubmitProposal{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_ParameterChange{v} + m.Sum = &Message_MsgSubmitProposal{v} iNdEx = postIndex - case 3: + case 10: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SoftwareUpgrade", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgVote", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4640,15 +7866,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types5.SoftwareUpgradeProposal{} + v := &types5.MsgVote{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_SoftwareUpgrade{v} + m.Sum = &Message_MsgVote{v} iNdEx = postIndex - case 4: + case 11: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CancelSoftwareUpgrade", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgDeposit", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4675,15 +7901,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types5.CancelSoftwareUpgradeProposal{} + v := &types5.MsgDeposit{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_CancelSoftwareUpgrade{v} + m.Sum = &Message_MsgDeposit{v} iNdEx = postIndex - case 5: + case 12: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CommunityPoolSpend", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgUnjail", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4710,68 +7936,50 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types6.CommunityPoolSpendProposal{} + v := &types9.MsgUnjail{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_CommunityPoolSpend{v} + m.Sum = &Message_MsgUnjail{v} iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgCreateValidator", wireType) } - if skippy < 0 { - return ErrInvalidLengthCodec + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) < 0 { + if msglen < 0 { return ErrInvalidLengthCodec } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Transaction) 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 ErrIntOverflowCodec + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + v := &types10.MsgCreateValidator{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Transaction: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Transaction: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.Sum = &Message_MsgCreateValidator{v} + iNdEx = postIndex + case 14: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StdTxBase", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgEditValidator", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4798,13 +8006,15 @@ func (m *Transaction) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.StdTxBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + v := &types10.MsgEditValidator{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } + m.Sum = &Message_MsgEditValidator{v} iNdEx = postIndex - case 2: + case 15: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Msgs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgDelegate", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4831,67 +8041,50 @@ func (m *Transaction) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Msgs = append(m.Msgs, Message{}) - if err := m.Msgs[len(m.Msgs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + v := &types10.MsgDelegate{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } + m.Sum = &Message_MsgDelegate{v} iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgBeginRedelegate", wireType) } - if skippy < 0 { - return ErrInvalidLengthCodec + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) < 0 { + if msglen < 0 { return ErrInvalidLengthCodec } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Message) 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 ErrIntOverflowCodec + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + v := &types10.MsgBeginRedelegate{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Message: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.Sum = &Message_MsgBeginRedelegate{v} + iNdEx = postIndex + case 17: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSend", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgUndelegate", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4918,15 +8111,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types2.MsgSend{} + v := &types10.MsgUndelegate{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgSend{v} + m.Sum = &Message_MsgUndelegate{v} iNdEx = postIndex - case 2: + case 18: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgMultiSend", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgConnectionOpenInit", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4953,15 +8146,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types2.MsgMultiSend{} + v := &types11.MsgConnectionOpenInit{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgMultiSend{v} + m.Sum = &Message_MsgConnectionOpenInit{v} iNdEx = postIndex - case 3: + case 19: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgVerifyInvariant", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgConnectionOpenTry", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4988,15 +8181,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types7.MsgVerifyInvariant{} + v := &types11.MsgConnectionOpenTry{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgVerifyInvariant{v} + m.Sum = &Message_MsgConnectionOpenTry{v} iNdEx = postIndex - case 4: + case 20: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSetWithdrawAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgConnectionOpenAck", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5023,15 +8216,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types6.MsgSetWithdrawAddress{} + v := &types11.MsgConnectionOpenAck{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgSetWithdrawAddress{v} + m.Sum = &Message_MsgConnectionOpenAck{v} iNdEx = postIndex - case 5: + case 21: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgWithdrawDelegatorReward", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgConnectionOpenConfirm", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5058,15 +8251,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types6.MsgWithdrawDelegatorReward{} + v := &types11.MsgConnectionOpenConfirm{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgWithdrawDelegatorReward{v} + m.Sum = &Message_MsgConnectionOpenConfirm{v} iNdEx = postIndex - case 6: + case 22: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgWithdrawValidatorCommission", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgChannelOpenInit", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5093,15 +8286,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types6.MsgWithdrawValidatorCommission{} + v := &types12.MsgChannelOpenInit{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgWithdrawValidatorCommission{v} + m.Sum = &Message_MsgChannelOpenInit{v} iNdEx = postIndex - case 7: + case 23: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgFundCommunityPool", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgChannelOpenTry", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5128,15 +8321,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types6.MsgFundCommunityPool{} + v := &types12.MsgChannelOpenTry{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgFundCommunityPool{v} + m.Sum = &Message_MsgChannelOpenTry{v} iNdEx = postIndex - case 8: + case 24: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitEvidence", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgChannelOpenAck", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5163,15 +8356,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &MsgSubmitEvidence{} + v := &types12.MsgChannelOpenAck{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgSubmitEvidence{v} + m.Sum = &Message_MsgChannelOpenAck{v} iNdEx = postIndex - case 9: + case 25: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitProposal", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgChannelOpenConfirm", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5198,15 +8391,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &MsgSubmitProposal{} + v := &types12.MsgChannelOpenConfirm{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgSubmitProposal{v} + m.Sum = &Message_MsgChannelOpenConfirm{v} iNdEx = postIndex - case 10: + case 26: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgVote", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgChannelCloseInit", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5233,15 +8426,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types4.MsgVote{} + v := &types12.MsgChannelCloseInit{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgVote{v} + m.Sum = &Message_MsgChannelCloseInit{v} iNdEx = postIndex - case 11: + case 27: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgDeposit", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgChannelCloseConfirm", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5268,15 +8461,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types4.MsgDeposit{} + v := &types12.MsgChannelCloseConfirm{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgDeposit{v} + m.Sum = &Message_MsgChannelCloseConfirm{v} iNdEx = postIndex - case 12: + case 28: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgUnjail", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgPacket", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5303,15 +8496,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgUnjail{} + v := &types12.MsgPacket{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgUnjail{v} + m.Sum = &Message_MsgPacket{v} iNdEx = postIndex - case 13: + case 29: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgCreateValidator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgAcknowledgement", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5338,15 +8531,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types9.MsgCreateValidator{} + v := &types12.MsgAcknowledgement{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgCreateValidator{v} + m.Sum = &Message_MsgAcknowledgement{v} iNdEx = postIndex - case 14: + case 30: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgEditValidator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgCreateClientTendermint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5373,15 +8566,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types9.MsgEditValidator{} + v := &types4.MsgCreateClient{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgEditValidator{v} + m.Sum = &Message_MsgCreateClientTendermint{v} iNdEx = postIndex - case 15: + case 31: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgDelegate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgUpdateClientTendermint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5408,15 +8601,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types9.MsgDelegate{} + v := &types4.MsgUpdateClient{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgDelegate{v} + m.Sum = &Message_MsgUpdateClientTendermint{v} iNdEx = postIndex - case 16: + case 32: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgBeginRedelegate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitClientMisbehaviourTendermint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5443,15 +8636,15 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types9.MsgBeginRedelegate{} + v := &types4.MsgSubmitClientMisbehaviour{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgBeginRedelegate{v} + m.Sum = &Message_MsgSubmitClientMisbehaviourTendermint{v} iNdEx = postIndex - case 17: + case 33: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgUndelegate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgTransfer", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5478,11 +8671,11 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types9.MsgUndelegate{} + v := &types13.MsgTransfer{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Message_MsgUndelegate{v} + m.Sum = &Message_MsgTransfer{v} iNdEx = postIndex default: iNdEx = preIndex @@ -5686,7 +8879,7 @@ func (m *StdFee) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types10.Coin{}) + m.Amount = append(m.Amount, types14.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/std/codec.proto b/std/codec.proto index 67ca3e77ca75..fa474fce4269 100644 --- a/std/codec.proto +++ b/std/codec.proto @@ -15,6 +15,10 @@ import "x/slashing/types/types.proto"; import "x/staking/types/types.proto"; import "x/params/types/proposal/types.proto"; import "x/upgrade/types/types.proto"; +import "x/ibc/03-connection/types/types.proto"; +import "x/ibc/04-channel/types/types.proto"; +import "x/ibc/07-tendermint/types/types.proto"; +import "x/ibc/20-transfer/types/types.proto"; option go_package = "github.com/cosmos/cosmos-sdk/std"; @@ -51,7 +55,8 @@ message Evidence { // sum defines a set of all acceptable concrete Evidence implementations. oneof sum { - cosmos_sdk.x.evidence.v1.Equivocation equivocation = 1; + cosmos_sdk.x.evidence.v1.Equivocation equivocation = 1; + cosmos_sdk.x.ibc.tendermint.v1.Evidence client_misbehaviour = 2; } } @@ -75,8 +80,8 @@ message MsgSubmitProposal { Content content = 2; } -// Proposal defines the application-level concrete proposal type used in governance -// proposals. +// Proposal defines the application-level concrete proposal type used in +// governance proposals. message Proposal { option (gogoproto.equal) = true; @@ -90,7 +95,8 @@ message Content { option (gogoproto.equal) = true; option (cosmos_proto.interface_type) = "*github.com/cosmos/cosmos-sdk/x/gov/types.Content"; - // sum defines a set of all acceptable concrete governance proposal Content types. + // sum defines a set of all acceptable concrete governance proposal Content + // types. oneof sum { cosmos_sdk.x.gov.v1.TextProposal text = 1; cosmos_sdk.x.params.v1.ParameterChangeProposal parameter_change = 2; @@ -100,6 +106,57 @@ message Content { } } +message ClientState { + option (cosmos_proto.interface_type) = "*github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported.ClientState"; + // sum defines a set of all acceptable concrete ClientState implementations. + oneof sum { + cosmos_sdk.x.ibc.tendermint.v1.ClientState tendermint = 1; + } +} + +message ConsensusState { + option (cosmos_proto.interface_type) = "*github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported.ConsensusState"; + // sum defines a set of all acceptable concrete ConsensusState + // implementations. + oneof sum { + cosmos_sdk.x.ibc.tendermint.v1.ConsensusState tendermint = 1; + } +} + +message Misbehaviour { + option (cosmos_proto.interface_type) = "*github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported.Misbehaviour"; + // sum defines a set of all acceptable concrete Misbehaviour implementations. + oneof sum { + cosmos_sdk.x.ibc.tendermint.v1.Evidence tendermint = 1; + } +} + +message Header { + option (cosmos_proto.interface_type) = "*github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported.Header"; + // sum defines a set of all acceptable concrete Header implementations. + oneof sum { + cosmos_sdk.x.ibc.tendermint.v1.Header tendermint = 1; + } +} + +message MsgCreateClient { + option (cosmos_proto.interface_type) = "*github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported.MsgCreateClient"; + oneof sum { + // sum defines a set of all acceptable concrete MsgCreateClient + // implementations. + cosmos_sdk.x.ibc.tendermint.v1.MsgCreateClient tendermint = 1; + } +} + +message MsgUpdateClient { + option (cosmos_proto.interface_type) = "*github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported.MsgUpdateClient"; + // sum defines a set of all acceptable concrete MsgUpdateClient + // implementations. + oneof sum { + cosmos_sdk.x.ibc.tendermint.v1.MsgUpdateClient tendermint = 1; + } +} + // Transaction defines the application-level transaction that can be signed and // processed by the state-machine. It contains a base of common fields and // repeated set of Message types. @@ -117,23 +174,39 @@ message Message { // sum defines the set of all allowed valid messages defined in modules. oneof sum { - cosmos_sdk.x.bank.v1.MsgSend msg_send = 1; - cosmos_sdk.x.bank.v1.MsgMultiSend msg_multi_send = 2; - cosmos_sdk.x.crisis.v1.MsgVerifyInvariant msg_verify_invariant = 3; - cosmos_sdk.x.distribution.v1.MsgSetWithdrawAddress msg_set_withdraw_address = 4; - cosmos_sdk.x.distribution.v1.MsgWithdrawDelegatorReward msg_withdraw_delegator_reward = 5; - cosmos_sdk.x.distribution.v1.MsgWithdrawValidatorCommission msg_withdraw_validator_commission = 6; - cosmos_sdk.x.distribution.v1.MsgFundCommunityPool msg_fund_community_pool = 7; - MsgSubmitEvidence msg_submit_evidence = 8; - MsgSubmitProposal msg_submit_proposal = 9; - cosmos_sdk.x.gov.v1.MsgVote msg_vote = 10; - cosmos_sdk.x.gov.v1.MsgDeposit msg_deposit = 11; - cosmos_sdk.x.slashing.v1.MsgUnjail msg_unjail = 12; - cosmos_sdk.x.staking.v1.MsgCreateValidator msg_create_validator = 13; - cosmos_sdk.x.staking.v1.MsgEditValidator msg_edit_validator = 14; - cosmos_sdk.x.staking.v1.MsgDelegate msg_delegate = 15; - cosmos_sdk.x.staking.v1.MsgBeginRedelegate msg_begin_redelegate = 16; - cosmos_sdk.x.staking.v1.MsgUndelegate msg_undelegate = 17; + cosmos_sdk.x.bank.v1.MsgSend msg_send = 1; + cosmos_sdk.x.bank.v1.MsgMultiSend msg_multi_send = 2; + cosmos_sdk.x.crisis.v1.MsgVerifyInvariant msg_verify_invariant = 3; + cosmos_sdk.x.distribution.v1.MsgSetWithdrawAddress msg_set_withdraw_address = 4; + cosmos_sdk.x.distribution.v1.MsgWithdrawDelegatorReward msg_withdraw_delegator_reward = 5; + cosmos_sdk.x.distribution.v1.MsgWithdrawValidatorCommission msg_withdraw_validator_commission = 6; + cosmos_sdk.x.distribution.v1.MsgFundCommunityPool msg_fund_community_pool = 7; + MsgSubmitEvidence msg_submit_evidence = 8; + MsgSubmitProposal msg_submit_proposal = 9; + cosmos_sdk.x.gov.v1.MsgVote msg_vote = 10; + cosmos_sdk.x.gov.v1.MsgDeposit msg_deposit = 11; + cosmos_sdk.x.slashing.v1.MsgUnjail msg_unjail = 12; + cosmos_sdk.x.staking.v1.MsgCreateValidator msg_create_validator = 13; + cosmos_sdk.x.staking.v1.MsgEditValidator msg_edit_validator = 14; + cosmos_sdk.x.staking.v1.MsgDelegate msg_delegate = 15; + cosmos_sdk.x.staking.v1.MsgBeginRedelegate msg_begin_redelegate = 16; + cosmos_sdk.x.staking.v1.MsgUndelegate msg_undelegate = 17; + cosmos_sdk.x.ibc.connection.v1.MsgConnectionOpenInit msg_connection_open_init = 18; + cosmos_sdk.x.ibc.connection.v1.MsgConnectionOpenTry msg_connection_open_try = 19; + cosmos_sdk.x.ibc.connection.v1.MsgConnectionOpenAck msg_connection_open_ack = 20; + cosmos_sdk.x.ibc.connection.v1.MsgConnectionOpenConfirm msg_connection_open_confirm = 21; + cosmos_sdk.x.ibc.channel.v1.MsgChannelOpenInit msg_channel_open_init = 22; + cosmos_sdk.x.ibc.channel.v1.MsgChannelOpenTry msg_channel_open_try = 23; + cosmos_sdk.x.ibc.channel.v1.MsgChannelOpenAck msg_channel_open_ack = 24; + cosmos_sdk.x.ibc.channel.v1.MsgChannelOpenConfirm msg_channel_open_confirm = 25; + cosmos_sdk.x.ibc.channel.v1.MsgChannelCloseInit msg_channel_close_init = 26; + cosmos_sdk.x.ibc.channel.v1.MsgChannelCloseConfirm msg_channel_close_confirm = 27; + cosmos_sdk.x.ibc.channel.v1.MsgPacket msg_packet = 28; + cosmos_sdk.x.ibc.channel.v1.MsgAcknowledgement msg_acknowledgement = 29; + cosmos_sdk.x.ibc.tendermint.v1.MsgCreateClient msg_create_client_tendermint = 30; // TODO: should I use the interface defined above instead? + cosmos_sdk.x.ibc.tendermint.v1.MsgUpdateClient msg_update_client_tendermint = 31; // TODO: ditto + cosmos_sdk.x.ibc.tendermint.v1.MsgSubmitClientMisbehaviour msg_submit_client_misbehaviour_tendermint = 32; // FIXME: use submit evidence msg? + cosmos_sdk.x.ibc.transfer.v1.MsgTransfer msg_transfer = 33; } } diff --git a/third_party/proto/tendermint/proto/evidence/msgs.proto b/third_party/proto/tendermint/proto/evidence/msgs.proto new file mode 100644 index 000000000000..a52d17e3305e --- /dev/null +++ b/third_party/proto/tendermint/proto/evidence/msgs.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package tendermint.proto.evidence; + +option go_package = "github.com/tendermint/tendermint/proto/evidence"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "third_party/proto/tendermint/proto/types/evidence.proto"; + +message List { + repeated tendermint.proto.types.Evidence evidence = 1 [(gogoproto.nullable) = false]; +} + +message Info { + bool committed = 1; + int64 priority = 2; + tendermint.proto.types.Evidence evidence = 3 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/tendermint/proto/types/block.proto b/third_party/proto/tendermint/proto/types/block.proto new file mode 100644 index 000000000000..5761720b830d --- /dev/null +++ b/third_party/proto/tendermint/proto/types/block.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package tendermint.proto.types; + +option go_package = "github.com/tendermint/tendermint/proto/types"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "third_party/proto/tendermint/proto/types/types.proto"; +import "third_party/proto/tendermint/proto/types/evidence.proto"; + +message Block { + Header header = 1 [(gogoproto.nullable) = false]; + Data data = 2 [(gogoproto.nullable) = false]; + tendermint.proto.types.EvidenceData evidence = 3 [(gogoproto.nullable) = false]; + Commit last_commit = 4; +} diff --git a/third_party/proto/tendermint/proto/types/evidence.proto b/third_party/proto/tendermint/proto/types/evidence.proto new file mode 100644 index 000000000000..084379b9a422 --- /dev/null +++ b/third_party/proto/tendermint/proto/types/evidence.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +package tendermint.proto.types; + +option go_package = "github.com/tendermint/tendermint/proto/types"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "third_party/proto/tendermint/proto/types/types.proto"; +import "google/protobuf/timestamp.proto"; + +// DuplicateVoteEvidence contains evidence a validator signed two conflicting +// votes. +message DuplicateVoteEvidence { + Vote vote_a = 1; + Vote vote_b = 2; +} + +// MockEvidence is used for testing pruposes +message MockEvidence { + int64 evidence_height = 1; + google.protobuf.Timestamp evidence_time = 2 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes evidence_address = 3; +} + +message Evidence { + oneof sum { + DuplicateVoteEvidence duplicate_vote_evidence = 1; + MockEvidence mock_evidence = 2; + } +} + +// EvidenceData contains any evidence of malicious wrong-doing by validators +message EvidenceData { + repeated Evidence evidence = 1 [(gogoproto.nullable) = false]; + bytes hash = 2; +} diff --git a/third_party/proto/tendermint/proto/types/validator.proto b/third_party/proto/tendermint/proto/types/validator.proto new file mode 100644 index 000000000000..f1ef344d74f9 --- /dev/null +++ b/third_party/proto/tendermint/proto/types/validator.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; +package tendermint.proto.types; + +option go_package = "github.com/tendermint/tendermint/proto/types"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "third_party/proto/tendermint/proto/crypto/keys/types.proto"; + +message ValidatorSet { + repeated Validator validators = 1 [(gogoproto.nullable) = false]; + Validator proposer = 2 [(gogoproto.nullable) = false]; + int64 total_voting_power = 3; +} + +message Validator { + bytes address = 1; + tendermint.proto.crypto.keys.PublicKey pub_key = 2 [(gogoproto.nullable) = false]; + int64 voting_power = 3; + int64 proposer_priority = 4; +} diff --git a/third_party/proto/tendermint/types/types.proto b/third_party/proto/tendermint/types/types.proto new file mode 100644 index 000000000000..adaa0a00dc6c --- /dev/null +++ b/third_party/proto/tendermint/types/types.proto @@ -0,0 +1,55 @@ +syntax = "proto3"; + +package tendermint.types.proto3; +option go_package = "github.com/tendermint/tendermint/types/proto3"; + +message PartSetHeader { + int32 Total = 1; + bytes Hash = 2; +} + +message BlockID { + bytes Hash = 1; + PartSetHeader PartsHeader = 2; +} + +message Header { + // basic block info + Version Version = 1; + string ChainID = 2; + int64 Height = 3; + Timestamp Time = 4; + + // prev block info + BlockID LastBlockID = 5; + + // hashes of block data + bytes LastCommitHash = 6; // commit from validators from the last block + bytes DataHash = 7; // transactions + + // hashes from the app output from the prev block + bytes ValidatorsHash = 8; // validators for the current block + bytes NextValidatorsHash = 9; // validators for the next block + bytes ConsensusHash = 10; // consensus params for current block + bytes AppHash = 11; // state after txs from the previous block + bytes LastResultsHash = 12; // root hash of all results from the txs from the previous block + + // consensus info + bytes EvidenceHash = 13; // evidence included in the block + bytes ProposerAddress = 14; // original proposer of the block +} + +message Version { + uint64 Block = 1; + uint64 App = 2; +} + +// Timestamp wraps how amino encodes time. +// This is the protobuf well-known type protobuf/timestamp.proto +// See: +// https://github.com/google/protobuf/blob/d2980062c859649523d5fd51d6b55ab310e47482/src/google/protobuf/timestamp.proto#L123-L135 +// NOTE/XXX: nanos do not get skipped if they are zero in amino. +message Timestamp { + int64 seconds = 1; + int32 nanos = 2; +} diff --git a/x/ibc/02-client/client/utils/utils.go b/x/ibc/02-client/client/utils/utils.go index 8dae0bc0de36..3d971bc8d8ae 100644 --- a/x/ibc/02-client/client/utils/utils.go +++ b/x/ibc/02-client/client/utils/utils.go @@ -114,9 +114,19 @@ func QueryTendermintHeader(cliCtx context.CLIContext) (ibctmtypes.Header, int64, return ibctmtypes.Header{}, 0, err } + tmValset := tmtypes.NewValidatorSet(validators.Validators) + tmValset.TotalVotingPower() // update voting power + + // migrate to protobuf + protoSignedHeader := commit.SignedHeader.ToProto() + protoValSet, err := tmValset.ToProto() + if err != nil { + return ibctmtypes.Header{}, 0, err + } + header := ibctmtypes.Header{ - SignedHeader: commit.SignedHeader, - ValidatorSet: tmtypes.NewValidatorSet(validators.Validators), + SignedHeader: *protoSignedHeader, + ValidatorSet: protoValSet, } return header, height, nil @@ -147,10 +157,19 @@ func QueryNodeConsensusState(cliCtx context.CLIContext) (ibctmtypes.ConsensusSta return ibctmtypes.ConsensusState{}, 0, err } + tmValset := tmtypes.NewValidatorSet(validators.Validators) + tmValset.TotalVotingPower() // update voting power + + protoValSet, err := tmValset.ToProto() + if err != nil { + return ibctmtypes.ConsensusState{}, 0, err + } + state := ibctmtypes.ConsensusState{ Timestamp: commit.Time, Root: commitmenttypes.NewMerkleRoot(commit.AppHash), - ValidatorSet: tmtypes.NewValidatorSet(validators.Validators), + Height: uint64(height), + ValidatorSet: protoValSet, } return state, height, nil diff --git a/x/ibc/02-client/keeper/client_test.go b/x/ibc/02-client/keeper/client_test.go index b04a51f9ed3a..70858de16950 100644 --- a/x/ibc/02-client/keeper/client_test.go +++ b/x/ibc/02-client/keeper/client_test.go @@ -64,11 +64,11 @@ func (suite *KeeperTestSuite) TestCreateClient() { func (suite *KeeperTestSuite) TestUpdateClientTendermint() { // Must create header creation functions since suite.header gets recreated on each test case createValidUpdateFn := func(s *KeeperTestSuite) ibctmtypes.Header { - return ibctmtypes.CreateTestHeader(testClientID, suite.header.Height+1, suite.header.Time.Add(time.Minute), + return ibctmtypes.CreateTestHeader(testClientID, suite.header.SignedHeader.Header.Height+1, suite.header.GetTime().Add(time.Minute), suite.valSet, []tmtypes.PrivValidator{suite.privVal}) } createInvalidUpdateFn := func(s *KeeperTestSuite) ibctmtypes.Header { - return ibctmtypes.CreateTestHeader(testClientID, suite.header.Height-3, suite.header.Time.Add(time.Minute), + return ibctmtypes.CreateTestHeader(testClientID, suite.header.SignedHeader.Header.Height-3, suite.header.GetTime().Add(time.Minute), suite.valSet, []tmtypes.PrivValidator{suite.privVal}) } var updateHeader ibctmtypes.Header @@ -136,7 +136,7 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() { err := tc.malleate() suite.Require().NoError(err) - suite.ctx = suite.ctx.WithBlockTime(updateHeader.Time.Add(time.Minute)) + suite.ctx = suite.ctx.WithBlockTime(updateHeader.GetTime().Add(time.Minute)) updatedClientState, err := suite.keeper.UpdateClient(suite.ctx, testClientID, updateHeader) @@ -145,8 +145,8 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() { expConsensusState := ibctmtypes.ConsensusState{ Height: updateHeader.GetHeight(), - Timestamp: updateHeader.Time, - Root: commitmenttypes.NewMerkleRoot(updateHeader.AppHash), + Timestamp: updateHeader.GetTime(), + Root: commitmenttypes.NewMerkleRoot(updateHeader.SignedHeader.Header.AppHash), ValidatorSet: updateHeader.ValidatorSet, } @@ -158,14 +158,15 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() { tmConsState, ok := consensusState.(ibctmtypes.ConsensusState) suite.Require().True(ok, "consensus state is not a tendermint consensus state") // recalculate cached totalVotingPower field for equality check - tmConsState.ValidatorSet.TotalVotingPower() + var tmValSet *tmtypes.ValidatorSet + err := tmValSet.FromProto(tmConsState.ValidatorSet) + suite.Require().NoError(err) + + tmConsState.ValidatorSet.TotalVotingPower = tmValSet.TotalVotingPower() tmClientState, ok := updatedClientState.(ibctmtypes.ClientState) suite.Require().True(ok, "client state is not a tendermint client state") - // recalculate cached totalVotingPower field for equality check - tmClientState.LastHeader.ValidatorSet.TotalVotingPower() - suite.Require().NoError(err, "valid test case %d failed: %s", i, tc.name) suite.Require().Equal(updateHeader.GetHeight(), clientState.GetLatestHeight(), "client state height not updated correctly on case %s", tc.name) suite.Require().Equal(expConsensusState, consensusState, "consensus state should have been updated on case %s", tc.name) @@ -180,7 +181,7 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() { func (suite *KeeperTestSuite) TestUpdateClientLocalhost() { var localhostClient exported.ClientState = localhosttypes.NewClientState( suite.keeper.ClientStore(suite.ctx, exported.ClientTypeLocalHost), - suite.header.ChainID, + suite.header.SignedHeader.Header.GetChainID(), suite.ctx.BlockHeight(), ) @@ -203,6 +204,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { // Create bothValSet with both suite validator and altVal bothValSet := tmtypes.NewValidatorSet(append(suite.valSet.Validators, altVal)) + protoBothValSet, err := bothValSet.ToProto() + suite.Require().NoError(err) // Create alternative validator set with only altVal altValSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{altVal}) @@ -234,7 +237,7 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { ClientID: testClientID, }, func() error { - suite.consensusState.ValidatorSet = bothValSet + suite.consensusState.ValidatorSet = protoBothValSet clientState, err := ibctmtypes.Initialize(testClientID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header) if err != nil { return err @@ -254,7 +257,7 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { ClientID: testClientID, }, func() error { - suite.consensusState.ValidatorSet = bothValSet + suite.consensusState.ValidatorSet = protoBothValSet clientState, err := ibctmtypes.Initialize(testClientID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header) if err != nil { return err diff --git a/x/ibc/02-client/keeper/keeper.go b/x/ibc/02-client/keeper/keeper.go index 3149e721b344..95296c6ffcc7 100644 --- a/x/ibc/02-client/keeper/keeper.go +++ b/x/ibc/02-client/keeper/keeper.go @@ -196,12 +196,19 @@ func (k Keeper) GetSelfConsensusState(ctx sdk.Context, height uint64) (exported. } valSet := stakingtypes.Validators(histInfo.Valset) + tmVals := tmtypes.NewValidatorSet(valSet.ToTmValidators()) + + protoValset, err := tmVals.ToProto() + if err != nil { + // TODO: should this return false instead? + panic(err) + } consensusState := ibctmtypes.ConsensusState{ Height: height, Timestamp: histInfo.Header.Time, Root: commitmenttypes.NewMerkleRoot(histInfo.Header.AppHash), - ValidatorSet: tmtypes.NewValidatorSet(valSet.ToTmValidators()), + ValidatorSet: protoValset, } return consensusState, true } diff --git a/x/ibc/02-client/keeper/keeper_test.go b/x/ibc/02-client/keeper/keeper_test.go index c47218ea824b..009ed9733d44 100644 --- a/x/ibc/02-client/keeper/keeper_test.go +++ b/x/ibc/02-client/keeper/keeper_test.go @@ -42,6 +42,7 @@ type KeeperTestSuite struct { consensusState ibctmtypes.ConsensusState header ibctmtypes.Header valSet *tmtypes.ValidatorSet + protoValSet *tmproto.ValidatorSet privVal tmtypes.PrivValidator now time.Time } @@ -62,12 +63,15 @@ func (suite *KeeperTestSuite) SetupTest() { validator := tmtypes.NewValidator(pubKey, 1) suite.valSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + suite.protoValSet, err = suite.valSet.ToProto() + suite.Require().NoError(err) + suite.header = ibctmtypes.CreateTestHeader(testClientID, testClientHeight, now2, suite.valSet, []tmtypes.PrivValidator{suite.privVal}) suite.consensusState = ibctmtypes.ConsensusState{ Height: testClientHeight, Timestamp: suite.now, Root: commitmenttypes.NewMerkleRoot([]byte("hash")), - ValidatorSet: suite.valSet, + ValidatorSet: suite.protoValSet, } var validators staking.Validators @@ -113,7 +117,11 @@ func (suite *KeeperTestSuite) TestSetClientConsensusState() { tmConsState, ok := retrievedConsState.(ibctmtypes.ConsensusState) // recalculate cached totalVotingPower field for equality check - tmConsState.ValidatorSet.TotalVotingPower() + var tmValSet *tmtypes.ValidatorSet + err := tmValSet.FromProto(tmConsState.ValidatorSet) + suite.Require().NoError(err) + + tmConsState.ValidatorSet.TotalVotingPower = tmValSet.TotalVotingPower() suite.Require().True(ok) suite.Require().Equal(suite.consensusState, tmConsState, "ConsensusState not stored correctly") } @@ -172,10 +180,10 @@ func (suite KeeperTestSuite) TestConsensusStateHelpers() { Height: testClientHeight + 5, Timestamp: suite.now, Root: commitmenttypes.NewMerkleRoot([]byte("next")), - ValidatorSet: suite.valSet, + ValidatorSet: suite.protoValSet, } - header := ibctmtypes.CreateTestHeader(testClientID, testClientHeight+5, suite.header.Time.Add(time.Minute), suite.valSet, []tmtypes.PrivValidator{suite.privVal}) + header := ibctmtypes.CreateTestHeader(testClientID, testClientHeight+5, suite.header.GetTime().Add(time.Minute), suite.valSet, []tmtypes.PrivValidator{suite.privVal}) // mock update functionality clientState.LastHeader = header @@ -184,14 +192,21 @@ func (suite KeeperTestSuite) TestConsensusStateHelpers() { latest, ok := suite.keeper.GetLatestClientConsensusState(suite.ctx, testClientID) // recalculate cached totalVotingPower for equality check - latest.(ibctmtypes.ConsensusState).ValidatorSet.TotalVotingPower() + var tmValSet *tmtypes.ValidatorSet + err := tmValSet.FromProto(latest.(ibctmtypes.ConsensusState).ValidatorSet) + suite.Require().NoError(err) + + latest.(ibctmtypes.ConsensusState).ValidatorSet.TotalVotingPower = tmValSet.TotalVotingPower() suite.Require().True(ok) suite.Require().Equal(nextState, latest, "Latest client not returned correctly") // Should return existing consensusState at latestClientHeight lte, ok := suite.keeper.GetClientConsensusStateLTE(suite.ctx, testClientID, testClientHeight+3) // recalculate cached totalVotingPower for equality check - lte.(ibctmtypes.ConsensusState).ValidatorSet.TotalVotingPower() + err = tmValSet.FromProto(latest.(ibctmtypes.ConsensusState).ValidatorSet) + suite.Require().NoError(err) + + latest.(ibctmtypes.ConsensusState).ValidatorSet.TotalVotingPower = tmValSet.TotalVotingPower() suite.Require().True(ok) suite.Require().Equal(suite.consensusState, lte, "LTE helper function did not return latest client state below height: %d", testClientHeight+3) } diff --git a/x/ibc/02-client/types/codec.go b/x/ibc/02-client/types/codec.go index b8c0eed6ee61..e566ab8505ea 100644 --- a/x/ibc/02-client/types/codec.go +++ b/x/ibc/02-client/types/codec.go @@ -5,10 +5,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" ) -// SubModuleCdc defines the IBC client codec. -var SubModuleCdc *codec.Codec - -// RegisterCodec registers the IBC client interfaces and types +// RegisterCodec registers the necessary x/ibc/02-client interfaces and concrete types +// on the provided Amino codec. These types are used for Amino JSON serialization. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterInterface((*exported.ClientState)(nil), nil) cdc.RegisterInterface((*exported.MsgCreateClient)(nil), nil) @@ -16,10 +14,22 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterInterface((*exported.ConsensusState)(nil), nil) cdc.RegisterInterface((*exported.Header)(nil), nil) cdc.RegisterInterface((*exported.Misbehaviour)(nil), nil) - - SetSubModuleCodec(cdc) } -func SetSubModuleCodec(cdc *codec.Codec) { - SubModuleCdc = cdc +var ( + amino = codec.New() + + // SubModuleCdc references the global x/ibc/02-client module codec. Note, the codec + // should ONLY be used in certain instances of tests and for JSON encoding as Amino + // is still used for that purpose. + // + // The actual codec used for serialization should be provided to x/ibc/02-client and + // defined at the application level. + SubModuleCdc = codec.NewHybridCodec(amino) +) + +func init() { + RegisterCodec(amino) + codec.RegisterCrypto(amino) + amino.Seal() } diff --git a/x/ibc/03-connection/client/rest/rest.go b/x/ibc/03-connection/client/rest/rest.go index a3d3c5613de1..7d1a42f73b70 100644 --- a/x/ibc/03-connection/client/rest/rest.go +++ b/x/ibc/03-connection/client/rest/rest.go @@ -5,7 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/types/rest" - commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" + commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" ) const ( @@ -21,42 +21,42 @@ func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, queryRoute string) // ConnectionOpenInitReq defines the properties of a connection open init request's body. type ConnectionOpenInitReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - ConnectionID string `json:"connection_id" yaml:"connection_id"` - ClientID string `json:"client_id" yaml:"client_id"` - CounterpartyClientID string `json:"counterparty_client_id" yaml:"counterparty_client_id"` - CounterpartyConnectionID string `json:"counterparty_connection_id" yaml:"counterparty_connection_id"` - CounterpartyPrefix commitmentexported.Prefix `json:"counterparty_prefix" yaml:"counterparty_prefix"` + BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` + ConnectionID string `json:"connection_id" yaml:"connection_id"` + ClientID string `json:"client_id" yaml:"client_id"` + CounterpartyClientID string `json:"counterparty_client_id" yaml:"counterparty_client_id"` + CounterpartyConnectionID string `json:"counterparty_connection_id" yaml:"counterparty_connection_id"` + CounterpartyPrefix commitmenttypes.MerklePrefix `json:"counterparty_prefix" yaml:"counterparty_prefix"` } // ConnectionOpenTryReq defines the properties of a connection open try request's body. type ConnectionOpenTryReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - ConnectionID string `json:"connection_id" yaml:"connection_id"` - ClientID string `json:"client_id" yaml:"client_id"` - CounterpartyClientID string `json:"counterparty_client_id" yaml:"counterparty_client_id"` - CounterpartyConnectionID string `json:"counterparty_connection_id" yaml:"counterparty_connection_id"` - CounterpartyPrefix commitmentexported.Prefix `json:"counterparty_prefix" yaml:"counterparty_prefix"` - CounterpartyVersions []string `json:"counterparty_versions" yaml:"counterparty_versions"` - ProofInit commitmentexported.Proof `json:"proof_init" yaml:"proof_init"` - ProofConsensus commitmentexported.Proof `json:"proof_consensus" yaml:"proof_consensus"` - ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` - ConsensusHeight uint64 `json:"consensus_height" yaml:"consensus_height"` + BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` + ConnectionID string `json:"connection_id" yaml:"connection_id"` + ClientID string `json:"client_id" yaml:"client_id"` + CounterpartyClientID string `json:"counterparty_client_id" yaml:"counterparty_client_id"` + CounterpartyConnectionID string `json:"counterparty_connection_id" yaml:"counterparty_connection_id"` + CounterpartyPrefix commitmenttypes.MerklePrefix `json:"counterparty_prefix" yaml:"counterparty_prefix"` + CounterpartyVersions []string `json:"counterparty_versions" yaml:"counterparty_versions"` + ProofInit commitmenttypes.MerkleProof `json:"proof_init" yaml:"proof_init"` + ProofConsensus commitmenttypes.MerkleProof `json:"proof_consensus" yaml:"proof_consensus"` + ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` + ConsensusHeight uint64 `json:"consensus_height" yaml:"consensus_height"` } // ConnectionOpenAckReq defines the properties of a connection open ack request's body. type ConnectionOpenAckReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - ProofTry commitmentexported.Proof `json:"proof_try" yaml:"proof_try"` - ProofConsensus commitmentexported.Proof `json:"proof_consensus" yaml:"proof_consensus"` - ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` - ConsensusHeight uint64 `json:"consensus_height" yaml:"consensus_height"` - Version string `json:"version" yaml:"version"` + BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` + ProofTry commitmenttypes.MerkleProof `json:"proof_try" yaml:"proof_try"` + ProofConsensus commitmenttypes.MerkleProof `json:"proof_consensus" yaml:"proof_consensus"` + ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` + ConsensusHeight uint64 `json:"consensus_height" yaml:"consensus_height"` + Version string `json:"version" yaml:"version"` } // ConnectionOpenConfirmReq defines the properties of a connection open confirm request's body. type ConnectionOpenConfirmReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - ProofAck commitmentexported.Proof `json:"proof_ack" yaml:"proof_ack"` - ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` + BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` + ProofAck commitmenttypes.MerkleProof `json:"proof_ack" yaml:"proof_ack"` + ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` } diff --git a/x/ibc/03-connection/exported/exported.go b/x/ibc/03-connection/exported/exported.go index afd7f8f0c065..b4aaca158764 100644 --- a/x/ibc/03-connection/exported/exported.go +++ b/x/ibc/03-connection/exported/exported.go @@ -1,14 +1,13 @@ package exported import ( - "encoding/json" - commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" + ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) // ConnectionI describes the required methods for a connection. type ConnectionI interface { - GetState() State + GetState() ibctypes.State GetID() string GetClientID() string GetCounterparty() CounterpartyI @@ -23,68 +22,3 @@ type CounterpartyI interface { GetPrefix() commitmentexported.Prefix ValidateBasic() error } - -// State defines the state of a connection between two disctinct -// chains -type State byte - -// available connection states -const ( - UNINITIALIZED State = iota // default State - INIT - TRYOPEN - OPEN -) - -// string representation of the connection states -const ( - StateUninitialized string = "UNINITIALIZED" - StateInit string = "INIT" - StateTryOpen string = "TRYOPEN" - StateOpen string = "OPEN" -) - -// String implements the Stringer interface -func (s State) String() string { - switch s { - case INIT: - return StateInit - case TRYOPEN: - return StateTryOpen - case OPEN: - return StateOpen - default: - return StateUninitialized - } -} - -// StateFromString parses a string into a connection state -func StateFromString(state string) State { - switch state { - case StateInit: - return INIT - case StateTryOpen: - return TRYOPEN - case StateOpen: - return OPEN - default: - return UNINITIALIZED - } -} - -// MarshalJSON marshal to JSON using string. -func (s State) MarshalJSON() ([]byte, error) { - return json.Marshal(s.String()) -} - -// UnmarshalJSON decodes from JSON assuming Bech32 encoding. -func (s *State) UnmarshalJSON(data []byte) error { - var str string - err := json.Unmarshal(data, &str) - if err != nil { - return err - } - - *s = StateFromString(str) - return nil -} diff --git a/x/ibc/03-connection/exported/exported_test.go b/x/ibc/03-connection/exported/exported_test.go deleted file mode 100644 index c45dfe6cca2b..000000000000 --- a/x/ibc/03-connection/exported/exported_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package exported - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestConnectionStateString(t *testing.T) { - cases := []struct { - name string - state State - }{ - {StateUninitialized, UNINITIALIZED}, - {StateInit, INIT}, - {StateTryOpen, TRYOPEN}, - {StateOpen, OPEN}, - } - - for _, tt := range cases { - tt := tt - require.Equal(t, tt.state, StateFromString(tt.name)) - require.Equal(t, tt.name, tt.state.String()) - } -} - -func TestConnectionlStateMarshalJSON(t *testing.T) { - cases := []struct { - name string - state State - }{ - {StateUninitialized, UNINITIALIZED}, - {StateInit, INIT}, - {StateTryOpen, TRYOPEN}, - {StateOpen, OPEN}, - } - - for _, tt := range cases { - tt := tt - bz, err := tt.state.MarshalJSON() - require.NoError(t, err) - var state State - require.NoError(t, state.UnmarshalJSON(bz)) - require.Equal(t, tt.name, state.String()) - } -} diff --git a/x/ibc/03-connection/keeper/handshake.go b/x/ibc/03-connection/keeper/handshake.go index 4cf0ff2a28b6..64cac7628b51 100644 --- a/x/ibc/03-connection/keeper/handshake.go +++ b/x/ibc/03-connection/keeper/handshake.go @@ -7,9 +7,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" - "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" + commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) @@ -28,7 +28,7 @@ func (k Keeper) ConnOpenInit( } // connection defines chain A's ConnectionEnd - connection := types.NewConnectionEnd(exported.INIT, connectionID, clientID, counterparty, types.GetCompatibleVersions()) + connection := types.NewConnectionEnd(ibctypes.INIT, connectionID, clientID, counterparty, types.GetCompatibleVersions()) k.SetConnection(ctx, connectionID, connection) if err := k.addConnectionToClient(ctx, clientID, connectionID); err != nil { @@ -68,15 +68,15 @@ func (k Keeper) ConnOpenTry( // expectedConnection defines Chain A's ConnectionEnd // NOTE: chain A's counterparty is chain B (i.e where this code is executed) prefix := k.GetCommitmentPrefix() - expectedCounterparty := types.NewCounterparty(clientID, connectionID, prefix) - expectedConnection := types.NewConnectionEnd(exported.INIT, counterparty.ConnectionID, counterparty.ClientID, expectedCounterparty, counterpartyVersions) + expectedCounterparty := types.NewCounterparty(clientID, connectionID, commitmenttypes.NewMerklePrefix(prefix.Bytes())) + expectedConnection := types.NewConnectionEnd(ibctypes.INIT, counterparty.ConnectionID, counterparty.ClientID, expectedCounterparty, counterpartyVersions) // chain B picks a version from Chain A's available versions that is compatible // with the supported IBC versions version := types.PickVersion(counterpartyVersions, types.GetCompatibleVersions()) // connection defines chain B's ConnectionEnd - connection := types.NewConnectionEnd(exported.UNINITIALIZED, connectionID, clientID, counterparty, []string{version}) + connection := types.NewConnectionEnd(ibctypes.UNINITIALIZED, connectionID, clientID, counterparty, []string{version}) // Check that ChainA committed expectedConnectionEnd to its state if err := k.VerifyConnectionState( @@ -97,7 +97,7 @@ func (k Keeper) ConnOpenTry( // is chainA and connection is on INIT stage // Check that existing connection version is on desired version of current handshake previousConnection, found := k.GetConnection(ctx, connectionID) - if found && !(previousConnection.State == exported.INIT && + if found && !(previousConnection.State == ibctypes.INIT && previousConnection.Counterparty.ConnectionID == counterparty.ConnectionID && bytes.Equal(previousConnection.Counterparty.Prefix.Bytes(), counterparty.Prefix.Bytes()) && previousConnection.ClientID == clientID && @@ -107,7 +107,7 @@ func (k Keeper) ConnOpenTry( } // Set connection state to TRYOPEN and store in chainB state - connection.State = exported.TRYOPEN + connection.State = ibctypes.TRYOPEN if err := k.addConnectionToClient(ctx, clientID, connectionID); err != nil { return sdkerrors.Wrap(err, "cannot relay connection attempt") } @@ -142,7 +142,7 @@ func (k Keeper) ConnOpenAck( } // Check connection on ChainA is on correct state: INIT - if connection.State != exported.INIT { + if connection.State != ibctypes.INIT { return sdkerrors.Wrapf( types.ErrInvalidConnectionState, "connection state is not INIT (got %s)", connection.State.String(), @@ -164,8 +164,8 @@ func (k Keeper) ConnOpenAck( } prefix := k.GetCommitmentPrefix() - expectedCounterparty := types.NewCounterparty(connection.ClientID, connectionID, prefix) - expectedConnection := types.NewConnectionEnd(exported.TRYOPEN, connection.Counterparty.ConnectionID, connection.Counterparty.ClientID, expectedCounterparty, []string{version}) + expectedCounterparty := types.NewCounterparty(connection.ClientID, connectionID, commitmenttypes.NewMerklePrefix(prefix.Bytes())) + expectedConnection := types.NewConnectionEnd(ibctypes.TRYOPEN, connection.Counterparty.ConnectionID, connection.Counterparty.ClientID, expectedCounterparty, []string{version}) // Ensure that ChainB stored expected connectionEnd in its state during ConnOpenTry if err := k.VerifyConnectionState( @@ -183,7 +183,7 @@ func (k Keeper) ConnOpenAck( } // Update connection state to Open - connection.State = exported.OPEN + connection.State = ibctypes.OPEN connection.Versions = []string{version} k.SetConnection(ctx, connectionID, connection) k.Logger(ctx).Info(fmt.Sprintf("connection %s state updated: INIT -> OPEN ", connectionID)) @@ -207,7 +207,7 @@ func (k Keeper) ConnOpenConfirm( } // Check that connection state on ChainB is on state: TRYOPEN - if connection.State != exported.TRYOPEN { + if connection.State != ibctypes.TRYOPEN { return sdkerrors.Wrapf( types.ErrInvalidConnectionState, "connection state is not TRYOPEN (got %s)", connection.State.String(), @@ -215,8 +215,8 @@ func (k Keeper) ConnOpenConfirm( } prefix := k.GetCommitmentPrefix() - expectedCounterparty := types.NewCounterparty(connection.ClientID, connectionID, prefix) - expectedConnection := types.NewConnectionEnd(exported.OPEN, connection.Counterparty.ConnectionID, connection.Counterparty.ClientID, expectedCounterparty, connection.Versions) + expectedCounterparty := types.NewCounterparty(connection.ClientID, connectionID, commitmenttypes.NewMerklePrefix(prefix.Bytes())) + expectedConnection := types.NewConnectionEnd(ibctypes.OPEN, connection.Counterparty.ConnectionID, connection.Counterparty.ClientID, expectedCounterparty, connection.Versions) // Check that connection on ChainA is open if err := k.VerifyConnectionState( @@ -227,7 +227,7 @@ func (k Keeper) ConnOpenConfirm( } // Update ChainB's connection to Open - connection.State = exported.OPEN + connection.State = ibctypes.OPEN k.SetConnection(ctx, connectionID, connection) k.Logger(ctx).Info(fmt.Sprintf("connection %s state updated: TRYOPEN -> OPEN ", connectionID)) return nil diff --git a/x/ibc/03-connection/keeper/handshake_test.go b/x/ibc/03-connection/keeper/handshake_test.go index 6c78915e842a..ccd2071f0b2d 100644 --- a/x/ibc/03-connection/keeper/handshake_test.go +++ b/x/ibc/03-connection/keeper/handshake_test.go @@ -4,7 +4,7 @@ import ( "fmt" connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" - "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" + commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) @@ -20,12 +20,12 @@ func (suite *KeeperTestSuite) TestConnOpenInit() { suite.chainA.CreateClient(suite.chainB) }, true}, {"connection already exists", func() { - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, exported.INIT) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.INIT) }, false}, {"couldn't add connection to client", func() {}, false}, } - counterparty := connection.NewCounterparty(testClientIDB, testConnectionIDB, suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix()) + counterparty := connection.NewCounterparty(testClientIDB, testConnectionIDB, commitmenttypes.NewMerklePrefix(suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes())) for i, tc := range testCases { tc := tc @@ -50,7 +50,7 @@ func (suite *KeeperTestSuite) TestConnOpenInit() { func (suite *KeeperTestSuite) TestConnOpenTry() { // counterparty for A on B counterparty := connection.NewCounterparty( - testClientIDB, testConnectionIDA, suite.chainB.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix(), + testClientIDB, testConnectionIDA, commitmenttypes.NewMerklePrefix(suite.chainB.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes()), ) testCases := []struct { @@ -61,12 +61,12 @@ func (suite *KeeperTestSuite) TestConnOpenTry() { {"success", func() uint64 { suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, exported.INIT) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, ibctypes.INIT) suite.chainB.updateClient(suite.chainA) suite.chainA.updateClient(suite.chainB) suite.chainB.updateClient(suite.chainA) suite.chainA.updateClient(suite.chainB) - return uint64(suite.chainB.Header.Height - 1) + return suite.chainB.Header.GetHeight() - 1 }, true}, {"consensus height > latest height", func() uint64 { return 0 @@ -78,29 +78,29 @@ func (suite *KeeperTestSuite) TestConnOpenTry() { {"connection state verification invalid", func() uint64 { suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, exported.UNINITIALIZED) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, ibctypes.UNINITIALIZED) suite.chainB.updateClient(suite.chainA) return 0 }, false}, {"consensus state verification invalid", func() uint64 { suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, exported.INIT) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, ibctypes.INIT) suite.chainB.updateClient(suite.chainA) suite.chainA.updateClient(suite.chainB) - return uint64(suite.chainB.Header.Height) + return suite.chainB.Header.GetHeight() }, false}, {"invalid previous connection", func() uint64 { suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) - suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, exported.UNINITIALIZED) + suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, ibctypes.UNINITIALIZED) suite.chainB.updateClient(suite.chainA) suite.chainA.updateClient(suite.chainB) return 0 }, false}, {"couldn't add connection to client", func() uint64 { suite.chainB.CreateClient(suite.chainA) - suite.chainA.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, exported.UNINITIALIZED) + suite.chainA.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, ibctypes.UNINITIALIZED) suite.chainB.updateClient(suite.chainA) suite.chainA.updateClient(suite.chainB) return 0 @@ -150,11 +150,11 @@ func (suite *KeeperTestSuite) TestConnOpenAck() { {"success", version, func() uint64 { suite.chainA.CreateClient(suite.chainB) suite.chainB.CreateClient(suite.chainA) - suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, exported.TRYOPEN) - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, exported.INIT) + suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, ibctypes.TRYOPEN) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, ibctypes.INIT) suite.chainB.updateClient(suite.chainA) suite.chainA.updateClient(suite.chainB) - return uint64(suite.chainB.Header.Height) + return suite.chainB.Header.GetHeight() }, true}, {"consensus height > latest height", version, func() uint64 { return 10 @@ -163,38 +163,38 @@ func (suite *KeeperTestSuite) TestConnOpenAck() { return 2 }, false}, {"connection state is not INIT", version, func() uint64 { - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, exported.UNINITIALIZED) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.UNINITIALIZED) suite.chainB.updateClient(suite.chainA) - return uint64(suite.chainB.Header.Height) + return suite.chainB.Header.GetHeight() }, false}, {"incompatible IBC versions", "2.0", func() uint64 { - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, exported.INIT) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.INIT) suite.chainB.updateClient(suite.chainA) - return uint64(suite.chainB.Header.Height) + return suite.chainB.Header.GetHeight() }, false}, {"self consensus state not found", version, func() uint64 { suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, exported.INIT) - suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, exported.TRYOPEN) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, ibctypes.INIT) + suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, ibctypes.TRYOPEN) suite.chainB.updateClient(suite.chainA) - return uint64(suite.chainB.Header.Height) + return suite.chainB.Header.GetHeight() }, false}, {"connection state verification failed", version, func() uint64 { suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, exported.INIT) - suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, exported.UNINITIALIZED) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, ibctypes.INIT) + suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, ibctypes.UNINITIALIZED) suite.chainB.updateClient(suite.chainA) - return uint64(suite.chainB.Header.Height) + return suite.chainB.Header.GetHeight() }, false}, {"consensus state verification failed", version, func() uint64 { suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, exported.INIT) - suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, exported.UNINITIALIZED) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, ibctypes.INIT) + suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, ibctypes.UNINITIALIZED) suite.chainB.updateClient(suite.chainA) - return uint64(suite.chainB.Header.Height) + return suite.chainB.Header.GetHeight() }, false}, } @@ -233,22 +233,22 @@ func (suite *KeeperTestSuite) TestConnOpenConfirm() { {"success", func() { suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, exported.OPEN) - suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, exported.TRYOPEN) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, ibctypes.TRYOPEN) suite.chainB.updateClient(suite.chainA) }, true}, {"connection not found", func() {}, false}, {"chain B's connection state is not TRYOPEN", func() { - suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, exported.UNINITIALIZED) - suite.chainA.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, exported.OPEN) + suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, ibctypes.UNINITIALIZED) + suite.chainA.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, ibctypes.OPEN) suite.chainA.updateClient(suite.chainB) }, false}, {"connection state verification failed", func() { suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) suite.chainB.updateClient(suite.chainA) - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, exported.INIT) - suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, exported.TRYOPEN) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.INIT) + suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, ibctypes.TRYOPEN) suite.chainA.updateClient(suite.chainA) }, false}, } diff --git a/x/ibc/03-connection/keeper/keeper_test.go b/x/ibc/03-connection/keeper/keeper_test.go index c02629ceafb8..7174b585eb02 100644 --- a/x/ibc/03-connection/keeper/keeper_test.go +++ b/x/ibc/03-connection/keeper/keeper_test.go @@ -17,7 +17,6 @@ import ( clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" - channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" @@ -90,8 +89,8 @@ func (suite *KeeperTestSuite) TestSetAndGetConnection() { _, existed := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetConnection(suite.chainA.GetContext(), testConnectionIDA) suite.Require().False(existed) - counterparty := types.NewCounterparty(testClientIDA, testConnectionIDA, suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix()) - expConn := types.NewConnectionEnd(exported.INIT, testConnectionIDB, testClientIDB, counterparty, types.GetCompatibleVersions()) + counterparty := types.NewCounterparty(testClientIDA, testConnectionIDA, commitmenttypes.NewMerklePrefix(suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes())) + expConn := types.NewConnectionEnd(ibctypes.INIT, testConnectionIDB, testClientIDB, counterparty, types.GetCompatibleVersions()) suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), testConnectionIDA, expConn) conn, existed := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetConnection(suite.chainA.GetContext(), testConnectionIDA) suite.Require().True(existed) @@ -110,13 +109,13 @@ func (suite *KeeperTestSuite) TestSetAndGetClientConnectionPaths() { func (suite KeeperTestSuite) TestGetAllConnections() { // Connection (Counterparty): A(C) -> C(B) -> B(A) - counterparty1 := types.NewCounterparty(testClientIDA, testConnectionIDA, suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix()) - counterparty2 := types.NewCounterparty(testClientIDB, testConnectionIDB, suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix()) - counterparty3 := types.NewCounterparty(testClientID3, testConnectionID3, suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix()) + counterparty1 := types.NewCounterparty(testClientIDA, testConnectionIDA, commitmenttypes.NewMerklePrefix(suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes())) + counterparty2 := types.NewCounterparty(testClientIDB, testConnectionIDB, commitmenttypes.NewMerklePrefix(suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes())) + counterparty3 := types.NewCounterparty(testClientID3, testConnectionID3, commitmenttypes.NewMerklePrefix(suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes())) - conn1 := types.NewConnectionEnd(exported.INIT, testConnectionIDA, testClientIDA, counterparty3, types.GetCompatibleVersions()) - conn2 := types.NewConnectionEnd(exported.INIT, testConnectionIDB, testClientIDB, counterparty1, types.GetCompatibleVersions()) - conn3 := types.NewConnectionEnd(exported.UNINITIALIZED, testConnectionID3, testClientID3, counterparty2, types.GetCompatibleVersions()) + conn1 := types.NewConnectionEnd(ibctypes.INIT, testConnectionIDA, testClientIDA, counterparty3, types.GetCompatibleVersions()) + conn2 := types.NewConnectionEnd(ibctypes.INIT, testConnectionIDB, testClientIDB, counterparty1, types.GetCompatibleVersions()) + conn3 := types.NewConnectionEnd(ibctypes.UNINITIALIZED, testConnectionID3, testClientID3, counterparty2, types.GetCompatibleVersions()) expConnections := []types.ConnectionEnd{conn1, conn2, conn3} @@ -226,7 +225,7 @@ func NewTestChain(clientID string) *TestChain { // Creates simple context for testing purposes func (chain *TestChain) GetContext() sdk.Context { - return chain.App.BaseApp.NewContext(false, tmproto.Header{ChainID: chain.Header.ChainID, Height: chain.Header.Height}) + return chain.App.BaseApp.NewContext(false, tmproto.Header{ChainID: chain.Header.SignedHeader.Header.ChainID, Height: chain.Header.SignedHeader.Header.Height}) } // createClient will create a client for clientChain on targetChain @@ -235,7 +234,7 @@ func (chain *TestChain) CreateClient(client *TestChain) error { // Commit and create a new block on appTarget to get a fresh CommitID client.App.Commit() commitID := client.App.LastCommitID() - client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.Height, Time: client.Header.Time}}) + client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.SignedHeader.Header.Height, Time: client.Header.GetTime()}}) // Set HistoricalInfo on client chain after Commit ctxClient := client.GetContext() @@ -247,12 +246,12 @@ func (chain *TestChain) CreateClient(client *TestChain) error { validators := []staking.Validator{validator} histInfo := staking.HistoricalInfo{ Header: tmproto.Header{ - Time: client.Header.Time, + Time: client.Header.GetTime(), AppHash: commitID.Hash, }, Valset: validators, } - client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.Height, histInfo) + client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.SignedHeader.Header.Height, histInfo) // also set staking params stakingParams := staking.DefaultParams() @@ -309,7 +308,7 @@ func (chain *TestChain) updateClient(client *TestChain) { } */ - client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.Height, Time: client.Header.Time}}) + client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.SignedHeader.Header.Height, Time: client.Header.GetTime()}}) // Set HistoricalInfo on client chain after Commit ctxClient := client.GetContext() @@ -321,22 +320,27 @@ func (chain *TestChain) updateClient(client *TestChain) { validators := []staking.Validator{validator} histInfo := staking.HistoricalInfo{ Header: tmproto.Header{ - Time: client.Header.Time, + Time: client.Header.GetTime(), AppHash: commitID.Hash, }, Valset: validators, } - client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.Height, histInfo) + client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.SignedHeader.Header.Height, histInfo) + + protoValset, err := client.Vals.ToProto() + if err != nil { + panic(err) + } consensusState := ibctmtypes.ConsensusState{ - Height: uint64(client.Header.Height), - Timestamp: client.Header.Time, + Height: client.Header.GetHeight(), + Timestamp: client.Header.GetTime(), Root: commitmenttypes.NewMerkleRoot(commitID.Hash), - ValidatorSet: client.Vals, + ValidatorSet: protoValset, } chain.App.IBCKeeper.ClientKeeper.SetClientConsensusState( - ctxTarget, client.ClientID, uint64(client.Header.Height), consensusState, + ctxTarget, client.ClientID, client.Header.GetHeight(), consensusState, ) chain.App.IBCKeeper.ClientKeeper.SetClientState( ctxTarget, ibctmtypes.NewClientState(client.ClientID, trustingPeriod, ubdPeriod, maxClockDrift, client.Header), @@ -357,9 +361,9 @@ func (chain *TestChain) updateClient(client *TestChain) { func (chain *TestChain) createConnection( connID, counterpartyConnID, clientID, counterpartyClientID string, - state exported.State, + state ibctypes.State, ) types.ConnectionEnd { - counterparty := types.NewCounterparty(counterpartyClientID, counterpartyConnID, chain.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix()) + counterparty := types.NewCounterparty(counterpartyClientID, counterpartyConnID, commitmenttypes.NewMerklePrefix(chain.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes())) connection := types.ConnectionEnd{ State: state, ID: connID, @@ -374,20 +378,21 @@ func (chain *TestChain) createConnection( func (chain *TestChain) createChannel( portID, channelID, counterpartyPortID, counterpartyChannelID string, - state channelexported.State, order channelexported.Order, connectionID string, + state ibctypes.State, order ibctypes.Order, connectionID string, ) channeltypes.Channel { counterparty := channeltypes.NewCounterparty(counterpartyPortID, counterpartyChannelID) - channel := channeltypes.NewChannel(state, order, counterparty, - []string{connectionID}, "1.0", - ) + channel := channeltypes.NewChannel(state, order, counterparty, []string{connectionID}, "1.0") ctx := chain.GetContext() chain.App.IBCKeeper.ChannelKeeper.SetChannel(ctx, portID, channelID, channel) return channel } func nextHeader(chain *TestChain) ibctmtypes.Header { - return ibctmtypes.CreateTestHeader(chain.Header.ChainID, chain.Header.Height+1, - chain.Header.Time.Add(nextTimestamp), chain.Vals, chain.Signers) + return ibctmtypes.CreateTestHeader( + chain.Header.SignedHeader.Header.ChainID, + chain.Header.SignedHeader.Header.Height+1, + chain.Header.Time.Add(nextTimestamp), chain.Vals, chain.Signers, + ) } func prefixedClientKey(clientID string, key []byte) []byte { diff --git a/x/ibc/03-connection/keeper/verify_test.go b/x/ibc/03-connection/keeper/verify_test.go index 78f8e1e77f83..07906674647d 100644 --- a/x/ibc/03-connection/keeper/verify_test.go +++ b/x/ibc/03-connection/keeper/verify_test.go @@ -4,9 +4,7 @@ import ( "fmt" clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" - "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" - channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" @@ -24,10 +22,10 @@ func (suite *KeeperTestSuite) TestVerifyClientConsensusState() { // create connection on chainA to chainB counterparty := types.NewCounterparty( testClientIDA, testConnectionIDA, - suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix(), + commitmenttypes.NewMerklePrefix(suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes()), ) connection1 := types.NewConnectionEnd( - exported.UNINITIALIZED, testConnectionIDB, testClientIDB, counterparty, + ibctypes.UNINITIALIZED, testConnectionIDB, testClientIDB, counterparty, types.GetCompatibleVersions(), ) @@ -67,7 +65,7 @@ func (suite *KeeperTestSuite) TestVerifyClientConsensusState() { suite.chainA.updateClient(suite.chainB) // TODO: is this the right consensus height - consensusHeight := uint64(suite.chainA.Header.Height) + consensusHeight := suite.chainA.Header.GetHeight() consensusKey := prefixedClientKey(testClientIDA, ibctypes.KeyConsensusState(consensusHeight)) // get proof that chainB stored chainA' consensus state @@ -119,11 +117,11 @@ func (suite *KeeperTestSuite) TestVerifyConnectionState() { tc.malleate() // create and store connection on chain A - expectedConnection := suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, exported.OPEN) + expectedConnection := suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, ibctypes.OPEN) // // create expected connection // TODO: why is this commented - // expectedConnection := types.NewConnectionEnd(exported.INIT, testClientIDB, counterparty, []string{"1.0.0"}) + // expectedConnection := types.NewConnectionEnd(types.INIT, testClientIDB, counterparty, []string{"1.0.0"}) // perform a couple updates of chain A on chain B suite.chainB.updateClient(suite.chainA) @@ -136,7 +134,7 @@ func (suite *KeeperTestSuite) TestVerifyConnectionState() { // Create B's connection to A counterparty := types.NewCounterparty(testClientIDB, testConnectionIDB, commitmenttypes.NewMerklePrefix([]byte("ibc"))) - connection := types.NewConnectionEnd(exported.UNINITIALIZED, testConnectionIDA, testClientIDA, counterparty, []string{"1.0.0"}) + connection := types.NewConnectionEnd(ibctypes.UNINITIALIZED, testConnectionIDA, testClientIDA, counterparty, []string{"1.0.0"}) // Ensure chain B can verify connection exists in chain A err := suite.chainB.App.IBCKeeper.ConnectionKeeper.VerifyConnectionState( suite.chainB.GetContext(), connection, proofHeight+1, proof, testConnectionIDA, expectedConnection, @@ -157,11 +155,11 @@ func (suite *KeeperTestSuite) TestVerifyChannelState() { // create connection of chainB to pass into verify function counterparty := types.NewCounterparty( testClientIDB, testConnectionIDB, - suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix(), + commitmenttypes.NewMerklePrefix(suite.chainA.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes()), ) connection := types.NewConnectionEnd( - exported.UNINITIALIZED, testConnectionIDA, testClientIDA, counterparty, + ibctypes.UNINITIALIZED, testConnectionIDA, testClientIDA, counterparty, types.GetCompatibleVersions(), ) @@ -195,7 +193,7 @@ func (suite *KeeperTestSuite) TestVerifyChannelState() { // Create and store channel on chain A channel := suite.chainA.createChannel( testPort1, testChannel1, testPort2, testChannel2, - channelexported.OPEN, channelexported.ORDERED, testConnectionIDA, + ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA, ) // Update chainA client on chainB @@ -252,7 +250,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketCommitment() { tc.malleate() // Set PacketCommitment on chainA - connection := suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, exported.OPEN) + connection := suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) suite.chainA.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainA.GetContext(), testPort1, testChannel1, 1, commitmentBz) // Update ChainA client on chainB @@ -305,7 +303,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketAcknowledgement() { suite.SetupTest() // reset tc.malleate() - connection := suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, exported.OPEN) + connection := suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) suite.chainA.App.IBCKeeper.ChannelKeeper.SetPacketAcknowledgement(suite.chainA.GetContext(), testPort1, testChannel1, 1, channeltypes.CommitAcknowledgement(ack)) suite.chainB.updateClient(suite.chainA) @@ -355,7 +353,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketAcknowledgementAbsence() { suite.SetupTest() // reset tc.malleate() - connection := suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, exported.OPEN) + connection := suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) suite.chainB.updateClient(suite.chainA) proof, proofHeight := queryProof(suite.chainA, packetAckKey) @@ -403,7 +401,7 @@ func (suite *KeeperTestSuite) TestVerifyNextSequenceRecv() { suite.SetupTest() // reset tc.malleate() - connection := suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, exported.OPEN) + connection := suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceRecv(suite.chainA.GetContext(), testPort1, testChannel1, 1) suite.chainB.updateClient(suite.chainA) diff --git a/x/ibc/03-connection/types/codec.go b/x/ibc/03-connection/types/codec.go index 263ec4c3f4ae..24dbdcca8d25 100644 --- a/x/ibc/03-connection/types/codec.go +++ b/x/ibc/03-connection/types/codec.go @@ -5,24 +5,32 @@ import ( "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" ) -// SubModuleCdc defines the IBC connection codec. -var SubModuleCdc *codec.Codec - -// RegisterCodec registers the IBC connection types +// RegisterCodec registers the necessary x/ibc/03-connection interfaces and concrete types +// on the provided Amino codec. These types are used for Amino JSON serialization. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterInterface((*exported.ConnectionI)(nil), nil) cdc.RegisterInterface((*exported.CounterpartyI)(nil), nil) - cdc.RegisterConcrete(ConnectionEnd{}, "ibc/connection/ConnectionEnd", nil) + cdc.RegisterConcrete(ConnectionEnd{}, "ibc/connection/ConnectionEnd", nil) cdc.RegisterConcrete(MsgConnectionOpenInit{}, "ibc/connection/MsgConnectionOpenInit", nil) cdc.RegisterConcrete(MsgConnectionOpenTry{}, "ibc/connection/MsgConnectionOpenTry", nil) cdc.RegisterConcrete(MsgConnectionOpenAck{}, "ibc/connection/MsgConnectionOpenAck", nil) cdc.RegisterConcrete(MsgConnectionOpenConfirm{}, "ibc/connection/MsgConnectionOpenConfirm", nil) - - SetSubModuleCodec(cdc) } -// SetSubModuleCodec sets the ibc connection codec -func SetSubModuleCodec(cdc *codec.Codec) { - SubModuleCdc = cdc +var ( + amino = codec.New() + + // SubModuleCdc references the global x/ibc/03-connectionl module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding as Amino is + // still used for that purpose. + // + // The actual codec used for serialization should be provided to x/ibc/03-connectionl and + // defined at the application level. + SubModuleCdc = codec.NewHybridCodec(amino) +) + +func init() { + RegisterCodec(amino) + amino.Seal() } diff --git a/x/ibc/03-connection/types/connection.go b/x/ibc/03-connection/types/connection.go index 0c9adbaa13df..7a918b5dbd83 100644 --- a/x/ibc/03-connection/types/connection.go +++ b/x/ibc/03-connection/types/connection.go @@ -6,32 +6,15 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" + commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) -var _ exported.ConnectionI = ConnectionEnd{} - -// ICS03 - Connection Data Structures as defined in https://github.com/cosmos/ics/tree/master/spec/ics-003-connection-semantics#data-structures - -// ConnectionEnd defines a stateful object on a chain connected to another separate -// one. -// NOTE: there must only be 2 defined ConnectionEnds to establish a connection -// between two chains. -type ConnectionEnd struct { - State exported.State `json:"state" yaml:"state"` - ID string `json:"id" yaml:"id"` - ClientID string `json:"client_id" yaml:"client_id"` - - // Counterparty chain associated with this connection. - Counterparty Counterparty `json:"counterparty" yaml:"counterparty"` - // Version is utilised to determine encodings or protocols for channels or - // packets utilising this connection. - Versions []string `json:"versions" yaml:"versions"` -} +var _ exported.ConnectionI = (*ConnectionEnd)(nil) // NewConnectionEnd creates a new ConnectionEnd instance. -func NewConnectionEnd(state exported.State, connectionID, clientID string, counterparty Counterparty, versions []string) ConnectionEnd { +func NewConnectionEnd(state ibctypes.State, connectionID, clientID string, counterparty Counterparty, versions []string) ConnectionEnd { return ConnectionEnd{ State: state, ID: connectionID, @@ -42,7 +25,7 @@ func NewConnectionEnd(state exported.State, connectionID, clientID string, count } // GetState implements the Connection interface -func (c ConnectionEnd) GetState() exported.State { +func (c ConnectionEnd) GetState() ibctypes.State { return c.State } @@ -87,17 +70,10 @@ func (c ConnectionEnd) ValidateBasic() error { return c.Counterparty.ValidateBasic() } -var _ exported.CounterpartyI = Counterparty{} - -// Counterparty defines the counterparty chain associated with a connection end. -type Counterparty struct { - ClientID string `json:"client_id" yaml:"client_id"` - ConnectionID string `json:"connection_id" yaml:"connection_id"` - Prefix commitmentexported.Prefix `json:"prefix" yaml:"prefix"` -} +var _ exported.CounterpartyI = (*Counterparty)(nil) // NewCounterparty creates a new Counterparty instance. -func NewCounterparty(clientID, connectionID string, prefix commitmentexported.Prefix) Counterparty { +func NewCounterparty(clientID, connectionID string, prefix commitmenttypes.MerklePrefix) Counterparty { return Counterparty{ ClientID: clientID, ConnectionID: connectionID, @@ -117,7 +93,7 @@ func (c Counterparty) GetConnectionID() string { // GetPrefix implements the CounterpartyI interface func (c Counterparty) GetPrefix() commitmentexported.Prefix { - return c.Prefix + return &c.Prefix } // ValidateBasic performs a basic validation check of the identifiers and prefix @@ -138,7 +114,7 @@ func (c Counterparty) ValidateBasic() error { ).Error(), ) } - if c.Prefix == nil || len(c.Prefix.Bytes()) == 0 { + if c.Prefix.IsEmpty() { return sdkerrors.Wrap(ErrInvalidCounterparty, "invalid counterparty prefix") } return nil diff --git a/x/ibc/03-connection/types/connection_test.go b/x/ibc/03-connection/types/connection_test.go index aae3536ae2fb..faabbaf7ab11 100644 --- a/x/ibc/03-connection/types/connection_test.go +++ b/x/ibc/03-connection/types/connection_test.go @@ -5,8 +5,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" + ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) var ( @@ -24,32 +24,32 @@ func TestConnectionValidateBasic(t *testing.T) { }{ { "valid connection", - ConnectionEnd{exported.INIT, connectionID, clientID, Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []string{"1.0.0"}}, + ConnectionEnd{connectionID, clientID, []string{"1.0.0"}, ibctypes.INIT, Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, true, }, { "invalid connection id", - ConnectionEnd{exported.INIT, "connectionIDONE", clientID, Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []string{"1.0.0"}}, + ConnectionEnd{"connectionIDONE", clientID, []string{"1.0.0"}, ibctypes.INIT, Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, false, }, { "invalid client id", - ConnectionEnd{exported.INIT, connectionID, "ClientIDTwo", Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []string{"1.0.0"}}, + ConnectionEnd{connectionID, "clientID1", []string{"1.0.0"}, ibctypes.INIT, Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, false, }, { "empty versions", - ConnectionEnd{exported.INIT, connectionID, clientID, Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, nil}, + ConnectionEnd{connectionID, clientID, nil, ibctypes.INIT, Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, false, }, { "invalid version", - ConnectionEnd{exported.INIT, connectionID, clientID, Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []string{""}}, + ConnectionEnd{connectionID, clientID, []string{""}, ibctypes.INIT, Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, false, }, { "invalid counterparty", - ConnectionEnd{exported.INIT, connectionID, clientID, Counterparty{clientID2, connectionID2, nil}, []string{"1.0.0"}}, + ConnectionEnd{connectionID, clientID, []string{"1.0.0"}, ibctypes.INIT, Counterparty{clientID2, connectionID2, emptyPrefix}}, false, }, } @@ -72,10 +72,10 @@ func TestCounterpartyValidateBasic(t *testing.T) { counterparty Counterparty expPass bool }{ - {"valid counterparty", Counterparty{"clientidone", connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, true}, + {"valid counterparty", Counterparty{clientID, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, true}, {"invalid client id", Counterparty{"InvalidClient", "channelidone", commitmenttypes.NewMerklePrefix([]byte("prefix"))}, false}, - {"invalid connection id", Counterparty{"clientidone", "InvalidConnection", commitmenttypes.NewMerklePrefix([]byte("prefix"))}, false}, - {"invalid prefix", Counterparty{"clientidone", connectionID2, nil}, false}, + {"invalid connection id", Counterparty{clientID, "InvalidConnection", commitmenttypes.NewMerklePrefix([]byte("prefix"))}, false}, + {"invalid prefix", Counterparty{clientID, connectionID2, emptyPrefix}, false}, } for i, tc := range testCases { diff --git a/x/ibc/03-connection/types/msgs.go b/x/ibc/03-connection/types/msgs.go index 9fb96cc3734e..425c32d4e0d1 100644 --- a/x/ibc/03-connection/types/msgs.go +++ b/x/ibc/03-connection/types/msgs.go @@ -5,7 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" @@ -13,19 +12,10 @@ import ( var _ sdk.Msg = MsgConnectionOpenInit{} -// MsgConnectionOpenInit defines the msg sent by an account on Chain A to -// initialize a connection with Chain B. -type MsgConnectionOpenInit struct { - ConnectionID string `json:"connection_id"` - ClientID string `json:"client_id"` - Counterparty Counterparty `json:"counterparty"` - Signer sdk.AccAddress `json:"signer"` -} - // NewMsgConnectionOpenInit creates a new MsgConnectionOpenInit instance func NewMsgConnectionOpenInit( connectionID, clientID, counterpartyConnectionID, - counterpartyClientID string, counterpartyPrefix commitmentexported.Prefix, + counterpartyClientID string, counterpartyPrefix commitmenttypes.MerklePrefix, signer sdk.AccAddress, ) MsgConnectionOpenInit { counterparty := NewCounterparty(counterpartyClientID, counterpartyConnectionID, counterpartyPrefix) @@ -73,25 +63,11 @@ func (msg MsgConnectionOpenInit) GetSigners() []sdk.AccAddress { var _ sdk.Msg = MsgConnectionOpenTry{} -// MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a connection -// on Chain B. -type MsgConnectionOpenTry struct { - ConnectionID string `json:"connection_id"` - ClientID string `json:"client_id"` - Counterparty Counterparty `json:"counterparty"` - CounterpartyVersions []string `json:"counterparty_versions"` - ProofInit commitmentexported.Proof `json:"proof_init"` // proof of the initialization the connection on Chain A: `none -> INIT` - ProofConsensus commitmentexported.Proof `json:"proof_consensus"` // proof of client consensus state - ProofHeight uint64 `json:"proof_height"` - ConsensusHeight uint64 `json:"consensus_height"` - Signer sdk.AccAddress `json:"signer"` -} - // NewMsgConnectionOpenTry creates a new MsgConnectionOpenTry instance func NewMsgConnectionOpenTry( connectionID, clientID, counterpartyConnectionID, - counterpartyClientID string, counterpartyPrefix commitmentexported.Prefix, - counterpartyVersions []string, proofInit, proofConsensus commitmentexported.Proof, + counterpartyClientID string, counterpartyPrefix commitmenttypes.MerklePrefix, + counterpartyVersions []string, proofInit, proofConsensus commitmenttypes.MerkleProof, proofHeight, consensusHeight uint64, signer sdk.AccAddress, ) MsgConnectionOpenTry { counterparty := NewCounterparty(counterpartyClientID, counterpartyConnectionID, counterpartyPrefix) @@ -134,7 +110,7 @@ func (msg MsgConnectionOpenTry) ValidateBasic() error { return sdkerrors.Wrap(ibctypes.ErrInvalidVersion, "version can't be blank") } } - if msg.ProofInit == nil || msg.ProofConsensus == nil { + if msg.ProofInit.IsEmpty() || msg.ProofConsensus.IsEmpty() { return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof") } if err := msg.ProofInit.ValidateBasic(); err != nil { @@ -167,21 +143,9 @@ func (msg MsgConnectionOpenTry) GetSigners() []sdk.AccAddress { var _ sdk.Msg = MsgConnectionOpenAck{} -// MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to acknowledge -// the change of connection state to TRYOPEN on Chain B. -type MsgConnectionOpenAck struct { - ConnectionID string `json:"connection_id"` - ProofTry commitmentexported.Proof `json:"proof_try"` // proof for the change of the connection state on Chain B: `none -> TRYOPEN` - ProofConsensus commitmentexported.Proof `json:"proof_consensus"` // proof of client consensus state - ProofHeight uint64 `json:"proof_height"` - ConsensusHeight uint64 `json:"consensus_height"` - Version string `json:"version"` - Signer sdk.AccAddress `json:"signer"` -} - // NewMsgConnectionOpenAck creates a new MsgConnectionOpenAck instance func NewMsgConnectionOpenAck( - connectionID string, proofTry, proofConsensus commitmentexported.Proof, + connectionID string, proofTry, proofConsensus commitmenttypes.MerkleProof, proofHeight, consensusHeight uint64, version string, signer sdk.AccAddress, ) MsgConnectionOpenAck { @@ -214,7 +178,7 @@ func (msg MsgConnectionOpenAck) ValidateBasic() error { if strings.TrimSpace(msg.Version) == "" { return sdkerrors.Wrap(ibctypes.ErrInvalidVersion, "version can't be blank") } - if msg.ProofTry == nil || msg.ProofConsensus == nil { + if msg.ProofTry.IsEmpty() || msg.ProofConsensus.IsEmpty() { return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof") } if err := msg.ProofTry.ValidateBasic(); err != nil { @@ -247,18 +211,9 @@ func (msg MsgConnectionOpenAck) GetSigners() []sdk.AccAddress { var _ sdk.Msg = MsgConnectionOpenConfirm{} -// MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to acknowledge -// the change of connection state to OPEN on Chain A. -type MsgConnectionOpenConfirm struct { - ConnectionID string `json:"connection_id"` - ProofAck commitmentexported.Proof `json:"proof_ack"` // proof for the change of the connection state on Chain A: `INIT -> OPEN` - ProofHeight uint64 `json:"proof_height"` - Signer sdk.AccAddress `json:"signer"` -} - // NewMsgConnectionOpenConfirm creates a new MsgConnectionOpenConfirm instance func NewMsgConnectionOpenConfirm( - connectionID string, proofAck commitmentexported.Proof, proofHeight uint64, + connectionID string, proofAck commitmenttypes.MerkleProof, proofHeight uint64, signer sdk.AccAddress, ) MsgConnectionOpenConfirm { return MsgConnectionOpenConfirm{ @@ -284,7 +239,7 @@ func (msg MsgConnectionOpenConfirm) ValidateBasic() error { if err := host.DefaultConnectionIdentifierValidator(msg.ConnectionID); err != nil { return sdkerrors.Wrap(err, "invalid connection ID") } - if msg.ProofAck == nil { + if msg.ProofAck.IsEmpty() { return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof") } if err := msg.ProofAck.ValidateBasic(); err != nil { diff --git a/x/ibc/03-connection/types/msgs_test.go b/x/ibc/03-connection/types/msgs_test.go index 26c88868837f..bc542e1be405 100644 --- a/x/ibc/03-connection/types/msgs_test.go +++ b/x/ibc/03-connection/types/msgs_test.go @@ -16,6 +16,11 @@ import ( commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" ) +var ( + emptyPrefix = commitmenttypes.MerklePrefix{} + emptyProof = commitmenttypes.MerkleProof{Proof: nil} +) + type MsgTestSuite struct { suite.Suite @@ -56,7 +61,7 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenInit() { NewMsgConnectionOpenInit("ibcconntest", "test/iris", "connectiontotest", "clienttotest", prefix, signer), NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "test/conn1", "clienttotest", prefix, signer), NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "test/conn1", prefix, signer), - NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", nil, signer), + NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", emptyPrefix, signer), NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", prefix, nil), NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", prefix, signer), } @@ -94,12 +99,10 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenTry() { NewMsgConnectionOpenTry("ibcconntest", "test/iris", "connectiontotest", "clienttotest", prefix, []string{"1.0.0"}, suite.proof, suite.proof, 10, 10, signer), NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "ibc/test", "clienttotest", prefix, []string{"1.0.0"}, suite.proof, suite.proof, 10, 10, signer), NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "test/conn1", prefix, []string{"1.0.0"}, suite.proof, suite.proof, 10, 10, signer), - NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", nil, []string{"1.0.0"}, suite.proof, suite.proof, 10, 10, signer), + NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", emptyPrefix, []string{"1.0.0"}, suite.proof, suite.proof, 10, 10, signer), NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", prefix, []string{}, suite.proof, suite.proof, 10, 10, signer), - NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", prefix, []string{"1.0.0"}, nil, suite.proof, 10, 10, signer), - NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", prefix, []string{"1.0.0"}, commitmenttypes.MerkleProof{Proof: nil}, suite.proof, 10, 10, signer), - NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", prefix, []string{"1.0.0"}, suite.proof, nil, 10, 10, signer), - NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", prefix, []string{"1.0.0"}, suite.proof, commitmenttypes.MerkleProof{Proof: nil}, 10, 10, signer), + NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", prefix, []string{"1.0.0"}, emptyProof, suite.proof, 10, 10, signer), + NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", prefix, []string{"1.0.0"}, suite.proof, emptyProof, 10, 10, signer), NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", prefix, []string{"1.0.0"}, suite.proof, suite.proof, 0, 10, signer), NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", prefix, []string{"1.0.0"}, suite.proof, suite.proof, 10, 0, signer), NewMsgConnectionOpenTry("ibcconntest", "clienttotesta", "connectiontotest", "clienttotest", prefix, []string{"1.0.0"}, suite.proof, suite.proof, 10, 10, nil), @@ -118,13 +121,11 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenTry() { {testMsgs[4], false, "empty counterparty prefix"}, {testMsgs[5], false, "empty counterpartyVersions"}, {testMsgs[6], false, "empty proofInit"}, - {testMsgs[7], false, "empty proofInit"}, - {testMsgs[8], false, "empty proofConsensus"}, - {testMsgs[9], false, "empty proofConsensus"}, - {testMsgs[10], false, "invalid proofHeight"}, - {testMsgs[11], false, "invalid consensusHeight"}, - {testMsgs[12], false, "empty singer"}, - {testMsgs[13], true, "success"}, + {testMsgs[7], false, "empty proofConsensus"}, + {testMsgs[8], false, "invalid proofHeight"}, + {testMsgs[9], false, "invalid consensusHeight"}, + {testMsgs[10], false, "empty singer"}, + {testMsgs[11], true, "success"}, } for i, tc := range testCases { @@ -142,10 +143,8 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenAck() { testMsgs := []MsgConnectionOpenAck{ NewMsgConnectionOpenAck("test/conn1", suite.proof, suite.proof, 10, 10, "1.0.0", signer), - NewMsgConnectionOpenAck("ibcconntest", nil, suite.proof, 10, 10, "1.0.0", signer), - NewMsgConnectionOpenAck("ibcconntest", commitmenttypes.MerkleProof{Proof: nil}, suite.proof, 10, 10, "1.0.0", signer), - NewMsgConnectionOpenAck("ibcconntest", suite.proof, nil, 10, 10, "1.0.0", signer), - NewMsgConnectionOpenAck("ibcconntest", suite.proof, commitmenttypes.MerkleProof{Proof: nil}, 10, 10, "1.0.0", signer), + NewMsgConnectionOpenAck("ibcconntest", emptyProof, suite.proof, 10, 10, "1.0.0", signer), + NewMsgConnectionOpenAck("ibcconntest", suite.proof, emptyProof, 10, 10, "1.0.0", signer), NewMsgConnectionOpenAck("ibcconntest", suite.proof, suite.proof, 0, 10, "1.0.0", signer), NewMsgConnectionOpenAck("ibcconntest", suite.proof, suite.proof, 10, 0, "1.0.0", signer), NewMsgConnectionOpenAck("ibcconntest", suite.proof, suite.proof, 10, 10, "", signer), @@ -159,14 +158,12 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenAck() { }{ {testMsgs[0], false, "invalid connection ID"}, {testMsgs[1], false, "empty proofTry"}, - {testMsgs[2], false, "empty proofTry"}, - {testMsgs[3], false, "empty proofConsensus"}, - {testMsgs[4], false, "empty proofConsensus"}, - {testMsgs[5], false, "invalid proofHeight"}, - {testMsgs[6], false, "invalid consensusHeight"}, - {testMsgs[7], false, "invalid version"}, - {testMsgs[8], false, "empty signer"}, - {testMsgs[9], true, "success"}, + {testMsgs[2], false, "empty proofConsensus"}, + {testMsgs[3], false, "invalid proofHeight"}, + {testMsgs[4], false, "invalid consensusHeight"}, + {testMsgs[5], false, "invalid version"}, + {testMsgs[6], false, "empty signer"}, + {testMsgs[7], true, "success"}, } for i, tc := range testCases { @@ -184,8 +181,7 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenConfirm() { testMsgs := []MsgConnectionOpenConfirm{ NewMsgConnectionOpenConfirm("test/conn1", suite.proof, 10, signer), - NewMsgConnectionOpenConfirm("ibcconntest", nil, 10, signer), - NewMsgConnectionOpenConfirm("ibcconntest", commitmenttypes.MerkleProof{Proof: nil}, 10, signer), + NewMsgConnectionOpenConfirm("ibcconntest", emptyProof, 10, signer), NewMsgConnectionOpenConfirm("ibcconntest", suite.proof, 0, signer), NewMsgConnectionOpenConfirm("ibcconntest", suite.proof, 10, nil), NewMsgConnectionOpenConfirm("ibcconntest", suite.proof, 10, signer), @@ -198,10 +194,9 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenConfirm() { }{ {testMsgs[0], false, "invalid connection ID"}, {testMsgs[1], false, "empty proofTry"}, - {testMsgs[2], false, "empty proofTry"}, - {testMsgs[3], false, "invalid proofHeight"}, - {testMsgs[4], false, "empty signer"}, - {testMsgs[5], true, "success"}, + {testMsgs[2], false, "invalid proofHeight"}, + {testMsgs[3], false, "empty signer"}, + {testMsgs[4], true, "success"}, } for i, tc := range testCases { diff --git a/x/ibc/03-connection/types/types.pb.go b/x/ibc/03-connection/types/types.pb.go new file mode 100644 index 000000000000..2eaad499e3b4 --- /dev/null +++ b/x/ibc/03-connection/types/types.pb.go @@ -0,0 +1,2460 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/ibc/03-connection/types/types.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" + types1 "github.com/cosmos/cosmos-sdk/x/ibc/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgConnectionOpenInit defines the msg sent by an account on Chain A to +// initialize a connection with Chain B. +type MsgConnectionOpenInit struct { + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + ConnectionID string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + Counterparty Counterparty `protobuf:"bytes,3,opt,name=counterparty,proto3" json:"counterparty"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgConnectionOpenInit) Reset() { *m = MsgConnectionOpenInit{} } +func (m *MsgConnectionOpenInit) String() string { return proto.CompactTextString(m) } +func (*MsgConnectionOpenInit) ProtoMessage() {} +func (*MsgConnectionOpenInit) Descriptor() ([]byte, []int) { + return fileDescriptor_30ee50c03d1fbe43, []int{0} +} +func (m *MsgConnectionOpenInit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgConnectionOpenInit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgConnectionOpenInit.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 *MsgConnectionOpenInit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgConnectionOpenInit.Merge(m, src) +} +func (m *MsgConnectionOpenInit) XXX_Size() int { + return m.Size() +} +func (m *MsgConnectionOpenInit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgConnectionOpenInit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgConnectionOpenInit proto.InternalMessageInfo + +func (m *MsgConnectionOpenInit) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" +} + +func (m *MsgConnectionOpenInit) GetConnectionID() string { + if m != nil { + return m.ConnectionID + } + return "" +} + +func (m *MsgConnectionOpenInit) GetCounterparty() Counterparty { + if m != nil { + return m.Counterparty + } + return Counterparty{} +} + +func (m *MsgConnectionOpenInit) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +// MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a connection +// on Chain B. +type MsgConnectionOpenTry struct { + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + ConnectionID string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + Counterparty Counterparty `protobuf:"bytes,3,opt,name=counterparty,proto3" json:"counterparty"` + CounterpartyVersions []string `protobuf:"bytes,4,rep,name=counterparty_versions,json=counterpartyVersions,proto3" json:"counterparty_versions,omitempty"` + // proof of the initialization the connection on Chain A: `UNITIALIZED -> INIT` + ProofInit types.MerkleProof `protobuf:"bytes,5,opt,name=proof_init,json=proofInit,proto3" json:"proof_init"` + ProofHeight uint64 `protobuf:"varint,6,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` + // proof of client consensus state + ProofConsensus types.MerkleProof `protobuf:"bytes,7,opt,name=proof_consensus,json=proofConsensus,proto3" json:"proof_consensus"` + ConsensusHeight uint64 `protobuf:"varint,8,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height,omitempty"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,9,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgConnectionOpenTry) Reset() { *m = MsgConnectionOpenTry{} } +func (m *MsgConnectionOpenTry) String() string { return proto.CompactTextString(m) } +func (*MsgConnectionOpenTry) ProtoMessage() {} +func (*MsgConnectionOpenTry) Descriptor() ([]byte, []int) { + return fileDescriptor_30ee50c03d1fbe43, []int{1} +} +func (m *MsgConnectionOpenTry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgConnectionOpenTry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgConnectionOpenTry.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 *MsgConnectionOpenTry) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgConnectionOpenTry.Merge(m, src) +} +func (m *MsgConnectionOpenTry) XXX_Size() int { + return m.Size() +} +func (m *MsgConnectionOpenTry) XXX_DiscardUnknown() { + xxx_messageInfo_MsgConnectionOpenTry.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgConnectionOpenTry proto.InternalMessageInfo + +func (m *MsgConnectionOpenTry) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" +} + +func (m *MsgConnectionOpenTry) GetConnectionID() string { + if m != nil { + return m.ConnectionID + } + return "" +} + +func (m *MsgConnectionOpenTry) GetCounterparty() Counterparty { + if m != nil { + return m.Counterparty + } + return Counterparty{} +} + +func (m *MsgConnectionOpenTry) GetCounterpartyVersions() []string { + if m != nil { + return m.CounterpartyVersions + } + return nil +} + +func (m *MsgConnectionOpenTry) GetProofInit() types.MerkleProof { + if m != nil { + return m.ProofInit + } + return types.MerkleProof{} +} + +func (m *MsgConnectionOpenTry) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + +func (m *MsgConnectionOpenTry) GetProofConsensus() types.MerkleProof { + if m != nil { + return m.ProofConsensus + } + return types.MerkleProof{} +} + +func (m *MsgConnectionOpenTry) GetConsensusHeight() uint64 { + if m != nil { + return m.ConsensusHeight + } + return 0 +} + +func (m *MsgConnectionOpenTry) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +// MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to acknowledge +// the change of connection state to TRYOPEN on Chain B. +type MsgConnectionOpenAck struct { + ConnectionID string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + // proof of the initialization the connection on Chain B: `UNITIALIZED -> TRYOPEN` + ProofTry types.MerkleProof `protobuf:"bytes,3,opt,name=proof_try,json=proofTry,proto3" json:"proof_try"` + ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` + // proof of client consensus state + ProofConsensus types.MerkleProof `protobuf:"bytes,5,opt,name=proof_consensus,json=proofConsensus,proto3" json:"proof_consensus"` + ConsensusHeight uint64 `protobuf:"varint,6,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height,omitempty"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,7,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgConnectionOpenAck) Reset() { *m = MsgConnectionOpenAck{} } +func (m *MsgConnectionOpenAck) String() string { return proto.CompactTextString(m) } +func (*MsgConnectionOpenAck) ProtoMessage() {} +func (*MsgConnectionOpenAck) Descriptor() ([]byte, []int) { + return fileDescriptor_30ee50c03d1fbe43, []int{2} +} +func (m *MsgConnectionOpenAck) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgConnectionOpenAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgConnectionOpenAck.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 *MsgConnectionOpenAck) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgConnectionOpenAck.Merge(m, src) +} +func (m *MsgConnectionOpenAck) XXX_Size() int { + return m.Size() +} +func (m *MsgConnectionOpenAck) XXX_DiscardUnknown() { + xxx_messageInfo_MsgConnectionOpenAck.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgConnectionOpenAck proto.InternalMessageInfo + +func (m *MsgConnectionOpenAck) GetConnectionID() string { + if m != nil { + return m.ConnectionID + } + return "" +} + +func (m *MsgConnectionOpenAck) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *MsgConnectionOpenAck) GetProofTry() types.MerkleProof { + if m != nil { + return m.ProofTry + } + return types.MerkleProof{} +} + +func (m *MsgConnectionOpenAck) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + +func (m *MsgConnectionOpenAck) GetProofConsensus() types.MerkleProof { + if m != nil { + return m.ProofConsensus + } + return types.MerkleProof{} +} + +func (m *MsgConnectionOpenAck) GetConsensusHeight() uint64 { + if m != nil { + return m.ConsensusHeight + } + return 0 +} + +func (m *MsgConnectionOpenAck) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +// MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to acknowledge +// the change of connection state to OPEN on Chain A. +type MsgConnectionOpenConfirm struct { + ConnectionID string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + // proof for the change of the connection state on Chain A: `INIT -> OPEN` + ProofAck types.MerkleProof `protobuf:"bytes,2,opt,name=proof_ack,json=proofAck,proto3" json:"proof_ack"` + ProofHeight uint64 `protobuf:"varint,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgConnectionOpenConfirm) Reset() { *m = MsgConnectionOpenConfirm{} } +func (m *MsgConnectionOpenConfirm) String() string { return proto.CompactTextString(m) } +func (*MsgConnectionOpenConfirm) ProtoMessage() {} +func (*MsgConnectionOpenConfirm) Descriptor() ([]byte, []int) { + return fileDescriptor_30ee50c03d1fbe43, []int{3} +} +func (m *MsgConnectionOpenConfirm) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgConnectionOpenConfirm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgConnectionOpenConfirm.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 *MsgConnectionOpenConfirm) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgConnectionOpenConfirm.Merge(m, src) +} +func (m *MsgConnectionOpenConfirm) XXX_Size() int { + return m.Size() +} +func (m *MsgConnectionOpenConfirm) XXX_DiscardUnknown() { + xxx_messageInfo_MsgConnectionOpenConfirm.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgConnectionOpenConfirm proto.InternalMessageInfo + +func (m *MsgConnectionOpenConfirm) GetConnectionID() string { + if m != nil { + return m.ConnectionID + } + return "" +} + +func (m *MsgConnectionOpenConfirm) GetProofAck() types.MerkleProof { + if m != nil { + return m.ProofAck + } + return types.MerkleProof{} +} + +func (m *MsgConnectionOpenConfirm) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + +func (m *MsgConnectionOpenConfirm) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +// ConnectionEnd defines a stateful object on a chain connected to another separate +// one. +// NOTE: there must only be 2 defined ConnectionEnds to establish a connection +// between two chains. +type ConnectionEnd struct { + // connection identifier. + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` + // client associated with this connection. + ClientID string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` + // opaque string which can be utilised to determine encodings or protocols for + // channels or packets utilising this connection + Versions []string `protobuf:"bytes,3,rep,name=versions,proto3" json:"versions,omitempty"` + // current state of the connection end. + State types1.State `protobuf:"varint,4,opt,name=state,proto3,enum=cosmos_sdk.x.ibc.v1.State" json:"state,omitempty"` + // counterparty chain associated with this connection. + Counterparty Counterparty `protobuf:"bytes,5,opt,name=counterparty,proto3" json:"counterparty"` +} + +func (m *ConnectionEnd) Reset() { *m = ConnectionEnd{} } +func (m *ConnectionEnd) String() string { return proto.CompactTextString(m) } +func (*ConnectionEnd) ProtoMessage() {} +func (*ConnectionEnd) Descriptor() ([]byte, []int) { + return fileDescriptor_30ee50c03d1fbe43, []int{4} +} +func (m *ConnectionEnd) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConnectionEnd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConnectionEnd.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 *ConnectionEnd) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConnectionEnd.Merge(m, src) +} +func (m *ConnectionEnd) XXX_Size() int { + return m.Size() +} +func (m *ConnectionEnd) XXX_DiscardUnknown() { + xxx_messageInfo_ConnectionEnd.DiscardUnknown(m) +} + +var xxx_messageInfo_ConnectionEnd proto.InternalMessageInfo + +// Counterparty defines the counterparty chain associated with a connection end. +type Counterparty struct { + // identifies the client on the counterparty chain associated with a given connection. + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` + // identifies the connection end on the counterparty chain associated with a given connection. + ConnectionID string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"` + // commitment merkle prefix of the counterparty chain + Prefix types.MerklePrefix `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix"` +} + +func (m *Counterparty) Reset() { *m = Counterparty{} } +func (m *Counterparty) String() string { return proto.CompactTextString(m) } +func (*Counterparty) ProtoMessage() {} +func (*Counterparty) Descriptor() ([]byte, []int) { + return fileDescriptor_30ee50c03d1fbe43, []int{5} +} +func (m *Counterparty) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Counterparty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Counterparty.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 *Counterparty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Counterparty.Merge(m, src) +} +func (m *Counterparty) XXX_Size() int { + return m.Size() +} +func (m *Counterparty) XXX_DiscardUnknown() { + xxx_messageInfo_Counterparty.DiscardUnknown(m) +} + +var xxx_messageInfo_Counterparty proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgConnectionOpenInit)(nil), "cosmos_sdk.x.ibc.connection.v1.MsgConnectionOpenInit") + proto.RegisterType((*MsgConnectionOpenTry)(nil), "cosmos_sdk.x.ibc.connection.v1.MsgConnectionOpenTry") + proto.RegisterType((*MsgConnectionOpenAck)(nil), "cosmos_sdk.x.ibc.connection.v1.MsgConnectionOpenAck") + proto.RegisterType((*MsgConnectionOpenConfirm)(nil), "cosmos_sdk.x.ibc.connection.v1.MsgConnectionOpenConfirm") + proto.RegisterType((*ConnectionEnd)(nil), "cosmos_sdk.x.ibc.connection.v1.ConnectionEnd") + proto.RegisterType((*Counterparty)(nil), "cosmos_sdk.x.ibc.connection.v1.Counterparty") +} + +func init() { + proto.RegisterFile("x/ibc/03-connection/types/types.proto", fileDescriptor_30ee50c03d1fbe43) +} + +var fileDescriptor_30ee50c03d1fbe43 = []byte{ + // 744 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x3d, 0x6f, 0xd3, 0x40, + 0x18, 0x8e, 0xf3, 0xd5, 0xe4, 0x9a, 0x7e, 0xc8, 0xb4, 0xc2, 0xca, 0x60, 0x07, 0x23, 0x50, 0x2a, + 0xa8, 0xd3, 0x0f, 0xc1, 0x50, 0x89, 0xa1, 0x49, 0x91, 0x30, 0x52, 0xa1, 0x32, 0xa8, 0x43, 0x97, + 0x28, 0xb1, 0xaf, 0xc9, 0x29, 0xf5, 0x5d, 0xe4, 0xbb, 0x56, 0xcd, 0x3f, 0x60, 0x83, 0x1f, 0x80, + 0x04, 0x3f, 0x80, 0x1f, 0xd2, 0x81, 0xa1, 0x23, 0x93, 0x85, 0xd2, 0x9d, 0xa1, 0x23, 0x13, 0xf2, + 0xd9, 0xb1, 0xdd, 0x38, 0x94, 0xd2, 0x96, 0x81, 0x25, 0xf1, 0xdd, 0x3d, 0xf7, 0xbc, 0x1f, 0xcf, + 0xa3, 0xd7, 0x06, 0x0f, 0x8e, 0x6b, 0xa8, 0x6d, 0xd6, 0x56, 0xd6, 0x97, 0x4d, 0x82, 0x31, 0x34, + 0x19, 0x22, 0xb8, 0xc6, 0x06, 0x7d, 0x48, 0xfd, 0x5f, 0xad, 0xef, 0x10, 0x46, 0x44, 0xd9, 0x24, + 0xd4, 0x26, 0xb4, 0x49, 0xad, 0x9e, 0x76, 0xac, 0xa1, 0xb6, 0xa9, 0x45, 0x70, 0xed, 0x68, 0xb5, + 0xfc, 0x90, 0x75, 0x91, 0x63, 0x35, 0xfb, 0x2d, 0x87, 0x0d, 0x6a, 0xfc, 0x4a, 0xad, 0x43, 0x3a, + 0x24, 0x7a, 0xf2, 0x79, 0xca, 0x41, 0xb8, 0x35, 0x2f, 0x9c, 0x6d, 0x23, 0x66, 0x43, 0xcc, 0x92, + 0xe1, 0xca, 0x77, 0x7d, 0x58, 0xe2, 0x40, 0xfd, 0x98, 0x06, 0x8b, 0xdb, 0xb4, 0xd3, 0x08, 0x83, + 0xbf, 0xee, 0x43, 0xac, 0x63, 0xc4, 0xc4, 0x25, 0x50, 0x34, 0x0f, 0x10, 0xc4, 0xac, 0x89, 0x2c, + 0x49, 0xa8, 0x08, 0xd5, 0x62, 0xbd, 0x34, 0x74, 0x95, 0x42, 0x83, 0x6f, 0xea, 0x5b, 0x46, 0xc1, + 0x3f, 0xd6, 0x2d, 0xf1, 0x09, 0x98, 0x89, 0xb2, 0xf7, 0xe0, 0x69, 0x0e, 0x9f, 0x1f, 0xba, 0x4a, + 0x29, 0x62, 0xd6, 0xb7, 0x8c, 0x52, 0x04, 0xd3, 0x2d, 0x71, 0x17, 0x94, 0x4c, 0x72, 0x88, 0x19, + 0x74, 0x78, 0x99, 0x52, 0xa6, 0x22, 0x54, 0xa7, 0xd7, 0x1e, 0x6b, 0x97, 0xb7, 0x46, 0x6b, 0xc4, + 0xee, 0xd4, 0xb3, 0x27, 0xae, 0x92, 0x32, 0x2e, 0xf0, 0x88, 0x3a, 0xc8, 0x53, 0xd4, 0xc1, 0xd0, + 0x91, 0xb2, 0x15, 0xa1, 0x5a, 0xaa, 0xaf, 0xfe, 0x74, 0x95, 0xe5, 0x0e, 0x62, 0xdd, 0xc3, 0xb6, + 0x66, 0x12, 0xbb, 0xe6, 0xf3, 0x07, 0x7f, 0xcb, 0xd4, 0xea, 0x05, 0x1d, 0xd9, 0x34, 0xcd, 0x4d, + 0xcb, 0x72, 0x20, 0xa5, 0x46, 0x40, 0xa0, 0x7e, 0xcd, 0x82, 0x85, 0x44, 0x7b, 0xde, 0x3a, 0x83, + 0xff, 0xb8, 0x3b, 0xeb, 0x60, 0x31, 0xbe, 0x6e, 0x1e, 0x41, 0x87, 0x22, 0x82, 0xa9, 0x94, 0xad, + 0x64, 0xaa, 0x45, 0x63, 0x21, 0x7e, 0xb8, 0x1b, 0x9c, 0x89, 0x3b, 0x00, 0xf4, 0x1d, 0x42, 0xf6, + 0x9b, 0x08, 0x23, 0x26, 0xe5, 0x78, 0x2a, 0x8f, 0x26, 0xa5, 0x32, 0xf2, 0xa0, 0x97, 0xca, 0x36, + 0x74, 0x7a, 0x07, 0x70, 0xc7, 0xbb, 0x17, 0x64, 0x52, 0xe4, 0x24, 0xdc, 0x5e, 0xf7, 0x40, 0xc9, + 0x67, 0xec, 0x42, 0xd4, 0xe9, 0x32, 0x29, 0x5f, 0x11, 0xaa, 0x59, 0x63, 0x9a, 0xef, 0xbd, 0xe0, + 0x5b, 0xe2, 0x1e, 0x98, 0xf3, 0x21, 0x26, 0xc1, 0x14, 0x62, 0x7a, 0x48, 0xa5, 0xa9, 0xeb, 0x46, + 0x9e, 0xe5, 0x4c, 0x8d, 0x11, 0x91, 0xb8, 0x04, 0xe6, 0x43, 0xd6, 0x51, 0x0a, 0x05, 0x9e, 0xc2, + 0x5c, 0xb8, 0x1f, 0xa4, 0x11, 0xd9, 0xa9, 0x78, 0x53, 0x3b, 0x7d, 0xc9, 0x4c, 0xb0, 0xd3, 0xa6, + 0xd9, 0x4b, 0x7a, 0x44, 0xb8, 0x92, 0x47, 0x24, 0x30, 0x15, 0xc8, 0xe7, 0x9b, 0xca, 0x18, 0x2d, + 0xc5, 0x57, 0xc0, 0xef, 0x75, 0x93, 0x39, 0x23, 0xeb, 0x5c, 0xa3, 0x6b, 0x05, 0xce, 0xe1, 0xf9, + 0x7d, 0x5c, 0xae, 0xec, 0x95, 0xe4, 0xca, 0xfd, 0x4b, 0xb9, 0xf2, 0x7f, 0x92, 0x6b, 0xea, 0xa6, + 0x72, 0xbd, 0x4f, 0x03, 0x29, 0x21, 0x57, 0x83, 0xe0, 0x7d, 0xe4, 0xd8, 0xd7, 0x95, 0x2c, 0x14, + 0xa6, 0x65, 0xf6, 0xb8, 0x68, 0x37, 0x10, 0xc6, 0x73, 0xce, 0xb8, 0x30, 0x99, 0xa4, 0x30, 0xb7, + 0x38, 0x0f, 0x3f, 0xa5, 0xc1, 0x4c, 0x54, 0xdc, 0x73, 0x6c, 0x89, 0xf7, 0x41, 0x3a, 0xac, 0xfd, + 0xce, 0xd0, 0x55, 0xd2, 0xfa, 0xd6, 0xb9, 0xab, 0x14, 0x07, 0x2d, 0xfb, 0x60, 0x43, 0x45, 0x96, + 0x6a, 0xa4, 0x91, 0x25, 0x3e, 0x8b, 0x4f, 0x4b, 0x7f, 0xfc, 0x55, 0xe2, 0xd3, 0xf2, 0xdc, 0x55, + 0xe6, 0xfd, 0x1b, 0x21, 0x4c, 0x8d, 0x4d, 0xd0, 0x32, 0x28, 0x84, 0x53, 0x2a, 0xc3, 0xa7, 0x54, + 0xb8, 0x16, 0x57, 0x40, 0x8e, 0xb2, 0x16, 0x83, 0xbc, 0xb6, 0xd9, 0xb5, 0x72, 0xb2, 0x97, 0x47, + 0xab, 0xda, 0x1b, 0x0f, 0x61, 0xf8, 0xc0, 0xc4, 0x60, 0xcd, 0xdd, 0xce, 0x60, 0xdd, 0xc8, 0xbe, + 0xfb, 0xac, 0xa4, 0xd4, 0x1f, 0x02, 0x28, 0xc5, 0xa1, 0x17, 0x6b, 0x17, 0xfe, 0xba, 0xf6, 0xed, + 0xc9, 0x6f, 0x8f, 0xea, 0xb8, 0xcd, 0xce, 0x5d, 0x65, 0x21, 0xa0, 0x89, 0xc3, 0xd5, 0x31, 0xfb, + 0xbd, 0x04, 0xf9, 0xbe, 0x03, 0xf7, 0xd1, 0xf1, 0x65, 0xef, 0x93, 0x49, 0xde, 0xf3, 0xee, 0x04, + 0x65, 0x07, 0x0c, 0x7e, 0xc1, 0xf5, 0x9d, 0x93, 0xa1, 0x2c, 0x9c, 0x0e, 0x65, 0xe1, 0xfb, 0x50, + 0x16, 0x3e, 0x9c, 0xc9, 0xa9, 0xd3, 0x33, 0x39, 0xf5, 0xed, 0x4c, 0x4e, 0xed, 0x3d, 0xbd, 0xd4, + 0x63, 0xbf, 0xfd, 0x4e, 0x6a, 0xe7, 0xf9, 0xa7, 0xc9, 0xfa, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x38, 0xf5, 0xca, 0x1c, 0x4b, 0x09, 0x00, 0x00, +} + +func (m *MsgConnectionOpenInit) 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 *MsgConnectionOpenInit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgConnectionOpenInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x22 + } + { + size, err := m.Counterparty.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ConnectionID) > 0 { + i -= len(m.ConnectionID) + copy(dAtA[i:], m.ConnectionID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ConnectionID))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgConnectionOpenTry) 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 *MsgConnectionOpenTry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgConnectionOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x4a + } + if m.ConsensusHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ConsensusHeight)) + i-- + dAtA[i] = 0x40 + } + { + size, err := m.ProofConsensus.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if m.ProofHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x30 + } + { + size, err := m.ProofInit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.CounterpartyVersions) > 0 { + for iNdEx := len(m.CounterpartyVersions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.CounterpartyVersions[iNdEx]) + copy(dAtA[i:], m.CounterpartyVersions[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.CounterpartyVersions[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + { + size, err := m.Counterparty.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ConnectionID) > 0 { + i -= len(m.ConnectionID) + copy(dAtA[i:], m.ConnectionID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ConnectionID))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgConnectionOpenAck) 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 *MsgConnectionOpenAck) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgConnectionOpenAck) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x3a + } + if m.ConsensusHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ConsensusHeight)) + i-- + dAtA[i] = 0x30 + } + { + size, err := m.ProofConsensus.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.ProofHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.ProofTry.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x12 + } + if len(m.ConnectionID) > 0 { + i -= len(m.ConnectionID) + copy(dAtA[i:], m.ConnectionID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ConnectionID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgConnectionOpenConfirm) 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 *MsgConnectionOpenConfirm) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgConnectionOpenConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x22 + } + if m.ProofHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x18 + } + { + size, err := m.ProofAck.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.ConnectionID) > 0 { + i -= len(m.ConnectionID) + copy(dAtA[i:], m.ConnectionID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ConnectionID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ConnectionEnd) 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 *ConnectionEnd) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConnectionEnd) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Counterparty.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.State != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x20 + } + if len(m.Versions) > 0 { + for iNdEx := len(m.Versions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Versions[iNdEx]) + copy(dAtA[i:], m.Versions[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Versions[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0x12 + } + if len(m.ID) > 0 { + i -= len(m.ID) + copy(dAtA[i:], m.ID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Counterparty) 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 *Counterparty) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Counterparty) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Prefix.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ConnectionID) > 0 { + i -= len(m.ConnectionID) + copy(dAtA[i:], m.ConnectionID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ConnectionID))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgConnectionOpenInit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ConnectionID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Counterparty.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgConnectionOpenTry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ConnectionID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Counterparty.Size() + n += 1 + l + sovTypes(uint64(l)) + if len(m.CounterpartyVersions) > 0 { + for _, s := range m.CounterpartyVersions { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } + l = m.ProofInit.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ProofHeight != 0 { + n += 1 + sovTypes(uint64(m.ProofHeight)) + } + l = m.ProofConsensus.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ConsensusHeight != 0 { + n += 1 + sovTypes(uint64(m.ConsensusHeight)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgConnectionOpenAck) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConnectionID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Version) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.ProofTry.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ProofHeight != 0 { + n += 1 + sovTypes(uint64(m.ProofHeight)) + } + l = m.ProofConsensus.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ConsensusHeight != 0 { + n += 1 + sovTypes(uint64(m.ConsensusHeight)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgConnectionOpenConfirm) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConnectionID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.ProofAck.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ProofHeight != 0 { + n += 1 + sovTypes(uint64(m.ProofHeight)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *ConnectionEnd) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Versions) > 0 { + for _, s := range m.Versions { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.State != 0 { + n += 1 + sovTypes(uint64(m.State)) + } + l = m.Counterparty.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *Counterparty) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ConnectionID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Prefix.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgConnectionOpenInit) 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 ErrIntOverflowTypes + } + 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: MsgConnectionOpenInit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConnectionOpenInit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConnectionID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Counterparty", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Counterparty.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgConnectionOpenTry) 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 ErrIntOverflowTypes + } + 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: MsgConnectionOpenTry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConnectionOpenTry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConnectionID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Counterparty", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Counterparty.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyVersions", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CounterpartyVersions = append(m.CounterpartyVersions, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofInit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProofInit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofConsensus", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProofConsensus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusHeight", wireType) + } + m.ConsensusHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ConsensusHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgConnectionOpenAck) 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 ErrIntOverflowTypes + } + 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: MsgConnectionOpenAck: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConnectionOpenAck: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConnectionID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofTry", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProofTry.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofConsensus", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProofConsensus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusHeight", wireType) + } + m.ConsensusHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ConsensusHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgConnectionOpenConfirm) 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 ErrIntOverflowTypes + } + 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: MsgConnectionOpenConfirm: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConnectionOpenConfirm: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConnectionID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofAck", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProofAck.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConnectionEnd) 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 ErrIntOverflowTypes + } + 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: ConnectionEnd: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConnectionEnd: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Versions", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Versions = append(m.Versions, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= types1.State(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Counterparty", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Counterparty.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Counterparty) 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 ErrIntOverflowTypes + } + 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: Counterparty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Counterparty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConnectionID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Prefix.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibc/03-connection/types/types.proto b/x/ibc/03-connection/types/types.proto new file mode 100644 index 000000000000..f2ea6248ba2e --- /dev/null +++ b/x/ibc/03-connection/types/types.proto @@ -0,0 +1,132 @@ +syntax = "proto3"; +package cosmos_sdk.x.ibc.connection.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "x/ibc/23-commitment/types/types.proto"; +import "x/ibc/types/types.proto"; + +// MsgConnectionOpenInit defines the msg sent by an account on Chain A to +// initialize a connection with Chain B. +message MsgConnectionOpenInit { + string client_id = 1 [(gogoproto.customname) = "ClientID"]; + string connection_id = 2 [(gogoproto.customname) = "ConnectionID"]; + Counterparty counterparty = 3 [ + (gogoproto.nullable) = false + ]; + bytes signer = 4 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a connection +// on Chain B. +message MsgConnectionOpenTry { + string client_id = 1 [(gogoproto.customname) = "ClientID"]; + string connection_id = 2 [(gogoproto.customname) = "ConnectionID"]; + Counterparty counterparty = 3 [ + (gogoproto.nullable) = false + ]; + repeated string counterparty_versions = 4; + // proof of the initialization the connection on Chain A: `UNITIALIZED -> INIT` + cosmos_sdk.x.ibc.commitment.v1.MerkleProof proof_init = 5 [ + (gogoproto.nullable) = false + ]; + uint64 proof_height = 6; + // proof of client consensus state + cosmos_sdk.x.ibc.commitment.v1.MerkleProof proof_consensus = 7 [ + (gogoproto.nullable) = false + ]; + uint64 consensus_height = 8; + bytes signer = 9 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to acknowledge +// the change of connection state to TRYOPEN on Chain B. +message MsgConnectionOpenAck { + string connection_id = 1 [ + (gogoproto.customname) = "ConnectionID" + ]; + string version = 2; + // proof of the initialization the connection on Chain B: `UNITIALIZED -> TRYOPEN` + cosmos_sdk.x.ibc.commitment.v1.MerkleProof proof_try = 3 [ + (gogoproto.nullable) = false + ]; + uint64 proof_height = 4; + // proof of client consensus state + cosmos_sdk.x.ibc.commitment.v1.MerkleProof proof_consensus = 5 [ + (gogoproto.nullable) = false + ]; + uint64 consensus_height = 6; + bytes signer = 7 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to acknowledge +// the change of connection state to OPEN on Chain A. +message MsgConnectionOpenConfirm { + string connection_id = 1 [ + (gogoproto.customname) = "ConnectionID" + ]; + // proof for the change of the connection state on Chain A: `INIT -> OPEN` + cosmos_sdk.x.ibc.commitment.v1.MerkleProof proof_ack = 2 [ + (gogoproto.nullable) = false + ]; + uint64 proof_height = 3; + bytes signer = 4 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// ICS03 - Connection Data Structures as defined in https://github.com/cosmos/ics/tree/master/spec/ics-003-connection-semantics#data-structures + +// ConnectionEnd defines a stateful object on a chain connected to another separate +// one. +// NOTE: there must only be 2 defined ConnectionEnds to establish a connection +// between two chains. +message ConnectionEnd { + option (gogoproto.goproto_getters) = false; + // connection identifier. + string id = 1 [ + (gogoproto.customname) = "ID", + (gogoproto.moretags) = "yaml:\"id\"" + ]; + // client associated with this connection. + string client_id = 2 [ + (gogoproto.customname) = "ClientID", + (gogoproto.moretags) = "yaml:\"client_id\"" + ]; + // opaque string which can be utilised to determine encodings or protocols for + // channels or packets utilising this connection + repeated string versions = 3; + // current state of the connection end. + cosmos_sdk.x.ibc.v1.State state = 4; + // counterparty chain associated with this connection. + Counterparty counterparty = 5 [ + (gogoproto.nullable) = false + ]; +} + +// Counterparty defines the counterparty chain associated with a connection end. +message Counterparty { + option (gogoproto.goproto_getters) = false; + + // identifies the client on the counterparty chain associated with a given connection. + string client_id = 1 [ + (gogoproto.customname) = "ClientID", + (gogoproto.moretags) = "yaml:\"client_id\"" + ]; + // identifies the connection end on the counterparty chain associated with a given connection. + string connection_id = 2 [ + (gogoproto.customname) = "ConnectionID", + (gogoproto.moretags) = "yaml:\"connection_id\"" + ]; + // commitment merkle prefix of the counterparty chain + cosmos_sdk.x.ibc.commitment.v1.MerklePrefix prefix = 3 [ + (gogoproto.nullable) = false + ]; +} diff --git a/x/ibc/04-channel/client/cli/tx.go b/x/ibc/04-channel/client/cli/tx.go index 16183ae2ec04..db4565fc34a6 100644 --- a/x/ibc/04-channel/client/cli/tx.go +++ b/x/ibc/04-channel/client/cli/tx.go @@ -14,8 +14,8 @@ import ( authclient "github.com/cosmos/cosmos-sdk/x/auth/client" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" connectionutils "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/client/utils" - "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" + ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) // IBC Channel flags @@ -243,9 +243,9 @@ func GetMsgChannelCloseConfirmCmd(storeKey string, cdc *codec.Codec) *cobra.Comm } } -func channelOrder() exported.Order { +func channelOrder() ibctypes.Order { if viper.GetBool(FlagOrdered) { - return exported.ORDERED + return ibctypes.ORDERED } - return exported.UNORDERED + return ibctypes.UNORDERED } diff --git a/x/ibc/04-channel/client/rest/rest.go b/x/ibc/04-channel/client/rest/rest.go index 2d65fc2d5817..4bb45ad24338 100644 --- a/x/ibc/04-channel/client/rest/rest.go +++ b/x/ibc/04-channel/client/rest/rest.go @@ -5,9 +5,9 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" - commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" + commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" + ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) const ( @@ -27,7 +27,7 @@ type ChannelOpenInitReq struct { PortID string `json:"port_id" yaml:"port_id"` ChannelID string `json:"channel_id" yaml:"channel_id"` Version string `json:"version" yaml:"version"` - ChannelOrder exported.Order `json:"channel_order" yaml:"channel_order"` + ChannelOrder ibctypes.Order `json:"channel_order" yaml:"channel_order"` ConnectionHops []string `json:"connection_hops" yaml:"connection_hops"` CounterpartyPortID string `json:"counterparty_port_id" yaml:"counterparty_port_id"` CounterpartyChannelID string `json:"counterparty_channel_id" yaml:"counterparty_channel_id"` @@ -35,32 +35,32 @@ type ChannelOpenInitReq struct { // ChannelOpenTryReq defines the properties of a channel open try request's body. type ChannelOpenTryReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - PortID string `json:"port_id" yaml:"port_id"` - ChannelID string `json:"channel_id" yaml:"channel_id"` - Version string `json:"version" yaml:"version"` - ChannelOrder exported.Order `json:"channel_order" yaml:"channel_order"` - ConnectionHops []string `json:"connection_hops" yaml:"connection_hops"` - CounterpartyPortID string `json:"counterparty_port_id" yaml:"counterparty_port_id"` - CounterpartyChannelID string `json:"counterparty_channel_id" yaml:"counterparty_channel_id"` - CounterpartyVersion string `json:"counterparty_version" yaml:"counterparty_version"` - ProofInit commitmentexported.Proof `json:"proof_init" yaml:"proof_init"` - ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` + BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` + PortID string `json:"port_id" yaml:"port_id"` + ChannelID string `json:"channel_id" yaml:"channel_id"` + Version string `json:"version" yaml:"version"` + ChannelOrder ibctypes.Order `json:"channel_order" yaml:"channel_order"` + ConnectionHops []string `json:"connection_hops" yaml:"connection_hops"` + CounterpartyPortID string `json:"counterparty_port_id" yaml:"counterparty_port_id"` + CounterpartyChannelID string `json:"counterparty_channel_id" yaml:"counterparty_channel_id"` + CounterpartyVersion string `json:"counterparty_version" yaml:"counterparty_version"` + ProofInit commitmenttypes.MerkleProof `json:"proof_init" yaml:"proof_init"` + ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` } // ChannelOpenAckReq defines the properties of a channel open ack request's body. type ChannelOpenAckReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - CounterpartyVersion string `json:"counterparty_version" yaml:"counterparty_version"` - ProofTry commitmentexported.Proof `json:"proof_try" yaml:"proof_try"` - ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` + BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` + CounterpartyVersion string `json:"counterparty_version" yaml:"counterparty_version"` + ProofTry commitmenttypes.MerkleProof `json:"proof_try" yaml:"proof_try"` + ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` } // ChannelOpenConfirmReq defines the properties of a channel open confirm request's body. type ChannelOpenConfirmReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - ProofAck commitmentexported.Proof `json:"proof_ack" yaml:"proof_ack"` - ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` + BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` + ProofAck commitmenttypes.MerkleProof `json:"proof_ack" yaml:"proof_ack"` + ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` } // ConnectionOpenInitReq defines the properties of a channel close init request's body. @@ -70,15 +70,15 @@ type ChannelCloseInitReq struct { // ChannelCloseConfirmReq defines the properties of a channel close confirm request's body. type ChannelCloseConfirmReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - ProofInit commitmentexported.Proof `json:"proof_init" yaml:"proof_init"` - ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` + BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` + ProofInit commitmenttypes.MerkleProof `json:"proof_init" yaml:"proof_init"` + ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` } // RecvPacketReq defines the properties of a receive packet request's body. type RecvPacketReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - Packet types.Packet `json:"packet" yaml:"packet"` - Proofs commitmentexported.Proof `json:"proofs" yaml:"proofs"` - Height uint64 `json:"height" yaml:"height"` + BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` + Packet types.Packet `json:"packet" yaml:"packet"` + Proofs commitmenttypes.MerkleProof `json:"proofs" yaml:"proofs"` + Height uint64 `json:"height" yaml:"height"` } diff --git a/x/ibc/04-channel/exported/exported.go b/x/ibc/04-channel/exported/exported.go index 7ba92b5c9172..ed1dbc531d92 100644 --- a/x/ibc/04-channel/exported/exported.go +++ b/x/ibc/04-channel/exported/exported.go @@ -1,14 +1,13 @@ package exported import ( - "encoding/json" - "fmt" + ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) // ChannelI defines the standard interface for a channel end. type ChannelI interface { - GetState() State - GetOrdering() Order + GetState() ibctypes.State + GetOrdering() ibctypes.Order GetCounterparty() CounterpartyI GetConnectionHops() []string GetVersion() string @@ -35,137 +34,3 @@ type PacketI interface { GetData() []byte ValidateBasic() error } - -// Order defines if a channel is ORDERED or UNORDERED -type Order byte - -// string representation of the channel ordering -const ( - NONE Order = iota // zero-value for channel ordering - UNORDERED // packets can be delivered in any order, which may differ from the order in which they were sent. - ORDERED // packets are delivered exactly in the order which they were sent -) - -// channel order types -const ( - OrderNone string = "" - OrderUnordered string = "UNORDERED" - OrderOrdered string = "ORDERED" -) - -// String implements the Stringer interface -func (o Order) String() string { - switch o { - case UNORDERED: - return OrderUnordered - case ORDERED: - return OrderOrdered - default: - return OrderNone - } -} - -// MarshalJSON marshal to JSON using string. -func (o Order) MarshalJSON() ([]byte, error) { - return json.Marshal(o.String()) -} - -// UnmarshalJSON decodes from JSON. -func (o *Order) UnmarshalJSON(data []byte) error { - var s string - err := json.Unmarshal(data, &s) - if err != nil { - return err - } - - order := OrderFromString(s) - if order == 0 { - return fmt.Errorf("invalid order '%s'", s) - } - - *o = order - return nil -} - -// OrderFromString parses a string into a channel order byte -func OrderFromString(order string) Order { - switch order { - case OrderUnordered: - return UNORDERED - case OrderOrdered: - return ORDERED - default: - return NONE - } -} - -// State defines if a channel is in one of the following states: -// CLOSED, INIT, OPENTRY or OPEN -type State byte - -// channel state types -const ( - UNINITIALIZED State = iota // Default State - INIT // A channel end has just started the opening handshake. - TRYOPEN // A channel end has acknowledged the handshake step on the counterparty chain. - OPEN // A channel end has completed the handshake and is ready to send and receive packets. - CLOSED // A channel end has been closed and can no longer be used to send or receive packets. -) - -// string representation of the channel states -const ( - StateUninitialized string = "UNINITIALIZED" - StateInit string = "INIT" - StateTryOpen string = "TRYOPEN" - StateOpen string = "OPEN" - StateClosed string = "CLOSED" -) - -// String implements the Stringer interface -func (s State) String() string { - switch s { - case INIT: - return StateInit - case TRYOPEN: - return StateTryOpen - case OPEN: - return StateOpen - case CLOSED: - return StateClosed - default: - return StateUninitialized - } -} - -// MarshalJSON marshal to JSON using string. -func (s State) MarshalJSON() ([]byte, error) { - return json.Marshal(s.String()) -} - -// UnmarshalJSON decodes from JSON. -func (s *State) UnmarshalJSON(data []byte) error { - var stateStr string - err := json.Unmarshal(data, &stateStr) - if err != nil { - return err - } - - *s = StateFromString(stateStr) - return nil -} - -// StateFromString parses a string into a channel state byte -func StateFromString(state string) State { - switch state { - case StateClosed: - return CLOSED - case StateInit: - return INIT - case StateTryOpen: - return TRYOPEN - case StateOpen: - return OPEN - default: - return UNINITIALIZED - } -} diff --git a/x/ibc/04-channel/exported/exported_test.go b/x/ibc/04-channel/exported/exported_test.go deleted file mode 100644 index 51d94bfdebb1..000000000000 --- a/x/ibc/04-channel/exported/exported_test.go +++ /dev/null @@ -1,91 +0,0 @@ -package exported - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestChannelStateString(t *testing.T) { - cases := []struct { - name string - state State - }{ - {StateUninitialized, UNINITIALIZED}, - {StateInit, INIT}, - {StateTryOpen, TRYOPEN}, - {StateOpen, OPEN}, - {StateClosed, CLOSED}, - } - - for _, tt := range cases { - tt := tt - require.Equal(t, tt.state, StateFromString(tt.name)) - require.Equal(t, tt.name, tt.state.String()) - } -} - -func TestChannelStateMarshalJSON(t *testing.T) { - cases := []struct { - name string - state State - }{ - {StateUninitialized, UNINITIALIZED}, - {StateInit, INIT}, - {StateTryOpen, TRYOPEN}, - {StateOpen, OPEN}, - {StateClosed, CLOSED}, - } - - for _, tt := range cases { - tt := tt - bz, err := tt.state.MarshalJSON() - require.NoError(t, err) - var state State - require.NoError(t, state.UnmarshalJSON(bz)) - require.Equal(t, tt.name, state.String()) - } -} - -func TestOrderString(t *testing.T) { - cases := []struct { - name string - order Order - }{ - {OrderNone, NONE}, - {OrderUnordered, UNORDERED}, - {OrderOrdered, ORDERED}, - } - - for _, tt := range cases { - tt := tt - require.Equal(t, tt.order, OrderFromString(tt.name)) - require.Equal(t, tt.name, tt.order.String()) - } -} - -func TestOrderMarshalJSON(t *testing.T) { - cases := []struct { - msg string - name string - order Order - expectPass bool - }{ - {"none ordering should have failed", OrderNone, NONE, false}, - {"unordered should have passed", OrderUnordered, UNORDERED, true}, - {"ordered should have passed", OrderOrdered, ORDERED, true}, - } - - for _, tt := range cases { - tt := tt - bz, err := tt.order.MarshalJSON() - require.NoError(t, err) - var order Order - if tt.expectPass { - require.NoError(t, order.UnmarshalJSON(bz), tt.msg) - require.Equal(t, tt.name, order.String(), tt.msg) - } else { - require.Error(t, order.UnmarshalJSON(bz), tt.msg) - } - } -} diff --git a/x/ibc/04-channel/keeper/handshake.go b/x/ibc/04-channel/keeper/handshake.go index 1accf5f7d5ef..bca6710843a3 100644 --- a/x/ibc/04-channel/keeper/handshake.go +++ b/x/ibc/04-channel/keeper/handshake.go @@ -5,9 +5,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/capability" connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" - connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" - "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types" commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" @@ -32,7 +30,7 @@ func (k Keeper) CounterpartyHops(ctx sdk.Context, ch types.Channel) ([]string, b // a module on another chain. func (k Keeper) ChanOpenInit( ctx sdk.Context, - order exported.Order, + order ibctypes.Order, connectionHops []string, portID, channelID string, @@ -52,7 +50,7 @@ func (k Keeper) ChanOpenInit( return nil, sdkerrors.Wrap(connection.ErrConnectionNotFound, connectionHops[0]) } - if connectionEnd.GetState() == connectionexported.UNINITIALIZED { + if connectionEnd.GetState() == ibctypes.UNINITIALIZED { return nil, sdkerrors.Wrap( connection.ErrInvalidConnectionState, "connection state cannot be UNINITIALIZED", @@ -63,7 +61,7 @@ func (k Keeper) ChanOpenInit( return nil, sdkerrors.Wrap(porttypes.ErrInvalidPort, "caller does not own port capability") } - channel := types.NewChannel(exported.INIT, order, counterparty, connectionHops, version) + channel := types.NewChannel(ibctypes.INIT, order, counterparty, connectionHops, version) k.SetChannel(ctx, portID, channelID, channel) capKey, err := k.scopedKeeper.NewCapability(ctx, ibctypes.ChannelCapabilityPath(portID, channelID)) @@ -80,7 +78,7 @@ func (k Keeper) ChanOpenInit( // handshake initiated by a module on another chain. func (k Keeper) ChanOpenTry( ctx sdk.Context, - order exported.Order, + order ibctypes.Order, connectionHops []string, portID, channelID string, @@ -94,7 +92,7 @@ func (k Keeper) ChanOpenTry( // channel identifier and connection hop length checked on msg.ValidateBasic() previousChannel, found := k.GetChannel(ctx, portID, channelID) - if found && !(previousChannel.State == exported.INIT && + if found && !(previousChannel.State == ibctypes.INIT && previousChannel.Ordering == order && previousChannel.Counterparty.PortID == counterparty.PortID && previousChannel.Counterparty.ChannelID == counterparty.ChannelID && @@ -112,7 +110,7 @@ func (k Keeper) ChanOpenTry( return nil, sdkerrors.Wrap(connection.ErrConnectionNotFound, connectionHops[0]) } - if connectionEnd.GetState() != connectionexported.OPEN { + if connectionEnd.GetState() != ibctypes.OPEN { return nil, sdkerrors.Wrapf( connection.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.GetState().String(), @@ -121,7 +119,7 @@ func (k Keeper) ChanOpenTry( // NOTE: this step has been switched with the one below to reverse the connection // hops - channel := types.NewChannel(exported.TRYOPEN, order, counterparty, connectionHops, version) + channel := types.NewChannel(ibctypes.TRYOPEN, order, counterparty, connectionHops, version) counterpartyHops, found := k.CounterpartyHops(ctx, channel) if !found { @@ -133,7 +131,7 @@ func (k Keeper) ChanOpenTry( // (i.e self) expectedCounterparty := types.NewCounterparty(portID, channelID) expectedChannel := types.NewChannel( - exported.INIT, channel.Ordering, expectedCounterparty, + ibctypes.INIT, channel.Ordering, expectedCounterparty, counterpartyHops, counterpartyVersion, ) @@ -172,7 +170,7 @@ func (k Keeper) ChanOpenAck( return sdkerrors.Wrap(types.ErrChannelNotFound, channelID) } - if !(channel.State == exported.INIT || channel.State == exported.TRYOPEN) { + if !(channel.State == ibctypes.INIT || channel.State == ibctypes.TRYOPEN) { return sdkerrors.Wrapf( types.ErrInvalidChannelState, "channel state should be INIT or TRYOPEN (got %s)", channel.State.String(), @@ -188,7 +186,7 @@ func (k Keeper) ChanOpenAck( return sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) } - if connectionEnd.GetState() != connectionexported.OPEN { + if connectionEnd.GetState() != ibctypes.OPEN { return sdkerrors.Wrapf( connection.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.GetState().String(), @@ -204,7 +202,7 @@ func (k Keeper) ChanOpenAck( // counterparty of the counterparty channel end (i.e self) expectedCounterparty := types.NewCounterparty(portID, channelID) expectedChannel := types.NewChannel( - exported.TRYOPEN, channel.Ordering, expectedCounterparty, + ibctypes.TRYOPEN, channel.Ordering, expectedCounterparty, counterpartyHops, counterpartyVersion, ) @@ -216,7 +214,7 @@ func (k Keeper) ChanOpenAck( return err } - channel.State = exported.OPEN + channel.State = ibctypes.OPEN channel.Version = counterpartyVersion k.SetChannel(ctx, portID, channelID, channel) @@ -238,7 +236,7 @@ func (k Keeper) ChanOpenConfirm( return sdkerrors.Wrap(types.ErrChannelNotFound, channelID) } - if channel.State != exported.TRYOPEN { + if channel.State != ibctypes.TRYOPEN { return sdkerrors.Wrapf( types.ErrInvalidChannelState, "channel state is not TRYOPEN (got %s)", channel.State.String(), @@ -254,7 +252,7 @@ func (k Keeper) ChanOpenConfirm( return sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) } - if connectionEnd.GetState() != connectionexported.OPEN { + if connectionEnd.GetState() != ibctypes.OPEN { return sdkerrors.Wrapf( connection.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.GetState().String(), @@ -269,7 +267,7 @@ func (k Keeper) ChanOpenConfirm( counterparty := types.NewCounterparty(portID, channelID) expectedChannel := types.NewChannel( - exported.OPEN, channel.Ordering, counterparty, + ibctypes.OPEN, channel.Ordering, counterparty, counterpartyHops, channel.Version, ) @@ -281,7 +279,7 @@ func (k Keeper) ChanOpenConfirm( return err } - channel.State = exported.OPEN + channel.State = ibctypes.OPEN k.SetChannel(ctx, portID, channelID, channel) return nil @@ -309,7 +307,7 @@ func (k Keeper) ChanCloseInit( return sdkerrors.Wrap(types.ErrChannelNotFound, channelID) } - if channel.State == exported.CLOSED { + if channel.State == ibctypes.CLOSED { return sdkerrors.Wrap(types.ErrInvalidChannelState, "channel is already CLOSED") } @@ -318,14 +316,14 @@ func (k Keeper) ChanCloseInit( return sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) } - if connectionEnd.GetState() != connectionexported.OPEN { + if connectionEnd.GetState() != ibctypes.OPEN { return sdkerrors.Wrapf( connection.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.GetState().String(), ) } - channel.State = exported.CLOSED + channel.State = ibctypes.CLOSED k.SetChannel(ctx, portID, channelID, channel) k.Logger(ctx).Info("channel close initialized: portID (%s), channelID (%s)", portID, channelID) return nil @@ -350,7 +348,7 @@ func (k Keeper) ChanCloseConfirm( return sdkerrors.Wrap(types.ErrChannelNotFound, channelID) } - if channel.State == exported.CLOSED { + if channel.State == ibctypes.CLOSED { return sdkerrors.Wrap(types.ErrInvalidChannelState, "channel is already CLOSED") } @@ -359,7 +357,7 @@ func (k Keeper) ChanCloseConfirm( return sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) } - if connectionEnd.GetState() != connectionexported.OPEN { + if connectionEnd.GetState() != ibctypes.OPEN { return sdkerrors.Wrapf( connection.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.GetState().String(), @@ -374,7 +372,7 @@ func (k Keeper) ChanCloseConfirm( counterparty := types.NewCounterparty(portID, channelID) expectedChannel := types.NewChannel( - exported.CLOSED, channel.Ordering, counterparty, + ibctypes.CLOSED, channel.Ordering, counterparty, counterpartyHops, channel.Version, ) @@ -386,7 +384,7 @@ func (k Keeper) ChanCloseConfirm( return err } - channel.State = exported.CLOSED + channel.State = ibctypes.CLOSED k.SetChannel(ctx, portID, channelID, channel) return nil diff --git a/x/ibc/04-channel/keeper/handshake_test.go b/x/ibc/04-channel/keeper/handshake_test.go index eefb7a30cf4d..afe923078966 100644 --- a/x/ibc/04-channel/keeper/handshake_test.go +++ b/x/ibc/04-channel/keeper/handshake_test.go @@ -4,10 +4,7 @@ import ( "fmt" "github.com/cosmos/cosmos-sdk/x/capability" - connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" - "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" - porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types" ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) @@ -19,26 +16,26 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { {"success", func() { suite.chainA.createConnection( testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, - connectionexported.INIT, + ibctypes.INIT, ) }, true}, {"channel already exists", func() { suite.chainA.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.INIT, - exported.ORDERED, testConnectionIDA, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.INIT, + ibctypes.ORDERED, testConnectionIDA, ) }, false}, {"connection doesn't exist", func() {}, false}, {"connection is UNINITIALIZED", func() { suite.chainA.createConnection( testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, - connectionexported.UNINITIALIZED, + ibctypes.UNINITIALIZED, ) }, false}, {"capability is incorrect", func() { suite.chainA.createConnection( testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, - connectionexported.INIT, + ibctypes.INIT, ) portCap = capability.NewCapability(3) }, false}, @@ -52,13 +49,13 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { var err error portCap, err = suite.chainA.App.ScopedIBCKeeper.NewCapability( - suite.chainA.GetContext(), porttypes.PortPath(testPort1), + suite.chainA.GetContext(), ibctypes.PortPath(testPort1), ) suite.Require().NoError(err, "could not create capability") tc.malleate() cap, err := suite.chainA.App.IBCKeeper.ChannelKeeper.ChanOpenInit( - suite.chainA.GetContext(), exported.ORDERED, []string{testConnectionIDA}, + suite.chainA.GetContext(), ibctypes.ORDERED, []string{testConnectionIDA}, testPort1, testChannel1, portCap, counterparty, testChannelVersion, ) @@ -89,36 +86,36 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { suite.chainB.CreateClient(suite.chainA) _ = suite.chainA.createConnection( testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, - connectionexported.OPEN, + ibctypes.OPEN, ) suite.chainB.createConnection( - testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.INIT, exported.ORDERED, testConnectionIDA) + testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.INIT, ibctypes.ORDERED, testConnectionIDA) }, true}, {"previous channel with invalid state", func() { _ = suite.chainA.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.UNINITIALIZED, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.UNINITIALIZED, + ibctypes.ORDERED, testConnectionIDB, ) }, false}, {"connection doesn't exist", func() {}, false}, {"connection is not OPEN", func() { _ = suite.chainA.createConnection( testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, - connectionexported.INIT, + ibctypes.INIT, ) }, false}, {"consensus state not found", func() { _ = suite.chainA.createConnection( testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, - connectionexported.OPEN, + ibctypes.OPEN, ) }, false}, {"channel verification failed", func() { suite.chainA.CreateClient(suite.chainB) _ = suite.chainA.createConnection( testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, - connectionexported.OPEN, + ibctypes.OPEN, ) }, false}, {"port capability not found", func() { @@ -126,11 +123,11 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { suite.chainB.CreateClient(suite.chainA) _ = suite.chainA.createConnection( testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, - connectionexported.OPEN, + ibctypes.OPEN, ) suite.chainB.createConnection( - testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.INIT, exported.ORDERED, testConnectionIDA) + testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.INIT, ibctypes.ORDERED, testConnectionIDA) portCap = capability.NewCapability(3) }, false}, } @@ -142,7 +139,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { suite.SetupTest() // reset var err error - portCap, err = suite.chainA.App.ScopedIBCKeeper.NewCapability(suite.chainA.GetContext(), porttypes.PortPath(testPort2)) + portCap, err = suite.chainA.App.ScopedIBCKeeper.NewCapability(suite.chainA.GetContext(), ibctypes.PortPath(testPort2)) suite.Require().NoError(err, "could not create capability") tc.malleate() @@ -153,7 +150,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { if tc.expPass { cap, err := suite.chainA.App.IBCKeeper.ChannelKeeper.ChanOpenTry( - suite.chainA.GetContext(), exported.ORDERED, []string{testConnectionIDB}, + suite.chainA.GetContext(), ibctypes.ORDERED, []string{testConnectionIDB}, testPort2, testChannel2, portCap, counterparty, testChannelVersion, testChannelVersion, proof, proofHeight+1, ) @@ -167,7 +164,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { suite.Require().Equal(chanCap.String(), cap.String(), "channel capability is not correct") } else { _, err := suite.chainA.App.IBCKeeper.ChannelKeeper.ChanOpenTry( - suite.chainA.GetContext(), exported.ORDERED, []string{testConnectionIDB}, + suite.chainA.GetContext(), ibctypes.ORDERED, []string{testConnectionIDB}, testPort2, testChannel2, portCap, counterparty, testChannelVersion, testChannelVersion, invalidProof{}, proofHeight, ) @@ -187,63 +184,63 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { suite.chainB.CreateClient(suite.chainA) suite.chainA.createConnection( testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainB.createConnection( testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainA.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.INIT, - exported.ORDERED, testConnectionIDB, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.INIT, + ibctypes.ORDERED, testConnectionIDB, ) suite.chainB.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.TRYOPEN, - exported.ORDERED, testConnectionIDA, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.TRYOPEN, + ibctypes.ORDERED, testConnectionIDA, ) }, true}, {"channel doesn't exist", func() {}, false}, {"channel state is not INIT or TRYOPEN", func() { _ = suite.chainB.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.UNINITIALIZED, - exported.ORDERED, testConnectionIDA, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.UNINITIALIZED, + ibctypes.ORDERED, testConnectionIDA, ) }, false}, {"connection not found", func() { _ = suite.chainB.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.TRYOPEN, - exported.ORDERED, testConnectionIDA, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.TRYOPEN, + ibctypes.ORDERED, testConnectionIDA, ) }, false}, {"connection is not OPEN", func() { _ = suite.chainB.createConnection( testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, - connectionexported.TRYOPEN, + ibctypes.TRYOPEN, ) _ = suite.chainB.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.TRYOPEN, - exported.ORDERED, testConnectionIDA, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.TRYOPEN, + ibctypes.ORDERED, testConnectionIDA, ) }, false}, {"consensus state not found", func() { _ = suite.chainB.createConnection( testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainB.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.TRYOPEN, - exported.ORDERED, testConnectionIDA, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.TRYOPEN, + ibctypes.ORDERED, testConnectionIDA, ) }, false}, {"channel verification failed", func() { suite.chainB.CreateClient(suite.chainA) _ = suite.chainB.createConnection( testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainB.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.TRYOPEN, - exported.ORDERED, testConnectionIDA, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.TRYOPEN, + ibctypes.ORDERED, testConnectionIDA, ) }, false}, {"channel capability not found", func() { @@ -251,19 +248,19 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { suite.chainB.CreateClient(suite.chainA) suite.chainA.createConnection( testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainB.createConnection( testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainA.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.INIT, - exported.ORDERED, testConnectionIDB, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.INIT, + ibctypes.ORDERED, testConnectionIDB, ) suite.chainB.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.TRYOPEN, - exported.ORDERED, testConnectionIDA, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.TRYOPEN, + ibctypes.ORDERED, testConnectionIDA, ) channelCap = capability.NewCapability(3) }, false}, @@ -312,61 +309,61 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { suite.chainB.CreateClient(suite.chainA) _ = suite.chainA.createConnection( testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, - connectionexported.TRYOPEN, + ibctypes.TRYOPEN, ) - suite.chainB.createConnection( + _ = suite.chainB.createConnection( testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainA.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, + ibctypes.ORDERED, testConnectionIDB, ) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, - exported.TRYOPEN, exported.ORDERED, testConnectionIDA) + _ = suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, + ibctypes.TRYOPEN, ibctypes.ORDERED, testConnectionIDA) }, true}, {"channel doesn't exist", func() {}, false}, {"channel state is not TRYOPEN", func() { _ = suite.chainA.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.UNINITIALIZED, - exported.ORDERED, testConnectionIDB, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.UNINITIALIZED, + ibctypes.ORDERED, testConnectionIDB, ) }, false}, {"connection not found", func() { _ = suite.chainA.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.TRYOPEN, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.TRYOPEN, + ibctypes.ORDERED, testConnectionIDB, ) }, false}, {"connection is not OPEN", func() { _ = suite.chainA.createConnection( testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, - connectionexported.TRYOPEN, + ibctypes.TRYOPEN, ) _ = suite.chainA.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.TRYOPEN, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.TRYOPEN, + ibctypes.ORDERED, testConnectionIDB, ) }, false}, {"consensus state not found", func() { _ = suite.chainA.createConnection( testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainA.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.TRYOPEN, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.TRYOPEN, + ibctypes.ORDERED, testConnectionIDB, ) }, false}, {"channel verification failed", func() { suite.chainA.CreateClient(suite.chainB) _ = suite.chainA.createConnection( testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainA.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.TRYOPEN, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.TRYOPEN, + ibctypes.ORDERED, testConnectionIDB, ) }, false}, {"channel capability not found", func() { @@ -374,18 +371,18 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { suite.chainB.CreateClient(suite.chainA) _ = suite.chainA.createConnection( testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, - connectionexported.TRYOPEN, + ibctypes.TRYOPEN, ) suite.chainB.createConnection( testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainA.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, + ibctypes.ORDERED, testConnectionIDB, ) suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, - exported.TRYOPEN, exported.ORDERED, testConnectionIDA) + ibctypes.TRYOPEN, ibctypes.ORDERED, testConnectionIDA) channelCap = capability.NewCapability(3) }, false}, } @@ -430,45 +427,45 @@ func (suite *KeeperTestSuite) TestChanCloseInit() { suite.chainB.CreateClient(suite.chainA) _ = suite.chainA.createConnection( testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainA.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, - exported.ORDERED, testConnectionIDA, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, + ibctypes.ORDERED, testConnectionIDA, ) }, true}, {"channel doesn't exist", func() {}, false}, {"channel state is CLOSED", func() { _ = suite.chainA.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.CLOSED, - exported.ORDERED, testConnectionIDB, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.CLOSED, + ibctypes.ORDERED, testConnectionIDB, ) }, false}, {"connection not found", func() { _ = suite.chainA.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, - exported.ORDERED, testConnectionIDA, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, + ibctypes.ORDERED, testConnectionIDA, ) }, false}, {"connection is not OPEN", func() { _ = suite.chainA.createConnection( testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, - connectionexported.TRYOPEN, + ibctypes.TRYOPEN, ) _ = suite.chainA.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.UNINITIALIZED, - exported.ORDERED, testConnectionIDA, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.UNINITIALIZED, + ibctypes.ORDERED, testConnectionIDA, ) }, false}, {"channel capability not found", func() { suite.chainB.CreateClient(suite.chainA) _ = suite.chainA.createConnection( testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainA.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, - exported.ORDERED, testConnectionIDA, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, + ibctypes.ORDERED, testConnectionIDA, ) channelCap = capability.NewCapability(3) }, false}, @@ -508,63 +505,63 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { suite.chainB.CreateClient(suite.chainA) _ = suite.chainB.createConnection( testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, - connectionexported.OPEN, + ibctypes.OPEN, ) suite.chainA.createConnection( testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainB.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, + ibctypes.ORDERED, testConnectionIDB, ) suite.chainA.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.CLOSED, - exported.ORDERED, testConnectionIDA, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.CLOSED, + ibctypes.ORDERED, testConnectionIDA, ) }, true}, {"channel doesn't exist", func() {}, false}, {"channel state is CLOSED", func() { _ = suite.chainB.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.CLOSED, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.CLOSED, + ibctypes.ORDERED, testConnectionIDB, ) }, false}, {"connection not found", func() { _ = suite.chainB.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, - exported.ORDERED, testConnectionIDA, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, + ibctypes.ORDERED, testConnectionIDA, ) }, false}, {"connection is not OPEN", func() { _ = suite.chainB.createConnection( testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, - connectionexported.TRYOPEN, + ibctypes.TRYOPEN, ) _ = suite.chainB.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, + ibctypes.ORDERED, testConnectionIDB, ) }, false}, {"consensus state not found", func() { _ = suite.chainB.createConnection( testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainB.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, + ibctypes.ORDERED, testConnectionIDB, ) }, false}, {"channel verification failed", func() { suite.chainB.CreateClient(suite.chainA) _ = suite.chainB.createConnection( testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainB.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, + ibctypes.ORDERED, testConnectionIDB, ) }, false}, {"channel capability not found", func() { @@ -572,19 +569,19 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { suite.chainB.CreateClient(suite.chainA) _ = suite.chainB.createConnection( testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, - connectionexported.OPEN, + ibctypes.OPEN, ) suite.chainA.createConnection( testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, - connectionexported.OPEN, + ibctypes.OPEN, ) _ = suite.chainB.createChannel( - testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, - exported.ORDERED, testConnectionIDB, + testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, + ibctypes.ORDERED, testConnectionIDB, ) suite.chainA.createChannel( - testPort1, testChannel1, testPort2, testChannel2, exported.CLOSED, - exported.ORDERED, testConnectionIDA, + testPort1, testChannel1, testPort2, testChannel2, ibctypes.CLOSED, + ibctypes.ORDERED, testConnectionIDA, ) }, false}, } diff --git a/x/ibc/04-channel/keeper/keeper_test.go b/x/ibc/04-channel/keeper/keeper_test.go index abaebeda3d9e..610cad64002b 100644 --- a/x/ibc/04-channel/keeper/keeper_test.go +++ b/x/ibc/04-channel/keeper/keeper_test.go @@ -15,9 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" - "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" @@ -42,7 +40,7 @@ const ( testChannel2 = "secondchannel" testChannel3 = "thirdchannel" - testChannelOrder = exported.ORDERED + testChannelOrder = ibctypes.ORDERED testChannelVersion = "1.0" trustingPeriod time.Duration = time.Hour * 24 * 7 * 2 @@ -78,7 +76,7 @@ func (suite *KeeperTestSuite) TestSetChannel() { counterparty2 := types.NewCounterparty(testPort2, testChannel2) channel := types.NewChannel( - exported.INIT, testChannelOrder, + ibctypes.INIT, testChannelOrder, counterparty2, []string{testConnectionIDA}, testChannelVersion, ) suite.chainB.App.IBCKeeper.ChannelKeeper.SetChannel(ctx, testPort1, testChannel1, channel) @@ -95,15 +93,15 @@ func (suite KeeperTestSuite) TestGetAllChannels() { counterparty3 := types.NewCounterparty(testPort3, testChannel3) channel1 := types.NewChannel( - exported.INIT, testChannelOrder, + ibctypes.INIT, testChannelOrder, counterparty3, []string{testConnectionIDA}, testChannelVersion, ) channel2 := types.NewChannel( - exported.INIT, testChannelOrder, + ibctypes.INIT, testChannelOrder, counterparty1, []string{testConnectionIDA}, testChannelVersion, ) channel3 := types.NewChannel( - exported.CLOSED, testChannelOrder, + ibctypes.CLOSED, testChannelOrder, counterparty2, []string{testConnectionIDA}, testChannelVersion, ) @@ -288,7 +286,7 @@ func NewTestChain(clientID string) *TestChain { // Creates simple context for testing purposes func (chain *TestChain) GetContext() sdk.Context { - return chain.App.BaseApp.NewContext(false, tmproto.Header{ChainID: chain.Header.ChainID, Height: chain.Header.Height}) + return chain.App.BaseApp.NewContext(false, tmproto.Header{ChainID: chain.Header.SignedHeader.Header.ChainID, Height: int64(chain.Header.GetHeight())}) } // createClient will create a client for clientChain on targetChain @@ -297,7 +295,7 @@ func (chain *TestChain) CreateClient(client *TestChain) error { // Commit and create a new block on appTarget to get a fresh CommitID client.App.Commit() commitID := client.App.LastCommitID() - client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.Height, Time: client.Header.Time}}) + client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: int64(client.Header.GetHeight()), Time: client.Header.GetTime()}}) // Set HistoricalInfo on client chain after Commit ctxClient := client.GetContext() @@ -313,7 +311,7 @@ func (chain *TestChain) CreateClient(client *TestChain) error { }, Valset: validators, } - client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.Height, histInfo) + client.App.StakingKeeper.SetHistoricalInfo(ctxClient, int64(client.Header.GetHeight()), histInfo) // Create target ctx ctxTarget := chain.GetContext() @@ -358,7 +356,7 @@ func (chain *TestChain) updateClient(client *TestChain) { commitID := client.App.LastCommitID() client.Header = nextHeader(client) - client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.Height, Time: client.Header.Time}}) + client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: int64(client.Header.GetHeight()), Time: client.Header.GetTime()}}) // Set HistoricalInfo on client chain after Commit ctxClient := client.GetContext() @@ -374,17 +372,22 @@ func (chain *TestChain) updateClient(client *TestChain) { }, Valset: validators, } - client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.Height, histInfo) + client.App.StakingKeeper.SetHistoricalInfo(ctxClient, int64(client.Header.GetHeight()), histInfo) + + protoValset, err := client.Vals.ToProto() + if err != nil { + panic(err) + } consensusState := ibctmtypes.ConsensusState{ - Height: uint64(client.Header.Height), - Timestamp: client.Header.Time, + Height: client.Header.GetHeight(), + Timestamp: client.Header.GetTime(), Root: commitmenttypes.NewMerkleRoot(commitID.Hash), - ValidatorSet: client.Vals, + ValidatorSet: protoValset, } chain.App.IBCKeeper.ClientKeeper.SetClientConsensusState( - ctxTarget, client.ClientID, uint64(client.Header.Height), consensusState, + ctxTarget, client.ClientID, client.Header.GetHeight(), consensusState, ) chain.App.IBCKeeper.ClientKeeper.SetClientState( ctxTarget, ibctmtypes.NewClientState(client.ClientID, trustingPeriod, ubdPeriod, maxClockDrift, client.Header), @@ -405,9 +408,9 @@ func (chain *TestChain) updateClient(client *TestChain) { func (chain *TestChain) createConnection( connID, counterpartyConnID, clientID, counterpartyClientID string, - state connectionexported.State, + state ibctypes.State, ) connectiontypes.ConnectionEnd { - counterparty := connectiontypes.NewCounterparty(counterpartyClientID, counterpartyConnID, chain.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix()) + counterparty := connectiontypes.NewCounterparty(counterpartyClientID, counterpartyConnID, commitmenttypes.NewMerklePrefix(chain.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes())) connection := connectiontypes.ConnectionEnd{ State: state, ClientID: clientID, @@ -421,7 +424,7 @@ func (chain *TestChain) createConnection( func (chain *TestChain) createChannel( portID, channelID, counterpartyPortID, counterpartyChannelID string, - state exported.State, order exported.Order, connectionID string, + state ibctypes.State, order ibctypes.Order, connectionID string, ) types.Channel { counterparty := types.NewCounterparty(counterpartyPortID, counterpartyChannelID) channel := types.NewChannel(state, order, counterparty, @@ -433,8 +436,8 @@ func (chain *TestChain) createChannel( } func nextHeader(chain *TestChain) ibctmtypes.Header { - return ibctmtypes.CreateTestHeader(chain.Header.ChainID, chain.Header.Height+1, - chain.Header.Time.Add(time.Minute), chain.Vals, chain.Signers) + return ibctmtypes.CreateTestHeader(chain.Header.SignedHeader.Header.ChainID, int64(chain.Header.GetHeight())+1, + chain.Header.GetTime().Add(time.Minute), chain.Vals, chain.Signers) } // Mocked types diff --git a/x/ibc/04-channel/keeper/packet.go b/x/ibc/04-channel/keeper/packet.go index 4a35e8039460..8e0e2eb32361 100644 --- a/x/ibc/04-channel/keeper/packet.go +++ b/x/ibc/04-channel/keeper/packet.go @@ -10,7 +10,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/capability" client "github.com/cosmos/cosmos-sdk/x/ibc/02-client" connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" - connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" @@ -34,7 +33,7 @@ func (k Keeper) SendPacket( return sdkerrors.Wrap(types.ErrChannelNotFound, packet.GetSourceChannel()) } - if channel.State == exported.CLOSED { + if channel.State == ibctypes.CLOSED { return sdkerrors.Wrapf( types.ErrInvalidChannelState, "channel is CLOSED (got %s)", channel.State.String(), @@ -65,7 +64,7 @@ func (k Keeper) SendPacket( } // NOTE: assume UNINITIALIZED is a closed connection - if connectionEnd.GetState() == connectionexported.UNINITIALIZED { + if connectionEnd.GetState() == ibctypes.UNINITIALIZED { return sdkerrors.Wrap( connection.ErrInvalidConnectionState, "connection is closed (i.e NONE)", @@ -147,7 +146,7 @@ func (k Keeper) RecvPacket( return nil, sdkerrors.Wrap(types.ErrChannelNotFound, packet.GetDestChannel()) } - if channel.State != exported.OPEN { + if channel.State != ibctypes.OPEN { return nil, sdkerrors.Wrapf( types.ErrInvalidChannelState, "channel state is not OPEN (got %s)", channel.State.String(), @@ -177,7 +176,7 @@ func (k Keeper) RecvPacket( return nil, sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) } - if connectionEnd.GetState() != connectionexported.OPEN { + if connectionEnd.GetState() != ibctypes.OPEN { return nil, sdkerrors.Wrapf( connection.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.GetState().String(), @@ -226,7 +225,7 @@ func (k Keeper) PacketExecuted( } // sanity check - if channel.State != exported.OPEN { + if channel.State != ibctypes.OPEN { return sdkerrors.Wrapf( types.ErrInvalidChannelState, "channel state is not OPEN (got %s)", channel.State.String(), @@ -238,14 +237,14 @@ func (k Keeper) PacketExecuted( return sdkerrors.Wrap(types.ErrInvalidChannelCapability, "channel capability failed authentication") } - if acknowledgement != nil || channel.Ordering == exported.UNORDERED { + if acknowledgement != nil || channel.Ordering == ibctypes.UNORDERED { k.SetPacketAcknowledgement( ctx, packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence(), types.CommitAcknowledgement(acknowledgement), ) } - if channel.Ordering == exported.ORDERED { + if channel.Ordering == ibctypes.ORDERED { nextSequenceRecv, found := k.GetNextSequenceRecv(ctx, packet.GetDestPort(), packet.GetDestChannel()) if !found { return types.ErrSequenceReceiveNotFound @@ -302,7 +301,7 @@ func (k Keeper) AcknowledgePacket( return nil, sdkerrors.Wrap(types.ErrChannelNotFound, packet.GetSourceChannel()) } - if channel.State != exported.OPEN { + if channel.State != ibctypes.OPEN { return nil, sdkerrors.Wrapf( types.ErrInvalidChannelState, "channel state is not OPEN (got %s)", channel.State.String(), @@ -332,7 +331,7 @@ func (k Keeper) AcknowledgePacket( return nil, sdkerrors.Wrap(connection.ErrConnectionNotFound, channel.ConnectionHops[0]) } - if connectionEnd.GetState() != connectionexported.OPEN { + if connectionEnd.GetState() != ibctypes.OPEN { return nil, sdkerrors.Wrapf( connection.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.GetState().String(), @@ -396,7 +395,7 @@ func (k Keeper) CleanupPacket( return nil, sdkerrors.Wrap(types.ErrChannelNotFound, packet.GetSourceChannel()) } - if channel.State != exported.OPEN { + if channel.State != ibctypes.OPEN { return nil, sdkerrors.Wrapf( types.ErrInvalidChannelState, "channel state is not OPEN (got %s)", channel.State.String(), @@ -447,13 +446,13 @@ func (k Keeper) CleanupPacket( var err error switch channel.Ordering { - case exported.ORDERED: + case ibctypes.ORDERED: // check that the recv sequence is as claimed err = k.connectionKeeper.VerifyNextSequenceRecv( ctx, connectionEnd, proofHeight, proof, packet.GetDestPort(), packet.GetDestChannel(), nextSequenceRecv, ) - case exported.UNORDERED: + case ibctypes.UNORDERED: err = k.connectionKeeper.VerifyPacketAcknowledgement( ctx, connectionEnd, proofHeight, proof, packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence(), diff --git a/x/ibc/04-channel/keeper/packet_test.go b/x/ibc/04-channel/keeper/packet_test.go index 5bc4e00ff3e1..a3583d42d9fe 100644 --- a/x/ibc/04-channel/keeper/packet_test.go +++ b/x/ibc/04-channel/keeper/packet_test.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/cosmos/cosmos-sdk/x/capability" - connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" @@ -21,8 +20,8 @@ func (suite *KeeperTestSuite) TestSendPacket() { {"success", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) suite.chainB.CreateClient(suite.chainA) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) suite.chainB.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainB.GetContext(), testPort1, testChannel1, 1) }, true}, {"packet basic validation failed", func() { @@ -33,36 +32,36 @@ func (suite *KeeperTestSuite) TestSendPacket() { }, false}, {"channel closed", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.CLOSED, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.CLOSED, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet dest port ≠ channel counterparty port", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, testPort3, counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet dest channel ID ≠ channel counterparty channel ID", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), testChannel3, timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"connection not found", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"connection is UNINITIALIZED", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.UNINITIALIZED) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.UNINITIALIZED) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"client state not found", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"timeout height passed", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) commitNBlocks(suite.chainB, 10) suite.chainB.CreateClient(suite.chainA) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"timeout timestamp passed", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), disabledTimeoutHeight, timeoutTimestamp) @@ -74,21 +73,21 @@ func (suite *KeeperTestSuite) TestSendPacket() { {"next sequence send not found", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) suite.chainB.CreateClient(suite.chainA) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"next sequence wrong", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) suite.chainB.CreateClient(suite.chainA) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) suite.chainB.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainB.GetContext(), testPort1, testChannel1, 5) }, false}, {"channel capability not found", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) suite.chainB.CreateClient(suite.chainA) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) suite.chainB.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainB.GetContext(), testPort1, testChannel1, 1) channelCap = capability.NewCapability(3) }, false}, @@ -127,10 +126,10 @@ func (suite *KeeperTestSuite) TestRecvPacket() { {"success", func() { suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainA.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) - suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.ORDERED, testConnectionIDB) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainA.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) + suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDB) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort2, testChannel2, 1) packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort2, testChannel2, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) suite.chainA.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainA.GetContext(), testPort2, testChannel2, 1, types.CommitPacket(packet)) @@ -139,41 +138,35 @@ func (suite *KeeperTestSuite) TestRecvPacket() { {"channel not found", func() {}, false}, {"channel not open", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.INIT, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.INIT, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet source port ≠ channel counterparty port", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort2, testChannel2, testPort3, testChannel1, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort2, testChannel2, testPort3, testChannel1, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet source channel ID ≠ channel counterparty channel ID", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel3, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel3, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"connection not found", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"connection not OPEN", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.INIT) - suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.INIT) + suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"timeout height passed", func() { commitNBlocks(suite.chainB, 10) packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.ORDERED, testConnectionIDA) - }, false}, - {"timeout timestamp passed", func() { - commitBlockWithNewTimestamp(suite.chainB, timeoutTimestamp) - packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), disabledTimeoutHeight, timeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"validation failed", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, } @@ -210,31 +203,31 @@ func (suite *KeeperTestSuite) TestPacketExecuted() { testCases := []testCase{ {"success: UNORDERED", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.UNORDERED, testConnectionIDA) + suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.UNORDERED, testConnectionIDA) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceRecv(suite.chainA.GetContext(), testPort2, testChannel2, 1) }, true}, {"success: ORDERED", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceRecv(suite.chainA.GetContext(), testPort2, testChannel2, 1) }, true}, {"channel not found", func() {}, false}, {"channel not OPEN", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.CLOSED, exported.ORDERED, testConnectionIDA) + suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.CLOSED, ibctypes.ORDERED, testConnectionIDA) }, false}, {"next sequence receive not found", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet sequence ≠ next sequence receive", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceRecv(suite.chainA.GetContext(), testPort2, testChannel2, 5) }, false}, {"capability not found", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.UNORDERED, testConnectionIDA) + suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.UNORDERED, testConnectionIDA) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceRecv(suite.chainA.GetContext(), testPort2, testChannel2, 1) channelCap = capability.NewCapability(3) }, false}, @@ -276,44 +269,44 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainA.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) - suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.ORDERED, testConnectionIDB) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainA.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) + suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDB) suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 1, types.CommitPacket(packet)) suite.chainA.App.IBCKeeper.ChannelKeeper.SetPacketAcknowledgement(suite.chainA.GetContext(), testPort2, testChannel2, 1, types.CommitAcknowledgement(ack)) }, true}, {"channel not found", func() {}, false}, {"channel not open", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.CLOSED, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.CLOSED, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet source port ≠ channel counterparty port", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort3, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort3, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet source channel ID ≠ channel counterparty channel ID", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel3, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel3, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"connection not found", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"connection not OPEN", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.INIT) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.INIT) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet hasn't been sent", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet ack verification failed", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 1, types.CommitPacket(packet)) }, false}, } @@ -358,58 +351,58 @@ func (suite *KeeperTestSuite) TestCleanupPacket() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) suite.chainA.CreateClient(suite.chainB) suite.chainB.CreateClient(suite.chainA) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainA.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.UNORDERED, testConnectionIDA) - suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.UNORDERED, testConnectionIDB) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainA.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.UNORDERED, testConnectionIDA) + suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.UNORDERED, testConnectionIDB) suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 1, types.CommitPacket(packet)) suite.chainA.App.IBCKeeper.ChannelKeeper.SetPacketAcknowledgement(suite.chainA.GetContext(), testPort2, testChannel2, 1, types.CommitAcknowledgement(ack)) }, true}, {"channel not found", func() {}, false}, {"channel not open", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.CLOSED, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.CLOSED, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet source port ≠ channel counterparty port", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort3, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort3, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet source channel ID ≠ channel counterparty channel ID", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel3, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel3, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"connection not found", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"connection not OPEN", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.INIT) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.INIT) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet already received ", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 10, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet hasn't been sent", func() { nextSeqRecv = 10 packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"next seq receive verification failed", func() { nextSeqRecv = 10 packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 1, types.CommitPacket(packet)) }, false}, {"packet ack verification failed", func() { nextSeqRecv = 10 packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.UNORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.UNORDERED, testConnectionIDA) suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 1, types.CommitPacket(packet)) }, false}, } diff --git a/x/ibc/04-channel/keeper/timeout.go b/x/ibc/04-channel/keeper/timeout.go index ca7161077cf4..53701e1081ed 100644 --- a/x/ibc/04-channel/keeper/timeout.go +++ b/x/ibc/04-channel/keeper/timeout.go @@ -34,7 +34,7 @@ func (k Keeper) TimeoutPacket( ) } - if channel.State != exported.OPEN { + if channel.State != ibctypes.OPEN { return nil, sdkerrors.Wrapf( types.ErrInvalidChannelState, "channel state is not OPEN (got %s)", channel.State.String(), @@ -90,13 +90,13 @@ func (k Keeper) TimeoutPacket( } switch channel.Ordering { - case exported.ORDERED: + case ibctypes.ORDERED: // check that the recv sequence is as claimed err = k.connectionKeeper.VerifyNextSequenceRecv( ctx, connectionEnd, proofHeight, proof, packet.GetDestPort(), packet.GetDestChannel(), nextSequenceRecv, ) - case exported.UNORDERED: + case ibctypes.UNORDERED: err = k.connectionKeeper.VerifyPacketAcknowledgementAbsence( ctx, connectionEnd, proofHeight, proof, packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence(), @@ -142,8 +142,8 @@ func (k Keeper) TimeoutExecuted(ctx sdk.Context, chanCap *capability.Capability, k.deletePacketCommitment(ctx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) - if channel.Ordering == exported.ORDERED { - channel.State = exported.CLOSED + if channel.Ordering == ibctypes.ORDERED { + channel.State = ibctypes.CLOSED k.SetChannel(ctx, packet.GetSourcePort(), packet.GetSourceChannel(), channel) } @@ -212,7 +212,7 @@ func (k Keeper) TimeoutOnClose( counterparty := types.NewCounterparty(packet.GetSourcePort(), packet.GetSourceChannel()) expectedChannel := types.NewChannel( - exported.CLOSED, channel.Ordering, counterparty, counterpartyHops, channel.Version, + ibctypes.CLOSED, channel.Ordering, counterparty, counterpartyHops, channel.Version, ) // check that the opposing channel end has closed @@ -226,13 +226,13 @@ func (k Keeper) TimeoutOnClose( var err error switch channel.Ordering { - case exported.ORDERED: + case ibctypes.ORDERED: // check that the recv sequence is as claimed err = k.connectionKeeper.VerifyNextSequenceRecv( ctx, connectionEnd, proofHeight, proof, packet.GetDestPort(), packet.GetDestChannel(), nextSequenceRecv, ) - case exported.UNORDERED: + case ibctypes.UNORDERED: err = k.connectionKeeper.VerifyPacketAcknowledgementAbsence( ctx, connectionEnd, proofHeight, proof, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence(), diff --git a/x/ibc/04-channel/keeper/timeout_test.go b/x/ibc/04-channel/keeper/timeout_test.go index 61ab13f218fd..98c2d5225d0e 100644 --- a/x/ibc/04-channel/keeper/timeout_test.go +++ b/x/ibc/04-channel/keeper/timeout_test.go @@ -4,8 +4,6 @@ import ( "fmt" "github.com/cosmos/cosmos-sdk/x/capability" - connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" - "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) @@ -24,58 +22,58 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { packet = types.NewPacket(newMockTimeoutPacket().GetBytes(), 2, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), 1, disabledTimeoutTimestamp) suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.UNORDERED, testConnectionIDA) - suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.UNORDERED, testConnectionIDB) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.UNORDERED, testConnectionIDA) + suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.OPEN, ibctypes.UNORDERED, testConnectionIDB) suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 2, types.CommitPacket(packet)) }, true}, {"channel not found", func() {}, false}, {"channel not open", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.CLOSED, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.CLOSED, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet source port ≠ channel counterparty port", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort3, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort3, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet source channel ID ≠ channel counterparty channel ID", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel3, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel3, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"connection not found", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"timeout", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 10, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet already received ", func() { nextSeqRecv = 2 packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet hasn't been sent", func() { nextSeqRecv = 1 packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 2, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"next seq receive verification failed", func() { nextSeqRecv = 1 packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 2, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 2, types.CommitPacket(packet)) }, false}, {"packet ack verification failed", func() { nextSeqRecv = 1 packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 2, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.UNORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.UNORDERED, testConnectionIDA) suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 2, types.CommitPacket(packet)) }, false}, } @@ -111,14 +109,14 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { var chanCap *capability.Capability testCases := []testCase{ {"success ORDERED", func() { - packet = types.NewPacket(newMockTimeoutPacket().GetBytes(), 1, testPort1, testChannel1, testPort2, testChannel2, 3, disabledTimeoutTimestamp) - suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + packet = types.NewPacket(newMockTimeoutPacket().GetBytes(), 1, testPort1, testChannel1, testPort2, testChannel2, 100) + suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, true}, {"channel not found", func() {}, false}, {"incorrect capability", func() { - packet = types.NewPacket(newMockTimeoutPacket().GetBytes(), 1, testPort1, testChannel1, testPort2, testChannel2, 3, disabledTimeoutTimestamp) - suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) - chanCap = capability.NewCapability(1) + packet = types.NewPacket(newMockTimeoutPacket().GetBytes(), 1, testPort1, testChannel1, testPort2, testChannel2, 3) + suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) + chanCap = capability.NewCapability(timeoutHeight, disabledTimeoutTimestamp) }, false}, } @@ -129,7 +127,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { var err error chanCap, err = suite.chainA.App.ScopedIBCKeeper.NewCapability( - suite.chainA.GetContext(), ibctypes.ChannelCapabilityPath(testPort1, testChannel1), + suite.chainA.GetContext(), ibctypes.ChannelCapabilityPath(testPort1, testChanneltimeoutHeight, disabledTimeoutTimestamp), ) suite.Require().NoError(err, "could not create capability") @@ -160,52 +158,52 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 2, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) suite.chainB.CreateClient(suite.chainA) suite.chainA.CreateClient(suite.chainB) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainA.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.UNORDERED, testConnectionIDA) - suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.CLOSED, exported.UNORDERED, testConnectionIDB) // channel on chainA is closed + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainA.createConnection(testConnectionIDB, testConnectionIDA, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.UNORDERED, testConnectionIDA) + suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, ibctypes.CLOSED, ibctypes.UNORDERED, testConnectionIDB) // channel on chainA is closed suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 2, types.CommitPacket(packet)) suite.chainB.App.IBCKeeper.ChannelKeeper.SetNextSequenceRecv(suite.chainB.GetContext(), testPort1, testChannel1, nextSeqRecv) }, true}, {"channel not found", func() {}, false}, {"packet dest port ≠ channel counterparty port", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort3, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort3, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet dest channel ID ≠ channel counterparty channel ID", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel3, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel3, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"connection not found", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 1, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"packet hasn't been sent", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 2, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) }, false}, {"channel verification failed", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 2, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) suite.chainB.CreateClient(suite.chainA) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.UNORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.UNORDERED, testConnectionIDA) suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 2, types.CommitPacket(packet)) suite.chainB.App.IBCKeeper.ChannelKeeper.SetNextSequenceRecv(suite.chainB.GetContext(), testPort1, testChannel1, nextSeqRecv) }, false}, {"next seq receive verification failed", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 2, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) suite.chainB.CreateClient(suite.chainA) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnectionIDA) suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 2, types.CommitPacket(packet)) suite.chainB.App.IBCKeeper.ChannelKeeper.SetNextSequenceRecv(suite.chainB.GetContext(), testPort1, testChannel1, nextSeqRecv) }, false}, {"packet ack verification failed", func() { packet = types.NewPacket(mockSuccessPacket{}.GetBytes(), 2, testPort1, testChannel1, counterparty.GetPortID(), counterparty.GetChannelID(), timeoutHeight, disabledTimeoutTimestamp) suite.chainB.CreateClient(suite.chainA) - suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, connectionexported.OPEN) - suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.UNORDERED, testConnectionIDA) + suite.chainB.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, ibctypes.OPEN) + suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.UNORDERED, testConnectionIDA) suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 2, types.CommitPacket(packet)) suite.chainB.App.IBCKeeper.ChannelKeeper.SetNextSequenceRecv(suite.chainB.GetContext(), testPort1, testChannel1, nextSeqRecv) }, false}, diff --git a/x/ibc/04-channel/types/channel.go b/x/ibc/04-channel/types/channel.go index a68e8ec465c3..3572f2e40bfe 100644 --- a/x/ibc/04-channel/types/channel.go +++ b/x/ibc/04-channel/types/channel.go @@ -9,19 +9,15 @@ import ( ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) -// Channel defines... -type Channel struct { - State exported.State `json:"state" yaml:"state"` - Ordering exported.Order `json:"ordering" yaml:"ordering"` - Counterparty Counterparty `json:"counterparty" yaml:"counterparty"` - ConnectionHops []string `json:"connection_hops" yaml:"connection_hops"` - Version string `json:"version" yaml:"version "` -} +var ( + _ exported.ChannelI = (*Channel)(nil) + _ exported.CounterpartyI = (*Counterparty)(nil) +) // NewChannel creates a new Channel instance func NewChannel( - state exported.State, ordering exported.Order, - counterparty Counterparty, hops []string, version string, + state ibctypes.State, ordering ibctypes.Order, counterparty Counterparty, + hops []string, version string, ) Channel { return Channel{ State: state, @@ -33,12 +29,12 @@ func NewChannel( } // GetState implements Channel interface. -func (ch Channel) GetState() exported.State { +func (ch Channel) GetState() ibctypes.State { return ch.State } // GetOrdering implements Channel interface. -func (ch Channel) GetOrdering() exported.Order { +func (ch Channel) GetOrdering() ibctypes.Order { return ch.Ordering } @@ -62,8 +58,8 @@ func (ch Channel) ValidateBasic() error { if ch.State.String() == "" { return sdkerrors.Wrap(ErrInvalidChannel, ErrInvalidChannelState.Error()) } - if ch.Ordering.String() == "" { - return sdkerrors.Wrap(ErrInvalidChannel, ErrInvalidChannelOrdering.Error()) + if !(ch.Ordering == ibctypes.ORDERED || ch.Ordering == ibctypes.UNORDERED) { + return sdkerrors.Wrap(ErrInvalidChannelOrdering, ch.Ordering.String()) } if len(ch.ConnectionHops) != 1 { return sdkerrors.Wrap( @@ -86,12 +82,6 @@ func (ch Channel) ValidateBasic() error { return ch.Counterparty.ValidateBasic() } -// Counterparty defines the counterparty chain's channel and port identifiers -type Counterparty struct { - PortID string `json:"port_id" yaml:"port_id"` - ChannelID string `json:"channel_id" yaml:"channel_id"` -} - // NewCounterparty returns a new Counterparty instance func NewCounterparty(portID, channelID string) Counterparty { return Counterparty{ diff --git a/x/ibc/04-channel/types/codec.go b/x/ibc/04-channel/types/codec.go index 3217e9b63d59..54d9aca7e557 100644 --- a/x/ibc/04-channel/types/codec.go +++ b/x/ibc/04-channel/types/codec.go @@ -2,23 +2,11 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" - client "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" - commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" ) -// SubModuleCdc defines the IBC channel codec. -var SubModuleCdc *codec.Codec - -func init() { - SubModuleCdc = codec.New() - commitmenttypes.RegisterCodec(SubModuleCdc) - client.RegisterCodec(SubModuleCdc) - RegisterCodec(SubModuleCdc) -} - -// RegisterCodec registers all the necessary types and interfaces for the -// IBC channel. +// RegisterCodec registers the necessary x/ibc/04-channel interfaces and concrete types +// on the provided Amino codec. These types are used for Amino JSON serialization. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterInterface((*exported.PacketI)(nil), nil) cdc.RegisterConcrete(Channel{}, "ibc/channel/Channel", nil) @@ -30,15 +18,24 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgChannelOpenConfirm{}, "ibc/channel/MsgChannelOpenConfirm", nil) cdc.RegisterConcrete(MsgChannelCloseInit{}, "ibc/channel/MsgChannelCloseInit", nil) cdc.RegisterConcrete(MsgChannelCloseConfirm{}, "ibc/channel/MsgChannelCloseConfirm", nil) - cdc.RegisterConcrete(MsgPacket{}, "ibc/channel/MsgPacket", nil) cdc.RegisterConcrete(MsgAcknowledgement{}, "ibc/channel/MsgAcknowledgement", nil) cdc.RegisterConcrete(MsgTimeout{}, "ibc/channel/MsgTimeout", nil) - - SetSubModuleCodec(cdc) } -// SetSubModuleCodec sets the ibc channel codec -func SetSubModuleCodec(cdc *codec.Codec) { - SubModuleCdc = cdc +var ( + amino = codec.New() + + // SubModuleCdc references the global x/ibc/04-channel module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding as Amino is + // still used for that purpose. + // + // The actual codec used for serialization should be provided to x/ibc/04-channel and + // defined at the application level. + SubModuleCdc = codec.NewHybridCodec(amino) +) + +func init() { + RegisterCodec(amino) + amino.Seal() } diff --git a/x/ibc/04-channel/types/msgs.go b/x/ibc/04-channel/types/msgs.go index f003bdafb627..cb2e139bd3c9 100644 --- a/x/ibc/04-channel/types/msgs.go +++ b/x/ibc/04-channel/types/msgs.go @@ -6,8 +6,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" - commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" @@ -15,20 +13,13 @@ import ( var _ sdk.Msg = MsgChannelOpenInit{} -type MsgChannelOpenInit struct { - PortID string `json:"port_id"` - ChannelID string `json:"channel_id"` - Channel Channel `json:"channel"` - Signer sdk.AccAddress `json:"signer"` -} - // NewMsgChannelOpenInit creates a new MsgChannelCloseInit MsgChannelOpenInit func NewMsgChannelOpenInit( - portID, channelID string, version string, channelOrder exported.Order, connectionHops []string, + portID, channelID string, version string, channelOrder ibctypes.Order, connectionHops []string, counterpartyPortID, counterpartyChannelID string, signer sdk.AccAddress, ) MsgChannelOpenInit { counterparty := NewCounterparty(counterpartyPortID, counterpartyChannelID) - channel := NewChannel(exported.INIT, channelOrder, counterparty, connectionHops, version) + channel := NewChannel(ibctypes.INIT, channelOrder, counterparty, connectionHops, version) return MsgChannelOpenInit{ PortID: portID, ChannelID: channelID, @@ -71,24 +62,14 @@ func (msg MsgChannelOpenInit) GetSigners() []sdk.AccAddress { var _ sdk.Msg = MsgChannelOpenTry{} -type MsgChannelOpenTry struct { - PortID string `json:"port_id"` - ChannelID string `json:"channel_id"` - Channel Channel `json:"channel"` - CounterpartyVersion string `json:"counterparty_version"` - ProofInit commitmentexported.Proof `json:"proof_init"` - ProofHeight uint64 `json:"proof_height"` - Signer sdk.AccAddress `json:"signer"` -} - // NewMsgChannelOpenTry creates a new MsgChannelOpenTry instance func NewMsgChannelOpenTry( - portID, channelID, version string, channelOrder exported.Order, connectionHops []string, + portID, channelID, version string, channelOrder ibctypes.Order, connectionHops []string, counterpartyPortID, counterpartyChannelID, counterpartyVersion string, - proofInit commitmentexported.Proof, proofHeight uint64, signer sdk.AccAddress, + proofInit commitmenttypes.MerkleProof, proofHeight uint64, signer sdk.AccAddress, ) MsgChannelOpenTry { counterparty := NewCounterparty(counterpartyPortID, counterpartyChannelID) - channel := NewChannel(exported.INIT, channelOrder, counterparty, connectionHops, version) + channel := NewChannel(ibctypes.INIT, channelOrder, counterparty, connectionHops, version) return MsgChannelOpenTry{ PortID: portID, ChannelID: channelID, @@ -121,7 +102,7 @@ func (msg MsgChannelOpenTry) ValidateBasic() error { if strings.TrimSpace(msg.CounterpartyVersion) == "" { return sdkerrors.Wrap(ErrInvalidCounterparty, "counterparty version cannot be blank") } - if msg.ProofInit == nil { + if msg.ProofInit.IsEmpty() { return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof") } if err := msg.ProofInit.ValidateBasic(); err != nil { @@ -146,18 +127,9 @@ func (msg MsgChannelOpenTry) GetSigners() []sdk.AccAddress { var _ sdk.Msg = MsgChannelOpenAck{} -type MsgChannelOpenAck struct { - PortID string `json:"port_id"` - ChannelID string `json:"channel_id"` - CounterpartyVersion string `json:"counterparty_version"` - ProofTry commitmentexported.Proof `json:"proof_try"` - ProofHeight uint64 `json:"proof_height"` - Signer sdk.AccAddress `json:"signer"` -} - // NewMsgChannelOpenAck creates a new MsgChannelOpenAck instance func NewMsgChannelOpenAck( - portID, channelID string, cpv string, proofTry commitmentexported.Proof, proofHeight uint64, + portID, channelID string, cpv string, proofTry commitmenttypes.MerkleProof, proofHeight uint64, signer sdk.AccAddress, ) MsgChannelOpenAck { return MsgChannelOpenAck{ @@ -191,7 +163,7 @@ func (msg MsgChannelOpenAck) ValidateBasic() error { if strings.TrimSpace(msg.CounterpartyVersion) == "" { return sdkerrors.Wrap(ErrInvalidCounterparty, "counterparty version cannot be blank") } - if msg.ProofTry == nil { + if msg.ProofTry.IsEmpty() { return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof") } if err := msg.ProofTry.ValidateBasic(); err != nil { @@ -216,17 +188,9 @@ func (msg MsgChannelOpenAck) GetSigners() []sdk.AccAddress { var _ sdk.Msg = MsgChannelOpenConfirm{} -type MsgChannelOpenConfirm struct { - PortID string `json:"port_id"` - ChannelID string `json:"channel_id"` - ProofAck commitmentexported.Proof `json:"proof_ack"` - ProofHeight uint64 `json:"proof_height"` - Signer sdk.AccAddress `json:"signer"` -} - // NewMsgChannelOpenConfirm creates a new MsgChannelOpenConfirm instance func NewMsgChannelOpenConfirm( - portID, channelID string, proofAck commitmentexported.Proof, proofHeight uint64, + portID, channelID string, proofAck commitmenttypes.MerkleProof, proofHeight uint64, signer sdk.AccAddress, ) MsgChannelOpenConfirm { return MsgChannelOpenConfirm{ @@ -256,7 +220,7 @@ func (msg MsgChannelOpenConfirm) ValidateBasic() error { if err := host.DefaultChannelIdentifierValidator(msg.ChannelID); err != nil { return sdkerrors.Wrap(err, "invalid channel ID") } - if msg.ProofAck == nil { + if msg.ProofAck.IsEmpty() { return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof") } if err := msg.ProofAck.ValidateBasic(); err != nil { @@ -281,14 +245,10 @@ func (msg MsgChannelOpenConfirm) GetSigners() []sdk.AccAddress { var _ sdk.Msg = MsgChannelCloseInit{} -type MsgChannelCloseInit struct { - PortID string `json:"port_id"` - ChannelID string `json:"channel_id"` - Signer sdk.AccAddress `json:"signer"` -} - // NewMsgChannelCloseInit creates a new MsgChannelCloseInit instance -func NewMsgChannelCloseInit(portID string, channelID string, signer sdk.AccAddress) MsgChannelCloseInit { +func NewMsgChannelCloseInit( + portID string, channelID string, signer sdk.AccAddress, +) MsgChannelCloseInit { return MsgChannelCloseInit{ PortID: portID, ChannelID: channelID, @@ -330,17 +290,9 @@ func (msg MsgChannelCloseInit) GetSigners() []sdk.AccAddress { var _ sdk.Msg = MsgChannelCloseConfirm{} -type MsgChannelCloseConfirm struct { - PortID string `json:"port_id"` - ChannelID string `json:"channel_id"` - ProofInit commitmentexported.Proof `json:"proof_init"` - ProofHeight uint64 `json:"proof_height"` - Signer sdk.AccAddress `json:"signer"` -} - // NewMsgChannelCloseConfirm creates a new MsgChannelCloseConfirm instance func NewMsgChannelCloseConfirm( - portID, channelID string, proofInit commitmentexported.Proof, proofHeight uint64, + portID, channelID string, proofInit commitmenttypes.MerkleProof, proofHeight uint64, signer sdk.AccAddress, ) MsgChannelCloseConfirm { return MsgChannelCloseConfirm{ @@ -370,7 +322,7 @@ func (msg MsgChannelCloseConfirm) ValidateBasic() error { if err := host.DefaultChannelIdentifierValidator(msg.ChannelID); err != nil { return sdkerrors.Wrap(err, "invalid channel ID") } - if msg.ProofInit == nil { + if msg.ProofInit.IsEmpty() { return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof") } if err := msg.ProofInit.ValidateBasic(); err != nil { @@ -393,18 +345,13 @@ func (msg MsgChannelCloseConfirm) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{msg.Signer} } -// MsgPacket receives incoming IBC packet -type MsgPacket struct { - Packet `json:"packet" yaml:"packet"` - Proof commitmentexported.Proof `json:"proof" yaml:"proof"` - ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` - Signer sdk.AccAddress `json:"signer" yaml:"signer"` -} - var _ sdk.Msg = MsgPacket{} // NewMsgPacket constructs new MsgPacket -func NewMsgPacket(packet Packet, proof commitmentexported.Proof, proofHeight uint64, signer sdk.AccAddress) MsgPacket { +func NewMsgPacket( + packet Packet, proof commitmenttypes.MerkleProof, proofHeight uint64, + signer sdk.AccAddress, +) MsgPacket { return MsgPacket{ Packet: packet, Proof: proof, @@ -420,7 +367,7 @@ func (msg MsgPacket) Route() string { // ValidateBasic implements sdk.Msg func (msg MsgPacket) ValidateBasic() error { - if msg.Proof == nil { + if msg.Proof.IsEmpty() { return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof") } if err := msg.Proof.ValidateBasic(); err != nil { @@ -444,7 +391,7 @@ func (msg MsgPacket) GetSignBytes() []byte { // GetDataSignBytes returns the base64-encoded bytes used for the // data field when signing the packet. func (msg MsgPacket) GetDataSignBytes() []byte { - s := "\"" + base64.StdEncoding.EncodeToString(msg.Data) + "\"" + s := "\"" + base64.StdEncoding.EncodeToString(msg.Packet.Data) + "\"" return []byte(s) } @@ -460,17 +407,11 @@ func (msg MsgPacket) Type() string { var _ sdk.Msg = MsgTimeout{} -// MsgTimeout receives timed-out packet -type MsgTimeout struct { - Packet `json:"packet" yaml:"packet"` - NextSequenceRecv uint64 `json:"next_sequence_recv" yaml:"next_sequence_recv"` - Proof commitmentexported.Proof `json:"proof" yaml:"proof"` - ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` - Signer sdk.AccAddress `json:"signer" yaml:"signer"` -} - // NewMsgTimeout constructs new MsgTimeout -func NewMsgTimeout(packet Packet, nextSequenceRecv uint64, proof commitmentexported.Proof, proofHeight uint64, signer sdk.AccAddress) MsgTimeout { +func NewMsgTimeout( + packet Packet, nextSequenceRecv uint64, proof commitmenttypes.MerkleProof, + proofHeight uint64, signer sdk.AccAddress, +) MsgTimeout { return MsgTimeout{ Packet: packet, NextSequenceRecv: nextSequenceRecv, @@ -487,7 +428,7 @@ func (msg MsgTimeout) Route() string { // ValidateBasic implements sdk.Msg func (msg MsgTimeout) ValidateBasic() error { - if msg.Proof == nil { + if msg.Proof.IsEmpty() { return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof") } if err := msg.Proof.ValidateBasic(); err != nil { @@ -520,17 +461,9 @@ func (msg MsgTimeout) Type() string { var _ sdk.Msg = MsgAcknowledgement{} -// MsgAcknowledgement receives incoming IBC acknowledgement -type MsgAcknowledgement struct { - Packet `json:"packet" yaml:"packet"` - Acknowledgement []byte `json:"acknowledgement" yaml:"acknowledgement"` - Proof commitmentexported.Proof `json:"proof" yaml:"proof"` - ProofHeight uint64 `json:"proof_height" yaml:"proof_height"` - Signer sdk.AccAddress `json:"signer" yaml:"signer"` -} - // NewMsgAcknowledgement constructs a new MsgAcknowledgement -func NewMsgAcknowledgement(packet Packet, ack []byte, proof commitmentexported.Proof, proofHeight uint64, signer sdk.AccAddress) MsgAcknowledgement { +func NewMsgAcknowledgement( + packet Packet, ack []byte, proof commitmenttypes.MerkleProof, proofHeight uint64, signer sdk.AccAddress) MsgAcknowledgement { return MsgAcknowledgement{ Packet: packet, Acknowledgement: ack, @@ -547,7 +480,7 @@ func (msg MsgAcknowledgement) Route() string { // ValidateBasic implements sdk.Msg func (msg MsgAcknowledgement) ValidateBasic() error { - if msg.Proof == nil { + if msg.Proof.IsEmpty() { return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof") } if err := msg.Proof.ValidateBasic(); err != nil { diff --git a/x/ibc/04-channel/types/msgs_test.go b/x/ibc/04-channel/types/msgs_test.go index 87687c27d468..fd6dcce9c2af 100644 --- a/x/ibc/04-channel/types/msgs_test.go +++ b/x/ibc/04-channel/types/msgs_test.go @@ -15,9 +15,9 @@ import ( "github.com/cosmos/cosmos-sdk/store/rootmulti" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" + ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) // define constants used for testing @@ -42,7 +42,7 @@ var ( invalidShortConnHops = []string{invalidShortConnection} invalidLongConnHops = []string{invalidLongConnection} - proof = commitmenttypes.MerkleProof{Proof: &merkle.Proof{}} + proof = commitmenttypes.MerkleProof{Proof: &merkle.Proof{Ops: []merkle.ProofOp{{Type: "proof", Key: []byte("key"), Data: []byte("data")}}}} addr = sdk.AccAddress("testaddr") ) @@ -81,21 +81,21 @@ func TestMsgTestSuite(t *testing.T) { // TestMsgChannelOpenInit tests ValidateBasic for MsgChannelOpenInit func (suite *MsgTestSuite) TestMsgChannelOpenInit() { testMsgs := []MsgChannelOpenInit{ - NewMsgChannelOpenInit("testportid", "testchannel", "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", addr), // valid msg - NewMsgChannelOpenInit(invalidShortPort, "testchannel", "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", addr), // too short port id - NewMsgChannelOpenInit(invalidLongPort, "testchannel", "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", addr), // too long port id - NewMsgChannelOpenInit(invalidPort, "testchannel", "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", addr), // port id contains non-alpha - NewMsgChannelOpenInit("testportid", invalidShortChannel, "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", addr), // too short channel id - NewMsgChannelOpenInit("testportid", invalidLongChannel, "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", addr), // too long channel id - NewMsgChannelOpenInit("testportid", invalidChannel, "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", addr), // channel id contains non-alpha - NewMsgChannelOpenInit("testportid", "testchannel", "1.0", exported.Order(3), connHops, "testcpport", "testcpchannel", addr), // invalid channel order - NewMsgChannelOpenInit("testportid", "testchannel", "1.0", exported.ORDERED, invalidConnHops, "testcpport", "testcpchannel", addr), // connection hops more than 1 - NewMsgChannelOpenInit("testportid", "testchannel", "1.0", exported.UNORDERED, invalidShortConnHops, "testcpport", "testcpchannel", addr), // too short connection id - NewMsgChannelOpenInit("testportid", "testchannel", "1.0", exported.UNORDERED, invalidLongConnHops, "testcpport", "testcpchannel", addr), // too long connection id - NewMsgChannelOpenInit("testportid", "testchannel", "1.0", exported.UNORDERED, []string{invalidConnection}, "testcpport", "testcpchannel", addr), // connection id contains non-alpha - NewMsgChannelOpenInit("testportid", "testchannel", "", exported.UNORDERED, connHops, "testcpport", "testcpchannel", addr), // empty channel version - NewMsgChannelOpenInit("testportid", "testchannel", "1.0", exported.UNORDERED, connHops, invalidPort, "testcpchannel", addr), // invalid counterparty port id - NewMsgChannelOpenInit("testportid", "testchannel", "1.0", exported.UNORDERED, connHops, "testcpport", invalidChannel, addr), // invalid counterparty channel id + NewMsgChannelOpenInit("testportid", "testchannel", "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", addr), // valid msg + NewMsgChannelOpenInit(invalidShortPort, "testchannel", "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", addr), // too short port id + NewMsgChannelOpenInit(invalidLongPort, "testchannel", "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", addr), // too long port id + NewMsgChannelOpenInit(invalidPort, "testchannel", "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", addr), // port id contains non-alpha + NewMsgChannelOpenInit("testportid", invalidShortChannel, "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", addr), // too short channel id + NewMsgChannelOpenInit("testportid", invalidLongChannel, "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", addr), // too long channel id + NewMsgChannelOpenInit("testportid", invalidChannel, "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", addr), // channel id contains non-alpha + NewMsgChannelOpenInit("testportid", "testchannel", "1.0", ibctypes.Order(3), connHops, "testcpport", "testcpchannel", addr), // invalid channel order + NewMsgChannelOpenInit("testportid", "testchannel", "1.0", ibctypes.ORDERED, invalidConnHops, "testcpport", "testcpchannel", addr), // connection hops more than 1 + NewMsgChannelOpenInit("testportid", "testchannel", "1.0", ibctypes.UNORDERED, invalidShortConnHops, "testcpport", "testcpchannel", addr), // too short connection id + NewMsgChannelOpenInit("testportid", "testchannel", "1.0", ibctypes.UNORDERED, invalidLongConnHops, "testcpport", "testcpchannel", addr), // too long connection id + NewMsgChannelOpenInit("testportid", "testchannel", "1.0", ibctypes.UNORDERED, []string{invalidConnection}, "testcpport", "testcpchannel", addr), // connection id contains non-alpha + NewMsgChannelOpenInit("testportid", "testchannel", "", ibctypes.UNORDERED, connHops, "testcpport", "testcpchannel", addr), // empty channel version + NewMsgChannelOpenInit("testportid", "testchannel", "1.0", ibctypes.UNORDERED, connHops, invalidPort, "testcpchannel", addr), // invalid counterparty port id + NewMsgChannelOpenInit("testportid", "testchannel", "1.0", ibctypes.UNORDERED, connHops, "testcpport", invalidChannel, addr), // invalid counterparty channel id } testCases := []struct { @@ -133,24 +133,23 @@ func (suite *MsgTestSuite) TestMsgChannelOpenInit() { // TestMsgChannelOpenTry tests ValidateBasic for MsgChannelOpenTry func (suite *MsgTestSuite) TestMsgChannelOpenTry() { testMsgs := []MsgChannelOpenTry{ - NewMsgChannelOpenTry("testportid", "testchannel", "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // valid msg - NewMsgChannelOpenTry(invalidShortPort, "testchannel", "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too short port id - NewMsgChannelOpenTry(invalidLongPort, "testchannel", "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too long port id - NewMsgChannelOpenTry(invalidPort, "testchannel", "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // port id contains non-alpha - NewMsgChannelOpenTry("testportid", invalidShortChannel, "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too short channel id - NewMsgChannelOpenTry("testportid", invalidLongChannel, "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too long channel id - NewMsgChannelOpenTry("testportid", invalidChannel, "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // channel id contains non-alpha - NewMsgChannelOpenTry("testportid", "testchannel", "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", "", suite.proof, 1, addr), // empty counterparty version - NewMsgChannelOpenTry("testportid", "testchannel", "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", nil, 1, addr), // empty suite.proof - NewMsgChannelOpenTry("testportid", "testchannel", "1.0", exported.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 0, addr), // suite.proof height is zero - NewMsgChannelOpenTry("testportid", "testchannel", "1.0", exported.Order(4), connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // invalid channel order - NewMsgChannelOpenTry("testportid", "testchannel", "1.0", exported.UNORDERED, invalidConnHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // connection hops more than 1 - NewMsgChannelOpenTry("testportid", "testchannel", "1.0", exported.UNORDERED, invalidShortConnHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too short connection id - NewMsgChannelOpenTry("testportid", "testchannel", "1.0", exported.UNORDERED, invalidLongConnHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too long connection id - NewMsgChannelOpenTry("testportid", "testchannel", "1.0", exported.UNORDERED, []string{invalidConnection}, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // connection id contains non-alpha - NewMsgChannelOpenTry("testportid", "testchannel", "", exported.UNORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // empty channel version - NewMsgChannelOpenTry("testportid", "testchannel", "1.0", exported.UNORDERED, connHops, invalidPort, "testcpchannel", "1.0", suite.proof, 1, addr), // invalid counterparty port id - NewMsgChannelOpenTry("testportid", "testchannel", "1.0", exported.UNORDERED, connHops, "testcpport", invalidChannel, "1.0", suite.proof, 1, addr), // invalid counterparty channel id + NewMsgChannelOpenTry("testportid", "testchannel", "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // valid msg + NewMsgChannelOpenTry(invalidShortPort, "testchannel", "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too short port id + NewMsgChannelOpenTry(invalidLongPort, "testchannel", "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too long port id + NewMsgChannelOpenTry(invalidPort, "testchannel", "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // port id contains non-alpha + NewMsgChannelOpenTry("testportid", invalidShortChannel, "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too short channel id + NewMsgChannelOpenTry("testportid", invalidLongChannel, "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too long channel id + NewMsgChannelOpenTry("testportid", invalidChannel, "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // channel id contains non-alpha + NewMsgChannelOpenTry("testportid", "testchannel", "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", "", suite.proof, 1, addr), // empty counterparty version + NewMsgChannelOpenTry("testportid", "testchannel", "1.0", ibctypes.ORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 0, addr), // suite.proof height is zero + NewMsgChannelOpenTry("testportid", "testchannel", "1.0", ibctypes.Order(4), connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // invalid channel order + NewMsgChannelOpenTry("testportid", "testchannel", "1.0", ibctypes.UNORDERED, invalidConnHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // connection hops more than 1 + NewMsgChannelOpenTry("testportid", "testchannel", "1.0", ibctypes.UNORDERED, invalidShortConnHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too short connection id + NewMsgChannelOpenTry("testportid", "testchannel", "1.0", ibctypes.UNORDERED, invalidLongConnHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // too long connection id + NewMsgChannelOpenTry("testportid", "testchannel", "1.0", ibctypes.UNORDERED, []string{invalidConnection}, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // connection id contains non-alpha + NewMsgChannelOpenTry("testportid", "testchannel", "", ibctypes.UNORDERED, connHops, "testcpport", "testcpchannel", "1.0", suite.proof, 1, addr), // empty channel version + NewMsgChannelOpenTry("testportid", "testchannel", "1.0", ibctypes.UNORDERED, connHops, invalidPort, "testcpchannel", "1.0", suite.proof, 1, addr), // invalid counterparty port id + NewMsgChannelOpenTry("testportid", "testchannel", "1.0", ibctypes.UNORDERED, connHops, "testcpport", invalidChannel, "1.0", suite.proof, 1, addr), // invalid counterparty channel id } testCases := []struct { @@ -166,16 +165,15 @@ func (suite *MsgTestSuite) TestMsgChannelOpenTry() { {testMsgs[5], false, "too long channel id"}, {testMsgs[6], false, "channel id contains non-alpha"}, {testMsgs[7], false, "empty counterparty version"}, - {testMsgs[8], false, "empty proof"}, - {testMsgs[9], false, "proof height is zero"}, - {testMsgs[10], false, "invalid channel order"}, - {testMsgs[11], false, "connection hops more than 1 "}, - {testMsgs[12], false, "too short connection id"}, - {testMsgs[13], false, "too long connection id"}, - {testMsgs[14], false, "connection id contains non-alpha"}, - {testMsgs[15], false, "empty channel version"}, - {testMsgs[16], false, "invalid counterparty port id"}, - {testMsgs[17], false, "invalid counterparty channel id"}, + {testMsgs[8], false, "proof height is zero"}, + {testMsgs[9], false, "invalid channel order"}, + {testMsgs[10], false, "connection hops more than 1 "}, + {testMsgs[11], false, "too short connection id"}, + {testMsgs[12], false, "too long connection id"}, + {testMsgs[13], false, "connection id contains non-alpha"}, + {testMsgs[14], false, "empty channel version"}, + {testMsgs[15], false, "invalid counterparty port id"}, + {testMsgs[16], false, "invalid counterparty channel id"}, } for i, tc := range testCases { @@ -199,7 +197,6 @@ func (suite *MsgTestSuite) TestMsgChannelOpenAck() { NewMsgChannelOpenAck("testportid", invalidLongChannel, "1.0", suite.proof, 1, addr), // too long channel id NewMsgChannelOpenAck("testportid", invalidChannel, "1.0", suite.proof, 1, addr), // channel id contains non-alpha NewMsgChannelOpenAck("testportid", "testchannel", "", suite.proof, 1, addr), // empty counterparty version - NewMsgChannelOpenAck("testportid", "testchannel", "1.0", nil, 1, addr), // empty proof NewMsgChannelOpenAck("testportid", "testchannel", "1.0", commitmenttypes.MerkleProof{Proof: nil}, 1, addr), // empty proof NewMsgChannelOpenAck("testportid", "testchannel", "1.0", suite.proof, 0, addr), // proof height is zero } @@ -218,8 +215,7 @@ func (suite *MsgTestSuite) TestMsgChannelOpenAck() { {testMsgs[6], false, "channel id contains non-alpha"}, {testMsgs[7], false, "empty counterparty version"}, {testMsgs[8], false, "empty proof"}, - {testMsgs[9], false, "empty proof"}, - {testMsgs[10], false, "proof height is zero"}, + {testMsgs[9], false, "proof height is zero"}, } for i, tc := range testCases { @@ -242,7 +238,6 @@ func (suite *MsgTestSuite) TestMsgChannelOpenConfirm() { NewMsgChannelOpenConfirm("testportid", invalidShortChannel, suite.proof, 1, addr), // too short channel id NewMsgChannelOpenConfirm("testportid", invalidLongChannel, suite.proof, 1, addr), // too long channel id NewMsgChannelOpenConfirm("testportid", invalidChannel, suite.proof, 1, addr), // channel id contains non-alpha - NewMsgChannelOpenConfirm("testportid", "testchannel", nil, 1, addr), // empty proof NewMsgChannelOpenConfirm("testportid", "testchannel", commitmenttypes.MerkleProof{Proof: nil}, 1, addr), // empty proof NewMsgChannelOpenConfirm("testportid", "testchannel", suite.proof, 0, addr), // proof height is zero } @@ -260,8 +255,7 @@ func (suite *MsgTestSuite) TestMsgChannelOpenConfirm() { {testMsgs[5], false, "too long channel id"}, {testMsgs[6], false, "channel id contains non-alpha"}, {testMsgs[7], false, "empty proof"}, - {testMsgs[8], false, "empty proof"}, - {testMsgs[9], false, "proof height is zero"}, + {testMsgs[8], false, "proof height is zero"}, } for i, tc := range testCases { @@ -320,7 +314,6 @@ func (suite *MsgTestSuite) TestMsgChannelCloseConfirm() { NewMsgChannelCloseConfirm("testportid", invalidShortChannel, suite.proof, 1, addr), // too short channel id NewMsgChannelCloseConfirm("testportid", invalidLongChannel, suite.proof, 1, addr), // too long channel id NewMsgChannelCloseConfirm("testportid", invalidChannel, suite.proof, 1, addr), // channel id contains non-alpha - NewMsgChannelCloseConfirm("testportid", "testchannel", nil, 1, addr), // empty proof NewMsgChannelCloseConfirm("testportid", "testchannel", commitmenttypes.MerkleProof{Proof: nil}, 1, addr), // empty proof NewMsgChannelCloseConfirm("testportid", "testchannel", suite.proof, 0, addr), // proof height is zero } @@ -338,8 +331,7 @@ func (suite *MsgTestSuite) TestMsgChannelCloseConfirm() { {testMsgs[5], false, "too long channel id"}, {testMsgs[6], false, "channel id contains non-alpha"}, {testMsgs[7], false, "empty proof"}, - {testMsgs[8], false, "empty proof"}, - {testMsgs[9], false, "proof height is zero"}, + {testMsgs[8], false, "proof height is zero"}, } for i, tc := range testCases { @@ -382,7 +374,7 @@ var ( func TestMsgPacketType(t *testing.T) { msg := NewMsgPacket(packet, proof, 1, addr1) - require.Equal(t, []byte("testdata"), msg.GetData()) + require.Equal(t, []byte("testdata"), msg.Packet.GetData()) } // TestMsgPacketValidation tests ValidateBasic for MsgPacket @@ -390,8 +382,6 @@ func TestMsgPacketValidation(t *testing.T) { testMsgs := []MsgPacket{ NewMsgPacket(packet, proof, 1, addr1), // valid msg NewMsgPacket(packet, proof, 0, addr1), // proof height is zero - NewMsgPacket(packet, nil, 1, addr1), // missing proof - NewMsgPacket(packet, invalidProofs1, 1, addr1), // missing proof NewMsgPacket(packet, invalidProofs2, 1, addr1), // proof contain empty proof NewMsgPacket(packet, proof, 1, emptyAddr), // missing signer address NewMsgPacket(unknownPacket, proof, 1, addr1), // unknown packet @@ -404,11 +394,9 @@ func TestMsgPacketValidation(t *testing.T) { }{ {testMsgs[0], true, ""}, {testMsgs[1], false, "proof height is zero"}, - {testMsgs[2], false, "missing proof"}, - {testMsgs[3], false, "missing proof"}, - {testMsgs[4], false, "proof contain empty proof"}, - {testMsgs[5], false, "missing signer address"}, - {testMsgs[6], false, "invalid packet"}, + {testMsgs[2], false, "proof contain empty proof"}, + {testMsgs[3], false, "missing signer address"}, + {testMsgs[4], false, "invalid packet"}, } for i, tc := range testCases { @@ -427,7 +415,7 @@ func TestMsgPacketGetSignBytes(t *testing.T) { res := msg.GetSignBytes() expected := fmt.Sprintf( - `{"type":"ibc/channel/MsgPacket","value":{"packet":{"data":%s,"destination_channel":"testcpchannel","destination_port":"testcpport","sequence":"1","source_channel":"testchannel","source_port":"testportid","timeout_height":"100","timeout_timestamp":"100"},"proof":{"type":"ibc/commitment/MerkleProof","value":{"proof":{"ops":[]}}},"proof_height":"1","signer":"cosmos1w3jhxarpv3j8yvg4ufs4x"}}`, + `{"type":"ibc/channel/MsgPacket","value":{"packet":{"data":%s,"destination_channel":"testcpchannel","destination_port":"testcpport","sequence":"1","source_channel":"testchannel","source_port":"testportid","timeout_height":"100","timeout_timestamp":"100"},"proof":{"proof":{"ops":[{"data":"ZGF0YQ==","key":"a2V5","type":"proof"}]}},"proof_height":"1","signer":"cosmos1w3jhxarpv3j8yvg4ufs4x"}}`, string(msg.GetDataSignBytes()), ) require.Equal(t, expected, string(res)) @@ -445,12 +433,11 @@ func TestMsgPacketGetSigners(t *testing.T) { // TestMsgTimeout tests ValidateBasic for MsgTimeout func (suite *MsgTestSuite) TestMsgTimeout() { testMsgs := []MsgTimeout{ - NewMsgTimeout(packet, 0, proof, 1, addr), - NewMsgTimeout(packet, 0, proof, 0, addr), - NewMsgTimeout(packet, 0, proof, 1, emptyAddr), - NewMsgTimeout(packet, 0, emptyProof, 1, addr), - NewMsgTimeout(unknownPacket, 0, proof, 1, addr), - NewMsgTimeout(packet, 0, invalidProofs1, 1, addr), + NewMsgTimeout(packet, 1, proof, 1, addr), + NewMsgTimeout(packet, 1, proof, 0, addr), + NewMsgTimeout(packet, 1, proof, 1, emptyAddr), + NewMsgTimeout(packet, 1, emptyProof, 1, addr), + NewMsgTimeout(unknownPacket, 1, proof, 1, addr), } testCases := []struct { @@ -463,7 +450,6 @@ func (suite *MsgTestSuite) TestMsgTimeout() { {testMsgs[2], false, "missing signer address"}, {testMsgs[3], false, "cannot submit an empty proof"}, {testMsgs[4], false, "invalid packet"}, - {testMsgs[5], false, "cannot submit an invalid proof"}, } for i, tc := range testCases { @@ -485,7 +471,6 @@ func (suite *MsgTestSuite) TestMsgAcknowledgement() { NewMsgAcknowledgement(packet, packet.GetData(), emptyProof, 1, addr), NewMsgAcknowledgement(unknownPacket, packet.GetData(), proof, 1, addr), NewMsgAcknowledgement(packet, invalidAck, proof, 1, addr), - NewMsgAcknowledgement(packet, packet.GetData(), invalidProofs1, 1, addr), } testCases := []struct { @@ -499,7 +484,6 @@ func (suite *MsgTestSuite) TestMsgAcknowledgement() { {testMsgs[3], false, "cannot submit an empty proof"}, {testMsgs[4], false, "invalid packet"}, {testMsgs[5], false, "invalid acknowledgement"}, - {testMsgs[6], false, "cannot submit an invalid proof"}, } for i, tc := range testCases { diff --git a/x/ibc/04-channel/types/packet.go b/x/ibc/04-channel/types/packet.go index 16c397ef38b0..626ffae89fd3 100644 --- a/x/ibc/04-channel/types/packet.go +++ b/x/ibc/04-channel/types/packet.go @@ -23,22 +23,10 @@ func CommitAcknowledgement(data []byte) []byte { return tmhash.Sum(data) } -var _ exported.PacketI = Packet{} +var _ exported.PacketI = (*Packet)(nil) -// Packet defines a type that carries data across different chains through IBC -type Packet struct { - Data []byte `json:"data" yaml:"data"` // Actual opaque bytes transferred directly to the application module - - Sequence uint64 `json:"sequence" yaml:"sequence"` // number corresponds to the order of sends and receives, where a Packet with an earlier sequence number must be sent and received before a Packet with a later sequence number. - SourcePort string `json:"source_port" yaml:"source_port"` // identifies the port on the sending chain. - SourceChannel string `json:"source_channel" yaml:"source_channel"` // identifies the channel end on the sending chain. - DestinationPort string `json:"destination_port" yaml:"destination_port"` // identifies the port on the receiving chain. - DestinationChannel string `json:"destination_channel" yaml:"destination_channel"` // identifies the channel end on the receiving chain. - TimeoutHeight uint64 `json:"timeout_height" yaml:"timeout_height"` // block height after which the packet times out - TimeoutTimestamp uint64 `json:"timeout_timestamp" yaml:"timeout_timestamp"` // block timestamp (in nanoseconds) after which the packet times out -} - -// NewPacket creates a new Packet instance +// NewPacket creates a new Packet instance. It panics if the provided +// packet data interface is not registered. func NewPacket( data []byte, sequence uint64, sourcePort, sourceChannel, diff --git a/x/ibc/04-channel/types/types.pb.go b/x/ibc/04-channel/types/types.pb.go new file mode 100644 index 000000000000..f21eaba8fe36 --- /dev/null +++ b/x/ibc/04-channel/types/types.pb.go @@ -0,0 +1,4449 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/ibc/04-channel/types/types.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" + types1 "github.com/cosmos/cosmos-sdk/x/ibc/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It is +// called by a relayer on Chain A. +type MsgChannelOpenInit struct { + PortID string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + Channel Channel `protobuf:"bytes,3,opt,name=channel,proto3" json:"channel"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgChannelOpenInit) Reset() { *m = MsgChannelOpenInit{} } +func (m *MsgChannelOpenInit) String() string { return proto.CompactTextString(m) } +func (*MsgChannelOpenInit) ProtoMessage() {} +func (*MsgChannelOpenInit) Descriptor() ([]byte, []int) { + return fileDescriptor_a69005b45bd92d03, []int{0} +} +func (m *MsgChannelOpenInit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgChannelOpenInit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgChannelOpenInit.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 *MsgChannelOpenInit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgChannelOpenInit.Merge(m, src) +} +func (m *MsgChannelOpenInit) XXX_Size() int { + return m.Size() +} +func (m *MsgChannelOpenInit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgChannelOpenInit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgChannelOpenInit proto.InternalMessageInfo + +func (m *MsgChannelOpenInit) GetPortID() string { + if m != nil { + return m.PortID + } + return "" +} + +func (m *MsgChannelOpenInit) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *MsgChannelOpenInit) GetChannel() Channel { + if m != nil { + return m.Channel + } + return Channel{} +} + +func (m *MsgChannelOpenInit) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +// MsgChannelOpenInit defines an sdk.Msg to try open a channel handshake. It is +// called by a relayer on Chain A. +type MsgChannelOpenTry struct { + PortID string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + Channel Channel `protobuf:"bytes,3,opt,name=channel,proto3" json:"channel"` + CounterpartyVersion string `protobuf:"bytes,4,opt,name=counterparty_version,json=counterpartyVersion,proto3" json:"counterparty_version,omitempty" yaml:"counterparty_version"` + ProofInit types.MerkleProof `protobuf:"bytes,5,opt,name=proof_init,json=proofInit,proto3" json:"proof_init"` + ProofHeight uint64 `protobuf:"varint,6,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,7,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgChannelOpenTry) Reset() { *m = MsgChannelOpenTry{} } +func (m *MsgChannelOpenTry) String() string { return proto.CompactTextString(m) } +func (*MsgChannelOpenTry) ProtoMessage() {} +func (*MsgChannelOpenTry) Descriptor() ([]byte, []int) { + return fileDescriptor_a69005b45bd92d03, []int{1} +} +func (m *MsgChannelOpenTry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgChannelOpenTry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgChannelOpenTry.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 *MsgChannelOpenTry) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgChannelOpenTry.Merge(m, src) +} +func (m *MsgChannelOpenTry) XXX_Size() int { + return m.Size() +} +func (m *MsgChannelOpenTry) XXX_DiscardUnknown() { + xxx_messageInfo_MsgChannelOpenTry.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgChannelOpenTry proto.InternalMessageInfo + +func (m *MsgChannelOpenTry) GetPortID() string { + if m != nil { + return m.PortID + } + return "" +} + +func (m *MsgChannelOpenTry) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *MsgChannelOpenTry) GetChannel() Channel { + if m != nil { + return m.Channel + } + return Channel{} +} + +func (m *MsgChannelOpenTry) GetCounterpartyVersion() string { + if m != nil { + return m.CounterpartyVersion + } + return "" +} + +func (m *MsgChannelOpenTry) GetProofInit() types.MerkleProof { + if m != nil { + return m.ProofInit + } + return types.MerkleProof{} +} + +func (m *MsgChannelOpenTry) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + +func (m *MsgChannelOpenTry) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +type MsgChannelOpenAck struct { + PortID string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + CounterpartyVersion string `protobuf:"bytes,3,opt,name=counterparty_version,json=counterpartyVersion,proto3" json:"counterparty_version,omitempty" yaml:"counterparty_version"` + ProofTry types.MerkleProof `protobuf:"bytes,4,opt,name=proof_try,json=proofTry,proto3" json:"proof_try"` + ProofHeight uint64 `protobuf:"varint,5,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,6,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgChannelOpenAck) Reset() { *m = MsgChannelOpenAck{} } +func (m *MsgChannelOpenAck) String() string { return proto.CompactTextString(m) } +func (*MsgChannelOpenAck) ProtoMessage() {} +func (*MsgChannelOpenAck) Descriptor() ([]byte, []int) { + return fileDescriptor_a69005b45bd92d03, []int{2} +} +func (m *MsgChannelOpenAck) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgChannelOpenAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgChannelOpenAck.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 *MsgChannelOpenAck) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgChannelOpenAck.Merge(m, src) +} +func (m *MsgChannelOpenAck) XXX_Size() int { + return m.Size() +} +func (m *MsgChannelOpenAck) XXX_DiscardUnknown() { + xxx_messageInfo_MsgChannelOpenAck.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgChannelOpenAck proto.InternalMessageInfo + +func (m *MsgChannelOpenAck) GetPortID() string { + if m != nil { + return m.PortID + } + return "" +} + +func (m *MsgChannelOpenAck) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *MsgChannelOpenAck) GetCounterpartyVersion() string { + if m != nil { + return m.CounterpartyVersion + } + return "" +} + +func (m *MsgChannelOpenAck) GetProofTry() types.MerkleProof { + if m != nil { + return m.ProofTry + } + return types.MerkleProof{} +} + +func (m *MsgChannelOpenAck) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + +func (m *MsgChannelOpenAck) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +type MsgChannelOpenConfirm struct { + PortID string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + ProofAck types.MerkleProof `protobuf:"bytes,3,opt,name=proof_ack,json=proofAck,proto3" json:"proof_ack"` + ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgChannelOpenConfirm) Reset() { *m = MsgChannelOpenConfirm{} } +func (m *MsgChannelOpenConfirm) String() string { return proto.CompactTextString(m) } +func (*MsgChannelOpenConfirm) ProtoMessage() {} +func (*MsgChannelOpenConfirm) Descriptor() ([]byte, []int) { + return fileDescriptor_a69005b45bd92d03, []int{3} +} +func (m *MsgChannelOpenConfirm) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgChannelOpenConfirm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgChannelOpenConfirm.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 *MsgChannelOpenConfirm) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgChannelOpenConfirm.Merge(m, src) +} +func (m *MsgChannelOpenConfirm) XXX_Size() int { + return m.Size() +} +func (m *MsgChannelOpenConfirm) XXX_DiscardUnknown() { + xxx_messageInfo_MsgChannelOpenConfirm.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgChannelOpenConfirm proto.InternalMessageInfo + +func (m *MsgChannelOpenConfirm) GetPortID() string { + if m != nil { + return m.PortID + } + return "" +} + +func (m *MsgChannelOpenConfirm) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *MsgChannelOpenConfirm) GetProofAck() types.MerkleProof { + if m != nil { + return m.ProofAck + } + return types.MerkleProof{} +} + +func (m *MsgChannelOpenConfirm) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + +func (m *MsgChannelOpenConfirm) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +type MsgChannelCloseInit struct { + PortID string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgChannelCloseInit) Reset() { *m = MsgChannelCloseInit{} } +func (m *MsgChannelCloseInit) String() string { return proto.CompactTextString(m) } +func (*MsgChannelCloseInit) ProtoMessage() {} +func (*MsgChannelCloseInit) Descriptor() ([]byte, []int) { + return fileDescriptor_a69005b45bd92d03, []int{4} +} +func (m *MsgChannelCloseInit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgChannelCloseInit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgChannelCloseInit.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 *MsgChannelCloseInit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgChannelCloseInit.Merge(m, src) +} +func (m *MsgChannelCloseInit) XXX_Size() int { + return m.Size() +} +func (m *MsgChannelCloseInit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgChannelCloseInit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgChannelCloseInit proto.InternalMessageInfo + +func (m *MsgChannelCloseInit) GetPortID() string { + if m != nil { + return m.PortID + } + return "" +} + +func (m *MsgChannelCloseInit) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *MsgChannelCloseInit) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +type MsgChannelCloseConfirm struct { + PortID string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + ProofInit types.MerkleProof `protobuf:"bytes,3,opt,name=proof_init,json=proofInit,proto3" json:"proof_init"` + ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgChannelCloseConfirm) Reset() { *m = MsgChannelCloseConfirm{} } +func (m *MsgChannelCloseConfirm) String() string { return proto.CompactTextString(m) } +func (*MsgChannelCloseConfirm) ProtoMessage() {} +func (*MsgChannelCloseConfirm) Descriptor() ([]byte, []int) { + return fileDescriptor_a69005b45bd92d03, []int{5} +} +func (m *MsgChannelCloseConfirm) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgChannelCloseConfirm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgChannelCloseConfirm.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 *MsgChannelCloseConfirm) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgChannelCloseConfirm.Merge(m, src) +} +func (m *MsgChannelCloseConfirm) XXX_Size() int { + return m.Size() +} +func (m *MsgChannelCloseConfirm) XXX_DiscardUnknown() { + xxx_messageInfo_MsgChannelCloseConfirm.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgChannelCloseConfirm proto.InternalMessageInfo + +func (m *MsgChannelCloseConfirm) GetPortID() string { + if m != nil { + return m.PortID + } + return "" +} + +func (m *MsgChannelCloseConfirm) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *MsgChannelCloseConfirm) GetProofInit() types.MerkleProof { + if m != nil { + return m.ProofInit + } + return types.MerkleProof{} +} + +func (m *MsgChannelCloseConfirm) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + +func (m *MsgChannelCloseConfirm) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +// MsgPacket receives incoming IBC packet +type MsgPacket struct { + Packet Packet `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"` + Proof types.MerkleProof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof"` + ProofHeight uint64 `protobuf:"varint,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgPacket) Reset() { *m = MsgPacket{} } +func (m *MsgPacket) String() string { return proto.CompactTextString(m) } +func (*MsgPacket) ProtoMessage() {} +func (*MsgPacket) Descriptor() ([]byte, []int) { + return fileDescriptor_a69005b45bd92d03, []int{6} +} +func (m *MsgPacket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPacket.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 *MsgPacket) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPacket.Merge(m, src) +} +func (m *MsgPacket) XXX_Size() int { + return m.Size() +} +func (m *MsgPacket) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPacket.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPacket proto.InternalMessageInfo + +func (m *MsgPacket) GetPacket() Packet { + if m != nil { + return m.Packet + } + return Packet{} +} + +func (m *MsgPacket) GetProof() types.MerkleProof { + if m != nil { + return m.Proof + } + return types.MerkleProof{} +} + +func (m *MsgPacket) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + +func (m *MsgPacket) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +// MsgTimeout receives timed-out packet +type MsgTimeout struct { + Packet Packet `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"` + Proof types.MerkleProof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof"` + ProofHeight uint64 `protobuf:"varint,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` + NextSequenceRecv uint64 `protobuf:"varint,4,opt,name=next_sequence_recv,json=nextSequenceRecv,proto3" json:"next_sequence_recv,omitempty"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgTimeout) Reset() { *m = MsgTimeout{} } +func (m *MsgTimeout) String() string { return proto.CompactTextString(m) } +func (*MsgTimeout) ProtoMessage() {} +func (*MsgTimeout) Descriptor() ([]byte, []int) { + return fileDescriptor_a69005b45bd92d03, []int{7} +} +func (m *MsgTimeout) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTimeout) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTimeout.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 *MsgTimeout) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTimeout.Merge(m, src) +} +func (m *MsgTimeout) XXX_Size() int { + return m.Size() +} +func (m *MsgTimeout) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTimeout.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTimeout proto.InternalMessageInfo + +func (m *MsgTimeout) GetPacket() Packet { + if m != nil { + return m.Packet + } + return Packet{} +} + +func (m *MsgTimeout) GetProof() types.MerkleProof { + if m != nil { + return m.Proof + } + return types.MerkleProof{} +} + +func (m *MsgTimeout) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + +func (m *MsgTimeout) GetNextSequenceRecv() uint64 { + if m != nil { + return m.NextSequenceRecv + } + return 0 +} + +func (m *MsgTimeout) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +// MsgAcknowledgement receives incoming IBC acknowledgement +type MsgAcknowledgement struct { + Packet Packet `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"` + Acknowledgement []byte `protobuf:"bytes,2,opt,name=acknowledgement,proto3" json:"acknowledgement,omitempty"` + Proof types.MerkleProof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof"` + ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgAcknowledgement) Reset() { *m = MsgAcknowledgement{} } +func (m *MsgAcknowledgement) String() string { return proto.CompactTextString(m) } +func (*MsgAcknowledgement) ProtoMessage() {} +func (*MsgAcknowledgement) Descriptor() ([]byte, []int) { + return fileDescriptor_a69005b45bd92d03, []int{8} +} +func (m *MsgAcknowledgement) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAcknowledgement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAcknowledgement.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 *MsgAcknowledgement) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAcknowledgement.Merge(m, src) +} +func (m *MsgAcknowledgement) XXX_Size() int { + return m.Size() +} +func (m *MsgAcknowledgement) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAcknowledgement.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAcknowledgement proto.InternalMessageInfo + +func (m *MsgAcknowledgement) GetPacket() Packet { + if m != nil { + return m.Packet + } + return Packet{} +} + +func (m *MsgAcknowledgement) GetAcknowledgement() []byte { + if m != nil { + return m.Acknowledgement + } + return nil +} + +func (m *MsgAcknowledgement) GetProof() types.MerkleProof { + if m != nil { + return m.Proof + } + return types.MerkleProof{} +} + +func (m *MsgAcknowledgement) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + +func (m *MsgAcknowledgement) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Signer + } + return nil +} + +// Channel defines pipeline for exactly-once packet delivery between specific +// modules on separate blockchains, which has at least one end capable of sending +// packets and one end capable of receiving packets. +type Channel struct { + // current state of the channel end + State types1.State `protobuf:"varint,1,opt,name=state,proto3,enum=cosmos_sdk.x.ibc.v1.State" json:"state,omitempty"` + // whether the channel is ordered or unordered + Ordering types1.Order `protobuf:"varint,2,opt,name=ordering,proto3,enum=cosmos_sdk.x.ibc.v1.Order" json:"ordering,omitempty"` + // counterparty channel end + Counterparty Counterparty `protobuf:"bytes,3,opt,name=counterparty,proto3" json:"counterparty"` + // list of connection identifiers, in order, along which packets sent on this + // channel will travel + ConnectionHops []string `protobuf:"bytes,4,rep,name=connection_hops,json=connectionHops,proto3" json:"connection_hops,omitempty" yaml:"connection_hops"` + // opaque channel version, which is agreed upon during the handshake + Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"` +} + +func (m *Channel) Reset() { *m = Channel{} } +func (m *Channel) String() string { return proto.CompactTextString(m) } +func (*Channel) ProtoMessage() {} +func (*Channel) Descriptor() ([]byte, []int) { + return fileDescriptor_a69005b45bd92d03, []int{9} +} +func (m *Channel) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Channel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Channel.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 *Channel) XXX_Merge(src proto.Message) { + xxx_messageInfo_Channel.Merge(m, src) +} +func (m *Channel) XXX_Size() int { + return m.Size() +} +func (m *Channel) XXX_DiscardUnknown() { + xxx_messageInfo_Channel.DiscardUnknown(m) +} + +var xxx_messageInfo_Channel proto.InternalMessageInfo + +// Counterparty defines a channel end counterparty +type Counterparty struct { + // port on the counterparty chain which owns the other end of the channel. + PortID string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` + // channel end on the counterparty chain + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` +} + +func (m *Counterparty) Reset() { *m = Counterparty{} } +func (m *Counterparty) String() string { return proto.CompactTextString(m) } +func (*Counterparty) ProtoMessage() {} +func (*Counterparty) Descriptor() ([]byte, []int) { + return fileDescriptor_a69005b45bd92d03, []int{10} +} +func (m *Counterparty) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Counterparty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Counterparty.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 *Counterparty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Counterparty.Merge(m, src) +} +func (m *Counterparty) XXX_Size() int { + return m.Size() +} +func (m *Counterparty) XXX_DiscardUnknown() { + xxx_messageInfo_Counterparty.DiscardUnknown(m) +} + +var xxx_messageInfo_Counterparty proto.InternalMessageInfo + +// Packet defines a type that carries data across different chains through IBC +type Packet struct { + // number corresponds to the order of sends and receives, where a Packet with + // an earlier sequence number must be sent and received before a Packet with a + // later sequence number. + Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` + // identifies the port on the sending chain. + SourcePort string `protobuf:"bytes,2,opt,name=source_port,json=sourcePort,proto3" json:"source_port,omitempty" yaml:"source_port"` + // identifies the channel end on the sending chain. + SourceChannel string `protobuf:"bytes,3,opt,name=source_channel,json=sourceChannel,proto3" json:"source_channel,omitempty" yaml:"source_channel"` + // identifies the port on the receiving chain. + DestinationPort string `protobuf:"bytes,4,opt,name=destination_port,json=destinationPort,proto3" json:"destination_port,omitempty" yaml:"destination_port"` + // identifies the channel end on the receiving chain. + DestinationChannel string `protobuf:"bytes,5,opt,name=destination_channel,json=destinationChannel,proto3" json:"destination_channel,omitempty" yaml:"destination_channel"` + // actual opaque bytes transferred directly to the application module + Data []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty" yaml:"data"` + // block height after which the packet times out + TimeoutHeight uint64 `protobuf:"varint,7,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty" yaml:"timeout_height"` + // block timestamp (in nanoseconds) after which the packet times out + TimeoutTimestamp uint64 `protobuf:"varint,8,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty" yaml:"timeout_timestamp"` +} + +func (m *Packet) Reset() { *m = Packet{} } +func (m *Packet) String() string { return proto.CompactTextString(m) } +func (*Packet) ProtoMessage() {} +func (*Packet) Descriptor() ([]byte, []int) { + return fileDescriptor_a69005b45bd92d03, []int{11} +} +func (m *Packet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Packet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Packet.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 *Packet) XXX_Merge(src proto.Message) { + xxx_messageInfo_Packet.Merge(m, src) +} +func (m *Packet) XXX_Size() int { + return m.Size() +} +func (m *Packet) XXX_DiscardUnknown() { + xxx_messageInfo_Packet.DiscardUnknown(m) +} + +var xxx_messageInfo_Packet proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgChannelOpenInit)(nil), "cosmos_sdk.x.ibc.channel.v1.MsgChannelOpenInit") + proto.RegisterType((*MsgChannelOpenTry)(nil), "cosmos_sdk.x.ibc.channel.v1.MsgChannelOpenTry") + proto.RegisterType((*MsgChannelOpenAck)(nil), "cosmos_sdk.x.ibc.channel.v1.MsgChannelOpenAck") + proto.RegisterType((*MsgChannelOpenConfirm)(nil), "cosmos_sdk.x.ibc.channel.v1.MsgChannelOpenConfirm") + proto.RegisterType((*MsgChannelCloseInit)(nil), "cosmos_sdk.x.ibc.channel.v1.MsgChannelCloseInit") + proto.RegisterType((*MsgChannelCloseConfirm)(nil), "cosmos_sdk.x.ibc.channel.v1.MsgChannelCloseConfirm") + proto.RegisterType((*MsgPacket)(nil), "cosmos_sdk.x.ibc.channel.v1.MsgPacket") + proto.RegisterType((*MsgTimeout)(nil), "cosmos_sdk.x.ibc.channel.v1.MsgTimeout") + proto.RegisterType((*MsgAcknowledgement)(nil), "cosmos_sdk.x.ibc.channel.v1.MsgAcknowledgement") + proto.RegisterType((*Channel)(nil), "cosmos_sdk.x.ibc.channel.v1.Channel") + proto.RegisterType((*Counterparty)(nil), "cosmos_sdk.x.ibc.channel.v1.Counterparty") + proto.RegisterType((*Packet)(nil), "cosmos_sdk.x.ibc.channel.v1.Packet") +} + +func init() { + proto.RegisterFile("x/ibc/04-channel/types/types.proto", fileDescriptor_a69005b45bd92d03) +} + +var fileDescriptor_a69005b45bd92d03 = []byte{ + // 1061 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0x4d, 0x6f, 0xe3, 0x44, + 0x18, 0xae, 0xf3, 0xd9, 0x4c, 0xb2, 0xfd, 0x70, 0xd9, 0x6e, 0x48, 0x57, 0x71, 0xf0, 0x02, 0x0a, + 0x82, 0x26, 0xdb, 0x96, 0x0f, 0x69, 0x4f, 0x24, 0x5d, 0xc1, 0xe6, 0x10, 0x5a, 0x4d, 0x2b, 0x0e, + 0x5c, 0x2c, 0xd7, 0x9e, 0x75, 0xac, 0x24, 0x1e, 0xe3, 0x99, 0x84, 0xe6, 0x07, 0x20, 0x71, 0x42, + 0xfc, 0x83, 0xe5, 0x0f, 0x70, 0xe3, 0xc0, 0x4f, 0xd8, 0x1b, 0x2b, 0x4e, 0x88, 0x83, 0x85, 0xd2, + 0x03, 0x57, 0x94, 0x23, 0x27, 0xe4, 0x99, 0x71, 0xe2, 0x24, 0xdd, 0x1c, 0x9a, 0x56, 0xd1, 0x5e, + 0x62, 0xcf, 0xfb, 0x35, 0xef, 0xfb, 0x3c, 0xef, 0x8c, 0x67, 0x02, 0xd4, 0xcb, 0xaa, 0x7d, 0x61, + 0x54, 0x1f, 0x7f, 0xbc, 0x6f, 0xb4, 0x74, 0xc7, 0x41, 0x9d, 0x2a, 0x1d, 0xb8, 0x88, 0xf0, 0xdf, + 0x8a, 0xeb, 0x61, 0x8a, 0xe5, 0x3d, 0x03, 0x93, 0x2e, 0x26, 0x1a, 0x31, 0xdb, 0x95, 0xcb, 0x8a, + 0x7d, 0x61, 0x54, 0x84, 0x6d, 0xa5, 0x7f, 0x50, 0x78, 0x9f, 0xb6, 0x6c, 0xcf, 0xd4, 0x5c, 0xdd, + 0xa3, 0x83, 0x2a, 0xb3, 0xaf, 0x5a, 0xd8, 0xc2, 0x93, 0x37, 0x1e, 0xa4, 0xf0, 0x1e, 0x9f, 0xe8, + 0xf0, 0x68, 0xdf, 0xc0, 0xdd, 0xae, 0x4d, 0xbb, 0xc8, 0xa1, 0xf3, 0x73, 0x15, 0x1e, 0x70, 0xb3, + 0x39, 0x85, 0xfa, 0x22, 0x06, 0xe4, 0x26, 0xb1, 0x8e, 0xf9, 0xcc, 0x27, 0x2e, 0x72, 0x1a, 0x8e, + 0x4d, 0xe5, 0x4f, 0x40, 0xda, 0xc5, 0x1e, 0xd5, 0x6c, 0x33, 0x2f, 0x95, 0xa4, 0x72, 0xa6, 0xfe, + 0x70, 0xe8, 0x2b, 0xa9, 0x53, 0xec, 0xd1, 0xc6, 0xd3, 0x91, 0xaf, 0x6c, 0x0c, 0xf4, 0x6e, 0xe7, + 0x89, 0x2a, 0x4c, 0x54, 0x98, 0x0a, 0xde, 0x1a, 0xa6, 0x5c, 0x03, 0x40, 0xd4, 0x10, 0x78, 0xc6, + 0x98, 0xa7, 0x3a, 0xf4, 0x95, 0x8c, 0x88, 0xcf, 0x9c, 0xb7, 0xb9, 0xf3, 0xc4, 0x50, 0x85, 0x19, + 0x31, 0x68, 0x98, 0xf2, 0x53, 0x90, 0x16, 0x83, 0x7c, 0xbc, 0x24, 0x95, 0xb3, 0x87, 0xef, 0x56, + 0x16, 0xe0, 0x54, 0x11, 0x81, 0xeb, 0x89, 0x97, 0xbe, 0xb2, 0x06, 0x43, 0x57, 0xb9, 0x01, 0x52, + 0xc4, 0xb6, 0x1c, 0xe4, 0xe5, 0x13, 0x25, 0xa9, 0x9c, 0xab, 0x1f, 0xfc, 0xe7, 0x2b, 0xfb, 0x96, + 0x4d, 0x5b, 0xbd, 0x8b, 0x8a, 0x81, 0xbb, 0x55, 0x1e, 0x52, 0x3c, 0xf6, 0x89, 0xd9, 0x16, 0xa0, + 0xd4, 0x0c, 0xa3, 0x66, 0x9a, 0x1e, 0x22, 0x04, 0x8a, 0x00, 0xea, 0x3f, 0x71, 0xb0, 0x3d, 0x8d, + 0xd0, 0xb9, 0x37, 0x78, 0xe3, 0x01, 0x82, 0xe0, 0x2d, 0x03, 0xf7, 0x1c, 0x8a, 0x3c, 0xd6, 0x62, + 0x5a, 0x1f, 0x79, 0xc4, 0xc6, 0x0e, 0x83, 0x2b, 0x53, 0x57, 0x46, 0xbe, 0xb2, 0x27, 0xb2, 0xb8, + 0xc6, 0x4a, 0x85, 0x3b, 0x51, 0xf1, 0xd7, 0x5c, 0x2a, 0x9f, 0x02, 0xe0, 0x7a, 0x18, 0x3f, 0xd7, + 0x6c, 0xc7, 0xa6, 0xf9, 0x24, 0x4b, 0xee, 0xc3, 0x6b, 0x92, 0x1b, 0x37, 0x6a, 0x90, 0x5f, 0x13, + 0x79, 0xed, 0x0e, 0x3a, 0x0d, 0xfc, 0x44, 0x8e, 0x19, 0x16, 0x84, 0xb5, 0xe1, 0x3b, 0x20, 0xc7, + 0x23, 0xb6, 0x90, 0x6d, 0xb5, 0x68, 0x3e, 0x55, 0x92, 0xca, 0x09, 0x98, 0x65, 0xb2, 0x67, 0x4c, + 0x14, 0x61, 0x3a, 0xbd, 0x2c, 0xd3, 0x2f, 0xe6, 0x98, 0xae, 0x19, 0xed, 0x15, 0x32, 0xfd, 0x3a, + 0x8e, 0xe2, 0x4b, 0x70, 0xf4, 0x15, 0xe0, 0xf0, 0x6a, 0xd4, 0x1b, 0x30, 0xb2, 0x6f, 0x44, 0xd1, + 0x3a, 0x8b, 0x11, 0xac, 0x83, 0x59, 0x86, 0x92, 0x8b, 0x18, 0x4a, 0x2d, 0xcb, 0xd0, 0xef, 0x31, + 0x70, 0x7f, 0x9a, 0xa1, 0x63, 0xec, 0x3c, 0xb7, 0xbd, 0xee, 0x0a, 0x59, 0x1a, 0x23, 0xaa, 0x1b, + 0x6d, 0xb1, 0x22, 0x6f, 0x8c, 0x68, 0xd0, 0x6f, 0xb3, 0x88, 0x26, 0x16, 0x21, 0x9a, 0x5c, 0x16, + 0xd1, 0xbf, 0x24, 0xb0, 0x33, 0x41, 0xf4, 0xb8, 0x83, 0x09, 0x5a, 0xf1, 0x07, 0x60, 0x52, 0x5c, + 0x7c, 0xd9, 0xe2, 0xfe, 0x88, 0x81, 0xdd, 0x99, 0xe2, 0x56, 0xdf, 0x2f, 0xd3, 0xbb, 0x64, 0xfc, + 0x0e, 0x76, 0xc9, 0xbb, 0xed, 0x98, 0xef, 0x63, 0x20, 0xd3, 0x24, 0xd6, 0xa9, 0x6e, 0xb4, 0x11, + 0x95, 0x6b, 0x20, 0xe5, 0xb2, 0x37, 0x06, 0x63, 0xf6, 0xf0, 0xd1, 0xc2, 0x8f, 0x11, 0x77, 0x12, + 0x15, 0x08, 0x47, 0xf9, 0x4b, 0x90, 0x64, 0xa9, 0x32, 0x38, 0x6f, 0x84, 0x05, 0xf7, 0x9f, 0xc3, + 0x21, 0xbe, 0x08, 0x87, 0xa5, 0xcf, 0x05, 0xbf, 0xc6, 0x00, 0x68, 0x12, 0xeb, 0xdc, 0xee, 0x22, + 0xdc, 0x7b, 0xe3, 0x80, 0xf8, 0x08, 0xc8, 0x0e, 0xba, 0xa4, 0x1a, 0x41, 0xdf, 0xf6, 0x90, 0x63, + 0x20, 0xcd, 0x43, 0x46, 0x5f, 0x74, 0xce, 0x56, 0xa0, 0x39, 0x13, 0x0a, 0x88, 0x8c, 0xfe, 0x6d, + 0xb6, 0xcf, 0x6f, 0xfc, 0xc0, 0x59, 0x33, 0xda, 0x0e, 0xfe, 0xae, 0x83, 0x4c, 0x0b, 0x05, 0xe5, + 0xdc, 0x06, 0x7c, 0x65, 0xb0, 0xa9, 0x4f, 0x47, 0x65, 0x40, 0xe6, 0xe0, 0xac, 0x78, 0x02, 0x74, + 0xfc, 0x96, 0x81, 0xbe, 0xdb, 0x95, 0xf7, 0x4b, 0x0c, 0xa4, 0xc5, 0x3e, 0x23, 0x3f, 0x06, 0x49, + 0x42, 0x75, 0x8a, 0x18, 0x5c, 0x1b, 0x87, 0x85, 0xf9, 0x12, 0xfa, 0x07, 0x95, 0xb3, 0xc0, 0x02, + 0x72, 0x43, 0xf9, 0x53, 0xb0, 0x8e, 0x3d, 0x13, 0x79, 0xb6, 0x63, 0x31, 0x5c, 0x5e, 0xe7, 0x74, + 0x12, 0x18, 0xc1, 0xb1, 0xad, 0x7c, 0x06, 0x72, 0xd1, 0x83, 0x84, 0xc0, 0xec, 0x83, 0xc5, 0x87, + 0xce, 0x88, 0x83, 0x40, 0x6c, 0x2a, 0x88, 0x7c, 0x0c, 0x36, 0x0d, 0xec, 0x38, 0xc8, 0xa0, 0x36, + 0x76, 0xb4, 0x16, 0x76, 0x49, 0x3e, 0x51, 0x8a, 0x97, 0x33, 0xf5, 0xc2, 0xc8, 0x57, 0x76, 0xc3, + 0x53, 0xcd, 0x94, 0x81, 0x0a, 0x37, 0x26, 0x92, 0x67, 0xd8, 0x25, 0x72, 0x1e, 0xa4, 0xc3, 0x23, + 0x51, 0x80, 0x6d, 0x06, 0x86, 0xc3, 0x27, 0x89, 0x1f, 0x7e, 0x56, 0xd6, 0xd4, 0x1f, 0x25, 0x90, + 0x8b, 0x66, 0xb2, 0xba, 0x4d, 0x5f, 0x24, 0xf4, 0x6f, 0x1c, 0xa4, 0xc4, 0xbe, 0x59, 0x00, 0xeb, + 0xe1, 0xd2, 0x63, 0xb9, 0x24, 0xe0, 0x78, 0x2c, 0x7f, 0x06, 0xb2, 0x04, 0xf7, 0x3c, 0x03, 0x69, + 0x41, 0x02, 0x62, 0xc2, 0xdd, 0x91, 0xaf, 0xc8, 0x7c, 0x8e, 0x88, 0x52, 0x85, 0x80, 0x8f, 0x82, + 0x22, 0xe4, 0xcf, 0xc1, 0x86, 0xd0, 0x45, 0x6f, 0x08, 0x99, 0xfa, 0xdb, 0x23, 0x5f, 0xb9, 0x3f, + 0xe5, 0x2b, 0xf4, 0x2a, 0xbc, 0xc7, 0x05, 0x61, 0x5b, 0x7d, 0x01, 0xb6, 0x4c, 0x44, 0xa8, 0xed, + 0xe8, 0x0c, 0x77, 0x36, 0x3f, 0xbf, 0x12, 0xec, 0x8d, 0x7c, 0xe5, 0x01, 0x8f, 0x31, 0x6b, 0xa1, + 0xc2, 0xcd, 0x88, 0x88, 0x65, 0x72, 0x02, 0x76, 0xa2, 0x56, 0x61, 0x3a, 0x8c, 0xa6, 0x7a, 0x71, + 0xe4, 0x2b, 0x85, 0xf9, 0x50, 0xe3, 0x9c, 0xe4, 0x88, 0x34, 0x4c, 0xec, 0x11, 0x48, 0x98, 0x3a, + 0xd5, 0xc5, 0x11, 0x72, 0x73, 0xe4, 0x2b, 0x59, 0x11, 0x41, 0xa7, 0xba, 0x0a, 0x99, 0x32, 0xa8, + 0x9f, 0xf2, 0xed, 0x38, 0x5c, 0x90, 0xc1, 0x9d, 0x20, 0x11, 0xad, 0x7f, 0x5a, 0xaf, 0xc2, 0x7b, + 0x42, 0x30, 0x5e, 0xad, 0xdb, 0xa1, 0x45, 0xf0, 0x24, 0x54, 0xef, 0xba, 0xf9, 0x75, 0x16, 0xe4, + 0xe1, 0xc8, 0x57, 0xf2, 0xd3, 0x41, 0xc6, 0x26, 0x2a, 0xdc, 0x12, 0xb2, 0xf3, 0x50, 0xc4, 0x29, + 0xaf, 0x37, 0x5f, 0x0e, 0x8b, 0xd2, 0xab, 0x61, 0x51, 0xfa, 0x7b, 0x58, 0x94, 0x7e, 0xba, 0x2a, + 0xae, 0xbd, 0xba, 0x2a, 0xae, 0xfd, 0x79, 0x55, 0x5c, 0xfb, 0xe6, 0x68, 0xe1, 0x26, 0x70, 0xfd, + 0xff, 0x07, 0x17, 0x29, 0x76, 0x6b, 0x3f, 0xfa, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x8f, 0x81, 0x7d, + 0x68, 0x60, 0x10, 0x00, 0x00, +} + +func (m *MsgChannelOpenInit) 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 *MsgChannelOpenInit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgChannelOpenInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x22 + } + { + size, err := m.Channel.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.PortID) > 0 { + i -= len(m.PortID) + copy(dAtA[i:], m.PortID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PortID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgChannelOpenTry) 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 *MsgChannelOpenTry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgChannelOpenTry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x3a + } + if m.ProofHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x30 + } + { + size, err := m.ProofInit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.CounterpartyVersion) > 0 { + i -= len(m.CounterpartyVersion) + copy(dAtA[i:], m.CounterpartyVersion) + i = encodeVarintTypes(dAtA, i, uint64(len(m.CounterpartyVersion))) + i-- + dAtA[i] = 0x22 + } + { + size, err := m.Channel.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.PortID) > 0 { + i -= len(m.PortID) + copy(dAtA[i:], m.PortID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PortID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgChannelOpenAck) 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 *MsgChannelOpenAck) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgChannelOpenAck) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x32 + } + if m.ProofHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x28 + } + { + size, err := m.ProofTry.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.CounterpartyVersion) > 0 { + i -= len(m.CounterpartyVersion) + copy(dAtA[i:], m.CounterpartyVersion) + i = encodeVarintTypes(dAtA, i, uint64(len(m.CounterpartyVersion))) + i-- + dAtA[i] = 0x1a + } + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.PortID) > 0 { + i -= len(m.PortID) + copy(dAtA[i:], m.PortID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PortID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgChannelOpenConfirm) 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 *MsgChannelOpenConfirm) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgChannelOpenConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x2a + } + if m.ProofHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.ProofAck.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.PortID) > 0 { + i -= len(m.PortID) + copy(dAtA[i:], m.PortID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PortID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgChannelCloseInit) 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 *MsgChannelCloseInit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgChannelCloseInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x1a + } + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.PortID) > 0 { + i -= len(m.PortID) + copy(dAtA[i:], m.PortID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PortID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgChannelCloseConfirm) 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 *MsgChannelCloseConfirm) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgChannelCloseConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x2a + } + if m.ProofHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.ProofInit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.PortID) > 0 { + i -= len(m.PortID) + copy(dAtA[i:], m.PortID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PortID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgPacket) 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 *MsgPacket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x22 + } + if m.ProofHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x18 + } + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Packet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgTimeout) 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 *MsgTimeout) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTimeout) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x2a + } + if m.NextSequenceRecv != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.NextSequenceRecv)) + i-- + dAtA[i] = 0x20 + } + if m.ProofHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x18 + } + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Packet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgAcknowledgement) 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 *MsgAcknowledgement) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAcknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x2a + } + if m.ProofHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Acknowledgement) > 0 { + i -= len(m.Acknowledgement) + copy(dAtA[i:], m.Acknowledgement) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Acknowledgement))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Packet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Channel) 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 *Channel) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Channel) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x2a + } + if len(m.ConnectionHops) > 0 { + for iNdEx := len(m.ConnectionHops) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ConnectionHops[iNdEx]) + copy(dAtA[i:], m.ConnectionHops[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ConnectionHops[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + { + size, err := m.Counterparty.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.Ordering != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Ordering)) + i-- + dAtA[i] = 0x10 + } + if m.State != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Counterparty) 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 *Counterparty) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Counterparty) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.PortID) > 0 { + i -= len(m.PortID) + copy(dAtA[i:], m.PortID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PortID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Packet) 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 *Packet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Packet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TimeoutTimestamp != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.TimeoutTimestamp)) + i-- + dAtA[i] = 0x40 + } + if m.TimeoutHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.TimeoutHeight)) + i-- + dAtA[i] = 0x38 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x32 + } + if len(m.DestinationChannel) > 0 { + i -= len(m.DestinationChannel) + copy(dAtA[i:], m.DestinationChannel) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DestinationChannel))) + i-- + dAtA[i] = 0x2a + } + if len(m.DestinationPort) > 0 { + i -= len(m.DestinationPort) + copy(dAtA[i:], m.DestinationPort) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DestinationPort))) + i-- + dAtA[i] = 0x22 + } + if len(m.SourceChannel) > 0 { + i -= len(m.SourceChannel) + copy(dAtA[i:], m.SourceChannel) + i = encodeVarintTypes(dAtA, i, uint64(len(m.SourceChannel))) + i-- + dAtA[i] = 0x1a + } + if len(m.SourcePort) > 0 { + i -= len(m.SourcePort) + copy(dAtA[i:], m.SourcePort) + i = encodeVarintTypes(dAtA, i, uint64(len(m.SourcePort))) + i-- + dAtA[i] = 0x12 + } + if m.Sequence != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgChannelOpenInit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PortID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Channel.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgChannelOpenTry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PortID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Channel.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.CounterpartyVersion) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.ProofInit.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ProofHeight != 0 { + n += 1 + sovTypes(uint64(m.ProofHeight)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgChannelOpenAck) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PortID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.CounterpartyVersion) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.ProofTry.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ProofHeight != 0 { + n += 1 + sovTypes(uint64(m.ProofHeight)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgChannelOpenConfirm) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PortID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.ProofAck.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ProofHeight != 0 { + n += 1 + sovTypes(uint64(m.ProofHeight)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgChannelCloseInit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PortID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgChannelCloseConfirm) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PortID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.ProofInit.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ProofHeight != 0 { + n += 1 + sovTypes(uint64(m.ProofHeight)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgPacket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Packet.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.Proof.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ProofHeight != 0 { + n += 1 + sovTypes(uint64(m.ProofHeight)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgTimeout) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Packet.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.Proof.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ProofHeight != 0 { + n += 1 + sovTypes(uint64(m.ProofHeight)) + } + if m.NextSequenceRecv != 0 { + n += 1 + sovTypes(uint64(m.NextSequenceRecv)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgAcknowledgement) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Packet.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.Acknowledgement) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Proof.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ProofHeight != 0 { + n += 1 + sovTypes(uint64(m.ProofHeight)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *Channel) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.State != 0 { + n += 1 + sovTypes(uint64(m.State)) + } + if m.Ordering != 0 { + n += 1 + sovTypes(uint64(m.Ordering)) + } + l = m.Counterparty.Size() + n += 1 + l + sovTypes(uint64(l)) + if len(m.ConnectionHops) > 0 { + for _, s := range m.ConnectionHops { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } + l = len(m.Version) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *Counterparty) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PortID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *Packet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sequence != 0 { + n += 1 + sovTypes(uint64(m.Sequence)) + } + l = len(m.SourcePort) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.SourceChannel) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.DestinationPort) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.DestinationChannel) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.TimeoutHeight != 0 { + n += 1 + sovTypes(uint64(m.TimeoutHeight)) + } + if m.TimeoutTimestamp != 0 { + n += 1 + sovTypes(uint64(m.TimeoutTimestamp)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgChannelOpenInit) 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 ErrIntOverflowTypes + } + 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: MsgChannelOpenInit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgChannelOpenInit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Channel", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Channel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgChannelOpenTry) 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 ErrIntOverflowTypes + } + 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: MsgChannelOpenTry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgChannelOpenTry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Channel", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Channel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyVersion", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CounterpartyVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofInit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProofInit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgChannelOpenAck) 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 ErrIntOverflowTypes + } + 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: MsgChannelOpenAck: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgChannelOpenAck: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyVersion", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CounterpartyVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofTry", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProofTry.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgChannelOpenConfirm) 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 ErrIntOverflowTypes + } + 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: MsgChannelOpenConfirm: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgChannelOpenConfirm: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofAck", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProofAck.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgChannelCloseInit) 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 ErrIntOverflowTypes + } + 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: MsgChannelCloseInit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgChannelCloseInit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgChannelCloseConfirm) 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 ErrIntOverflowTypes + } + 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: MsgChannelCloseConfirm: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgChannelCloseConfirm: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofInit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProofInit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPacket) 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 ErrIntOverflowTypes + } + 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: MsgPacket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPacket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Packet", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Packet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgTimeout) 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 ErrIntOverflowTypes + } + 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: MsgTimeout: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTimeout: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Packet", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Packet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NextSequenceRecv", wireType) + } + m.NextSequenceRecv = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NextSequenceRecv |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAcknowledgement) 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 ErrIntOverflowTypes + } + 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: MsgAcknowledgement: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAcknowledgement: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Packet", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Packet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Acknowledgement", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Acknowledgement = append(m.Acknowledgement[:0], dAtA[iNdEx:postIndex]...) + if m.Acknowledgement == nil { + m.Acknowledgement = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Channel) 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 ErrIntOverflowTypes + } + 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: Channel: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Channel: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= types1.State(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ordering", wireType) + } + m.Ordering = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Ordering |= types1.Order(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Counterparty", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Counterparty.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionHops", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConnectionHops = append(m.ConnectionHops, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Counterparty) 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 ErrIntOverflowTypes + } + 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: Counterparty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Counterparty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Packet) 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 ErrIntOverflowTypes + } + 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: Packet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Packet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + m.Sequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourcePort", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourcePort = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceChannel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourceChannel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationPort", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationPort = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationChannel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationChannel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) + } + m.TimeoutHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutTimestamp", wireType) + } + m.TimeoutTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutTimestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibc/04-channel/types/types.proto b/x/ibc/04-channel/types/types.proto new file mode 100644 index 000000000000..96f442a6dd77 --- /dev/null +++ b/x/ibc/04-channel/types/types.proto @@ -0,0 +1,231 @@ +syntax = "proto3"; +package cosmos_sdk.x.ibc.channel.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "x/ibc/23-commitment/types/types.proto"; +import "x/ibc/types/types.proto"; + +// MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It is +// called by a relayer on Chain A. +message MsgChannelOpenInit { + string port_id = 1 [ + (gogoproto.customname) = "PortID", + (gogoproto.moretags) = "yaml:\"port_id\"" + ]; + string channel_id = 2 [ + (gogoproto.customname) = "ChannelID", + (gogoproto.moretags) = "yaml:\"channel_id\"" + ]; + Channel channel = 3 [ + (gogoproto.nullable) = false + ]; + bytes signer = 4 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// MsgChannelOpenInit defines an sdk.Msg to try open a channel handshake. It is +// called by a relayer on Chain A. +message MsgChannelOpenTry { + string port_id = 1 [ + (gogoproto.customname) = "PortID", + (gogoproto.moretags) = "yaml:\"port_id\"" + ]; + string channel_id = 2 [ + (gogoproto.customname) = "ChannelID", + (gogoproto.moretags) = "yaml:\"channel_id\"" + ]; + Channel channel = 3 [ + (gogoproto.nullable) = false + ]; + string counterparty_version = 4 [ + (gogoproto.moretags) = "yaml:\"counterparty_version\"" + ]; + cosmos_sdk.x.ibc.commitment.v1.MerkleProof proof_init = 5 [ + (gogoproto.nullable) = false + ]; + uint64 proof_height = 6; + bytes signer = 7 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +message MsgChannelOpenAck { + string port_id = 1 [ + (gogoproto.customname) = "PortID", + (gogoproto.moretags) = "yaml:\"port_id\"" + ]; + string channel_id = 2 [ + (gogoproto.customname) = "ChannelID", + (gogoproto.moretags) = "yaml:\"channel_id\"" + ]; + string counterparty_version = 3 [ + (gogoproto.moretags) = "yaml:\"counterparty_version\"" + ]; + cosmos_sdk.x.ibc.commitment.v1.MerkleProof proof_try = 4 [ + (gogoproto.nullable) = false + ]; + uint64 proof_height = 5; + bytes signer = 6 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +message MsgChannelOpenConfirm { + string port_id = 1 [ + (gogoproto.customname) = "PortID", + (gogoproto.moretags) = "yaml:\"port_id\"" + ]; + string channel_id = 2 [ + (gogoproto.customname) = "ChannelID", + (gogoproto.moretags) = "yaml:\"channel_id\"" + ]; + cosmos_sdk.x.ibc.commitment.v1.MerkleProof proof_ack = 3 [ + (gogoproto.nullable) = false + ]; + uint64 proof_height = 4; + bytes signer = 5 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +message MsgChannelCloseInit { + string port_id = 1 [ + (gogoproto.customname) = "PortID", + (gogoproto.moretags) = "yaml:\"port_id\"" + ]; + string channel_id = 2 [ + (gogoproto.customname) = "ChannelID", + (gogoproto.moretags) = "yaml:\"channel_id\"" + ]; + bytes signer = 3 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +message MsgChannelCloseConfirm { + string port_id = 1 [ + (gogoproto.customname) = "PortID", + (gogoproto.moretags) = "yaml:\"port_id\"" + ]; + string channel_id = 2 [ + (gogoproto.customname) = "ChannelID", + (gogoproto.moretags) = "yaml:\"channel_id\"" + ]; + cosmos_sdk.x.ibc.commitment.v1.MerkleProof proof_init = 3 [ + (gogoproto.nullable) = false + ]; + uint64 proof_height = 4; + bytes signer = 5 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// MsgPacket receives incoming IBC packet +message MsgPacket { + Packet packet = 1 [ + (gogoproto.nullable) = false + ]; + cosmos_sdk.x.ibc.commitment.v1.MerkleProof proof = 2 [ + (gogoproto.nullable) = false + ]; + uint64 proof_height = 3; + bytes signer = 4 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// MsgTimeout receives timed-out packet +message MsgTimeout { + Packet packet = 1 [ + (gogoproto.nullable) = false + ]; + cosmos_sdk.x.ibc.commitment.v1.MerkleProof proof = 2 [ + (gogoproto.nullable) = false + ]; + uint64 proof_height = 3; + uint64 next_sequence_recv = 4; + bytes signer = 5 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// MsgAcknowledgement receives incoming IBC acknowledgement +message MsgAcknowledgement { + Packet packet = 1 [ + (gogoproto.nullable) = false + ]; + bytes acknowledgement = 2; + cosmos_sdk.x.ibc.commitment.v1.MerkleProof proof = 3 [ + (gogoproto.nullable) = false + ]; + uint64 proof_height = 4; + bytes signer = 5 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// Channel defines pipeline for exactly-once packet delivery between specific +// modules on separate blockchains, which has at least one end capable of sending +// packets and one end capable of receiving packets. +message Channel { + option (gogoproto.goproto_getters) = false; + + // current state of the channel end + cosmos_sdk.x.ibc.v1.State state = 1; + // whether the channel is ordered or unordered + cosmos_sdk.x.ibc.v1.Order ordering = 2; + // counterparty channel end + Counterparty counterparty = 3 [ + (gogoproto.nullable) = false + ]; + // list of connection identifiers, in order, along which packets sent on this + // channel will travel + repeated string connection_hops = 4 [ + (gogoproto.moretags) = "yaml:\"connection_hops\"" + ]; + // opaque channel version, which is agreed upon during the handshake + string version = 5; +} + +// Counterparty defines a channel end counterparty +message Counterparty { + option (gogoproto.goproto_getters) = false; + + // port on the counterparty chain which owns the other end of the channel. + string port_id = 1 [ + (gogoproto.customname) = "PortID", + (gogoproto.moretags) = "yaml:\"port_id\"" + ]; + // channel end on the counterparty chain + string channel_id = 2 [ + (gogoproto.customname) = "ChannelID", + (gogoproto.moretags) = "yaml:\"channel_id\"" + ]; +} + +// Packet defines a type that carries data across different chains through IBC +message Packet { + option (gogoproto.goproto_getters) = false; + + // number corresponds to the order of sends and receives, where a Packet with + // an earlier sequence number must be sent and received before a Packet with a + // later sequence number. + uint64 sequence = 1; + // identifies the port on the sending chain. + string source_port = 2 [(gogoproto.moretags) = "yaml:\"source_port\""]; + // identifies the channel end on the sending chain. + string source_channel = 3 [(gogoproto.moretags) = "yaml:\"source_channel\""]; + // identifies the port on the receiving chain. + string destination_port = 4 [(gogoproto.moretags) = "yaml:\"destination_port\""]; + // identifies the channel end on the receiving chain. + string destination_channel = 5 [(gogoproto.moretags) = "yaml:\"destination_channel\""]; + // actual opaque bytes transferred directly to the application module + bytes data = 6 [(gogoproto.moretags) = "yaml:\"data\""]; + // block height after which the packet times out + uint64 timeout_height = 7 [(gogoproto.moretags) = "yaml:\"timeout_height\""]; + // block timestamp (in nanoseconds) after which the packet times out + uint64 timeout_timestamp = 8 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""]; +} diff --git a/x/ibc/05-port/alias.go b/x/ibc/05-port/alias.go index 31dd696ea206..5aa03309b5e7 100644 --- a/x/ibc/05-port/alias.go +++ b/x/ibc/05-port/alias.go @@ -26,8 +26,6 @@ var ( ErrPortNotFound = types.ErrPortNotFound ErrInvalidPort = types.ErrInvalidPort ErrInvalidRoute = types.ErrInvalidRoute - PortPath = types.PortPath - KeyPort = types.KeyPort ) type ( diff --git a/x/ibc/05-port/keeper/keeper.go b/x/ibc/05-port/keeper/keeper.go index cb0749e35c90..5e760f22f7b9 100644 --- a/x/ibc/05-port/keeper/keeper.go +++ b/x/ibc/05-port/keeper/keeper.go @@ -5,7 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/capability" - "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) @@ -24,7 +23,7 @@ func NewKeeper(sck capability.ScopedKeeper) Keeper { // isBounded checks a given port ID is already bounded. func (k Keeper) isBound(ctx sdk.Context, portID string) bool { - _, ok := k.scopedKeeper.GetCapability(ctx, types.PortPath(portID)) + _, ok := k.scopedKeeper.GetCapability(ctx, ibctypes.PortPath(portID)) return ok } @@ -41,7 +40,7 @@ func (k *Keeper) BindPort(ctx sdk.Context, portID string) *capability.Capability panic(fmt.Sprintf("port %s is already bound", portID)) } - key, err := k.scopedKeeper.NewCapability(ctx, types.PortPath(portID)) + key, err := k.scopedKeeper.NewCapability(ctx, ibctypes.PortPath(portID)) if err != nil { panic(err.Error()) } @@ -58,12 +57,12 @@ func (k Keeper) Authenticate(ctx sdk.Context, key *capability.Capability, portID panic(err.Error()) } - return k.scopedKeeper.AuthenticateCapability(ctx, key, types.PortPath(portID)) + return k.scopedKeeper.AuthenticateCapability(ctx, key, ibctypes.PortPath(portID)) } // LookupModuleByPort will return the IBCModule along with the capability associated with a given portID func (k Keeper) LookupModuleByPort(ctx sdk.Context, portID string) (string, *capability.Capability, bool) { - modules, cap, ok := k.scopedKeeper.LookupModules(ctx, types.PortPath(portID)) + modules, cap, ok := k.scopedKeeper.LookupModules(ctx, ibctypes.PortPath(portID)) if !ok { return "", nil, false } diff --git a/x/ibc/05-port/keeper/keeper_test.go b/x/ibc/05-port/keeper/keeper_test.go index c6c2e8fb626d..6c009d844475 100644 --- a/x/ibc/05-port/keeper/keeper_test.go +++ b/x/ibc/05-port/keeper/keeper_test.go @@ -8,7 +8,6 @@ import ( tmproto "github.com/tendermint/tendermint/proto/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/ibc/05-port/keeper" @@ -22,7 +21,6 @@ var ( type KeeperTestSuite struct { suite.Suite - cdc *codec.Codec ctx sdk.Context keeper *keeper.Keeper } @@ -31,7 +29,6 @@ func (suite *KeeperTestSuite) SetupTest() { isCheckTx := false app := simapp.Setup(isCheckTx) - suite.cdc = app.Codec() suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{}) suite.keeper = &app.IBCKeeper.PortKeeper } diff --git a/x/ibc/05-port/types/keys.go b/x/ibc/05-port/types/keys.go index b1250e0e4463..6e79bb535066 100644 --- a/x/ibc/05-port/types/keys.go +++ b/x/ibc/05-port/types/keys.go @@ -1,9 +1,5 @@ package types -import ( - "fmt" -) - const ( // SubModuleName defines the IBC port name SubModuleName = "port" @@ -17,15 +13,3 @@ const ( // QuerierRoute is the querier route for IBC ports QuerierRoute = SubModuleName ) - -// The following paths are the keys to the store as defined in https://github.com/cosmos/ics/tree/master/spec/ics-005-port-allocation#store-paths - -// PortPath defines the path under which ports paths are stored -func PortPath(portID string) string { - return fmt.Sprintf("ports/%s", portID) -} - -// KeyPort returns the store key for a particular port -func KeyPort(portID string) []byte { - return []byte(PortPath(portID)) -} diff --git a/x/ibc/05-port/types/module.go b/x/ibc/05-port/types/module.go index 013fac6a37b3..4499cbd81774 100644 --- a/x/ibc/05-port/types/module.go +++ b/x/ibc/05-port/types/module.go @@ -4,8 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/capability" - channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" + ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) // IBCModule defines an interface that implements all the callbacks @@ -13,7 +13,7 @@ import ( type IBCModule interface { OnChanOpenInit( ctx sdk.Context, - order channelexported.Order, + order ibctypes.Order, connectionHops []string, portID string, channelID string, @@ -24,7 +24,7 @@ type IBCModule interface { OnChanOpenTry( ctx sdk.Context, - order channelexported.Order, + order ibctypes.Order, connectionHops []string, portID, channelID string, diff --git a/x/ibc/07-tendermint/client/cli/tx.go b/x/ibc/07-tendermint/client/cli/tx.go index 23d861f7849e..4d9afefa6b6c 100644 --- a/x/ibc/07-tendermint/client/cli/tx.go +++ b/x/ibc/07-tendermint/client/cli/tx.go @@ -18,7 +18,7 @@ import ( "github.com/cosmos/cosmos-sdk/version" authclient "github.com/cosmos/cosmos-sdk/x/auth/client" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - evidenceexported "github.com/cosmos/cosmos-sdk/x/evidence/exported" + "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" ) @@ -145,7 +145,7 @@ $ %s tx ibc client misbehaviour [path/to/evidence.json] --from node0 --home ../n txBldr := authtypes.NewTxBuilderFromCLI(inBuf).WithTxEncoder(authclient.GetTxEncoder(cdc)) cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) - var ev evidenceexported.Evidence + var ev types.Evidence if err := cdc.UnmarshalJSON([]byte(args[0]), &ev); err != nil { // check for file path if JSON input is not provided contents, err := ioutil.ReadFile(args[0]) diff --git a/x/ibc/07-tendermint/misbehaviour.go b/x/ibc/07-tendermint/misbehaviour.go index d373e2e5afd1..d6097467b9ff 100644 --- a/x/ibc/07-tendermint/misbehaviour.go +++ b/x/ibc/07-tendermint/misbehaviour.go @@ -6,6 +6,7 @@ import ( "time" lite "github.com/tendermint/tendermint/lite2" + tmtypes "github.com/tendermint/tendermint/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" @@ -64,6 +65,11 @@ func checkMisbehaviour( clientState types.ClientState, consensusState types.ConsensusState, evidence types.Evidence, height uint64, currentTimestamp time.Time, ) error { + var ( + tmValidatorSet *tmtypes.ValidatorSet + tmSignedHeader1, tmSignedHeader2 *tmtypes.SignedHeader + ) + // check if provided height matches the headers' height if height > uint64(evidence.GetHeight()) { return sdkerrors.Wrapf( @@ -82,19 +88,30 @@ func checkMisbehaviour( // TODO: Evidence must be within trusting period // Blocked on https://github.com/cosmos/ics/issues/379 + if err := tmValidatorSet.FromProto(consensusState.ValidatorSet); err != nil { + return err + } + + if err := tmSignedHeader1.FromProto(&evidence.Header1.SignedHeader); err != nil { + return err + } + + if err := tmSignedHeader2.FromProto(&evidence.Header2.SignedHeader); err != nil { + return err + } // - ValidatorSet must have 2/3 similarity with trusted FromValidatorSet // - ValidatorSets on both headers are valid given the last trusted ValidatorSet - if err := consensusState.ValidatorSet.VerifyCommitTrusting( - evidence.ChainID, evidence.Header1.Commit.BlockID, evidence.Header1.Height, - evidence.Header1.Commit, lite.DefaultTrustLevel, + if err := tmValidatorSet.VerifyCommitTrusting( + evidence.ChainID, tmSignedHeader1.Commit.BlockID, int64(evidence.Header1.GetHeight()), + tmSignedHeader1.Commit, lite.DefaultTrustLevel, ); err != nil { return fmt.Errorf("validator set in header 1 has too much change from last known validator set: %v", err) } - if err := consensusState.ValidatorSet.VerifyCommitTrusting( - evidence.ChainID, evidence.Header2.Commit.BlockID, evidence.Header2.Height, - evidence.Header2.Commit, lite.DefaultTrustLevel, + if err := tmValidatorSet.VerifyCommitTrusting( + evidence.ChainID, tmSignedHeader2.Commit.BlockID, int64(evidence.Header2.GetHeight()), + tmSignedHeader2.Commit, lite.DefaultTrustLevel, ); err != nil { return fmt.Errorf("validator set in header 2 has too much change from last known validator set: %v", err) } diff --git a/x/ibc/07-tendermint/misbehaviour_test.go b/x/ibc/07-tendermint/misbehaviour_test.go index f94a43e7c24f..f9c2e45263a4 100644 --- a/x/ibc/07-tendermint/misbehaviour_test.go +++ b/x/ibc/07-tendermint/misbehaviour_test.go @@ -21,6 +21,12 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviour() { // Create bothValSet with both suite validator and altVal bothValSet := tmtypes.NewValidatorSet(append(suite.valSet.Validators, altVal)) + protoBothValSet, err := bothValSet.ToProto() + suite.Require().NoError(err) + + protoValSet, err := suite.valSet.ToProto() + suite.Require().NoError(err) + // Create alternative validator set with only altVal altValSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{altVal}) @@ -52,7 +58,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviour() { { "valid misbehavior evidence", ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), - ibctmtypes.ConsensusState{Timestamp: suite.now, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), ValidatorSet: bothValSet}, + ibctmtypes.ConsensusState{Timestamp: suite.now, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), ValidatorSet: protoBothValSet}, ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(chainID, height, suite.now, bothValSet, bothSigners), Header2: ibctmtypes.CreateTestHeader(chainID, height, suite.now.Add(time.Minute), bothValSet, bothSigners), @@ -64,8 +70,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviour() { }, { "valid misbehavior at height greater than last consensusState", - ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), - ibctmtypes.ConsensusState{Timestamp: suite.now, Height: height - 1, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), ValidatorSet: bothValSet}, + ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, vmaxClockDrift, suite.header), + ibctmtypes.ConsensusState{Timestamp: suite.now, Height: height - 1, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), ValidatorSet: protoBothValSet}, ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(chainID, height, suite.now, bothValSet, bothSigners), Header2: ibctmtypes.CreateTestHeader(chainID, height, suite.now.Add(time.Minute), bothValSet, bothSigners), @@ -78,7 +84,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviour() { { "consensus state's valset hash different from evidence should still pass", ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), - ibctmtypes.ConsensusState{Timestamp: suite.now, Height: height - 1, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), ValidatorSet: suite.valSet}, + ibctmtypes.ConsensusState{Timestamp: suite.now, Height: height - 1, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), ValidatorSet: protoValSet}, ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(chainID, height, suite.now, bothValSet, bothSigners), Header2: ibctmtypes.CreateTestHeader(chainID, height, suite.now.Add(time.Minute), bothValSet, bothSigners), @@ -91,7 +97,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviour() { { "first valset has too much change", ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), - ibctmtypes.ConsensusState{Timestamp: suite.now, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), ValidatorSet: bothValSet}, + ibctmtypes.ConsensusState{Timestamp: suite.now, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), ValidatorSet: protoBothValSet}, ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(chainID, height, suite.now, altValSet, altSigners), Header2: ibctmtypes.CreateTestHeader(chainID, height, suite.now.Add(time.Minute), bothValSet, bothSigners), @@ -104,7 +110,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviour() { { "second valset has too much change", ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), - ibctmtypes.ConsensusState{Timestamp: suite.now, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), ValidatorSet: bothValSet}, + ibctmtypes.ConsensusState{Timestamp: suite.now, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), ValidatorSet: protoBothValSet}, ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(chainID, height, suite.now, bothValSet, bothSigners), Header2: ibctmtypes.CreateTestHeader(chainID, height, suite.now.Add(time.Minute), altValSet, altSigners), @@ -117,7 +123,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviour() { { "both valsets have too much change", ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), - ibctmtypes.ConsensusState{Timestamp: suite.now, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), ValidatorSet: bothValSet}, + ibctmtypes.ConsensusState{Timestamp: suite.now, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), ValidatorSet: protoBothValSet}, ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(chainID, height, suite.now, altValSet, altSigners), Header2: ibctmtypes.CreateTestHeader(chainID, height, suite.now.Add(time.Minute), altValSet, altSigners), diff --git a/x/ibc/07-tendermint/types/client_state.go b/x/ibc/07-tendermint/types/client_state.go index 8d93ba6bb898..03bd20765389 100644 --- a/x/ibc/07-tendermint/types/client_state.go +++ b/x/ibc/07-tendermint/types/client_state.go @@ -19,37 +19,13 @@ import ( ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) -var _ clientexported.ClientState = ClientState{} - -// ClientState from Tendermint tracks the current validator set, latest height, -// and a possible frozen height. -type ClientState struct { - // Client ID - ID string `json:"id" yaml:"id"` - - // Duration of the period since the LastestTimestamp during which the - // submitted headers are valid for upgrade - TrustingPeriod time.Duration `json:"trusting_period" yaml:"trusting_period"` - - // Duration of the staking unbonding period - UnbondingPeriod time.Duration `json:"unbonding_period" yaml:"unbonding_period"` - - // MaxClockDrift defines how much new (untrusted) header's Time can drift into - // the future. - MaxClockDrift time.Duration - - // Block height when the client was frozen due to a misbehaviour - FrozenHeight uint64 `json:"frozen_height" yaml:"frozen_height"` - - // Last Header that was stored by client - LastHeader Header `json:"last_header" yaml:"last_header"` -} +var _ clientexported.ClientState = (*ClientState)(nil) // InitializeFromMsg creates a tendermint client state from a CreateClientMsg -func InitializeFromMsg(msg MsgCreateClient) (ClientState, error) { - return Initialize( - msg.GetClientID(), msg.TrustingPeriod, msg.UnbondingPeriod, msg.MaxClockDrift, msg.Header, - ) +func InitializeFromMsg( + msg MsgCreateClient, +) (ClientState, error) { + return Initialize(msg.ClientID, msg.TrustingPeriod, msg.UnbondingPeriod, msg.MaxClockDrift, msg.Header) } // Initialize creates a client state and validates its contents, checking that @@ -81,7 +57,7 @@ func NewClientState( } } -// GetID returns the tendermint client state identifier. +// GetID returns the client state identifier func (cs ClientState) GetID() string { return cs.ID } @@ -101,12 +77,12 @@ func (cs ClientState) ClientType() clientexported.ClientType { // GetLatestHeight returns latest block height. func (cs ClientState) GetLatestHeight() uint64 { - return uint64(cs.LastHeader.Height) + return cs.LastHeader.GetHeight() } // GetLatestTimestamp returns latest block time. func (cs ClientState) GetLatestTimestamp() time.Time { - return cs.LastHeader.Time + return cs.LastHeader.SignedHeader.Header.GetTime() } // IsFrozen returns true if the frozen height has been set. diff --git a/x/ibc/07-tendermint/types/client_state_test.go b/x/ibc/07-tendermint/types/client_state_test.go index 3b88105708fc..dc4bdde97035 100644 --- a/x/ibc/07-tendermint/types/client_state_test.go +++ b/x/ibc/07-tendermint/types/client_state_test.go @@ -2,12 +2,11 @@ package types_test import ( connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" - connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel" - channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" + ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) const ( @@ -80,7 +79,7 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() { // name: "successful verification", // clientState: ibctmtypes.NewClientState(chainID, chainID, height), // consensusState: ibctmtypes.ConsensusState{ - // Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + // Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), // }, // prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), // expPass: true, @@ -89,7 +88,7 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() { name: "ApplyPrefix failed", clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.MerklePrefix{}, expPass: false, @@ -98,7 +97,7 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() { name: "latest client height < height", clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -107,7 +106,7 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() { name: "client is frozen", clientState: ibctmtypes.ClientState{ID: chainID, LastHeader: suite.header, FrozenHeight: height - 1}, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -116,8 +115,8 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() { name: "proof verification failed", clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), - ValidatorSet: suite.valSet, + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), + ValidatorSet: suite.protoValSet, }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), proof: commitmenttypes.MerkleProof{}, @@ -142,7 +141,7 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() { func (suite *TendermintTestSuite) TestVerifyConnectionState() { counterparty := connection.NewCounterparty("clientB", testConnectionID, commitmenttypes.NewMerklePrefix([]byte("ibc"))) - conn := connection.NewConnectionEnd(connectionexported.OPEN, testConnectionID, "clientA", counterparty, []string{"1.0.0"}) + conn := connection.NewConnectionEnd(ibctypes.OPEN, testConnectionID, "clientA", counterparty, []string{"1.0.0"}) testCases := []struct { name string @@ -159,7 +158,7 @@ func (suite *TendermintTestSuite) TestVerifyConnectionState() { // clientState: ibctmtypes.NewClientState(chainID, chainID, height), // connection: conn, // consensusState: ibctmtypes.ConsensusState{ - // Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + // Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), // }, // prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), // expPass: true, @@ -169,7 +168,7 @@ func (suite *TendermintTestSuite) TestVerifyConnectionState() { clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), connection: conn, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.MerklePrefix{}, expPass: false, @@ -179,7 +178,7 @@ func (suite *TendermintTestSuite) TestVerifyConnectionState() { clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), connection: conn, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -189,7 +188,7 @@ func (suite *TendermintTestSuite) TestVerifyConnectionState() { clientState: ibctmtypes.ClientState{ID: chainID, LastHeader: suite.header, FrozenHeight: height - 1}, connection: conn, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -199,8 +198,8 @@ func (suite *TendermintTestSuite) TestVerifyConnectionState() { clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), connection: conn, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), - ValidatorSet: suite.valSet, + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), + ValidatorSet: suite.protoValSet, }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), proof: commitmenttypes.MerkleProof{}, @@ -225,7 +224,7 @@ func (suite *TendermintTestSuite) TestVerifyConnectionState() { func (suite *TendermintTestSuite) TestVerifyChannelState() { counterparty := channel.NewCounterparty(testPortID, testChannelID) - ch := channel.NewChannel(channelexported.OPEN, channelexported.ORDERED, counterparty, []string{testConnectionID}, "1.0.0") + ch := channel.NewChannel(ibctypes.OPEN, ibctypes.ORDERED, counterparty, []string{testConnectionID}, "1.0.0") testCases := []struct { name string @@ -242,7 +241,7 @@ func (suite *TendermintTestSuite) TestVerifyChannelState() { // clientState: ibctmtypes.NewClientState(chainID, height), // connection: conn, // consensusState: ibctmtypes.ConsensusState{ - // Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + // Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), // }, // prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), // expPass: true, @@ -252,7 +251,7 @@ func (suite *TendermintTestSuite) TestVerifyChannelState() { clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), channel: ch, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.MerklePrefix{}, expPass: false, @@ -262,7 +261,7 @@ func (suite *TendermintTestSuite) TestVerifyChannelState() { clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), channel: ch, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -272,7 +271,7 @@ func (suite *TendermintTestSuite) TestVerifyChannelState() { clientState: ibctmtypes.ClientState{ID: chainID, LastHeader: suite.header, FrozenHeight: height - 1}, channel: ch, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -282,8 +281,8 @@ func (suite *TendermintTestSuite) TestVerifyChannelState() { clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), channel: ch, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), - ValidatorSet: suite.valSet, + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), + ValidatorSet: suite.protoValSet, }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), proof: commitmenttypes.MerkleProof{}, @@ -322,7 +321,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketCommitment() { // clientState: ibctmtypes.NewClientState(chainID, height), // connection: conn, // consensusState: ibctmtypes.ConsensusState{ - // Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + // Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), // }, // prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), // expPass: true, @@ -332,7 +331,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketCommitment() { clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), commitment: []byte{}, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.MerklePrefix{}, expPass: false, @@ -342,7 +341,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketCommitment() { clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), commitment: []byte{}, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -352,7 +351,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketCommitment() { clientState: ibctmtypes.ClientState{ID: chainID, LastHeader: suite.header, FrozenHeight: height - 1}, commitment: []byte{}, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -362,8 +361,8 @@ func (suite *TendermintTestSuite) TestVerifyPacketCommitment() { clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), commitment: []byte{}, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), - ValidatorSet: suite.valSet, + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), + ValidatorSet: suite.protoValSet, }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), proof: commitmenttypes.MerkleProof{}, @@ -402,7 +401,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgement() { // clientState: ibctmtypes.NewClientState(chainID, chainID, height), // connection: conn, // consensusState: ibctmtypes.ConsensusState{ - // Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + // Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), // }, // prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), // expPass: true, @@ -412,7 +411,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgement() { clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), ack: []byte{}, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.MerklePrefix{}, expPass: false, @@ -422,7 +421,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgement() { clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), ack: []byte{}, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -432,7 +431,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgement() { clientState: ibctmtypes.ClientState{ID: chainID, LastHeader: suite.header, FrozenHeight: height - 1}, ack: []byte{}, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -442,8 +441,8 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgement() { clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), ack: []byte{}, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), - ValidatorSet: suite.valSet, + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), + ValidatorSet: suite.protoValSet, }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), proof: commitmenttypes.MerkleProof{}, @@ -481,7 +480,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgementAbsence() { // clientState: ibctmtypes.NewClientState(chainID, chainID, height), // connection: conn, // consensusState: ibctmtypes.ConsensusState{ - // Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + // Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), // }, // prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), // expPass: true, @@ -490,7 +489,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgementAbsence() { name: "ApplyPrefix failed", clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.MerklePrefix{}, expPass: false, @@ -499,7 +498,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgementAbsence() { name: "latest client height < height", clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -508,7 +507,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgementAbsence() { name: "client is frozen", clientState: ibctmtypes.ClientState{ID: chainID, LastHeader: suite.header, FrozenHeight: height - 1}, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -517,8 +516,8 @@ func (suite *TendermintTestSuite) TestVerifyPacketAcknowledgementAbsence() { name: "proof verification failed", clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), - ValidatorSet: suite.valSet, + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), + ValidatorSet: suite.protoValSet, }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), proof: commitmenttypes.MerkleProof{}, @@ -556,7 +555,7 @@ func (suite *TendermintTestSuite) TestVerifyNextSeqRecv() { // clientState: ibctmtypes.NewClientState(chainID, chainID, height), // connection: conn, // consensusState: ibctmtypes.ConsensusState{ - // Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + // Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), // }, // prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), // expPass: true, @@ -565,7 +564,7 @@ func (suite *TendermintTestSuite) TestVerifyNextSeqRecv() { name: "ApplyPrefix failed", clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.MerklePrefix{}, expPass: false, @@ -574,7 +573,7 @@ func (suite *TendermintTestSuite) TestVerifyNextSeqRecv() { name: "latest client height < height", clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -583,7 +582,7 @@ func (suite *TendermintTestSuite) TestVerifyNextSeqRecv() { name: "client is frozen", clientState: ibctmtypes.ClientState{ID: chainID, LastHeader: suite.header, FrozenHeight: height - 1}, consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), expPass: false, @@ -592,8 +591,8 @@ func (suite *TendermintTestSuite) TestVerifyNextSeqRecv() { name: "proof verification failed", clientState: ibctmtypes.NewClientState(chainID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header), consensusState: ibctmtypes.ConsensusState{ - Root: commitmenttypes.NewMerkleRoot(suite.header.AppHash), - ValidatorSet: suite.valSet, + Root: commitmenttypes.NewMerkleRoot(suite.header.SignedHeader.Header.AppHash), + ValidatorSet: suite.protoValSet, }, prefix: commitmenttypes.NewMerklePrefix([]byte("ibc")), proof: commitmenttypes.MerkleProof{}, diff --git a/x/ibc/07-tendermint/types/codec.go b/x/ibc/07-tendermint/types/codec.go index 086b23aae43d..2661b51dac97 100644 --- a/x/ibc/07-tendermint/types/codec.go +++ b/x/ibc/07-tendermint/types/codec.go @@ -4,10 +4,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" ) -// SubModuleCdc defines the IBC tendermint client codec. -var SubModuleCdc *codec.Codec - -// RegisterCodec registers the Tendermint types +// RegisterCodec registers the necessary x/ibc/07-tendermint interfaces and concrete types +// on the provided Amino codec. These types are used for Amino JSON serialization. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(ClientState{}, "ibc/client/tendermint/ClientState", nil) cdc.RegisterConcrete(ConsensusState{}, "ibc/client/tendermint/ConsensusState", nil) @@ -16,11 +14,22 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgCreateClient{}, "ibc/client/tendermint/MsgCreateClient", nil) cdc.RegisterConcrete(MsgUpdateClient{}, "ibc/client/tendermint/MsgUpdateClient", nil) cdc.RegisterConcrete(MsgSubmitClientMisbehaviour{}, "ibc/client/tendermint/MsgSubmitClientMisbehaviour", nil) - - SetSubModuleCodec(cdc) } -// SetSubModuleCodec sets the ibc tendermint client codec -func SetSubModuleCodec(cdc *codec.Codec) { - SubModuleCdc = cdc +var ( + amino = codec.New() + + // SubModuleCdc references the global x/ibc/07-tendermint module codec. Note, the codec + // should ONLY be used in certain instances of tests and for JSON encoding as Amino + // is still used for that purpose. + // + // The actual codec used for serialization should be provided to x/ibc/07-tendermint and + // defined at the application level. + SubModuleCdc = codec.NewHybridCodec(amino) +) + +func init() { + RegisterCodec(amino) + codec.RegisterCrypto(amino) + amino.Seal() } diff --git a/x/ibc/07-tendermint/types/consensus_state.go b/x/ibc/07-tendermint/types/consensus_state.go index 2bfc29f2b2b1..9720bf787677 100644 --- a/x/ibc/07-tendermint/types/consensus_state.go +++ b/x/ibc/07-tendermint/types/consensus_state.go @@ -3,21 +3,13 @@ package types import ( "time" - tmtypes "github.com/tendermint/tendermint/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" ) -// ConsensusState defines a Tendermint consensus state -type ConsensusState struct { - Timestamp time.Time `json:"timestamp" yaml:"timestamp"` - Root commitmentexported.Root `json:"root" yaml:"root"` - Height uint64 `json:"height" yaml:"height"` - ValidatorSet *tmtypes.ValidatorSet `json:"validator_set" yaml:"validator_set"` -} +var _ clientexported.ConsensusState = (*ConsensusState)(nil) // NewConsensusState creates a new ConsensusState instance. func NewConsensusState( @@ -39,7 +31,7 @@ func (ConsensusState) ClientType() clientexported.ClientType { // GetRoot returns the commitment Root for the specific func (cs ConsensusState) GetRoot() commitmentexported.Root { - return cs.Root + return &cs.Root } // GetHeight returns the height for the specific consensus state @@ -54,7 +46,7 @@ func (cs ConsensusState) GetTimestamp() uint64 { // ValidateBasic defines a basic validation for the tendermint consensus state. func (cs ConsensusState) ValidateBasic() error { - if cs.Root == nil || cs.Root.IsEmpty() { + if cs.Root.IsEmpty() { return sdkerrors.Wrap(clienttypes.ErrInvalidConsensus, "root cannot be empty") } if cs.ValidatorSet == nil { diff --git a/x/ibc/07-tendermint/types/consensus_state_test.go b/x/ibc/07-tendermint/types/consensus_state_test.go index ac1229b40568..811f50b44e16 100644 --- a/x/ibc/07-tendermint/types/consensus_state_test.go +++ b/x/ibc/07-tendermint/types/consensus_state_test.go @@ -19,15 +19,15 @@ func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() { Timestamp: suite.now, Height: height, Root: commitmenttypes.NewMerkleRoot([]byte("app_hash")), - ValidatorSet: suite.valSet, + ValidatorSet: suite.protoValSet, }, true}, {"root is nil", ibctmtypes.ConsensusState{ Timestamp: suite.now, Height: height, - Root: nil, - ValidatorSet: suite.valSet, + Root: commitmenttypes.MerkleRoot{}, + ValidatorSet: suite.protoValSet, }, false}, {"root is empty", @@ -35,7 +35,7 @@ func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() { Timestamp: suite.now, Height: height, Root: commitmenttypes.MerkleRoot{}, - ValidatorSet: suite.valSet, + ValidatorSet: suite.protoValSet, }, false}, {"valset is nil", @@ -51,7 +51,7 @@ func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() { Timestamp: suite.now, Height: 0, Root: commitmenttypes.NewMerkleRoot([]byte("app_hash")), - ValidatorSet: suite.valSet, + ValidatorSet: suite.protoValSet, }, false}, {"timestamp is zero", @@ -59,7 +59,7 @@ func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() { Timestamp: time.Time{}, Height: height, Root: commitmenttypes.NewMerkleRoot([]byte("app_hash")), - ValidatorSet: suite.valSet, + ValidatorSet: suite.protoValSet, }, false}, } @@ -68,7 +68,7 @@ func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() { tc := tc suite.Require().Equal(tc.consensusState.ClientType(), clientexported.Tendermint) - suite.Require().Equal(tc.consensusState.GetRoot(), tc.consensusState.Root) + suite.Require().Equal(tc.consensusState.GetRoot(), &tc.consensusState.Root) if tc.expectPass { suite.Require().NoError(tc.consensusState.ValidateBasic(), "valid test case %d failed: %s", i, tc.msg) diff --git a/x/ibc/07-tendermint/types/evidence.go b/x/ibc/07-tendermint/types/evidence.go index d161c10ed5dc..62b90c921ad3 100644 --- a/x/ibc/07-tendermint/types/evidence.go +++ b/x/ibc/07-tendermint/types/evidence.go @@ -7,6 +7,7 @@ import ( "github.com/tendermint/tendermint/crypto/tmhash" tmbytes "github.com/tendermint/tendermint/libs/bytes" + tmproto "github.com/tendermint/tendermint/proto/types" tmtypes "github.com/tendermint/tendermint/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -17,17 +18,13 @@ import ( ) var ( - _ evidenceexported.Evidence = Evidence{} - _ clientexported.Misbehaviour = Evidence{} + _ evidenceexported.Evidence = (*Evidence)(nil) + _ clientexported.Misbehaviour = (*Evidence)(nil) ) -// Evidence is a wrapper over tendermint's DuplicateVoteEvidence -// that implements Evidence interface expected by ICS-02 -type Evidence struct { - ClientID string `json:"client_id" yaml:"client_id"` - Header1 Header `json:"header1" yaml:"header1"` - Header2 Header `json:"header2" yaml:"header2"` - ChainID string `json:"chain_id" yaml:"chain_id"` +// GetClientID returns the ID of the client that committed a misbehaviour. +func (ev Evidence) GetClientID() string { + return ev.ClientID } // ClientType is Tendermint light client @@ -35,21 +32,11 @@ func (ev Evidence) ClientType() clientexported.ClientType { return clientexported.Tendermint } -// GetClientID returns the ID of the client that committed a misbehaviour. -func (ev Evidence) GetClientID() string { - return ev.ClientID -} - // Route implements Evidence interface func (ev Evidence) Route() string { return clienttypes.SubModuleName } -// Type implements Evidence interface -func (ev Evidence) Type() string { - return "client_misbehaviour" -} - // String implements Evidence interface func (ev Evidence) String() string { // FIXME: implement custom marshaller @@ -60,9 +47,17 @@ func (ev Evidence) String() string { return string(bz) } +// Type implements Evidence interface +func (ev Evidence) Type() string { + return "client_misbehaviour" +} + // Hash implements Evidence interface func (ev Evidence) Hash() tmbytes.HexBytes { - bz := SubModuleCdc.MustMarshalBinaryBare(ev) + bz, err := ev.Marshal() + if err != nil { + panic(err) + } return tmhash.Sum(bz) } @@ -70,7 +65,7 @@ func (ev Evidence) Hash() tmbytes.HexBytes { // // NOTE: assumes that evidence headers have the same height func (ev Evidence) GetHeight() int64 { - return int64(math.Min(float64(ev.Header1.Height), float64(ev.Header2.Height))) + return int64(math.Min(float64(ev.Header1.GetHeight()), float64(ev.Header2.GetHeight()))) } // ValidateBasic implements Evidence interface @@ -80,33 +75,31 @@ func (ev Evidence) ValidateBasic() error { } // ValidateBasic on both validators - if err := ev.Header1.ValidateBasic(ev.ChainID); err != nil { + if err := ev.Header1.ValidateBasic(ev.Header1.SignedHeader.GetHeader().GetChainID()); err != nil { return sdkerrors.Wrap( clienttypes.ErrInvalidEvidence, sdkerrors.Wrap(err, "header 1 failed validation").Error(), ) } - if err := ev.Header2.ValidateBasic(ev.ChainID); err != nil { + if err := ev.Header2.ValidateBasic(ev.Header2.SignedHeader.GetHeader().GetChainID()); err != nil { return sdkerrors.Wrap( clienttypes.ErrInvalidEvidence, sdkerrors.Wrap(err, "header 2 failed validation").Error(), ) } + // Ensure that Heights are the same - if ev.Header1.Height != ev.Header2.Height { - return sdkerrors.Wrapf(clienttypes.ErrInvalidEvidence, "headers in evidence are on different heights (%d ≠ %d)", ev.Header1.Height, ev.Header2.Height) + if ev.Header1.GetHeight() != ev.Header2.GetHeight() { + return sdkerrors.Wrapf(clienttypes.ErrInvalidEvidence, "headers in evidence are on different heights (%d ≠ %d)", ev.Header1.GetHeight(), ev.Header2.GetHeight()) } // Ensure that Commit Hashes are different - if ev.Header1.Commit.BlockID.Equals(ev.Header2.Commit.BlockID) { + if ev.Header1.SignedHeader.Commit.BlockID.Equal(ev.Header2.SignedHeader.Commit.BlockID) { return sdkerrors.Wrap(clienttypes.ErrInvalidEvidence, "headers commit to same blockID") } - if err := ValidCommit(ev.ChainID, ev.Header1.Commit, ev.Header1.ValidatorSet); err != nil { - return err - } - if err := ValidCommit(ev.ChainID, ev.Header2.Commit, ev.Header2.ValidatorSet); err != nil { + if err := ValidCommit(ev.ChainID, ev.Header1.SignedHeader.Commit, ev.Header1.ValidatorSet); err != nil { return err } - return nil + return ValidCommit(ev.ChainID, ev.Header2.SignedHeader.Commit, ev.Header2.ValidatorSet) } // ValidCommit checks if the given commit is a valid commit from the passed-in validatorset @@ -114,20 +107,33 @@ func (ev Evidence) ValidateBasic() error { // CommitToVoteSet will panic if the commit cannot be converted to a valid voteset given the validatorset // This implies that someone tried to submit evidence that wasn't actually committed by the validatorset // thus we should return an error here and reject the evidence rather than panicing. -func ValidCommit(chainID string, commit *tmtypes.Commit, valSet *tmtypes.ValidatorSet) (err error) { +func ValidCommit(chainID string, commit *tmproto.Commit, valSet *tmproto.ValidatorSet) (err error) { + var ( + tmCommit tmtypes.Commit + tmValSet tmtypes.ValidatorSet + ) + defer func() { if r := recover(); r != nil { err = sdkerrors.Wrapf(clienttypes.ErrInvalidEvidence, "invalid commit: %v", r) } }() + if err := tmCommit.FromProto(commit); err != nil { + return err + } + + if err := tmValSet.FromProto(valSet); err != nil { + return err + } + // Convert commits to vote-sets given the validator set so we can check if they both have 2/3 power - voteSet := tmtypes.CommitToVoteSet(chainID, commit, valSet) + voteSet := tmtypes.CommitToVoteSet(chainID, &tmCommit, &tmValSet) blockID, ok := voteSet.TwoThirdsMajority() // Check that ValidatorSet did indeed commit to blockID in Commit - if !ok || !blockID.Equals(commit.BlockID) { + if !ok || !blockID.Equals(tmCommit.BlockID) { return sdkerrors.Wrap(clienttypes.ErrInvalidEvidence, "validator set did not commit to header 1") } diff --git a/x/ibc/07-tendermint/types/evidence_test.go b/x/ibc/07-tendermint/types/evidence_test.go index bb59147d532f..ef4791dcbc56 100644 --- a/x/ibc/07-tendermint/types/evidence_test.go +++ b/x/ibc/07-tendermint/types/evidence_test.go @@ -5,7 +5,6 @@ import ( "time" "github.com/tendermint/tendermint/crypto/tmhash" - tmbytes "github.com/tendermint/tendermint/libs/bytes" tmproto "github.com/tendermint/tendermint/proto/types" tmtypes "github.com/tendermint/tendermint/types" @@ -27,7 +26,6 @@ func (suite *TendermintTestSuite) TestEvidence() { suite.Require().Equal(ev.GetClientID(), "gaiamainnet") suite.Require().Equal(ev.Route(), "client") suite.Require().Equal(ev.Type(), "client_misbehaviour") - suite.Require().Equal(ev.Hash(), tmbytes.HexBytes(tmhash.Sum(ibctmtypes.SubModuleCdc.MustMarshalBinaryBare(ev)))) suite.Require().Equal(ev.GetHeight(), int64(height)) } @@ -141,10 +139,18 @@ func (suite *TendermintTestSuite) TestEvidenceValidateBasic() { }, func(ev *ibctmtypes.Evidence) error { // voteSet contains only altVal which is less than 2/3 of total power (height/1height) - wrongVoteSet := tmtypes.NewVoteSet(chainID, ev.Header1.Height, 1, tmproto.PrecommitType, altValSet) - var err error - ev.Header1.Commit, err = tmtypes.MakeCommit(ev.Header1.Commit.BlockID, ev.Header2.Height, ev.Header1.Commit.Round, wrongVoteSet, altSigners, suite.now) - return err + wrongVoteSet := tmtypes.NewVoteSet(chainID, ev.Header1.SignedHeader.Header.Height, 1, tmproto.PrecommitType, altValSet) + tmBlockID := tmtypes.BlockID{} + err := tmBlockID.FromProto(&ev.Header1.SignedHeader.Commit.BlockID) + if err != nil { + return err + } + commit, err := tmtypes.MakeCommit(tmBlockID, ev.Header2.SignedHeader.Header.Height, ev.Header1.SignedHeader.Commit.Round, wrongVoteSet, altSigners, suite.now) + if err != nil { + return err + } + ev.Header1.SignedHeader.Commit = commit.ToProto() + return nil }, false, }, @@ -158,10 +164,18 @@ func (suite *TendermintTestSuite) TestEvidenceValidateBasic() { }, func(ev *ibctmtypes.Evidence) error { // voteSet contains only altVal which is less than 2/3 of total power (height/1height) - wrongVoteSet := tmtypes.NewVoteSet(chainID, ev.Header2.Height, 1, tmproto.PrecommitType, altValSet) - var err error - ev.Header2.Commit, err = tmtypes.MakeCommit(ev.Header2.Commit.BlockID, ev.Header2.Height, ev.Header2.Commit.Round, wrongVoteSet, altSigners, suite.now) - return err + wrongVoteSet := tmtypes.NewVoteSet(chainID, ev.Header2.SignedHeader.Header.Height, 1, tmproto.PrecommitType, altValSet) + tmBlockID := tmtypes.BlockID{} + err := tmBlockID.FromProto(&ev.Header2.SignedHeader.Commit.BlockID) + if err != nil { + return err + } + commit, err := tmtypes.MakeCommit(tmBlockID, ev.Header2.SignedHeader.Header.Height, ev.Header2.SignedHeader.Commit.Round, wrongVoteSet, altSigners, suite.now) + if err != nil { + return err + } + ev.Header2.SignedHeader.Commit = commit.ToProto() + return nil }, false, }, @@ -174,7 +188,9 @@ func (suite *TendermintTestSuite) TestEvidenceValidateBasic() { ClientID: "gaiamainnet", }, func(ev *ibctmtypes.Evidence) error { - ev.Header2.Commit.BlockID = ibctmtypes.MakeBlockID(tmhash.Sum([]byte("other_hash")), 3, tmhash.Sum([]byte("other_partset"))) + blockID := ibctmtypes.MakeBlockID(tmhash.Sum([]byte("other_hash")), 3, tmhash.Sum([]byte("other_partset"))) + protoBlockID := blockID.ToProto() + ev.Header2.SignedHeader.Commit.BlockID = *protoBlockID return nil }, false, diff --git a/x/ibc/07-tendermint/types/header.go b/x/ibc/07-tendermint/types/header.go index f1d59dd9a054..91c0c140a3a5 100644 --- a/x/ibc/07-tendermint/types/header.go +++ b/x/ibc/07-tendermint/types/header.go @@ -2,6 +2,7 @@ package types import ( "bytes" + "time" tmtypes "github.com/tendermint/tendermint/types" @@ -11,13 +12,7 @@ import ( commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" ) -var _ clientexported.Header = Header{} - -// Header defines the Tendermint consensus Header -type Header struct { - tmtypes.SignedHeader // contains the commitment root - ValidatorSet *tmtypes.ValidatorSet `json:"validator_set" yaml:"validator_set"` -} +var _ clientexported.Header = (*Header)(nil) // ClientType defines that the Header is a Tendermint consensus algorithm func (h Header) ClientType() clientexported.ClientType { @@ -27,9 +22,9 @@ func (h Header) ClientType() clientexported.ClientType { // ConsensusState returns the consensus state associated with the header func (h Header) ConsensusState() ConsensusState { return ConsensusState{ - Height: uint64(h.Height), - Timestamp: h.Time, - Root: commitmenttypes.NewMerkleRoot(h.AppHash), + Height: h.GetHeight(), + Timestamp: h.GetTime(), + Root: commitmenttypes.NewMerkleRoot(h.SignedHeader.Header.AppHash), ValidatorSet: h.ValidatorSet, } } @@ -38,19 +33,37 @@ func (h Header) ConsensusState() ConsensusState { // // NOTE: also referred as `sequence` func (h Header) GetHeight() uint64 { - return uint64(h.Height) + return uint64(h.SignedHeader.Header.GetHeight()) +} + +// GetTime returns the signed header's time +func (h Header) GetTime() time.Time { + return h.SignedHeader.Header.GetTime() } // ValidateBasic calls the SignedHeader ValidateBasic function // and checks that validatorsets are not nil func (h Header) ValidateBasic(chainID string) error { - if err := h.SignedHeader.ValidateBasic(chainID); err != nil { + var ( + tmSignedHeader tmtypes.SignedHeader + tmValSet tmtypes.ValidatorSet + ) + + if err := tmSignedHeader.FromProto(&h.SignedHeader); err != nil { + return err + } + + if err := tmValSet.FromProto(h.ValidatorSet); err != nil { + return err + } + + if err := tmSignedHeader.ValidateBasic(chainID); err != nil { return sdkerrors.Wrap(clienttypes.ErrInvalidHeader, err.Error()) } if h.ValidatorSet == nil { return sdkerrors.Wrap(clienttypes.ErrInvalidHeader, "validator set is nil") } - if !bytes.Equal(h.ValidatorsHash, h.ValidatorSet.Hash()) { + if !bytes.Equal(tmSignedHeader.Header.ValidatorsHash, tmValSet.Hash()) { return sdkerrors.Wrap(clienttypes.ErrInvalidHeader, "validator set does not match hash") } return nil diff --git a/x/ibc/07-tendermint/types/msgs.go b/x/ibc/07-tendermint/types/msgs.go index 0095ba5b9fc0..9740a113581c 100644 --- a/x/ibc/07-tendermint/types/msgs.go +++ b/x/ibc/07-tendermint/types/msgs.go @@ -26,16 +26,6 @@ var ( _ evidenceexported.MsgSubmitEvidence = MsgSubmitClientMisbehaviour{} ) -// MsgCreateClient defines a message to create an IBC client -type MsgCreateClient struct { - ClientID string `json:"client_id" yaml:"client_id"` - Header Header `json:"header" yaml:"header"` - TrustingPeriod time.Duration `json:"trusting_period" yaml:"trusting_period"` - UnbondingPeriod time.Duration `json:"unbonding_period" yaml:"unbonding_period"` - MaxClockDrift time.Duration `json:"max_clock_drift" yaml:"max_clock_drift"` - Signer sdk.AccAddress `json:"address" yaml:"address"` -} - // NewMsgCreateClient creates a new MsgCreateClient instance func NewMsgCreateClient( id string, header Header, @@ -52,6 +42,11 @@ func NewMsgCreateClient( } } +// GetClientID implements clientexported.MsgCreateClient +func (msg MsgCreateClient) GetClientID() string { + return msg.ClientID +} + // Route implements sdk.Msg func (msg MsgCreateClient) Route() string { return ibctypes.RouterKey @@ -77,8 +72,8 @@ func (msg MsgCreateClient) ValidateBasic() error { return sdkerrors.Wrap(ErrInvalidHeader, "header cannot be nil") } // ValidateBasic of provided header with self-attested chain-id - if err := msg.Header.ValidateBasic(msg.Header.ChainID); err != nil { - return sdkerrors.Wrapf(ErrInvalidHeader, "header failed validatebasic with its own chain-id: %v", err) + if err := msg.Header.ValidateBasic(msg.Header.SignedHeader.GetHeader().GetChainID()); err != nil { + return sdkerrors.Wrapf(ErrInvalidHeader, "header failed validate basic with its own chain-id: %v", err) } return host.DefaultClientIdentifierValidator(msg.ClientID) } @@ -93,11 +88,6 @@ func (msg MsgCreateClient) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{msg.Signer} } -// GetClientID implements clientexported.MsgCreateClient -func (msg MsgCreateClient) GetClientID() string { - return msg.ClientID -} - // GetClientType implements clientexported.MsgCreateClient func (msg MsgCreateClient) GetClientType() string { return clientexported.ClientTypeTendermint @@ -106,22 +96,15 @@ func (msg MsgCreateClient) GetClientType() string { // GetConsensusState implements clientexported.MsgCreateClient func (msg MsgCreateClient) GetConsensusState() clientexported.ConsensusState { // Construct initial consensus state from provided Header - root := commitmenttypes.NewMerkleRoot(msg.Header.AppHash) - return ConsensusState{ - Timestamp: msg.Header.Time, + root := commitmenttypes.NewMerkleRoot(msg.Header.SignedHeader.GetHeader().GetAppHash()) + return &ConsensusState{ + Timestamp: msg.Header.GetTime(), Root: root, - Height: uint64(msg.Header.Height), - ValidatorSet: msg.Header.ValidatorSet, + Height: msg.Header.GetHeight(), + ValidatorSet: msg.Header.GetValidatorSet(), } } -// MsgUpdateClient defines a message to update an IBC client -type MsgUpdateClient struct { - ClientID string `json:"client_id" yaml:"client_id"` - Header Header `json:"header" yaml:"header"` - Signer sdk.AccAddress `json:"address" yaml:"address"` -} - // NewMsgUpdateClient creates a new MsgUpdateClient instance func NewMsgUpdateClient(id string, header Header, signer sdk.AccAddress) MsgUpdateClient { return MsgUpdateClient{ @@ -131,6 +114,16 @@ func NewMsgUpdateClient(id string, header Header, signer sdk.AccAddress) MsgUpda } } +// GetClientID implements clientexported.MsgUpdateClient +func (msg MsgUpdateClient) GetClientID() string { + return msg.ClientID +} + +// GetHeader implements clientexported.MsgUpdateClient +func (msg MsgUpdateClient) GetHeader() clientexported.Header { + return &msg.Header +} + // Route implements sdk.Msg func (msg MsgUpdateClient) Route() string { return ibctypes.RouterKey @@ -159,27 +152,18 @@ func (msg MsgUpdateClient) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{msg.Signer} } -// GetClientID implements clientexported.MsgUpdateClient -func (msg MsgUpdateClient) GetClientID() string { - return msg.ClientID -} - -// GetHeader implements clientexported.MsgUpdateClient -func (msg MsgUpdateClient) GetHeader() clientexported.Header { - return msg.Header -} - -// MsgSubmitClientMisbehaviour defines an sdk.Msg type that supports submitting -// Evidence for client misbehaviour. -type MsgSubmitClientMisbehaviour struct { - Evidence evidenceexported.Evidence `json:"evidence" yaml:"evidence"` - Submitter sdk.AccAddress `json:"submitter" yaml:"submitter"` -} - // NewMsgSubmitClientMisbehaviour creates a new MsgSubmitClientMisbehaviour // instance. -func NewMsgSubmitClientMisbehaviour(e evidenceexported.Evidence, s sdk.AccAddress) MsgSubmitClientMisbehaviour { - return MsgSubmitClientMisbehaviour{Evidence: e, Submitter: s} +func NewMsgSubmitClientMisbehaviour(evidence evidenceexported.Evidence, signer sdk.AccAddress) MsgSubmitClientMisbehaviour { + ev, ok := evidence.(*Evidence) + if !ok { + // TODO: panic or return error? + return MsgSubmitClientMisbehaviour{} + } + return MsgSubmitClientMisbehaviour{ + Evidence: ev, + Submitter: signer, + } } // Route returns the MsgSubmitClientMisbehaviour's route. @@ -193,14 +177,11 @@ func (msg MsgSubmitClientMisbehaviour) ValidateBasic() error { if msg.Evidence == nil { return sdkerrors.Wrap(evidencetypes.ErrInvalidEvidence, "missing evidence") } - if err := msg.Evidence.ValidateBasic(); err != nil { - return err - } if msg.Submitter.Empty() { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Submitter.String()) } - return nil + return msg.Evidence.ValidateBasic() } // GetSignBytes returns the raw bytes a signer is expected to sign when submitting diff --git a/x/ibc/07-tendermint/types/tendermint_test.go b/x/ibc/07-tendermint/types/tendermint_test.go index 3deeadccef45..7b95b243324c 100644 --- a/x/ibc/07-tendermint/types/tendermint_test.go +++ b/x/ibc/07-tendermint/types/tendermint_test.go @@ -6,6 +6,7 @@ import ( "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/types" tmtypes "github.com/tendermint/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" @@ -24,11 +25,12 @@ const ( type TendermintTestSuite struct { suite.Suite - cdc *codec.Codec - privVal tmtypes.PrivValidator - valSet *tmtypes.ValidatorSet - header ibctmtypes.Header - now time.Time + cdc *codec.Codec + privVal tmtypes.PrivValidator + valSet *tmtypes.ValidatorSet + protoValSet *tmproto.ValidatorSet + header ibctmtypes.Header + now time.Time } func (suite *TendermintTestSuite) SetupTest() { @@ -45,6 +47,9 @@ func (suite *TendermintTestSuite) SetupTest() { val := tmtypes.NewValidator(pubKey, 10) suite.valSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{val}) + suite.protoValSet, err = suite.valSet.ToProto() + suite.Require().NoError(err) + suite.header = ibctmtypes.CreateTestHeader(chainID, height, suite.now, suite.valSet, []tmtypes.PrivValidator{suite.privVal}) } diff --git a/x/ibc/07-tendermint/types/test_utils.go b/x/ibc/07-tendermint/types/test_utils.go index 1604d2a27a2d..5e1917576e21 100644 --- a/x/ibc/07-tendermint/types/test_utils.go +++ b/x/ibc/07-tendermint/types/test_utils.go @@ -6,10 +6,11 @@ import ( "github.com/tendermint/tendermint/crypto/tmhash" tmproto "github.com/tendermint/tendermint/proto/types" + "github.com/tendermint/tendermint/proto/version" tmtypes "github.com/tendermint/tendermint/types" ) -// Copied unimported test functions from tmtypes to use them here +// MakeBlockID copied unimported test functions from tmtypes to use them here func MakeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) tmtypes.BlockID { return tmtypes.BlockID{ Hash: hash, @@ -23,8 +24,8 @@ func MakeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) tmtypes.Bl // CreateTestHeader creates a mock header for testing only. func CreateTestHeader(chainID string, height int64, timestamp time.Time, valSet *tmtypes.ValidatorSet, signers []tmtypes.PrivValidator) Header { vsetHash := valSet.Hash() - tmHeader := tmtypes.Header{ - // Version: version.Consensus{Block: 2, App: 2}, + tmHeader := &tmtypes.Header{ + Version: version.Consensus{Block: 2, App: 2}, ChainID: chainID, Height: height, Time: timestamp, @@ -39,21 +40,26 @@ func CreateTestHeader(chainID string, height int64, timestamp time.Time, valSet EvidenceHash: tmhash.Sum([]byte("evidence_hash")), ProposerAddress: valSet.Proposer.Address, } - hhash := tmHeader.Hash() - blockID := MakeBlockID(hhash, 3, tmhash.Sum([]byte("part_set"))) + + blockID := MakeBlockID(tmHeader.Hash(), 3, tmhash.Sum([]byte("part_set"))) voteSet := tmtypes.NewVoteSet(chainID, height, 1, tmproto.PrecommitType, valSet) commit, err := tmtypes.MakeCommit(blockID, height, 1, voteSet, signers, timestamp) if err != nil { panic(err) } - signedHeader := tmtypes.SignedHeader{ - Header: &tmHeader, - Commit: commit, + signedHeader := tmproto.SignedHeader{ + Header: tmHeader.ToProto(), + Commit: commit.ToProto(), + } + + protoValSet, err := valSet.ToProto() + if err != nil { + panic(err) } return Header{ SignedHeader: signedHeader, - ValidatorSet: valSet, + ValidatorSet: protoValSet, } } diff --git a/x/ibc/07-tendermint/types/types.pb.go b/x/ibc/07-tendermint/types/types.pb.go new file mode 100644 index 000000000000..8996eaedb2ab --- /dev/null +++ b/x/ibc/07-tendermint/types/types.pb.go @@ -0,0 +1,2357 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/ibc/07-tendermint/types/types.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/golang/protobuf/ptypes/duration" + _ "github.com/golang/protobuf/ptypes/timestamp" + types1 "github.com/tendermint/tendermint/proto/types" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgCreateClient defines a message to create a tendermint client state. +type MsgCreateClient struct { + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` + Header Header `protobuf:"bytes,2,opt,name=header,proto3" json:"header"` + TrustingPeriod time.Duration `protobuf:"bytes,3,opt,name=trusting_period,json=trustingPeriod,proto3,stdduration" json:"trusting_period" yaml:"trusting_period"` + UnbondingPeriod time.Duration `protobuf:"bytes,4,opt,name=unbonding_period,json=unbondingPeriod,proto3,stdduration" json:"unbonding_period" yaml:"unbonding_period"` + MaxClockDrift time.Duration `protobuf:"bytes,5,opt,name=max_clock_drift,json=maxClockDrift,proto3,stdduration" json:"max_clock_drift" yaml:"max_clock_drift"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,6,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgCreateClient) Reset() { *m = MsgCreateClient{} } +func (m *MsgCreateClient) String() string { return proto.CompactTextString(m) } +func (*MsgCreateClient) ProtoMessage() {} +func (*MsgCreateClient) Descriptor() ([]byte, []int) { + return fileDescriptor_c1207658e3de8b54, []int{0} +} +func (m *MsgCreateClient) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateClient) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateClient.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 *MsgCreateClient) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateClient.Merge(m, src) +} +func (m *MsgCreateClient) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateClient) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateClient.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateClient proto.InternalMessageInfo + +// MsgCreateClient defines an sdk.Msg to update a tendermint client state to +// the given header. +type MsgUpdateClient struct { + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` + Header Header `protobuf:"bytes,2,opt,name=header,proto3" json:"header"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgUpdateClient) Reset() { *m = MsgUpdateClient{} } +func (m *MsgUpdateClient) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateClient) ProtoMessage() {} +func (*MsgUpdateClient) Descriptor() ([]byte, []int) { + return fileDescriptor_c1207658e3de8b54, []int{1} +} +func (m *MsgUpdateClient) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateClient) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateClient.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 *MsgUpdateClient) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateClient.Merge(m, src) +} +func (m *MsgUpdateClient) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateClient) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateClient.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateClient proto.InternalMessageInfo + +// MsgSubmitClientMisbehaviour defines an sdk.Msg type that submits Evidence for +// light client misbehaviour. +type MsgSubmitClientMisbehaviour struct { + Evidence *Evidence `protobuf:"bytes,1,opt,name=evidence,proto3" json:"evidence,omitempty"` + Submitter github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=submitter,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"submitter,omitempty"` +} + +func (m *MsgSubmitClientMisbehaviour) Reset() { *m = MsgSubmitClientMisbehaviour{} } +func (m *MsgSubmitClientMisbehaviour) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitClientMisbehaviour) ProtoMessage() {} +func (*MsgSubmitClientMisbehaviour) Descriptor() ([]byte, []int) { + return fileDescriptor_c1207658e3de8b54, []int{2} +} +func (m *MsgSubmitClientMisbehaviour) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitClientMisbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitClientMisbehaviour.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 *MsgSubmitClientMisbehaviour) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitClientMisbehaviour.Merge(m, src) +} +func (m *MsgSubmitClientMisbehaviour) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitClientMisbehaviour) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitClientMisbehaviour.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitClientMisbehaviour proto.InternalMessageInfo + +// ClientState from Tendermint tracks the current validator set, latest height, +// and a possible frozen height. +type ClientState struct { + // client id + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // duration of the period since the LastestTimestamp during which the submitted + // headers are valid for upgrade + TrustingPeriod time.Duration `protobuf:"bytes,2,opt,name=trusting_period,json=trustingPeriod,proto3,stdduration" json:"trusting_period" yaml:"trusting_period"` + // duration of the staking unbonding period + UnbondingPeriod time.Duration `protobuf:"bytes,3,opt,name=unbonding_period,json=unbondingPeriod,proto3,stdduration" json:"unbonding_period" yaml:"unbonding_period"` + // defines how much new (untrusted) header's Time can drift into the future. + MaxClockDrift time.Duration `protobuf:"bytes,4,opt,name=max_clock_drift,json=maxClockDrift,proto3,stdduration" json:"max_clock_drift" yaml:"max_clock_drift"` + // Block height when the client was frozen due to a misbehaviour + FrozenHeight uint64 `protobuf:"varint,5,opt,name=frozen_height,json=frozenHeight,proto3" json:"frozen_height,omitempty" yaml:"frozen_height"` + // Last Header that was stored by the client + LastHeader Header `protobuf:"bytes,6,opt,name=last_header,json=lastHeader,proto3" json:"last_header" yaml:"last_header"` +} + +func (m *ClientState) Reset() { *m = ClientState{} } +func (m *ClientState) String() string { return proto.CompactTextString(m) } +func (*ClientState) ProtoMessage() {} +func (*ClientState) Descriptor() ([]byte, []int) { + return fileDescriptor_c1207658e3de8b54, []int{3} +} +func (m *ClientState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClientState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClientState.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 *ClientState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientState.Merge(m, src) +} +func (m *ClientState) XXX_Size() int { + return m.Size() +} +func (m *ClientState) XXX_DiscardUnknown() { + xxx_messageInfo_ClientState.DiscardUnknown(m) +} + +var xxx_messageInfo_ClientState proto.InternalMessageInfo + +// ConsensusState defines the consensus state from Tendermint. +type ConsensusState struct { + // timestamp that corresponds to the block height in which the ConsensusState + // was stored. + Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + // commitment root (i.e app hash) + Root types.MerkleRoot `protobuf:"bytes,2,opt,name=root,proto3" json:"root"` + // height at which the consensus state was stored. + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` + ValidatorSet *types1.ValidatorSet `protobuf:"bytes,4,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty" yaml:"validator_set"` +} + +func (m *ConsensusState) Reset() { *m = ConsensusState{} } +func (m *ConsensusState) String() string { return proto.CompactTextString(m) } +func (*ConsensusState) ProtoMessage() {} +func (*ConsensusState) Descriptor() ([]byte, []int) { + return fileDescriptor_c1207658e3de8b54, []int{4} +} +func (m *ConsensusState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsensusState.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 *ConsensusState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsensusState.Merge(m, src) +} +func (m *ConsensusState) XXX_Size() int { + return m.Size() +} +func (m *ConsensusState) XXX_DiscardUnknown() { + xxx_messageInfo_ConsensusState.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsensusState proto.InternalMessageInfo + +// Evidence defines two distinct headers at the same hight, chain id and client. +// It is used to verify and penalize light client misbehaviour. +type Evidence struct { + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` + ChainID string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` + Header1 Header `protobuf:"bytes,3,opt,name=header_1,json=header1,proto3" json:"header_1" yaml:"header_1"` + Header2 Header `protobuf:"bytes,4,opt,name=header_2,json=header2,proto3" json:"header_2" yaml:"header_2"` +} + +func (m *Evidence) Reset() { *m = Evidence{} } +func (*Evidence) ProtoMessage() {} +func (*Evidence) Descriptor() ([]byte, []int) { + return fileDescriptor_c1207658e3de8b54, []int{5} +} +func (m *Evidence) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Evidence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Evidence.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 *Evidence) XXX_Merge(src proto.Message) { + xxx_messageInfo_Evidence.Merge(m, src) +} +func (m *Evidence) XXX_Size() int { + return m.Size() +} +func (m *Evidence) XXX_DiscardUnknown() { + xxx_messageInfo_Evidence.DiscardUnknown(m) +} + +var xxx_messageInfo_Evidence proto.InternalMessageInfo + +// Header defines a tendermint signed header and the validator set that +// corresponds to the header. +type Header struct { + SignedHeader types1.SignedHeader `protobuf:"bytes,1,opt,name=signed_header,json=signedHeader,proto3" json:"signed_header" yaml:"signed_header"` + ValidatorSet *types1.ValidatorSet `protobuf:"bytes,2,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty" yaml:"validator_set"` +} + +func (m *Header) Reset() { *m = Header{} } +func (m *Header) String() string { return proto.CompactTextString(m) } +func (*Header) ProtoMessage() {} +func (*Header) Descriptor() ([]byte, []int) { + return fileDescriptor_c1207658e3de8b54, []int{6} +} +func (m *Header) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Header.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 *Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_Header.Merge(m, src) +} +func (m *Header) XXX_Size() int { + return m.Size() +} +func (m *Header) XXX_DiscardUnknown() { + xxx_messageInfo_Header.DiscardUnknown(m) +} + +var xxx_messageInfo_Header proto.InternalMessageInfo + +func (m *Header) GetSignedHeader() types1.SignedHeader { + if m != nil { + return m.SignedHeader + } + return types1.SignedHeader{} +} + +func (m *Header) GetValidatorSet() *types1.ValidatorSet { + if m != nil { + return m.ValidatorSet + } + return nil +} + +func init() { + proto.RegisterType((*MsgCreateClient)(nil), "cosmos_sdk.x.ibc.tendermint.v1.MsgCreateClient") + proto.RegisterType((*MsgUpdateClient)(nil), "cosmos_sdk.x.ibc.tendermint.v1.MsgUpdateClient") + proto.RegisterType((*MsgSubmitClientMisbehaviour)(nil), "cosmos_sdk.x.ibc.tendermint.v1.MsgSubmitClientMisbehaviour") + proto.RegisterType((*ClientState)(nil), "cosmos_sdk.x.ibc.tendermint.v1.ClientState") + proto.RegisterType((*ConsensusState)(nil), "cosmos_sdk.x.ibc.tendermint.v1.ConsensusState") + proto.RegisterType((*Evidence)(nil), "cosmos_sdk.x.ibc.tendermint.v1.Evidence") + proto.RegisterType((*Header)(nil), "cosmos_sdk.x.ibc.tendermint.v1.Header") +} + +func init() { + proto.RegisterFile("x/ibc/07-tendermint/types/types.proto", fileDescriptor_c1207658e3de8b54) +} + +var fileDescriptor_c1207658e3de8b54 = []byte{ + // 932 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4d, 0x6f, 0xe3, 0x44, + 0x18, 0x8e, 0x5d, 0x93, 0xa6, 0xd3, 0x74, 0xb3, 0xb2, 0x50, 0x09, 0x01, 0xd9, 0x95, 0x81, 0x55, + 0x85, 0x54, 0x87, 0x64, 0x11, 0x1f, 0x95, 0xf6, 0xb0, 0x49, 0x90, 0x36, 0x87, 0x8a, 0x95, 0x0b, + 0x1c, 0xb8, 0x58, 0x8e, 0x67, 0xea, 0x8c, 0x1a, 0x7b, 0xa2, 0x99, 0x49, 0x94, 0xf2, 0x0b, 0xe0, + 0xb6, 0xc7, 0xbd, 0x20, 0x95, 0xbf, 0xc1, 0x2f, 0xd8, 0xe3, 0x1e, 0x39, 0x20, 0xb3, 0x4a, 0x0f, + 0x70, 0xee, 0x91, 0x13, 0xf2, 0xcc, 0x38, 0x71, 0x93, 0xa5, 0xfb, 0x01, 0xbb, 0xda, 0x4b, 0x3b, + 0xf3, 0xfa, 0x7d, 0xde, 0xe7, 0xfd, 0x78, 0x5e, 0x3b, 0xe0, 0xa3, 0x59, 0x13, 0x0f, 0xc2, 0xe6, + 0x27, 0x9f, 0x1f, 0x70, 0x94, 0x40, 0x44, 0x63, 0x9c, 0xf0, 0x26, 0x3f, 0x1b, 0x23, 0x26, 0xff, + 0xba, 0x63, 0x4a, 0x38, 0x31, 0xad, 0x90, 0xb0, 0x98, 0x30, 0x9f, 0xc1, 0x53, 0x77, 0xe6, 0xe2, + 0x41, 0xe8, 0x2e, 0xdd, 0xdd, 0x69, 0xab, 0x71, 0x8b, 0x0f, 0x31, 0x85, 0xfe, 0x38, 0xa0, 0xfc, + 0xac, 0x29, 0x20, 0xcd, 0x88, 0x44, 0x64, 0x79, 0x92, 0x71, 0x1a, 0x9f, 0xae, 0xfb, 0x15, 0x78, + 0x95, 0x61, 0x95, 0xbd, 0xf1, 0xc5, 0x73, 0xa3, 0xa6, 0xc1, 0x08, 0xc3, 0x80, 0x13, 0xaa, 0x90, + 0x56, 0x44, 0x48, 0x34, 0x42, 0xd2, 0x67, 0x30, 0x39, 0x69, 0xc2, 0x09, 0x0d, 0x38, 0x26, 0x89, + 0x7a, 0x6e, 0xaf, 0x3e, 0xe7, 0x38, 0x46, 0x8c, 0x07, 0xf1, 0x58, 0x39, 0xa8, 0xfe, 0xb4, 0x6f, + 0x1f, 0x84, 0x24, 0x8e, 0x31, 0x8f, 0xd1, 0xd3, 0xfa, 0xe3, 0xfc, 0x62, 0x80, 0xda, 0x11, 0x8b, + 0xba, 0x14, 0x05, 0x1c, 0x75, 0x47, 0x18, 0x25, 0xdc, 0xbc, 0x03, 0xb6, 0x42, 0x71, 0xf2, 0x31, + 0xac, 0x6b, 0x7b, 0xda, 0xfe, 0x56, 0x67, 0x6f, 0x9e, 0xda, 0x15, 0xf9, 0xb8, 0xdf, 0xbb, 0x4c, + 0xed, 0x9b, 0x67, 0x41, 0x3c, 0x3a, 0x74, 0x16, 0x6e, 0x8e, 0x57, 0x91, 0xe7, 0x3e, 0x34, 0x7b, + 0xa0, 0x3c, 0x44, 0x01, 0x44, 0xb4, 0xae, 0xef, 0x69, 0xfb, 0xdb, 0xed, 0x5b, 0xee, 0xf5, 0x33, + 0x70, 0xef, 0x09, 0xef, 0x8e, 0xf1, 0x28, 0xb5, 0x4b, 0x9e, 0xc2, 0x9a, 0x27, 0xa0, 0xc6, 0xe9, + 0x84, 0x71, 0x9c, 0x44, 0xfe, 0x18, 0x51, 0x4c, 0x60, 0x7d, 0x43, 0x84, 0x7b, 0xd7, 0x95, 0xa5, + 0xbb, 0x79, 0xe9, 0x6e, 0x4f, 0xb5, 0xa6, 0xe3, 0x64, 0x11, 0x2e, 0x53, 0x7b, 0x57, 0x66, 0xb7, + 0x82, 0x77, 0x1e, 0xfe, 0x61, 0x6b, 0xde, 0x8d, 0xdc, 0x7a, 0x5f, 0x18, 0x4d, 0x0c, 0x6e, 0x4e, + 0x92, 0x01, 0x49, 0x60, 0x81, 0xc8, 0x78, 0x16, 0xd1, 0x07, 0x8a, 0xe8, 0x1d, 0x49, 0xb4, 0x1a, + 0x40, 0x32, 0xd5, 0x16, 0x66, 0x45, 0x85, 0x40, 0x2d, 0x0e, 0x66, 0x7e, 0x38, 0x22, 0xe1, 0xa9, + 0x0f, 0x29, 0x3e, 0xe1, 0xf5, 0xb7, 0x5e, 0xb0, 0xa4, 0x15, 0xbc, 0x24, 0xda, 0x89, 0x83, 0x59, + 0x37, 0x33, 0xf6, 0x32, 0x9b, 0xd9, 0x07, 0x65, 0x86, 0xa3, 0x04, 0xd1, 0x7a, 0x79, 0x4f, 0xdb, + 0xaf, 0x76, 0x5a, 0x7f, 0xa7, 0xf6, 0x41, 0x84, 0xf9, 0x70, 0x32, 0x70, 0x43, 0x12, 0x37, 0xe5, + 0x34, 0xd4, 0xbf, 0x03, 0x06, 0x4f, 0x95, 0x20, 0xee, 0x86, 0xe1, 0x5d, 0x08, 0x29, 0x62, 0xcc, + 0x53, 0x01, 0x0e, 0x8d, 0x1f, 0xcf, 0xed, 0x92, 0xf3, 0xa7, 0x26, 0x34, 0xf2, 0xed, 0x18, 0xbe, + 0x61, 0x1a, 0x59, 0x56, 0xba, 0xf1, 0xff, 0x54, 0xfa, 0xab, 0x06, 0xde, 0x3b, 0x62, 0xd1, 0xf1, + 0x64, 0x10, 0x63, 0x2e, 0x4b, 0x39, 0xc2, 0x6c, 0x80, 0x86, 0xc1, 0x14, 0x93, 0x09, 0x35, 0x7b, + 0xa0, 0x82, 0xa6, 0x18, 0xa2, 0x24, 0x44, 0xa2, 0xe8, 0xed, 0xf6, 0xfe, 0xb3, 0x12, 0xff, 0x4a, + 0xf9, 0x7b, 0x0b, 0xa4, 0xf9, 0x35, 0xd8, 0x62, 0x82, 0x81, 0xab, 0xfa, 0x5f, 0x2a, 0xf3, 0x65, + 0x0c, 0x95, 0xfc, 0x4f, 0x06, 0xd8, 0x96, 0x39, 0x1f, 0xf3, 0x80, 0x23, 0x73, 0x17, 0xe8, 0x8b, + 0xd9, 0x94, 0xe7, 0xa9, 0xad, 0xf7, 0x7b, 0x9e, 0x8e, 0xe1, 0xd3, 0x36, 0x4b, 0x7f, 0x5d, 0x9b, + 0xb5, 0xf1, 0xda, 0x36, 0xcb, 0x78, 0x05, 0x9b, 0x75, 0x07, 0xec, 0x9c, 0x50, 0xf2, 0x03, 0x4a, + 0xfc, 0x21, 0xc2, 0xd1, 0x50, 0xae, 0xaf, 0xd1, 0xa9, 0x5f, 0xa6, 0xf6, 0xdb, 0x32, 0xca, 0x95, + 0xc7, 0x8e, 0x57, 0x95, 0xf7, 0x7b, 0xe2, 0x6a, 0x86, 0x60, 0x7b, 0x14, 0x30, 0xee, 0x2b, 0xe5, + 0x97, 0x5f, 0x48, 0xf9, 0x0d, 0x95, 0xae, 0x29, 0x89, 0x0a, 0x81, 0x1c, 0x0f, 0x64, 0x37, 0xe9, + 0xa7, 0xb4, 0xf0, 0xb3, 0x0e, 0x6e, 0x74, 0x49, 0xc2, 0x50, 0xc2, 0x26, 0x4c, 0xca, 0xa1, 0x03, + 0xb6, 0x16, 0xdf, 0x08, 0x25, 0xde, 0xc6, 0x5a, 0x77, 0xbe, 0xc9, 0x3d, 0x3a, 0x95, 0x8c, 0xef, + 0x41, 0xd6, 0x84, 0x25, 0xcc, 0xec, 0x01, 0x83, 0x12, 0xc2, 0x95, 0x5e, 0x3e, 0x5e, 0x4f, 0x7d, + 0xf9, 0xad, 0xc9, 0x52, 0x3f, 0x42, 0xf4, 0x74, 0x84, 0x3c, 0x42, 0xb8, 0x5a, 0x5c, 0x81, 0x36, + 0x77, 0xb3, 0xe5, 0x17, 0xfd, 0xcb, 0xe4, 0x60, 0x78, 0xea, 0x66, 0x86, 0x60, 0x67, 0xf1, 0x19, + 0xf4, 0x19, 0xca, 0x67, 0xf8, 0x61, 0xb1, 0x21, 0x22, 0x53, 0x57, 0x2e, 0xc3, 0x77, 0xb9, 0xf3, + 0x31, 0xe2, 0xc5, 0x21, 0x5c, 0x09, 0xe2, 0x78, 0xd5, 0x69, 0xc1, 0x4f, 0xf5, 0xe7, 0x89, 0x0e, + 0x2a, 0xf9, 0x66, 0xfe, 0xd7, 0x77, 0xd9, 0x97, 0xa0, 0x12, 0x0e, 0x03, 0x9c, 0x64, 0x68, 0x5d, + 0xa0, 0xad, 0x79, 0x6a, 0x6f, 0x76, 0x33, 0x9b, 0x00, 0xd7, 0x14, 0x58, 0x39, 0x39, 0xde, 0xa6, + 0x38, 0xf6, 0x33, 0xdd, 0x56, 0xe4, 0x0c, 0xfd, 0x96, 0x5a, 0x8d, 0xe7, 0x95, 0x83, 0x50, 0x6f, + 0x46, 0x23, 0xef, 0xad, 0x25, 0x4d, 0x1e, 0xd0, 0xf1, 0x36, 0xe5, 0xb1, 0x55, 0xa0, 0x69, 0xab, + 0x9e, 0xbe, 0x24, 0x4d, 0x7b, 0x8d, 0xa6, 0xbd, 0xa0, 0x69, 0x1f, 0x56, 0xb3, 0xd6, 0x3e, 0x3c, + 0xb7, 0x4b, 0x7f, 0x9d, 0xdb, 0x9a, 0xf3, 0xbb, 0x06, 0xca, 0x12, 0x65, 0x46, 0x60, 0x47, 0xbc, + 0x66, 0x61, 0x2e, 0x7d, 0xed, 0xfa, 0xc1, 0x1e, 0x0b, 0x67, 0x95, 0xc2, 0xfb, 0x4a, 0xf8, 0x6a, + 0xb8, 0x57, 0x02, 0x39, 0x5e, 0x95, 0x15, 0x7c, 0xd7, 0x15, 0xa4, 0xbf, 0x0a, 0x05, 0x65, 0xe5, + 0x75, 0xee, 0x3f, 0x9a, 0x5b, 0xda, 0xe3, 0xb9, 0xa5, 0x3d, 0x99, 0x5b, 0xda, 0x83, 0x0b, 0xab, + 0xf4, 0xf8, 0xc2, 0x2a, 0xfd, 0x76, 0x61, 0x95, 0xbe, 0xff, 0xec, 0xda, 0xf7, 0xf8, 0xbf, 0xfe, + 0x6c, 0x1d, 0x94, 0x45, 0x66, 0xb7, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x19, 0xb9, 0x6e, 0x92, + 0xda, 0x0a, 0x00, 0x00, +} + +func (this *Evidence) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Evidence) + if !ok { + that2, ok := that.(Evidence) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClientID != that1.ClientID { + return false + } + if this.ChainID != that1.ChainID { + return false + } + if !this.Header1.Equal(&that1.Header1) { + return false + } + if !this.Header2.Equal(&that1.Header2) { + return false + } + return true +} +func (this *Header) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Header) + if !ok { + that2, ok := that.(Header) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.SignedHeader.Equal(&that1.SignedHeader) { + return false + } + if !this.ValidatorSet.Equal(that1.ValidatorSet) { + return false + } + return true +} +func (m *MsgCreateClient) 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 *MsgCreateClient) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateClient) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x32 + } + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxClockDrift, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxClockDrift):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintTypes(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x2a + n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingPeriod):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintTypes(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x22 + n3, err3 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.TrustingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.TrustingPeriod):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintTypes(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x1a + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateClient) 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 *MsgUpdateClient) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateClient) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitClientMisbehaviour) 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 *MsgSubmitClientMisbehaviour) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitClientMisbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Submitter) > 0 { + i -= len(m.Submitter) + copy(dAtA[i:], m.Submitter) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Submitter))) + i-- + dAtA[i] = 0x12 + } + if m.Evidence != nil { + { + size, err := m.Evidence.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ClientState) 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 *ClientState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.LastHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if m.FrozenHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.FrozenHeight)) + i-- + dAtA[i] = 0x28 + } + n8, err8 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxClockDrift, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxClockDrift):]) + if err8 != nil { + return 0, err8 + } + i -= n8 + i = encodeVarintTypes(dAtA, i, uint64(n8)) + i-- + dAtA[i] = 0x22 + n9, err9 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingPeriod):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintTypes(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x1a + n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.TrustingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.TrustingPeriod):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintTypes(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0x12 + if len(m.ID) > 0 { + i -= len(m.ID) + copy(dAtA[i:], m.ID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ConsensusState) 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 *ConsensusState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ValidatorSet != nil { + { + size, err := m.ValidatorSet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } + { + size, err := m.Root.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + n13, err13 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err13 != nil { + return 0, err13 + } + i -= n13 + i = encodeVarintTypes(dAtA, i, uint64(n13)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Evidence) 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 *Evidence) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Evidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Header2.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.Header1.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainID))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Header) 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 *Header) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ValidatorSet != nil { + { + size, err := m.ValidatorSet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.SignedHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateClient) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Header.Size() + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.TrustingPeriod) + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingPeriod) + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxClockDrift) + n += 1 + l + sovTypes(uint64(l)) + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgUpdateClient) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Header.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgSubmitClientMisbehaviour) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Evidence != nil { + l = m.Evidence.Size() + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Submitter) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *ClientState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.TrustingPeriod) + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingPeriod) + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxClockDrift) + n += 1 + l + sovTypes(uint64(l)) + if m.FrozenHeight != 0 { + n += 1 + sovTypes(uint64(m.FrozenHeight)) + } + l = m.LastHeader.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *ConsensusState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovTypes(uint64(l)) + l = m.Root.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.Height != 0 { + n += 1 + sovTypes(uint64(m.Height)) + } + if m.ValidatorSet != nil { + l = m.ValidatorSet.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *Evidence) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Header1.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.Header2.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *Header) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.SignedHeader.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.ValidatorSet != nil { + l = m.ValidatorSet.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateClient) 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 ErrIntOverflowTypes + } + 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: MsgCreateClient: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateClient: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrustingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.TrustingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.UnbondingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxClockDrift", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MaxClockDrift, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateClient) 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 ErrIntOverflowTypes + } + 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: MsgUpdateClient: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateClient: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitClientMisbehaviour) 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 ErrIntOverflowTypes + } + 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: MsgSubmitClientMisbehaviour: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitClientMisbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Evidence", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Evidence == nil { + m.Evidence = &Evidence{} + } + if err := m.Evidence.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Submitter = append(m.Submitter[:0], dAtA[iNdEx:postIndex]...) + if m.Submitter == nil { + m.Submitter = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClientState) 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 ErrIntOverflowTypes + } + 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: ClientState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClientState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrustingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.TrustingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.UnbondingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxClockDrift", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MaxClockDrift, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FrozenHeight", wireType) + } + m.FrozenHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FrozenHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LastHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConsensusState) 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 ErrIntOverflowTypes + } + 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: ConsensusState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsensusState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Root", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Root.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSet", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ValidatorSet == nil { + m.ValidatorSet = &types1.ValidatorSet{} + } + if err := m.ValidatorSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Evidence) 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 ErrIntOverflowTypes + } + 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: Evidence: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Evidence: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header1", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Header1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header2", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Header2.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Header) 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 ErrIntOverflowTypes + } + 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: Header: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SignedHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SignedHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSet", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ValidatorSet == nil { + m.ValidatorSet = &types1.ValidatorSet{} + } + if err := m.ValidatorSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibc/07-tendermint/types/types.proto b/x/ibc/07-tendermint/types/types.proto new file mode 100644 index 000000000000..90c98ae449bc --- /dev/null +++ b/x/ibc/07-tendermint/types/types.proto @@ -0,0 +1,169 @@ +syntax = "proto3"; +package cosmos_sdk.x.ibc.tendermint.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "third_party/proto/tendermint/proto/types/types.proto"; +import "third_party/proto/tendermint/proto/types/validator.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "x/ibc/23-commitment/types/types.proto"; + +// MsgCreateClient defines a message to create a tendermint client state. +message MsgCreateClient { + option (gogoproto.goproto_getters) = false; + + string client_id = 1 [ + (gogoproto.customname) = "ClientID", + (gogoproto.moretags) = "yaml:\"client_id\"" + ]; + Header header = 2 [ + (gogoproto.nullable) = false + ]; + google.protobuf.Duration trusting_period = 3 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "yaml:\"trusting_period\"" + ]; + google.protobuf.Duration unbonding_period = 4 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "yaml:\"unbonding_period\"" + ]; + google.protobuf.Duration max_clock_drift = 5 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "yaml:\"max_clock_drift\"" + ]; + bytes signer = 6 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// MsgCreateClient defines an sdk.Msg to update a tendermint client state to +// the given header. +message MsgUpdateClient { + option (gogoproto.goproto_getters) = false; + + string client_id = 1 [ + (gogoproto.customname) = "ClientID", + (gogoproto.moretags) = "yaml:\"client_id\"" + ]; + Header header = 2 [ + (gogoproto.nullable) = false + ]; + bytes signer = 3 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// MsgSubmitClientMisbehaviour defines an sdk.Msg type that submits Evidence for +// light client misbehaviour. +message MsgSubmitClientMisbehaviour { + option (gogoproto.goproto_getters) = false; + + Evidence evidence = 1; + bytes submitter = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// ClientState from Tendermint tracks the current validator set, latest height, +// and a possible frozen height. +message ClientState { + option (gogoproto.goproto_getters) = false; + // client id + string id = 1 [(gogoproto.customname) = "ID"]; + // duration of the period since the LastestTimestamp during which the submitted + // headers are valid for upgrade + google.protobuf.Duration trusting_period = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "yaml:\"trusting_period\"" + ]; + // duration of the staking unbonding period + google.protobuf.Duration unbonding_period = 3 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "yaml:\"unbonding_period\"" + ]; + // defines how much new (untrusted) header's Time can drift into the future. + google.protobuf.Duration max_clock_drift = 4 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "yaml:\"max_clock_drift\"" + ]; + // Block height when the client was frozen due to a misbehaviour + uint64 frozen_height = 5 [ + (gogoproto.moretags) = "yaml:\"frozen_height\"" + ]; + // Last Header that was stored by the client + Header last_header = 6 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"last_header\"" + ]; +} + +// ConsensusState defines the consensus state from Tendermint. +message ConsensusState { + option (gogoproto.goproto_getters) = false; + + // timestamp that corresponds to the block height in which the ConsensusState + // was stored. + google.protobuf.Timestamp timestamp = 1 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; + // commitment root (i.e app hash) + cosmos_sdk.x.ibc.commitment.v1.MerkleRoot root = 2 [ + (gogoproto.nullable) = false + ]; + // height at which the consensus state was stored. + uint64 height = 3; + .tendermint.proto.types.ValidatorSet validator_set = 4 [ + (gogoproto.moretags) = "yaml:\"validator_set\"" + ]; +} + +// Evidence defines two distinct headers at the same hight, chain id and client. +// It is used to verify and penalize light client misbehaviour. +message Evidence { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + string client_id = 1 [ + (gogoproto.customname) = "ClientID", + (gogoproto.moretags) = "yaml:\"client_id\"" + ]; + string chain_id = 2 [ + (gogoproto.customname) = "ChainID", + (gogoproto.moretags) = "yaml:\"chain_id\"" + ]; + Header header_1 = 3 [ + (gogoproto.customname) = "Header1", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"header_1\"" + ]; + Header header_2 = 4 [ + (gogoproto.customname) = "Header2", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"header_2\"" + ]; +} + +// Header defines a tendermint signed header and the validator set that +// corresponds to the header. +message Header { + option (gogoproto.equal) = true; + + .tendermint.proto.types.SignedHeader signed_header = 1 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"signed_header\"" + ]; + + .tendermint.proto.types.ValidatorSet validator_set = 2 [ + (gogoproto.moretags) = "yaml:\"validator_set\"" + ]; +} \ No newline at end of file diff --git a/x/ibc/07-tendermint/update.go b/x/ibc/07-tendermint/update.go index cee63ee6d9cd..05bf6b627880 100644 --- a/x/ibc/07-tendermint/update.go +++ b/x/ibc/07-tendermint/update.go @@ -5,6 +5,7 @@ import ( "time" lite "github.com/tendermint/tendermint/lite2" + tmtypes "github.com/tendermint/tendermint/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" @@ -54,13 +55,18 @@ func CheckValidityAndUpdateState( func checkValidity( clientState types.ClientState, header types.Header, currentTimestamp time.Time, ) error { + var ( + tmLastSignedHeader, tmSignedHeader *tmtypes.SignedHeader + tmLastValidatorSet, tmValidatorSet *tmtypes.ValidatorSet + ) + // assert trusting period has not yet passed if currentTimestamp.Sub(clientState.GetLatestTimestamp()) >= clientState.TrustingPeriod { return errors.New("trusting period since last client timestamp already passed") } // assert header timestamp is not past the trusting period - if header.Time.Sub(clientState.GetLatestTimestamp()) >= clientState.TrustingPeriod { + if header.SignedHeader.Header.GetTime().Sub(clientState.GetLatestTimestamp()) >= clientState.TrustingPeriod { return sdkerrors.Wrap( clienttypes.ErrInvalidHeader, "header blocktime is outside trusting period from last client timestamp", @@ -68,11 +74,11 @@ func checkValidity( } // assert header timestamp is past latest clientstate timestamp - if header.Time.Unix() <= clientState.GetLatestTimestamp().Unix() { + if header.SignedHeader.Header.GetTime().Unix() <= clientState.GetLatestTimestamp().Unix() { return sdkerrors.Wrapf( clienttypes.ErrInvalidHeader, "header blocktime ≤ latest client state block time (%s ≤ %s)", - header.Time.String(), clientState.GetLatestTimestamp().String(), + header.SignedHeader.Header.GetTime().String(), clientState.GetLatestTimestamp().String(), ) } @@ -84,12 +90,33 @@ func checkValidity( ) } + if err := tmLastSignedHeader.FromProto(&clientState.LastHeader.SignedHeader); err != nil { + return err + } + + if err := tmLastValidatorSet.FromProto(clientState.LastHeader.ValidatorSet); err != nil { + return err + } + + if err := tmSignedHeader.FromProto(&header.SignedHeader); err != nil { + return err + } + + if err := tmValidatorSet.FromProto(header.ValidatorSet); err != nil { + return err + } + // Verify next header with the last header's validatorset as trusted validatorset err := lite.Verify( - clientState.GetChainID(), &clientState.LastHeader.SignedHeader, - clientState.LastHeader.ValidatorSet, &header.SignedHeader, header.ValidatorSet, - clientState.TrustingPeriod, currentTimestamp, clientState.MaxClockDrift, lite.DefaultTrustLevel, - ) + clientState.GetChainID(), + tmLastSignedHeader, + tmLastValidatorSet, + tmSignedHeader, + tmValidatorSet, + clientState.TrustingPeriod, + currentTimestamp, + clientState.MaxClockDrift, + lite.DefaultTrustLevel) if err != nil { return sdkerrors.Wrap(clienttypes.ErrInvalidHeader, err.Error()) } @@ -100,9 +127,9 @@ func checkValidity( func update(clientState types.ClientState, header types.Header) (types.ClientState, types.ConsensusState) { clientState.LastHeader = header consensusState := types.ConsensusState{ - Height: uint64(header.Height), - Timestamp: header.Time, - Root: commitmenttypes.NewMerkleRoot(header.AppHash), + Height: uint64(header.SignedHeader.Header.GetHeight()), + Timestamp: header.SignedHeader.Header.GetTime(), + Root: commitmenttypes.NewMerkleRoot(header.SignedHeader.Header.GetAppHash()), ValidatorSet: header.ValidatorSet, } diff --git a/x/ibc/07-tendermint/update_test.go b/x/ibc/07-tendermint/update_test.go index 512f1de6cf16..86c069df0789 100644 --- a/x/ibc/07-tendermint/update_test.go +++ b/x/ibc/07-tendermint/update_test.go @@ -145,9 +145,9 @@ func (suite *TendermintTestSuite) TestCheckValidity() { tc.setup() expectedConsensus := ibctmtypes.ConsensusState{ - Height: uint64(newHeader.Height), - Timestamp: newHeader.Time, - Root: commitmenttypes.NewMerkleRoot(newHeader.AppHash), + Height: newHeader.GetHeight(), + Timestamp: newHeader.GetTime(), + Root: commitmenttypes.NewMerkleRoot(newHeader.SignedHeader.Header.AppHash), ValidatorSet: newHeader.ValidatorSet, } diff --git a/x/ibc/09-localhost/types/client_state.go b/x/ibc/09-localhost/types/client_state.go index b325d30f6945..8599e5d1f4b6 100644 --- a/x/ibc/09-localhost/types/client_state.go +++ b/x/ibc/09-localhost/types/client_state.go @@ -21,23 +21,23 @@ import ( ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) -var _ clientexported.ClientState = ClientState{} +var _ clientexported.ClientState = (*ClientState)(nil) // ClientState requires (read-only) access to keys outside the client prefix. -type ClientState struct { - store sdk.KVStore - ID string `json:"id" yaml:"id"` - ChainID string `json:"chain_id" yaml:"chain_id"` - Height int64 `json:"height" yaml:"height"` -} +// type ClientState struct { +// store sdk.KVStore +// ID string `json:"id" yaml:"id"` +// ChainID string `json:"chain_id" yaml:"chain_id"` +// Height int64 `json:"height" yaml:"height"` +// } // NewClientState creates a new ClientState instance func NewClientState(store sdk.KVStore, chainID string, height int64) ClientState { return ClientState{ - store: store, + // store: store, ID: clientexported.Localhost.String(), ChainID: chainID, - Height: height, + Height: uint64(height), } } @@ -58,7 +58,7 @@ func (cs ClientState) ClientType() clientexported.ClientType { // GetLatestHeight returns the latest height stored. func (cs ClientState) GetLatestHeight() uint64 { - return uint64(cs.Height) + return cs.Height } // IsFrozen returns false. diff --git a/x/ibc/09-localhost/types/client_state_test.go b/x/ibc/09-localhost/types/client_state_test.go index ed3063a97e81..db557ff6ed41 100644 --- a/x/ibc/09-localhost/types/client_state_test.go +++ b/x/ibc/09-localhost/types/client_state_test.go @@ -2,11 +2,10 @@ package types_test import ( connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" - connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel" - channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" + ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) const ( @@ -96,7 +95,7 @@ func (suite *LocalhostTestSuite) TestVerifyClientConsensusState() { func (suite *LocalhostTestSuite) TestVerifyConnectionState() { counterparty := connection.NewCounterparty("clientB", testConnectionID, commitmenttypes.NewMerklePrefix([]byte("ibc"))) - conn := connection.NewConnectionEnd(connectionexported.OPEN, testConnectionID, "clientA", counterparty, []string{"1.0.0"}) + conn := connection.NewConnectionEnd(ibctypes.OPEN, testConnectionID, "clientA", counterparty, []string{"1.0.0"}) testCases := []struct { name string @@ -140,7 +139,7 @@ func (suite *LocalhostTestSuite) TestVerifyConnectionState() { func (suite *LocalhostTestSuite) TestVerifyChannelState() { counterparty := channel.NewCounterparty(testPortID, testChannelID) - ch := channel.NewChannel(channelexported.OPEN, channelexported.ORDERED, counterparty, []string{testConnectionID}, "1.0.0") + ch := channel.NewChannel(ibctypes.OPEN, ibctypes.ORDERED, counterparty, []string{testConnectionID}, "1.0.0") testCases := []struct { name string diff --git a/x/ibc/09-localhost/types/codec.go b/x/ibc/09-localhost/types/codec.go index 67a9431fa589..88691cc3ab8f 100644 --- a/x/ibc/09-localhost/types/codec.go +++ b/x/ibc/09-localhost/types/codec.go @@ -9,17 +9,27 @@ const ( SubModuleName = "localhost" ) -// SubModuleCdc defines the IBC localhost client codec. -var SubModuleCdc *codec.Codec - -// RegisterCodec registers the localhost types +// RegisterCodec registers the necessary x/ibc/09-localhost interfaces and concrete types +// on the provided Amino codec. These types are used for Amino JSON serialization. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(ClientState{}, "ibc/client/localhost/ClientState", nil) cdc.RegisterConcrete(MsgCreateClient{}, "ibc/client/localhost/MsgCreateClient", nil) - SetSubModuleCodec(cdc) } -// SetSubModuleCodec sets the ibc localhost client codec -func SetSubModuleCodec(cdc *codec.Codec) { - SubModuleCdc = cdc +var ( + amino = codec.New() + + // SubModuleCdc references the global x/ibc/07-tendermint module codec. Note, the codec + // should ONLY be used in certain instances of tests and for JSON encoding as Amino + // is still used for that purpose. + // + // The actual codec used for serialization should be provided to x/ibc/07-tendermint and + // defined at the application level. + SubModuleCdc = codec.NewHybridCodec(amino) +) + +func init() { + RegisterCodec(amino) + codec.RegisterCrypto(amino) + amino.Seal() } diff --git a/x/ibc/09-localhost/types/msgs.go b/x/ibc/09-localhost/types/msgs.go index 508751a93ebf..904208babfe7 100644 --- a/x/ibc/09-localhost/types/msgs.go +++ b/x/ibc/09-localhost/types/msgs.go @@ -16,11 +16,6 @@ var ( _ clientexported.MsgCreateClient = MsgCreateClient{} ) -// MsgCreateClient defines a message to create an IBC client -type MsgCreateClient struct { - Signer sdk.AccAddress `json:"address" yaml:"address"` -} - // NewMsgCreateClient creates a new MsgCreateClient instance func NewMsgCreateClient(signer sdk.AccAddress) MsgCreateClient { return MsgCreateClient{ diff --git a/x/ibc/09-localhost/types/types.pb.go b/x/ibc/09-localhost/types/types.pb.go new file mode 100644 index 000000000000..247d602c9186 --- /dev/null +++ b/x/ibc/09-localhost/types/types.pb.go @@ -0,0 +1,571 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/ibc/09-localhost/types/types.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgCreateClient defines a message to create a localhost client state. +type MsgCreateClient struct { + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` +} + +func (m *MsgCreateClient) Reset() { *m = MsgCreateClient{} } +func (m *MsgCreateClient) String() string { return proto.CompactTextString(m) } +func (*MsgCreateClient) ProtoMessage() {} +func (*MsgCreateClient) Descriptor() ([]byte, []int) { + return fileDescriptor_a8da40ad8942fbdc, []int{0} +} +func (m *MsgCreateClient) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateClient) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateClient.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 *MsgCreateClient) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateClient.Merge(m, src) +} +func (m *MsgCreateClient) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateClient) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateClient.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateClient proto.InternalMessageInfo + +// ClientState defines a loopback (localhost) client. It requires (read-only) +// access to keys outside the client prefix. +type ClientState struct { + // client id + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // self chain ID + ChainID string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` + // self latest block height + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *ClientState) Reset() { *m = ClientState{} } +func (m *ClientState) String() string { return proto.CompactTextString(m) } +func (*ClientState) ProtoMessage() {} +func (*ClientState) Descriptor() ([]byte, []int) { + return fileDescriptor_a8da40ad8942fbdc, []int{1} +} +func (m *ClientState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClientState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClientState.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 *ClientState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientState.Merge(m, src) +} +func (m *ClientState) XXX_Size() int { + return m.Size() +} +func (m *ClientState) XXX_DiscardUnknown() { + xxx_messageInfo_ClientState.DiscardUnknown(m) +} + +var xxx_messageInfo_ClientState proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateClient)(nil), "cosmos_sdk.x.ibc.localhost.v1.MsgCreateClient") + proto.RegisterType((*ClientState)(nil), "cosmos_sdk.x.ibc.localhost.v1.ClientState") +} + +func init() { + proto.RegisterFile("x/ibc/09-localhost/types/types.proto", fileDescriptor_a8da40ad8942fbdc) +} + +var fileDescriptor_a8da40ad8942fbdc = []byte{ + // 326 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xa9, 0xd0, 0xcf, 0x4c, + 0x4a, 0xd6, 0x37, 0xb0, 0xd4, 0xcd, 0xc9, 0x4f, 0x4e, 0xcc, 0xc9, 0xc8, 0x2f, 0x2e, 0xd1, 0x2f, + 0xa9, 0x2c, 0x48, 0x2d, 0x86, 0x90, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xb2, 0xc9, 0xf9, + 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0xc5, 0x29, 0xd9, 0x7a, 0x15, 0x7a, 0x99, 0x49, 0xc9, 0x7a, 0x70, + 0xd5, 0x7a, 0x65, 0x86, 0x52, 0x6a, 0x25, 0x19, 0x99, 0x45, 0x29, 0xf1, 0x05, 0x89, 0x45, 0x25, + 0x95, 0xfa, 0x60, 0x1d, 0xfa, 0xe9, 0xf9, 0xe9, 0xf9, 0x08, 0x16, 0xc4, 0x18, 0xa5, 0x24, 0x2e, + 0x7e, 0xdf, 0xe2, 0x74, 0xe7, 0xa2, 0xd4, 0xc4, 0x92, 0x54, 0xe7, 0x9c, 0xcc, 0xd4, 0xbc, 0x12, + 0x21, 0x4f, 0x2e, 0xb6, 0xe2, 0xcc, 0xf4, 0xbc, 0xd4, 0x22, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x1e, + 0x27, 0xc3, 0x5f, 0xf7, 0xe4, 0x75, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, + 0xf5, 0x21, 0x16, 0x43, 0x29, 0xdd, 0xe2, 0x94, 0x6c, 0xa8, 0xbb, 0x1c, 0x93, 0x93, 0x1d, 0x53, + 0x52, 0x8a, 0x52, 0x8b, 0x8b, 0x83, 0xa0, 0x06, 0x58, 0xb1, 0x74, 0x2c, 0x90, 0x67, 0x50, 0xaa, + 0xe3, 0xe2, 0x86, 0x18, 0x1d, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0x24, 0xc6, 0xc5, 0x94, 0x99, 0x02, + 0x36, 0x9b, 0xd3, 0x89, 0xed, 0xd1, 0x3d, 0x79, 0x26, 0x4f, 0x97, 0x20, 0xa6, 0xcc, 0x14, 0x21, + 0x4b, 0x2e, 0x8e, 0xe4, 0x8c, 0xc4, 0xcc, 0xbc, 0xf8, 0xcc, 0x14, 0x09, 0x26, 0xb0, 0xac, 0xdc, + 0xa3, 0x7b, 0xf2, 0xec, 0xce, 0x20, 0x31, 0x4f, 0x97, 0x4f, 0xf7, 0xe4, 0xf9, 0x2b, 0x13, 0x73, + 0x73, 0xac, 0x94, 0x60, 0x8a, 0x94, 0x82, 0xd8, 0xc1, 0x4c, 0xcf, 0x14, 0x21, 0x31, 0x2e, 0xb6, + 0x8c, 0xd4, 0xcc, 0xf4, 0x8c, 0x12, 0x09, 0x66, 0x05, 0x46, 0x0d, 0x96, 0x20, 0x28, 0x0f, 0x62, + 0xbf, 0x93, 0xff, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, + 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x99, 0xe2, 0xf5, + 0x16, 0xae, 0x78, 0x48, 0x62, 0x03, 0x87, 0x9d, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x72, 0xc3, + 0xd9, 0x50, 0xaa, 0x01, 0x00, 0x00, +} + +func (m *MsgCreateClient) 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 *MsgCreateClient) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateClient) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ClientState) 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 *ClientState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } + if len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainID))) + i-- + dAtA[i] = 0x12 + } + if len(m.ID) > 0 { + i -= len(m.ID) + copy(dAtA[i:], m.ID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateClient) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *ClientState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovTypes(uint64(m.Height)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateClient) 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 ErrIntOverflowTypes + } + 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: MsgCreateClient: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateClient: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = append(m.Signer[:0], dAtA[iNdEx:postIndex]...) + if m.Signer == nil { + m.Signer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClientState) 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 ErrIntOverflowTypes + } + 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: ClientState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClientState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibc/09-localhost/types/types.proto b/x/ibc/09-localhost/types/types.proto new file mode 100644 index 000000000000..8f8bf51f0d55 --- /dev/null +++ b/x/ibc/09-localhost/types/types.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package cosmos_sdk.x.ibc.localhost.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"; + +import "third_party/proto/gogoproto/gogo.proto"; + +// MsgCreateClient defines a message to create a localhost client state. +message MsgCreateClient { + option (gogoproto.goproto_getters) = false; + + bytes signer = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; +} + +// ClientState defines a loopback (localhost) client. It requires (read-only) +// access to keys outside the client prefix. +message ClientState { + option (gogoproto.goproto_getters) = false; + // client id + string id = 1 [(gogoproto.customname) = "ID"]; + // self chain ID + string chain_id = 2 [ + (gogoproto.customname) = "ChainID", + (gogoproto.moretags) = "yaml:\"chain_id\"" + ]; + // self latest block height + uint64 height = 3; +} \ No newline at end of file diff --git a/x/ibc/20-transfer/handler.go b/x/ibc/20-transfer/handler.go index ee9f8582fb9d..88332020bcbb 100644 --- a/x/ibc/20-transfer/handler.go +++ b/x/ibc/20-transfer/handler.go @@ -20,7 +20,7 @@ func NewHandler(k Keeper) sdk.Handler { // See createOutgoingPacket in spec:https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#packet-relay func handleMsgTransfer(ctx sdk.Context, k Keeper, msg MsgTransfer) (*sdk.Result, error) { if err := k.SendTransfer( - ctx, msg.SourcePort, msg.SourceChannel, msg.DestHeight, msg.Amount, msg.Sender, msg.Receiver, + ctx, msg.SourcePort, msg.SourceChannel, msg.DestinationHeight, msg.Amount, msg.Sender, msg.Receiver, ); err != nil { return nil, err } diff --git a/x/ibc/20-transfer/handler_test.go b/x/ibc/20-transfer/handler_test.go index 8736d5614ec7..eca3e5f82d85 100644 --- a/x/ibc/20-transfer/handler_test.go +++ b/x/ibc/20-transfer/handler_test.go @@ -15,9 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/bank" - connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" - channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" transfer "github.com/cosmos/cosmos-sdk/x/ibc/20-transfer" @@ -87,8 +85,8 @@ func (suite *HandlerTestSuite) TestHandleMsgTransfer() { // Setup channel from A to B suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channelexported.OPEN, channelexported.ORDERED, testConnection) + suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnection) res, err = handler(ctx, msg) suite.Require().Error(err) @@ -160,7 +158,7 @@ func NewTestChain(clientID string) *TestChain { // Creates simple context for testing purposes func (chain *TestChain) GetContext() sdk.Context { - return chain.App.BaseApp.NewContext(false, tmproto.Header{ChainID: chain.Header.ChainID, Height: chain.Header.Height}) + return chain.App.BaseApp.NewContext(false, tmproto.Header{ChainID: chain.Header.SignedHeader.Header.ChainID, Height: chain.Header.SignedHeader.Header.GetHeight()}) } // createClient will create a client for clientChain on targetChain @@ -169,7 +167,7 @@ func (chain *TestChain) CreateClient(client *TestChain) error { // Commit and create a new block on appTarget to get a fresh CommitID client.App.Commit() commitID := client.App.LastCommitID() - client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.Height, Time: client.Header.Time}}) + client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.SignedHeader.Header.GetHeight(), Time: client.Header.GetTime()}}) // Set HistoricalInfo on client chain after Commit ctxClient := client.GetContext() @@ -185,7 +183,7 @@ func (chain *TestChain) CreateClient(client *TestChain) error { }, Valset: validators, } - client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.Height, histInfo) + client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.SignedHeader.Header.GetHeight(), histInfo) // Create target ctx ctxTarget := chain.GetContext() @@ -231,7 +229,7 @@ func (chain *TestChain) updateClient(client *TestChain) { commitID := client.App.LastCommitID() client.Header = nextHeader(client) - client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.Height, Time: client.Header.Time}}) + client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.SignedHeader.Header.GetHeight(), Time: client.Header.GetTime()}}) // Set HistoricalInfo on client chain after Commit ctxClient := client.GetContext() @@ -247,17 +245,22 @@ func (chain *TestChain) updateClient(client *TestChain) { }, Valset: validators, } - client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.Height, histInfo) + client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.SignedHeader.Header.GetHeight(), histInfo) + + protoValset, err := client.Vals.ToProto() + if err != nil { + panic(err) + } consensusState := ibctmtypes.ConsensusState{ - Height: uint64(client.Header.Height), - Timestamp: client.Header.Time, + Height: uint64(client.Header.SignedHeader.Header.GetHeight()), + Timestamp: client.Header.GetTime(), Root: commitmenttypes.NewMerkleRoot(commitID.Hash), - ValidatorSet: client.Vals, + ValidatorSet: protoValset, } chain.App.IBCKeeper.ClientKeeper.SetClientConsensusState( - ctxTarget, client.ClientID, uint64(client.Header.Height), consensusState, + ctxTarget, client.ClientID, uint64(client.Header.SignedHeader.Header.GetHeight()), consensusState, ) chain.App.IBCKeeper.ClientKeeper.SetClientState( ctxTarget, ibctmtypes.NewClientState(client.ClientID, trustingPeriod, ubdPeriod, maxClockDrift, client.Header), @@ -278,9 +281,9 @@ func (chain *TestChain) updateClient(client *TestChain) { func (chain *TestChain) createConnection( connID, counterpartyConnID, clientID, counterpartyClientID string, - state connectionexported.State, + state ibctypes.State, ) connectiontypes.ConnectionEnd { - counterparty := connectiontypes.NewCounterparty(counterpartyClientID, counterpartyConnID, chain.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix()) + counterparty := connectiontypes.NewCounterparty(counterpartyClientID, counterpartyConnID, commitmenttypes.NewMerklePrefix(chain.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes())) connection := connectiontypes.ConnectionEnd{ State: state, ClientID: clientID, @@ -295,7 +298,7 @@ func (chain *TestChain) createConnection( // nolint: unused func (chain *TestChain) createChannel( portID, channelID, counterpartyPortID, counterpartyChannelID string, - state channelexported.State, order channelexported.Order, connectionID string, + state ibctypes.State, order ibctypes.Order, connectionID string, ) channeltypes.Channel { counterparty := channeltypes.NewCounterparty(counterpartyPortID, counterpartyChannelID) channel := channeltypes.NewChannel(state, order, counterparty, @@ -307,6 +310,6 @@ func (chain *TestChain) createChannel( } func nextHeader(chain *TestChain) ibctmtypes.Header { - return ibctmtypes.CreateTestHeader(chain.Header.ChainID, chain.Header.Height+1, - chain.Header.Time.Add(time.Minute), chain.Vals, chain.Signers) + return ibctmtypes.CreateTestHeader(chain.Header.SignedHeader.Header.ChainID, chain.Header.SignedHeader.Header.GetHeight()+1, + chain.Header.GetTime().Add(time.Minute), chain.Vals, chain.Signers) } diff --git a/x/ibc/20-transfer/keeper/keeper.go b/x/ibc/20-transfer/keeper/keeper.go index 6cb3ed838f9a..739f900ba1a5 100644 --- a/x/ibc/20-transfer/keeper/keeper.go +++ b/x/ibc/20-transfer/keeper/keeper.go @@ -12,7 +12,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/capability" channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel" channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" - porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types" "github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types" ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) @@ -102,7 +101,7 @@ func (k Keeper) BindPort(ctx sdk.Context, portID string) error { store.Set([]byte(types.PortKey), []byte(portID)) cap := k.portKeeper.BindPort(ctx, portID) - return k.ClaimCapability(ctx, cap, porttypes.PortPath(portID)) + return k.ClaimCapability(ctx, cap, ibctypes.PortPath(portID)) } // GetPort returns the portID for the transfer module. Used in ExportGenesis diff --git a/x/ibc/20-transfer/keeper/keeper_test.go b/x/ibc/20-transfer/keeper/keeper_test.go index c70647ccb47a..5d9231e9e5a0 100644 --- a/x/ibc/20-transfer/keeper/keeper_test.go +++ b/x/ibc/20-transfer/keeper/keeper_test.go @@ -14,9 +14,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" - channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" "github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types" @@ -132,7 +130,7 @@ func NewTestChain(clientID string) *TestChain { // Creates simple context for testing purposes func (chain *TestChain) GetContext() sdk.Context { - return chain.App.BaseApp.NewContext(false, tmproto.Header{ChainID: chain.Header.ChainID, Height: chain.Header.Height}) + return chain.App.BaseApp.NewContext(false, tmproto.Header{ChainID: chain.Header.SignedHeader.Header.ChainID, Height: chain.Header.SignedHeader.Header.Height}) } // createClient will create a client for clientChain on targetChain @@ -141,7 +139,7 @@ func (chain *TestChain) CreateClient(client *TestChain) error { // Commit and create a new block on appTarget to get a fresh CommitID client.App.Commit() commitID := client.App.LastCommitID() - client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.Height, Time: client.Header.Time}}) + client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.SignedHeader.Header.Height, Time: client.Header.GetTime()}}) // Set HistoricalInfo on client chain after Commit ctxClient := client.GetContext() @@ -157,7 +155,7 @@ func (chain *TestChain) CreateClient(client *TestChain) error { }, Valset: validators, } - client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.Height, histInfo) + client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.SignedHeader.Header.Height, histInfo) // Create target ctx ctxTarget := chain.GetContext() @@ -203,7 +201,7 @@ func (chain *TestChain) updateClient(client *TestChain) { commitID := client.App.LastCommitID() client.Header = nextHeader(client) - client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.Height, Time: client.Header.Time}}) + client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.SignedHeader.Header.Height, Time: client.Header.GetTime()}}) // Set HistoricalInfo on client chain after Commit ctxClient := client.GetContext() @@ -219,17 +217,22 @@ func (chain *TestChain) updateClient(client *TestChain) { }, Valset: validators, } - client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.Height, histInfo) + client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.SignedHeader.Header.Height, histInfo) + + protoValset, err := client.Vals.ToProto() + if err != nil { + panic(err) + } consensusState := ibctmtypes.ConsensusState{ - Height: uint64(client.Header.Height), - Timestamp: client.Header.Time, + Height: client.Header.GetHeight(), + Timestamp: client.Header.GetTime(), Root: commitmenttypes.NewMerkleRoot(commitID.Hash), - ValidatorSet: client.Vals, + ValidatorSet: protoValset, } chain.App.IBCKeeper.ClientKeeper.SetClientConsensusState( - ctxTarget, client.ClientID, uint64(client.Header.Height), consensusState, + ctxTarget, client.ClientID, client.Header.GetHeight(), consensusState, ) chain.App.IBCKeeper.ClientKeeper.SetClientState( ctxTarget, ibctmtypes.NewClientState(client.ClientID, trustingPeriod, ubdPeriod, maxClockDrift, client.Header), @@ -250,9 +253,9 @@ func (chain *TestChain) updateClient(client *TestChain) { func (chain *TestChain) createConnection( connID, counterpartyConnID, clientID, counterpartyClientID string, - state connectionexported.State, + state ibctypes.State, ) connectiontypes.ConnectionEnd { - counterparty := connectiontypes.NewCounterparty(counterpartyClientID, counterpartyConnID, chain.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix()) + counterparty := connectiontypes.NewCounterparty(counterpartyClientID, counterpartyConnID, commitmenttypes.NewMerklePrefix(chain.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes())) connection := connectiontypes.ConnectionEnd{ State: state, ClientID: clientID, @@ -266,7 +269,7 @@ func (chain *TestChain) createConnection( func (chain *TestChain) createChannel( portID, channelID, counterpartyPortID, counterpartyChannelID string, - state channelexported.State, order channelexported.Order, connectionID string, + state ibctypes.State, order ibctypes.Order, connectionID string, ) channeltypes.Channel { counterparty := channeltypes.NewCounterparty(counterpartyPortID, counterpartyChannelID) channel := channeltypes.NewChannel(state, order, counterparty, @@ -278,6 +281,6 @@ func (chain *TestChain) createChannel( } func nextHeader(chain *TestChain) ibctmtypes.Header { - return ibctmtypes.CreateTestHeader(chain.Header.ChainID, chain.Header.Height+1, - chain.Header.Time.Add(time.Minute), chain.Vals, chain.Signers) + return ibctmtypes.CreateTestHeader(chain.Header.SignedHeader.Header.ChainID, chain.Header.SignedHeader.Header.Height+1, + chain.Header.GetTime().Add(time.Minute), chain.Vals, chain.Signers) } diff --git a/x/ibc/20-transfer/keeper/relay.go b/x/ibc/20-transfer/keeper/relay.go index b0c1e043898f..9a829bbd3981 100644 --- a/x/ibc/20-transfer/keeper/relay.go +++ b/x/ibc/20-transfer/keeper/relay.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" + channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" "github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types" ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" ) @@ -31,16 +31,16 @@ func (k Keeper) SendTransfer( ) error { sourceChannelEnd, found := k.channelKeeper.GetChannel(ctx, sourcePort, sourceChannel) if !found { - return sdkerrors.Wrap(channel.ErrChannelNotFound, sourceChannel) + return sdkerrors.Wrap(channeltypes.ErrChannelNotFound, sourceChannel) } - destinationPort := sourceChannelEnd.Counterparty.PortID - destinationChannel := sourceChannelEnd.Counterparty.ChannelID + destinationPort := sourceChannelEnd.GetCounterparty().GetPortID() + destinationChannel := sourceChannelEnd.GetCounterparty().GetChannelID() // get the next sequence sequence, found := k.channelKeeper.GetNextSequenceSend(ctx, sourcePort, sourceChannel) if !found { - return channel.ErrSequenceSendNotFound + return channeltypes.ErrSequenceSendNotFound } return k.createOutgoingPacket(ctx, sequence, sourcePort, sourceChannel, destinationPort, destinationChannel, destHeight, amount, sender, receiver) @@ -59,7 +59,7 @@ func (k Keeper) createOutgoingPacket( ) error { channelCap, ok := k.scopedKeeper.GetCapability(ctx, ibctypes.ChannelCapabilityPath(sourcePort, sourceChannel)) if !ok { - return sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, "module does not own channel capability") + return sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability") } // NOTE: // - Coins transferred from the destination chain should have their denomination @@ -127,7 +127,7 @@ func (k Keeper) createOutgoingPacket( amount, sender.String(), receiver, ) - packet := channel.NewPacket( + packet := channeltypes.NewPacket( packetData.GetBytes(), seq, sourcePort, @@ -141,7 +141,7 @@ func (k Keeper) createOutgoingPacket( return k.channelKeeper.SendPacket(ctx, channelCap, packet) } -func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channel.Packet, data types.FungibleTokenPacketData) error { +func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketData) error { // NOTE: packet data type already checked in handler.go if len(data.Amount) != 1 { @@ -190,18 +190,18 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channel.Packet, data types. return k.bankKeeper.SendCoins(ctx, escrowAddress, receiver, coins) } -func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channel.Packet, data types.FungibleTokenPacketData, ack types.FungibleTokenPacketAcknowledgement) error { +func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketData, ack types.FungibleTokenPacketAcknowledgement) error { if !ack.Success { return k.refundPacketAmount(ctx, packet, data) } return nil } -func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channel.Packet, data types.FungibleTokenPacketData) error { +func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketData) error { return k.refundPacketAmount(ctx, packet, data) } -func (k Keeper) refundPacketAmount(ctx sdk.Context, packet channel.Packet, data types.FungibleTokenPacketData) error { +func (k Keeper) refundPacketAmount(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketData) error { // NOTE: packet data type already checked in handler.go if len(data.Amount) != 1 { diff --git a/x/ibc/20-transfer/keeper/relay_test.go b/x/ibc/20-transfer/keeper/relay_test.go index 8684c5bf3123..b76a1c3bb56b 100644 --- a/x/ibc/20-transfer/keeper/relay_test.go +++ b/x/ibc/20-transfer/keeper/relay_test.go @@ -5,8 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/bank" - connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" - channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" "github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types" ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types" @@ -27,8 +25,8 @@ func (suite *KeeperTestSuite) TestSendTransfer() { func() { suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, testCoins) suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channelexported.OPEN, channelexported.ORDERED, testConnection) + suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnection) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1) }, true, true}, {"successful transfer from external chain", prefixCoins, @@ -37,8 +35,8 @@ func (suite *KeeperTestSuite) TestSendTransfer() { _, err := suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, prefixCoins) suite.Require().NoError(err) suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channelexported.OPEN, channelexported.ORDERED, testConnection) + suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnection) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1) }, false, true}, {"source channel not found", testCoins, @@ -46,32 +44,32 @@ func (suite *KeeperTestSuite) TestSendTransfer() { {"next seq send not found", testCoins, func() { suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channelexported.OPEN, channelexported.ORDERED, testConnection) + suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnection) }, true, false}, // createOutgoingPacket tests // - source chain {"send coins failed", testCoins, func() { suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channelexported.OPEN, channelexported.ORDERED, testConnection) + suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnection) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1) }, true, false}, // - receiving chain {"send from module account failed", testCoins, func() { suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channelexported.OPEN, channelexported.ORDERED, testConnection) + suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnection) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1) }, false, false}, {"channel capability not found", testCoins, func() { suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, testCoins) suite.chainA.CreateClient(suite.chainB) - suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, channelexported.OPEN, channelexported.ORDERED, testConnection) + suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainA.createChannel(testPort1, testChannel1, testPort2, testChannel2, ibctypes.OPEN, ibctypes.ORDERED, testConnection) suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), testPort1, testChannel1, 1) // Release channel capability cap, _ := suite.chainA.App.ScopedTransferKeeper.GetCapability(suite.chainA.GetContext(), capName) diff --git a/x/ibc/20-transfer/module.go b/x/ibc/20-transfer/module.go index dd0758a64049..fc7a86e18a30 100644 --- a/x/ibc/20-transfer/module.go +++ b/x/ibc/20-transfer/module.go @@ -16,7 +16,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/capability" channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel" - channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" port "github.com/cosmos/cosmos-sdk/x/ibc/05-port" porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types" @@ -138,7 +137,7 @@ func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.V // Implement IBCModule callbacks func (am AppModule) OnChanOpenInit( ctx sdk.Context, - order channelexported.Order, + order ibctypes.Order, connectionHops []string, portID string, channelID string, @@ -169,7 +168,7 @@ func (am AppModule) OnChanOpenInit( func (am AppModule) OnChanOpenTry( ctx sdk.Context, - order channelexported.Order, + order ibctypes.Order, connectionHops []string, portID, channelID string, diff --git a/x/ibc/20-transfer/types/codec.go b/x/ibc/20-transfer/types/codec.go index 80c1c767b978..af7a3fcfc6b1 100644 --- a/x/ibc/20-transfer/types/codec.go +++ b/x/ibc/20-transfer/types/codec.go @@ -2,21 +2,28 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" - channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel" - commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" ) -// ModuleCdc defines the IBC transfer codec. -var ModuleCdc = codec.New() - // RegisterCodec registers the IBC transfer types func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgTransfer{}, "ibc/transfer/MsgTransfer", nil) cdc.RegisterConcrete(FungibleTokenPacketData{}, "ibc/transfer/PacketDataTransfer", nil) } +var ( + amino = codec.New() + + // ModuleCdc references the global x/ibc/20-transfer module codec. Note, the codec + // should ONLY be used in certain instances of tests and for JSON encoding as Amino + // is still used for that purpose. + // + // The actual codec used for serialization should be provided to x/ibc/20-transfer and + // defined at the application level. + ModuleCdc = codec.NewHybridCodec(amino) +) + func init() { - RegisterCodec(ModuleCdc) - channel.RegisterCodec(ModuleCdc) - commitmenttypes.RegisterCodec(ModuleCdc) + RegisterCodec(amino) + codec.RegisterCrypto(amino) + amino.Seal() } diff --git a/x/ibc/20-transfer/types/expected_keepers.go b/x/ibc/20-transfer/types/expected_keepers.go index 1bb41ea225bd..a9d96eee8144 100644 --- a/x/ibc/20-transfer/types/expected_keepers.go +++ b/x/ibc/20-transfer/types/expected_keepers.go @@ -6,8 +6,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/capability" clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" - channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel" channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" + channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" ) // AccountKeeper defines the contract required for account APIs. @@ -27,7 +27,7 @@ type BankKeeper interface { // ChannelKeeper defines the expected IBC channel keeper type ChannelKeeper interface { - GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channel.Channel, found bool) + GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) SendPacket(ctx sdk.Context, channelCap *capability.Capability, packet channelexported.PacketI) error PacketExecuted(ctx sdk.Context, chanCap *capability.Capability, packet channelexported.PacketI, acknowledgement []byte) error diff --git a/x/ibc/20-transfer/types/msgs.go b/x/ibc/20-transfer/types/msgs.go index 35ffe8dd072f..5dc814d59d16 100644 --- a/x/ibc/20-transfer/types/msgs.go +++ b/x/ibc/20-transfer/types/msgs.go @@ -6,28 +6,22 @@ import ( host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" ) -// MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between ICS20 enabled chains. -// See ICS Spec here: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures -type MsgTransfer struct { - SourcePort string `json:"source_port" yaml:"source_port"` // the port on which the packet will be sent - SourceChannel string `json:"source_channel" yaml:"source_channel"` // the channel by which the packet will be sent - DestHeight uint64 `json:"dest_height" yaml:"dest_height"` // the current height of the destination chain - Amount sdk.Coins `json:"amount" yaml:"amount"` // the tokens to be transferred - Sender sdk.AccAddress `json:"sender" yaml:"sender"` // the sender address - Receiver string `json:"receiver" yaml:"receiver"` // the recipient address on the destination chain -} +// msg types +const ( + TypeMsgTransfer = "transfer" +) // NewMsgTransfer creates a new MsgTransfer instance func NewMsgTransfer( sourcePort, sourceChannel string, destHeight uint64, amount sdk.Coins, sender sdk.AccAddress, receiver string, ) MsgTransfer { return MsgTransfer{ - SourcePort: sourcePort, - SourceChannel: sourceChannel, - DestHeight: destHeight, - Amount: amount, - Sender: sender, - Receiver: receiver, + SourcePort: sourcePort, + SourceChannel: sourceChannel, + DestinationHeight: destHeight, + Amount: amount, + Sender: sender, + Receiver: receiver, } } @@ -38,7 +32,7 @@ func (MsgTransfer) Route() string { // Type implements sdk.Msg func (MsgTransfer) Type() string { - return "transfer" + return TypeMsgTransfer } // ValidateBasic implements sdk.Msg diff --git a/x/ibc/20-transfer/types/msgs_test.go b/x/ibc/20-transfer/types/msgs_test.go index 679613561bde..a53b6e3e57f9 100644 --- a/x/ibc/20-transfer/types/msgs_test.go +++ b/x/ibc/20-transfer/types/msgs_test.go @@ -96,7 +96,7 @@ func TestMsgTransferGetSignBytes(t *testing.T) { msg := NewMsgTransfer(validPort, validChannel, 10, coins, addr1, addr2) res := msg.GetSignBytes() - expected := `{"type":"ibc/transfer/MsgTransfer","value":{"amount":[{"amount":"100","denom":"atom"}],"dest_height":"10","receiver":"cosmos1w3jhxarpv3j8yvs7f9y7g","sender":"cosmos1w3jhxarpv3j8yvg4ufs4x","source_channel":"testchannel","source_port":"testportid"}}` + expected := `{"type":"ibc/transfer/MsgTransfer","value":{"amount":[{"amount":"100","denom":"atom"}],"destination_height":"10","receiver":"cosmos1w3jhxarpv3j8yvs7f9y7g","sender":"cosmos1w3jhxarpv3j8yvg4ufs4x","source_channel":"testchannel","source_port":"testportid"}}` require.Equal(t, expected, string(res)) } diff --git a/x/ibc/20-transfer/types/packet.go b/x/ibc/20-transfer/types/packet.go index 6e7f74c089e3..5ce4a4dfc4b5 100644 --- a/x/ibc/20-transfer/types/packet.go +++ b/x/ibc/20-transfer/types/packet.go @@ -1,20 +1,10 @@ package types import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -// FungibleTokenPacketData defines a struct for the packet payload -// See FungibleTokenPacketData spec: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures -type FungibleTokenPacketData struct { - Amount sdk.Coins `json:"amount" yaml:"amount"` // the tokens to be transferred - Sender string `json:"sender" yaml:"sender"` // the sender address - Receiver string `json:"receiver" yaml:"receiver"` // the recipient address on the destination chain -} - // NewFungibleTokenPacketData contructs a new FungibleTokenPacketData instance func NewFungibleTokenPacketData( amount sdk.Coins, sender, receiver string) FungibleTokenPacketData { @@ -25,18 +15,6 @@ func NewFungibleTokenPacketData( } } -// String returns a string representation of FungibleTokenPacketData -func (ftpd FungibleTokenPacketData) String() string { - return fmt.Sprintf(`FungibleTokenPacketData: - Amount: %s - Sender: %s - Receiver: %s`, - ftpd.Amount.String(), - ftpd.Sender, - ftpd.Receiver, - ) -} - // ValidateBasic is used for validating the token transfer func (ftpd FungibleTokenPacketData) ValidateBasic() error { if !ftpd.Amount.IsAllPositive() { @@ -59,14 +37,6 @@ func (ftpd FungibleTokenPacketData) GetBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(ftpd)) } -// FungibleTokenPacketAcknowledgement contains a boolean success flag and an optional error msg -// error msg is empty string on success -// See spec for onAcknowledgePacket: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#packet-relay -type FungibleTokenPacketAcknowledgement struct { - Success bool `json:"success" yaml:"success"` - Error string `json:"error" yaml:"error"` -} - // GetBytes is a helper for serialising func (ack FungibleTokenPacketAcknowledgement) GetBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(ack)) diff --git a/x/ibc/20-transfer/types/types.pb.go b/x/ibc/20-transfer/types/types.pb.go new file mode 100644 index 000000000000..bff7fb8a52b5 --- /dev/null +++ b/x/ibc/20-transfer/types/types.pb.go @@ -0,0 +1,1112 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/ibc/20-transfer/types/types.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between ICS20 enabled chains. +// See ICS Spec here: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures +type MsgTransfer struct { + // the port on which the packet will be sent + SourcePort string `protobuf:"bytes,1,opt,name=source_port,json=sourcePort,proto3" json:"source_port,omitempty" yaml:"source_port"` + // the channel by which the packet will be sent + SourceChannel string `protobuf:"bytes,2,opt,name=source_channel,json=sourceChannel,proto3" json:"source_channel,omitempty" yaml:"source_channel"` + // the current height of the destination chain + DestinationHeight uint64 `protobuf:"varint,3,opt,name=destination_height,json=destinationHeight,proto3" json:"destination_height,omitempty" yaml:"destination_height"` + // the tokens to be transferred + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` + // the sender address + Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` + // the recipient address on the destination chain + Receiver string `protobuf:"bytes,6,opt,name=receiver,proto3" json:"receiver,omitempty"` +} + +func (m *MsgTransfer) Reset() { *m = MsgTransfer{} } +func (m *MsgTransfer) String() string { return proto.CompactTextString(m) } +func (*MsgTransfer) ProtoMessage() {} +func (*MsgTransfer) Descriptor() ([]byte, []int) { + return fileDescriptor_2979e3085e18bdce, []int{0} +} +func (m *MsgTransfer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransfer.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 *MsgTransfer) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransfer.Merge(m, src) +} +func (m *MsgTransfer) XXX_Size() int { + return m.Size() +} +func (m *MsgTransfer) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransfer.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTransfer proto.InternalMessageInfo + +func (m *MsgTransfer) GetSourcePort() string { + if m != nil { + return m.SourcePort + } + return "" +} + +func (m *MsgTransfer) GetSourceChannel() string { + if m != nil { + return m.SourceChannel + } + return "" +} + +func (m *MsgTransfer) GetDestinationHeight() uint64 { + if m != nil { + return m.DestinationHeight + } + return 0 +} + +func (m *MsgTransfer) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Amount + } + return nil +} + +func (m *MsgTransfer) GetSender() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Sender + } + return nil +} + +func (m *MsgTransfer) GetReceiver() string { + if m != nil { + return m.Receiver + } + return "" +} + +// FungibleTokenPacketData defines a struct for the packet payload +// See FungibleTokenPacketData spec: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures +type FungibleTokenPacketData struct { + // the tokens to be transferred + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` + // the sender address + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + // the recipient address on the destination chain + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` +} + +func (m *FungibleTokenPacketData) Reset() { *m = FungibleTokenPacketData{} } +func (m *FungibleTokenPacketData) String() string { return proto.CompactTextString(m) } +func (*FungibleTokenPacketData) ProtoMessage() {} +func (*FungibleTokenPacketData) Descriptor() ([]byte, []int) { + return fileDescriptor_2979e3085e18bdce, []int{1} +} +func (m *FungibleTokenPacketData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FungibleTokenPacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FungibleTokenPacketData.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 *FungibleTokenPacketData) XXX_Merge(src proto.Message) { + xxx_messageInfo_FungibleTokenPacketData.Merge(m, src) +} +func (m *FungibleTokenPacketData) XXX_Size() int { + return m.Size() +} +func (m *FungibleTokenPacketData) XXX_DiscardUnknown() { + xxx_messageInfo_FungibleTokenPacketData.DiscardUnknown(m) +} + +var xxx_messageInfo_FungibleTokenPacketData proto.InternalMessageInfo + +func (m *FungibleTokenPacketData) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Amount + } + return nil +} + +func (m *FungibleTokenPacketData) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *FungibleTokenPacketData) GetReceiver() string { + if m != nil { + return m.Receiver + } + return "" +} + +// FungibleTokenPacketAcknowledgement contains a boolean success flag and an optional error msg +// error msg is empty string on success +// See spec for onAcknowledgePacket: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#packet-relay +type FungibleTokenPacketAcknowledgement struct { + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty" yaml:"success"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty" yaml:"error"` +} + +func (m *FungibleTokenPacketAcknowledgement) Reset() { *m = FungibleTokenPacketAcknowledgement{} } +func (m *FungibleTokenPacketAcknowledgement) String() string { return proto.CompactTextString(m) } +func (*FungibleTokenPacketAcknowledgement) ProtoMessage() {} +func (*FungibleTokenPacketAcknowledgement) Descriptor() ([]byte, []int) { + return fileDescriptor_2979e3085e18bdce, []int{2} +} +func (m *FungibleTokenPacketAcknowledgement) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FungibleTokenPacketAcknowledgement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FungibleTokenPacketAcknowledgement.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 *FungibleTokenPacketAcknowledgement) XXX_Merge(src proto.Message) { + xxx_messageInfo_FungibleTokenPacketAcknowledgement.Merge(m, src) +} +func (m *FungibleTokenPacketAcknowledgement) XXX_Size() int { + return m.Size() +} +func (m *FungibleTokenPacketAcknowledgement) XXX_DiscardUnknown() { + xxx_messageInfo_FungibleTokenPacketAcknowledgement.DiscardUnknown(m) +} + +var xxx_messageInfo_FungibleTokenPacketAcknowledgement proto.InternalMessageInfo + +func (m *FungibleTokenPacketAcknowledgement) GetSuccess() bool { + if m != nil { + return m.Success + } + return false +} + +func (m *FungibleTokenPacketAcknowledgement) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +func init() { + proto.RegisterType((*MsgTransfer)(nil), "cosmos_sdk.x.ibc.transfer.v1.MsgTransfer") + proto.RegisterType((*FungibleTokenPacketData)(nil), "cosmos_sdk.x.ibc.transfer.v1.FungibleTokenPacketData") + proto.RegisterType((*FungibleTokenPacketAcknowledgement)(nil), "cosmos_sdk.x.ibc.transfer.v1.FungibleTokenPacketAcknowledgement") +} + +func init() { + proto.RegisterFile("x/ibc/20-transfer/types/types.proto", fileDescriptor_2979e3085e18bdce) +} + +var fileDescriptor_2979e3085e18bdce = []byte{ + // 510 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0xc1, 0x6e, 0xd3, 0x4a, + 0x14, 0x8d, 0x5f, 0xda, 0xbc, 0x32, 0x29, 0x15, 0x1d, 0x44, 0x71, 0x23, 0xb0, 0x23, 0x23, 0x55, + 0x59, 0x10, 0xbb, 0x29, 0x48, 0x48, 0xac, 0x88, 0x8b, 0x10, 0x48, 0x80, 0x2a, 0xab, 0x2b, 0x24, + 0x14, 0x39, 0xe3, 0x8b, 0x33, 0x72, 0x3c, 0x13, 0xcd, 0x8c, 0x43, 0xc3, 0x57, 0xf0, 0x01, 0x7c, + 0x01, 0xe2, 0x43, 0xba, 0xec, 0x92, 0x95, 0x41, 0xc9, 0x1f, 0x78, 0xc9, 0x0a, 0xd5, 0xe3, 0x96, + 0x40, 0x0b, 0x62, 0xc3, 0xc6, 0xf6, 0xbd, 0xe7, 0xdc, 0xa3, 0x73, 0xae, 0x67, 0xd0, 0x9d, 0x23, + 0x8f, 0x0e, 0x89, 0xb7, 0xb7, 0xdb, 0x55, 0x22, 0x64, 0xf2, 0x0d, 0x08, 0x4f, 0xcd, 0x26, 0x20, + 0xf5, 0xd3, 0x9d, 0x08, 0xae, 0x38, 0xbe, 0x45, 0xb8, 0x4c, 0xb9, 0x1c, 0xc8, 0x28, 0x71, 0x8f, + 0x5c, 0x3a, 0x24, 0xee, 0x19, 0xd9, 0x9d, 0xf6, 0x5a, 0x3b, 0x6a, 0x44, 0x45, 0x34, 0x98, 0x84, + 0x42, 0xcd, 0xbc, 0x72, 0xc0, 0x8b, 0x79, 0xcc, 0x7f, 0x7c, 0x69, 0x95, 0xd6, 0xe6, 0x05, 0x61, + 0xe7, 0x43, 0x1d, 0x35, 0x5f, 0xc8, 0xf8, 0xb0, 0x52, 0xc3, 0x0f, 0x50, 0x53, 0xf2, 0x4c, 0x10, + 0x18, 0x4c, 0xb8, 0x50, 0xa6, 0xd1, 0x36, 0x3a, 0x57, 0xfc, 0xad, 0x22, 0xb7, 0xf1, 0x2c, 0x4c, + 0xc7, 0x0f, 0x9d, 0x25, 0xd0, 0x09, 0x90, 0xae, 0x0e, 0xb8, 0x50, 0xf8, 0x11, 0xda, 0xa8, 0x30, + 0x32, 0x0a, 0x19, 0x83, 0xb1, 0xf9, 0x5f, 0x39, 0xbb, 0x5d, 0xe4, 0xf6, 0x8d, 0x9f, 0x66, 0x2b, + 0xdc, 0x09, 0xae, 0xea, 0xc6, 0xbe, 0xae, 0xf1, 0x73, 0x84, 0x23, 0x90, 0x8a, 0xb2, 0x50, 0x51, + 0xce, 0x06, 0x23, 0xa0, 0xf1, 0x48, 0x99, 0xf5, 0xb6, 0xd1, 0x59, 0xf1, 0x6f, 0x17, 0xb9, 0xbd, + 0xad, 0x55, 0x2e, 0x72, 0x9c, 0x60, 0x73, 0xa9, 0xf9, 0xb4, 0xec, 0xe1, 0xd7, 0xa8, 0x11, 0xa6, + 0x3c, 0x63, 0xca, 0x5c, 0x69, 0xd7, 0x3b, 0xcd, 0xbd, 0xeb, 0xee, 0xd2, 0x0a, 0xa7, 0x3d, 0x77, + 0x9f, 0x53, 0xe6, 0xef, 0x1e, 0xe7, 0x76, 0xed, 0xe3, 0x17, 0xbb, 0x13, 0x53, 0x35, 0xca, 0x86, + 0x2e, 0xe1, 0xa9, 0xa7, 0x69, 0xd5, 0xab, 0x2b, 0xa3, 0xa4, 0xda, 0xd7, 0xe9, 0x80, 0x0c, 0x2a, + 0x51, 0xfc, 0x0c, 0x35, 0x24, 0xb0, 0x08, 0x84, 0xb9, 0xda, 0x36, 0x3a, 0xeb, 0x7e, 0xef, 0x5b, + 0x6e, 0x77, 0xff, 0x42, 0xa5, 0x4f, 0x48, 0x3f, 0x8a, 0x04, 0x48, 0x19, 0x54, 0x02, 0xb8, 0x85, + 0xd6, 0x04, 0x10, 0xa0, 0x53, 0x10, 0x66, 0xe3, 0x74, 0x67, 0xc1, 0x79, 0xed, 0x7c, 0x32, 0xd0, + 0xcd, 0x27, 0x19, 0x8b, 0xe9, 0x70, 0x0c, 0x87, 0x3c, 0x01, 0x76, 0x10, 0x92, 0x04, 0xd4, 0xe3, + 0x50, 0x85, 0x4b, 0x09, 0x8d, 0x7f, 0x91, 0x70, 0xeb, 0x3c, 0x61, 0xf9, 0x23, 0x2f, 0xb5, 0x5b, + 0xff, 0xc5, 0xee, 0x3b, 0xe4, 0x5c, 0xe2, 0xb6, 0x4f, 0x12, 0xc6, 0xdf, 0x8e, 0x21, 0x8a, 0x21, + 0x05, 0xa6, 0xf0, 0x5d, 0xf4, 0xbf, 0xcc, 0x08, 0x01, 0x29, 0xcb, 0xf3, 0xb5, 0xe6, 0xe3, 0x22, + 0xb7, 0x37, 0xaa, 0x33, 0xa2, 0x01, 0x27, 0x38, 0xa3, 0xe0, 0x1d, 0xb4, 0x0a, 0x42, 0xf0, 0xca, + 0x86, 0x7f, 0xad, 0xc8, 0xed, 0x75, 0xcd, 0x2d, 0xdb, 0x4e, 0xa0, 0x61, 0xff, 0xe5, 0xf1, 0xdc, + 0x32, 0x4e, 0xe6, 0x96, 0xf1, 0x75, 0x6e, 0x19, 0xef, 0x17, 0x56, 0xed, 0x64, 0x61, 0xd5, 0x3e, + 0x2f, 0xac, 0xda, 0xab, 0xfb, 0x7f, 0xcc, 0xfe, 0x9b, 0xeb, 0x37, 0x6c, 0x94, 0x17, 0xe4, 0xde, + 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x15, 0x32, 0x51, 0xa0, 0x03, 0x00, 0x00, +} + +func (m *MsgTransfer) 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 *MsgTransfer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x32 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x2a + } + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.DestinationHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.DestinationHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.SourceChannel) > 0 { + i -= len(m.SourceChannel) + copy(dAtA[i:], m.SourceChannel) + i = encodeVarintTypes(dAtA, i, uint64(len(m.SourceChannel))) + i-- + dAtA[i] = 0x12 + } + if len(m.SourcePort) > 0 { + i -= len(m.SourcePort) + copy(dAtA[i:], m.SourcePort) + i = encodeVarintTypes(dAtA, i, uint64(len(m.SourcePort))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FungibleTokenPacketData) 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 *FungibleTokenPacketData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FungibleTokenPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *FungibleTokenPacketAcknowledgement) 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 *FungibleTokenPacketAcknowledgement) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FungibleTokenPacketAcknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0x12 + } + if m.Success { + i-- + if m.Success { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgTransfer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SourcePort) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.SourceChannel) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.DestinationHeight != 0 { + n += 1 + sovTypes(uint64(m.DestinationHeight)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *FungibleTokenPacketData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *FungibleTokenPacketAcknowledgement) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Success { + n += 2 + } + l = len(m.Error) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgTransfer) 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 ErrIntOverflowTypes + } + 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: MsgTransfer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTransfer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourcePort", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourcePort = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceChannel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourceChannel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationHeight", wireType) + } + m.DestinationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DestinationHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = append(m.Sender[:0], dAtA[iNdEx:postIndex]...) + if m.Sender == nil { + m.Sender = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FungibleTokenPacketData) 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 ErrIntOverflowTypes + } + 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: FungibleTokenPacketData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FungibleTokenPacketData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FungibleTokenPacketAcknowledgement) 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 ErrIntOverflowTypes + } + 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: FungibleTokenPacketAcknowledgement: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FungibleTokenPacketAcknowledgement: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Success = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibc/20-transfer/types/types.proto b/x/ibc/20-transfer/types/types.proto new file mode 100644 index 000000000000..6457c58dedb4 --- /dev/null +++ b/x/ibc/20-transfer/types/types.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; +package cosmos_sdk.x.ibc.transfer.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "types/types.proto"; + +// MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between ICS20 enabled chains. +// See ICS Spec here: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures +message MsgTransfer { + // the port on which the packet will be sent + string source_port = 1 [ + (gogoproto.moretags) = "yaml:\"source_port\"" + ]; + // the channel by which the packet will be sent + string source_channel = 2 [ + (gogoproto.moretags) = "yaml:\"source_channel\"" + ]; + // the current height of the destination chain + uint64 destination_height = 3 [ + (gogoproto.moretags) = "yaml:\"destination_height\"" + ]; + // the tokens to be transferred + repeated cosmos_sdk.v1.Coin amount = 4 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // the sender address + bytes sender = 5 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; + // the recipient address on the destination chain + string receiver = 6; +} + +// FungibleTokenPacketData defines a struct for the packet payload +// See FungibleTokenPacketData spec: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures +message FungibleTokenPacketData { + // the tokens to be transferred + repeated cosmos_sdk.v1.Coin amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // the sender address + string sender = 2; + // the recipient address on the destination chain + string receiver = 3; +} + +// FungibleTokenPacketAcknowledgement contains a boolean success flag and an optional error msg +// error msg is empty string on success +// See spec for onAcknowledgePacket: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#packet-relay +message FungibleTokenPacketAcknowledgement { + bool success = 1 [ + (gogoproto.moretags) = "yaml:\"success\"" + ]; + string error = 2 [ + (gogoproto.moretags) = "yaml:\"error\"" + ]; +} \ No newline at end of file diff --git a/x/ibc/23-commitment/types/codec.go b/x/ibc/23-commitment/types/codec.go index e7e761867fc8..e46bef789829 100644 --- a/x/ibc/23-commitment/types/codec.go +++ b/x/ibc/23-commitment/types/codec.go @@ -5,9 +5,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" ) -var SubModuleCdc *codec.Codec - -// RegisterCodec registers types declared in this package +// RegisterCodec registers the necessary x/ibc/23-commitment interfaces and concrete types +// on the provided Amino codec. These types are used for Amino JSON serialization. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterInterface((*exported.Root)(nil), nil) cdc.RegisterInterface((*exported.Prefix)(nil), nil) @@ -18,10 +17,21 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MerklePrefix{}, "ibc/commitment/MerklePrefix", nil) cdc.RegisterConcrete(MerklePath{}, "ibc/commitment/MerklePath", nil) cdc.RegisterConcrete(MerkleProof{}, "ibc/commitment/MerkleProof", nil) - - SetSubModuleCodec(cdc) } -func SetSubModuleCodec(cdc *codec.Codec) { - SubModuleCdc = cdc +var ( + amino = codec.New() + + // SubModuleCdc references the global x/ibc/23-commitmentl module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding as Amino is + // still used for that purpose. + // + // The actual codec used for serialization should be provided to x/ibc/23-commitmentl and + // defined at the application level. + SubModuleCdc = codec.NewHybridCodec(amino) +) + +func init() { + RegisterCodec(amino) + amino.Seal() } diff --git a/x/ibc/23-commitment/types/key_path.go b/x/ibc/23-commitment/types/key_path.go new file mode 100644 index 000000000000..4d79e2e726e2 --- /dev/null +++ b/x/ibc/23-commitment/types/key_path.go @@ -0,0 +1,28 @@ +package types + +import ( + fmt "fmt" + "net/url" +) + +// AppendKey appends a new key to a KeyPath +func (pth KeyPath) AppendKey(key []byte, enc KeyEncoding) KeyPath { + pth.Keys = append(pth.Keys, &Key{name: key, enc: enc}) + return pth +} + +// String implements the fmt.Stringer interface +func (pth *KeyPath) String() string { + res := "" + for _, key := range pth.Keys { + switch key.enc { + case URL: + res += "/" + url.PathEscape(string(key.name)) + case HEX: + res += "/x:" + fmt.Sprintf("%X", key.name) + default: + panic("unexpected key encoding type") + } + } + return res +} diff --git a/x/ibc/23-commitment/types/merkle.go b/x/ibc/23-commitment/types/merkle.go index 74f6353f339a..5da657892ec2 100644 --- a/x/ibc/23-commitment/types/merkle.go +++ b/x/ibc/23-commitment/types/merkle.go @@ -4,11 +4,11 @@ import ( "errors" "net/url" - "github.com/tendermint/tendermint/crypto/merkle" - "github.com/cosmos/cosmos-sdk/store/rootmulti" "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" + + "github.com/tendermint/tendermint/crypto/merkle" ) // ICS 023 Merkle Types Implementation @@ -17,13 +17,7 @@ import ( // Merkle proof implementation of the Proof interface // Applied on SDK-based IBC implementation -var _ exported.Root = MerkleRoot{} - -// MerkleRoot defines a merkle root hash. -// In the Cosmos SDK, the AppHash of a block header becomes the root. -type MerkleRoot struct { - Hash []byte `json:"hash" yaml:"hash"` -} +var _ exported.Root = (*MerkleRoot)(nil) // NewMerkleRoot constructs a new MerkleRoot func NewMerkleRoot(hash []byte) MerkleRoot { @@ -32,28 +26,22 @@ func NewMerkleRoot(hash []byte) MerkleRoot { } } -// GetCommitmentType implements RootI interface -func (MerkleRoot) GetCommitmentType() exported.Type { - return exported.Merkle -} - // GetHash implements RootI interface func (mr MerkleRoot) GetHash() []byte { return mr.Hash } +// GetCommitmentType implements RootI interface +func (MerkleRoot) GetCommitmentType() exported.Type { + return exported.Merkle +} + // IsEmpty returns true if the root is empty func (mr MerkleRoot) IsEmpty() bool { return len(mr.GetHash()) == 0 } -var _ exported.Prefix = MerklePrefix{} - -// MerklePrefix is merkle path prefixed to the key. -// The constructed key from the Path and the key will be append(Path.KeyPath, append(Path.KeyPrefix, key...)) -type MerklePrefix struct { - KeyPrefix []byte `json:"key_prefix" yaml:"key_prefix"` // byte slice prefixed before the key -} +var _ exported.Prefix = (*MerklePrefix)(nil) // NewMerklePrefix constructs new MerklePrefix instance func NewMerklePrefix(keyPrefix []byte) MerklePrefix { @@ -77,19 +65,13 @@ func (mp MerklePrefix) IsEmpty() bool { return len(mp.Bytes()) == 0 } -var _ exported.Path = MerklePath{} - -// MerklePath is the path used to verify commitment proofs, which can be an arbitrary -// structured object (defined by a commitment type). -type MerklePath struct { - KeyPath merkle.KeyPath `json:"key_path" yaml:"key_path"` // byte slice prefixed before the key -} +var _ exported.Path = (*MerklePath)(nil) // NewMerklePath creates a new MerklePath instance func NewMerklePath(keyPathStr []string) MerklePath { - merkleKeyPath := merkle.KeyPath{} + merkleKeyPath := KeyPath{} for _, keyStr := range keyPathStr { - merkleKeyPath = merkleKeyPath.AppendKey([]byte(keyStr), merkle.KeyEncodingURL) + merkleKeyPath = merkleKeyPath.AppendKey([]byte(keyStr), URL) } return MerklePath{ @@ -118,7 +100,7 @@ func (mp MerklePath) Pretty() string { // IsEmpty returns true if the path is empty func (mp MerklePath) IsEmpty() bool { - return len(mp.KeyPath) == 0 + return len(mp.KeyPath.Keys) == 0 } // ApplyPrefix constructs a new commitment path from the arguments. It interprets @@ -138,15 +120,7 @@ func ApplyPrefix(prefix exported.Prefix, path string) (MerklePath, error) { return NewMerklePath([]string{string(prefix.Bytes()), path}), nil } -var _ exported.Proof = MerkleProof{} - -// MerkleProof is a wrapper type that contains a merkle proof. -// It demonstrates membership or non-membership for an element or set of elements, -// verifiable in conjunction with a known commitment root. Proofs should be -// succinct. -type MerkleProof struct { - Proof *merkle.Proof `json:"proof" yaml:"proof"` -} +var _ exported.Proof = (*MerkleProof)(nil) // GetCommitmentType implements ProofI func (MerkleProof) GetCommitmentType() exported.Type { @@ -175,7 +149,7 @@ func (proof MerkleProof) VerifyNonMembership(root exported.Root, path exported.P // IsEmpty returns true if the root is empty func (proof MerkleProof) IsEmpty() bool { - return (proof == MerkleProof{}) || proof.Proof == nil + return proof.Proof.Equal(nil) || proof.Equal(MerkleProof{}) || proof.Proof.Equal(nil) || proof.Proof.Equal(merkle.Proof{}) } // ValidateBasic checks if the proof is empty. diff --git a/x/ibc/23-commitment/types/merkle_test.go b/x/ibc/23-commitment/types/merkle_test.go index 6694ef07fa7d..1c436b0743b8 100644 --- a/x/ibc/23-commitment/types/merkle_test.go +++ b/x/ibc/23-commitment/types/merkle_test.go @@ -53,7 +53,7 @@ func (suite *MerkleTestSuite) TestVerifyMembership() { root := types.NewMerkleRoot(tc.root) path := types.NewMerklePath(tc.pathArr) - err := proof.VerifyMembership(root, path, tc.value) + err := proof.VerifyMembership(&root, path, tc.value) if tc.shouldPass { // nolint: scopelint @@ -108,7 +108,7 @@ func (suite *MerkleTestSuite) TestVerifyNonMembership() { root := types.NewMerkleRoot(tc.root) path := types.NewMerklePath(tc.pathArr) - err := proof.VerifyNonMembership(root, path) + err := proof.VerifyNonMembership(&root, path) if tc.shouldPass { // nolint: scopelint diff --git a/x/ibc/23-commitment/types/types.pb.go b/x/ibc/23-commitment/types/types.pb.go new file mode 100644 index 000000000000..c9502fcedde7 --- /dev/null +++ b/x/ibc/23-commitment/types/types.pb.go @@ -0,0 +1,1298 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/ibc/23-commitment/types/types.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + merkle "github.com/tendermint/tendermint/crypto/merkle" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type KeyEncoding int32 + +const ( + // URL encoding + URL KeyEncoding = 0 + // Hex encoding + HEX KeyEncoding = 1 +) + +var KeyEncoding_name = map[int32]string{ + 0: "URL", + 1: "HEX", +} + +var KeyEncoding_value = map[string]int32{ + "URL": 0, + "HEX": 1, +} + +func (KeyEncoding) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_1004b8837466efb9, []int{0} +} + +// MerkleRoot defines a merkle root hash. +// In the Cosmos SDK, the AppHash of a block header becomes the root. +type MerkleRoot struct { + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (m *MerkleRoot) Reset() { *m = MerkleRoot{} } +func (m *MerkleRoot) String() string { return proto.CompactTextString(m) } +func (*MerkleRoot) ProtoMessage() {} +func (*MerkleRoot) Descriptor() ([]byte, []int) { + return fileDescriptor_1004b8837466efb9, []int{0} +} +func (m *MerkleRoot) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MerkleRoot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MerkleRoot.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 *MerkleRoot) XXX_Merge(src proto.Message) { + xxx_messageInfo_MerkleRoot.Merge(m, src) +} +func (m *MerkleRoot) XXX_Size() int { + return m.Size() +} +func (m *MerkleRoot) XXX_DiscardUnknown() { + xxx_messageInfo_MerkleRoot.DiscardUnknown(m) +} + +var xxx_messageInfo_MerkleRoot proto.InternalMessageInfo + +// MerklePrefix is merkle path prefixed to the key. +// The constructed key from the Path and the key will be append(Path.KeyPath, append(Path.KeyPrefix, key...)) +type MerklePrefix struct { + KeyPrefix []byte `protobuf:"bytes,1,opt,name=key_prefix,json=keyPrefix,proto3" json:"key_prefix,omitempty"` +} + +func (m *MerklePrefix) Reset() { *m = MerklePrefix{} } +func (m *MerklePrefix) String() string { return proto.CompactTextString(m) } +func (*MerklePrefix) ProtoMessage() {} +func (*MerklePrefix) Descriptor() ([]byte, []int) { + return fileDescriptor_1004b8837466efb9, []int{1} +} +func (m *MerklePrefix) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MerklePrefix) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MerklePrefix.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 *MerklePrefix) XXX_Merge(src proto.Message) { + xxx_messageInfo_MerklePrefix.Merge(m, src) +} +func (m *MerklePrefix) XXX_Size() int { + return m.Size() +} +func (m *MerklePrefix) XXX_DiscardUnknown() { + xxx_messageInfo_MerklePrefix.DiscardUnknown(m) +} + +var xxx_messageInfo_MerklePrefix proto.InternalMessageInfo + +func (m *MerklePrefix) GetKeyPrefix() []byte { + if m != nil { + return m.KeyPrefix + } + return nil +} + +// MerklePath is the path used to verify commitment proofs, which can be an arbitrary +// structured object (defined by a commitment type). +type MerklePath struct { + KeyPath KeyPath `protobuf:"bytes,1,opt,name=key_path,json=keyPath,proto3" json:"key_path"` +} + +func (m *MerklePath) Reset() { *m = MerklePath{} } +func (*MerklePath) ProtoMessage() {} +func (*MerklePath) Descriptor() ([]byte, []int) { + return fileDescriptor_1004b8837466efb9, []int{2} +} +func (m *MerklePath) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MerklePath) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MerklePath.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 *MerklePath) XXX_Merge(src proto.Message) { + xxx_messageInfo_MerklePath.Merge(m, src) +} +func (m *MerklePath) XXX_Size() int { + return m.Size() +} +func (m *MerklePath) XXX_DiscardUnknown() { + xxx_messageInfo_MerklePath.DiscardUnknown(m) +} + +var xxx_messageInfo_MerklePath proto.InternalMessageInfo + +func (m *MerklePath) GetKeyPath() KeyPath { + if m != nil { + return m.KeyPath + } + return KeyPath{} +} + +// MerkleProof is a wrapper type that contains a merkle proof. +// It demonstrates membership or non-membership for an element or set of elements, +// verifiable in conjunction with a known commitment root. Proofs should be +// succinct. +type MerkleProof struct { + Proof *merkle.Proof `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` +} + +func (m *MerkleProof) Reset() { *m = MerkleProof{} } +func (m *MerkleProof) String() string { return proto.CompactTextString(m) } +func (*MerkleProof) ProtoMessage() {} +func (*MerkleProof) Descriptor() ([]byte, []int) { + return fileDescriptor_1004b8837466efb9, []int{3} +} +func (m *MerkleProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MerkleProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MerkleProof.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 *MerkleProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_MerkleProof.Merge(m, src) +} +func (m *MerkleProof) XXX_Size() int { + return m.Size() +} +func (m *MerkleProof) XXX_DiscardUnknown() { + xxx_messageInfo_MerkleProof.DiscardUnknown(m) +} + +var xxx_messageInfo_MerkleProof proto.InternalMessageInfo + +func (m *MerkleProof) GetProof() *merkle.Proof { + if m != nil { + return m.Proof + } + return nil +} + +// KeyPath defines a slice of keys +type KeyPath struct { + Keys []*Key `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` +} + +func (m *KeyPath) Reset() { *m = KeyPath{} } +func (*KeyPath) ProtoMessage() {} +func (*KeyPath) Descriptor() ([]byte, []int) { + return fileDescriptor_1004b8837466efb9, []int{4} +} +func (m *KeyPath) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *KeyPath) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_KeyPath.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 *KeyPath) XXX_Merge(src proto.Message) { + xxx_messageInfo_KeyPath.Merge(m, src) +} +func (m *KeyPath) XXX_Size() int { + return m.Size() +} +func (m *KeyPath) XXX_DiscardUnknown() { + xxx_messageInfo_KeyPath.DiscardUnknown(m) +} + +var xxx_messageInfo_KeyPath proto.InternalMessageInfo + +// Key defines a proof Key +type Key struct { + name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + enc KeyEncoding `protobuf:"varint,2,opt,name=enc,proto3,enum=cosmos_sdk.x.ibc.commitment.v1.KeyEncoding" json:"enc,omitempty"` +} + +func (m *Key) Reset() { *m = Key{} } +func (m *Key) String() string { return proto.CompactTextString(m) } +func (*Key) ProtoMessage() {} +func (*Key) Descriptor() ([]byte, []int) { + return fileDescriptor_1004b8837466efb9, []int{5} +} +func (m *Key) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Key) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Key.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 *Key) XXX_Merge(src proto.Message) { + xxx_messageInfo_Key.Merge(m, src) +} +func (m *Key) XXX_Size() int { + return m.Size() +} +func (m *Key) XXX_DiscardUnknown() { + xxx_messageInfo_Key.DiscardUnknown(m) +} + +var xxx_messageInfo_Key proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("cosmos_sdk.x.ibc.commitment.v1.KeyEncoding", KeyEncoding_name, KeyEncoding_value) + proto.RegisterType((*MerkleRoot)(nil), "cosmos_sdk.x.ibc.commitment.v1.MerkleRoot") + proto.RegisterType((*MerklePrefix)(nil), "cosmos_sdk.x.ibc.commitment.v1.MerklePrefix") + proto.RegisterType((*MerklePath)(nil), "cosmos_sdk.x.ibc.commitment.v1.MerklePath") + proto.RegisterType((*MerkleProof)(nil), "cosmos_sdk.x.ibc.commitment.v1.MerkleProof") + proto.RegisterType((*KeyPath)(nil), "cosmos_sdk.x.ibc.commitment.v1.KeyPath") + proto.RegisterType((*Key)(nil), "cosmos_sdk.x.ibc.commitment.v1.Key") +} + +func init() { + proto.RegisterFile("x/ibc/23-commitment/types/types.proto", fileDescriptor_1004b8837466efb9) +} + +var fileDescriptor_1004b8837466efb9 = []byte{ + // 464 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x8b, 0xd3, 0x40, + 0x14, 0xc7, 0x33, 0x36, 0xda, 0xfa, 0xba, 0xc8, 0x32, 0xa7, 0x52, 0x74, 0x52, 0x2a, 0xae, 0x55, + 0xe9, 0x0c, 0x76, 0xd1, 0x85, 0x1e, 0x0b, 0x2b, 0x8b, 0xbb, 0x42, 0x09, 0x08, 0x22, 0x42, 0x49, + 0x93, 0xd9, 0x24, 0xc4, 0x64, 0x62, 0x32, 0x4a, 0xf3, 0x0d, 0xf6, 0xe8, 0xd1, 0xe3, 0x82, 0x1e, + 0xfc, 0x28, 0x7b, 0xdc, 0xa3, 0xa7, 0x22, 0xe9, 0xc5, 0x8f, 0x21, 0x33, 0x93, 0xa5, 0x82, 0x28, + 0x7b, 0x79, 0xf3, 0x1e, 0xf9, 0xfd, 0xdf, 0xfb, 0xbf, 0xc9, 0xc0, 0x83, 0x15, 0x8b, 0x97, 0x3e, + 0x9b, 0xec, 0x8f, 0x7d, 0x91, 0xa6, 0xb1, 0x4c, 0x79, 0x26, 0x99, 0xac, 0x72, 0x5e, 0x9a, 0x48, + 0xf3, 0x42, 0x48, 0x81, 0x89, 0x2f, 0xca, 0x54, 0x94, 0x8b, 0x32, 0x48, 0xe8, 0x8a, 0xc6, 0x4b, + 0x9f, 0x6e, 0x71, 0xfa, 0xe9, 0x69, 0x7f, 0x4f, 0x46, 0x71, 0x11, 0x2c, 0x72, 0xaf, 0x90, 0x15, + 0xd3, 0x12, 0x16, 0x8a, 0x50, 0x6c, 0x33, 0xd3, 0xa7, 0x7f, 0xf0, 0x37, 0x27, 0x79, 0x16, 0xf0, + 0x22, 0x8d, 0x33, 0xc9, 0xfc, 0xa2, 0xca, 0xa5, 0x60, 0x29, 0x2f, 0x92, 0xf7, 0xbc, 0x39, 0x8c, + 0x70, 0xb8, 0x07, 0xf0, 0x4a, 0xd7, 0xae, 0x10, 0x12, 0x63, 0xb0, 0x23, 0xaf, 0x8c, 0x7a, 0x68, + 0x80, 0x46, 0x3b, 0xae, 0xce, 0xa7, 0xf6, 0xd9, 0xb9, 0x63, 0x0d, 0xc7, 0xb0, 0x63, 0xb8, 0x79, + 0xc1, 0x4f, 0xe3, 0x15, 0xbe, 0x07, 0x90, 0xf0, 0x6a, 0x91, 0xeb, 0xaa, 0xe1, 0x6f, 0x27, 0xbc, + 0x32, 0x9f, 0x87, 0xef, 0xae, 0xda, 0xce, 0x3d, 0x19, 0xe1, 0x23, 0xe8, 0x68, 0xd8, 0x93, 0xa6, + 0x75, 0x77, 0xf2, 0x90, 0xfe, 0x7f, 0x71, 0x7a, 0xcc, 0x2b, 0x25, 0x9d, 0xd9, 0x17, 0x6b, 0xc7, + 0x72, 0xdb, 0x89, 0x29, 0xa7, 0xf6, 0x17, 0x65, 0xe6, 0x25, 0x74, 0xaf, 0xcc, 0x08, 0x71, 0x8a, + 0x9f, 0xc1, 0xcd, 0x5c, 0x25, 0x4d, 0x6f, 0x87, 0x6e, 0x57, 0xa7, 0x66, 0x75, 0xda, 0xec, 0xac, + 0x79, 0xd7, 0xd0, 0x53, 0xfb, 0xd7, 0xb9, 0x83, 0x86, 0x27, 0xd0, 0x6e, 0x66, 0xe1, 0x03, 0xb0, + 0x13, 0x5e, 0x95, 0x3d, 0x34, 0x68, 0x8d, 0xba, 0x93, 0xfb, 0xd7, 0xb0, 0xe8, 0x6a, 0xc1, 0xb4, + 0xa3, 0xae, 0x48, 0x3b, 0xfb, 0x00, 0xad, 0x63, 0x5e, 0xe1, 0xbb, 0x60, 0x67, 0x5e, 0xca, 0xcd, + 0xbd, 0xcc, 0x3a, 0xf5, 0xda, 0xd1, 0xb5, 0xab, 0x23, 0x7e, 0x01, 0x2d, 0x9e, 0xf9, 0xbd, 0x1b, + 0x03, 0x34, 0xba, 0x33, 0x79, 0x72, 0x8d, 0x31, 0x87, 0x99, 0x2f, 0x82, 0x38, 0x0b, 0x67, 0xed, + 0x7a, 0xed, 0x28, 0xad, 0xab, 0x82, 0xf9, 0x33, 0x8f, 0x1f, 0x41, 0xf7, 0x0f, 0x04, 0xb7, 0xa1, + 0xf5, 0xda, 0x3d, 0xd9, 0xb5, 0x54, 0x72, 0x74, 0xf8, 0x66, 0x17, 0xf5, 0x3b, 0x67, 0x5f, 0x89, + 0xf5, 0xfd, 0x1b, 0xb1, 0x66, 0xf3, 0x8b, 0x9a, 0xa0, 0xcb, 0x9a, 0xa0, 0x9f, 0x35, 0x41, 0x9f, + 0x37, 0xc4, 0xba, 0xdc, 0x10, 0xeb, 0xc7, 0x86, 0x58, 0x6f, 0x9f, 0x87, 0xb1, 0x8c, 0x3e, 0x2e, + 0xd5, 0x68, 0x66, 0xfc, 0x34, 0xc7, 0xb8, 0x0c, 0x12, 0xf6, 0xcf, 0xb7, 0xbc, 0xbc, 0xa5, 0x5f, + 0xd1, 0xfe, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x40, 0x83, 0x81, 0xef, 0x02, 0x00, 0x00, +} + +func (this *MerkleProof) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MerkleProof) + if !ok { + that2, ok := that.(MerkleProof) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Proof.Equal(that1.Proof) { + return false + } + return true +} +func (m *MerkleRoot) 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 *MerkleRoot) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MerkleRoot) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MerklePrefix) 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 *MerklePrefix) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MerklePrefix) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.KeyPrefix) > 0 { + i -= len(m.KeyPrefix) + copy(dAtA[i:], m.KeyPrefix) + i = encodeVarintTypes(dAtA, i, uint64(len(m.KeyPrefix))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MerklePath) 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 *MerklePath) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MerklePath) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.KeyPath.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MerkleProof) 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 *MerkleProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MerkleProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Proof != nil { + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *KeyPath) 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 *KeyPath) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *KeyPath) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Keys) > 0 { + for iNdEx := len(m.Keys) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Keys[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Key) 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 *Key) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Key) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.enc != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.enc)) + i-- + dAtA[i] = 0x10 + } + if len(m.name) > 0 { + i -= len(m.name) + copy(dAtA[i:], m.name) + i = encodeVarintTypes(dAtA, i, uint64(len(m.name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MerkleRoot) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MerklePrefix) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.KeyPrefix) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MerklePath) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.KeyPath.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *MerkleProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Proof != nil { + l = m.Proof.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *KeyPath) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Keys) > 0 { + for _, e := range m.Keys { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *Key) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.name) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.enc != 0 { + n += 1 + sovTypes(uint64(m.enc)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MerkleRoot) 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 ErrIntOverflowTypes + } + 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: MerkleRoot: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MerkleRoot: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MerklePrefix) 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 ErrIntOverflowTypes + } + 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: MerklePrefix: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MerklePrefix: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyPrefix", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeyPrefix = append(m.KeyPrefix[:0], dAtA[iNdEx:postIndex]...) + if m.KeyPrefix == nil { + m.KeyPrefix = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MerklePath) 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 ErrIntOverflowTypes + } + 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: MerklePath: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MerklePath: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyPath", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.KeyPath.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MerkleProof) 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 ErrIntOverflowTypes + } + 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: MerkleProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MerkleProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proof == nil { + m.Proof = &merkle.Proof{} + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *KeyPath) 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 ErrIntOverflowTypes + } + 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: KeyPath: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyPath: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Keys = append(m.Keys, &Key{}) + if err := m.Keys[len(m.Keys)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Key) 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 ErrIntOverflowTypes + } + 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: Key: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Key: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field name", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.name = append(m.name[:0], dAtA[iNdEx:postIndex]...) + if m.name == nil { + m.name = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field enc", wireType) + } + m.enc = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.enc |= KeyEncoding(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibc/23-commitment/types/types.proto b/x/ibc/23-commitment/types/types.proto new file mode 100644 index 000000000000..f3e5f4a6672d --- /dev/null +++ b/x/ibc/23-commitment/types/types.proto @@ -0,0 +1,67 @@ +syntax = "proto3"; +package cosmos_sdk.x.ibc.commitment.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "third_party/proto/tendermint/crypto/merkle/merkle.proto"; + +// MerkleRoot defines a merkle root hash. +// In the Cosmos SDK, the AppHash of a block header becomes the root. +message MerkleRoot { + option (gogoproto.goproto_getters) = false; + + bytes hash = 1; +} + +// MerklePrefix is merkle path prefixed to the key. +// The constructed key from the Path and the key will be append(Path.KeyPath, append(Path.KeyPrefix, key...)) +message MerklePrefix { + bytes key_prefix = 1; +} + +// MerklePath is the path used to verify commitment proofs, which can be an arbitrary +// structured object (defined by a commitment type). +message MerklePath { + option (gogoproto.goproto_stringer) = false; + + KeyPath key_path = 1 [ + (gogoproto.nullable) = false + ]; +} + +// MerkleProof is a wrapper type that contains a merkle proof. +// It demonstrates membership or non-membership for an element or set of elements, +// verifiable in conjunction with a known commitment root. Proofs should be +// succinct. +message MerkleProof { + option (gogoproto.equal) = true; + + tendermint.crypto.merkle.Proof proof = 1; +} + +// KeyPath defines a slice of keys +message KeyPath { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.goproto_getters) = false; + + repeated Key keys = 1; +} + +// Key defines a proof Key +message Key { + option (gogoproto.goproto_getters) = false; + + bytes name = 1 [(gogoproto.customname) = "name"]; + KeyEncoding enc = 2 [(gogoproto.customname) = "enc"]; +} + +enum KeyEncoding { + option (gogoproto.goproto_enum_stringer) = false; + option (gogoproto.goproto_enum_prefix) = false; + + // URL encoding + URL = 0; + // Hex encoding + HEX = 1; +} \ No newline at end of file diff --git a/x/ibc/23-commitment/verify.go b/x/ibc/23-commitment/verify.go index 4690fe9e1567..a18cac3a85c4 100644 --- a/x/ibc/23-commitment/verify.go +++ b/x/ibc/23-commitment/verify.go @@ -9,7 +9,8 @@ import ( // CalculateRoot returns the application Hash at the curretn block height as a commitment // root for proof verification. func CalculateRoot(ctx sdk.Context) exported.Root { - return types.NewMerkleRoot(ctx.BlockHeader().AppHash) + root := types.NewMerkleRoot(ctx.BlockHeader().AppHash) + return &root } // BatchVerifyMembership verifies a proof that many paths have been set to diff --git a/x/ibc/ante/ante.go b/x/ibc/ante/ante.go index fa6da73ac6fd..906ed475b14c 100644 --- a/x/ibc/ante/ante.go +++ b/x/ibc/ante/ante.go @@ -34,7 +34,9 @@ func (pvr ProofVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, sim case channel.MsgPacket: _, err = pvr.channelKeeper.RecvPacket(ctx, msg.Packet, msg.Proof, msg.ProofHeight) case channel.MsgAcknowledgement: - _, err = pvr.channelKeeper.AcknowledgePacket(ctx, msg.Packet, msg.Acknowledgement, msg.Proof, msg.ProofHeight) + _, err = pvr.channelKeeper.AcknowledgePacket( + ctx, msg.Packet, msg.Acknowledgement, msg.Proof, msg.ProofHeight, + ) case channel.MsgTimeout: _, err = pvr.channelKeeper.TimeoutPacket(ctx, msg.Packet, msg.Proof, msg.ProofHeight, msg.NextSequenceRecv) } diff --git a/x/ibc/ante/ante_test.go b/x/ibc/ante/ante_test.go index 85c26d8f7ca7..069e96e996df 100644 --- a/x/ibc/ante/ante_test.go +++ b/x/ibc/ante/ante_test.go @@ -15,10 +15,8 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported" connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel" - channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types" "github.com/cosmos/cosmos-sdk/x/staking" @@ -58,8 +56,8 @@ func (suite *HandlerTestSuite) SetupTest() { // create client and connection during setups suite.chainA.CreateClient(suite.chainB) suite.chainB.CreateClient(suite.chainA) - suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, connectionexported.OPEN) - suite.chainB.createConnection(testConnection, testConnection, testClientIDA, testClientIDB, connectionexported.OPEN) + suite.chainA.createConnection(testConnection, testConnection, testClientIDB, testClientIDA, ibctypes.OPEN) + suite.chainB.createConnection(testConnection, testConnection, testClientIDA, testClientIDB, ibctypes.OPEN) } func queryProof(chain *TestChain, key string) (proof commitmenttypes.MerkleProof, height int64) { @@ -95,12 +93,12 @@ func (suite *HandlerTestSuite) TestHandleMsgPacketOrdered() { cctx, _ := ctx.CacheContext() // suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(ctx, packet.SourcePort, packet.SourceChannel, 1) suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), packet.SourcePort, packet.SourceChannel, packet.Sequence, channeltypes.CommitPacket(packet)) - msg := channel.NewMsgPacket(packet, nil, 0, addr1) + msg := channel.NewMsgPacket(packet, commitmenttypes.MerkleProof{}, 0, addr1) _, err := handler(cctx, suite.newTx(msg), false) suite.Error(err, "%+v", err) // channel does not exist - suite.chainA.createChannel(cpportid, cpchanid, portid, chanid, channelexported.OPEN, channelexported.ORDERED, testConnection) - suite.chainB.createChannel(portid, chanid, cpportid, cpchanid, channelexported.OPEN, channelexported.ORDERED, testConnection) + suite.chainA.createChannel(cpportid, cpchanid, portid, chanid, ibctypes.OPEN, ibctypes.ORDERED, testConnection) + suite.chainB.createChannel(portid, chanid, cpportid, cpchanid, ibctypes.OPEN, ibctypes.ORDERED, testConnection) ctx = suite.chainA.GetContext() packetCommitmentPath := ibctypes.PacketCommitmentPath(packet.SourcePort, packet.SourceChannel, packet.Sequence) proof, proofHeight := queryProof(suite.chainB, packetCommitmentPath) @@ -111,7 +109,7 @@ func (suite *HandlerTestSuite) TestHandleMsgPacketOrdered() { suite.chainA.updateClient(suite.chainB) // // commit chainA to flush to IAVL so we can get proof // suite.chainA.App.Commit() - // suite.chainA.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.chainA.App.LastBlockHeight() + 1, Time: suite.chainA.Header.Time}}) + // suite.chainA.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.chainA.App.LastBlockHeight() + 1, Time: suite.chainA.Header.GetTime()}}) // ctx = suite.chainA.GetContext() proof, proofHeight = queryProof(suite.chainB, packetCommitmentPath) @@ -154,7 +152,7 @@ func (suite *HandlerTestSuite) TestHandleMsgPacketUnordered() { // suite.chainA.App.IBCKeeper.ChannelKeeper.SetNextSequenceSend(suite.chainA.GetContext(), packet.SourcePort, packet.SourceChannel, uint64(10)) - suite.chainA.createChannel(cpportid, cpchanid, portid, chanid, channelexported.OPEN, channelexported.UNORDERED, testConnection) + suite.chainA.createChannel(cpportid, cpchanid, portid, chanid, ibctypes.OPEN, ibctypes.UNORDERED, testConnection) suite.chainA.updateClient(suite.chainB) @@ -212,7 +210,7 @@ func NewTestChain(clientID string) *TestChain { // Creates simple context for testing purposes func (chain *TestChain) GetContext() sdk.Context { - return chain.App.BaseApp.NewContext(false, tmproto.Header{ChainID: chain.Header.ChainID, Height: chain.Header.Height}) + return chain.App.BaseApp.NewContext(false, tmproto.Header{ChainID: chain.Header.SignedHeader.Header.ChainID, Height: int64(chain.Header.GetHeight())}) } // createClient will create a client for clientChain on targetChain @@ -221,7 +219,7 @@ func (chain *TestChain) CreateClient(client *TestChain) error { // Commit and create a new block on appTarget to get a fresh CommitID client.App.Commit() commitID := client.App.LastCommitID() - client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.Height, Time: client.Header.Time}}) + client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: int64(client.Header.GetHeight()), Time: client.Header.GetTime()}}) // Set HistoricalInfo on client chain after Commit ctxClient := client.GetContext() @@ -237,7 +235,7 @@ func (chain *TestChain) CreateClient(client *TestChain) error { }, Valset: validators, } - client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.Height, histInfo) + client.App.StakingKeeper.SetHistoricalInfo(ctxClient, int64(client.Header.GetHeight()), histInfo) // Create target ctx ctxTarget := chain.GetContext() @@ -282,7 +280,7 @@ func (chain *TestChain) updateClient(client *TestChain) { commitID := client.App.LastCommitID() client.Header = nextHeader(client) - client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: client.Header.Height, Time: client.Header.Time}}) + client.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: int64(client.Header.GetHeight()), Time: client.Header.GetTime()}}) // Set HistoricalInfo on client chain after Commit ctxClient := client.GetContext() @@ -298,17 +296,22 @@ func (chain *TestChain) updateClient(client *TestChain) { }, Valset: validators, } - client.App.StakingKeeper.SetHistoricalInfo(ctxClient, client.Header.Height, histInfo) + client.App.StakingKeeper.SetHistoricalInfo(ctxClient, int64(client.Header.GetHeight()), histInfo) + + protoValset, err := client.Vals.ToProto() + if err != nil { + panic(err) + } consensusState := ibctmtypes.ConsensusState{ - Height: uint64(client.Header.Height) - 1, - Timestamp: client.Header.Time, + Height: client.Header.GetHeight() - 1, + Timestamp: client.Header.GetTime(), Root: commitmenttypes.NewMerkleRoot(commitID.Hash), - ValidatorSet: client.Vals, + ValidatorSet: protoValset, } chain.App.IBCKeeper.ClientKeeper.SetClientConsensusState( - ctxTarget, client.ClientID, uint64(client.Header.Height-1), consensusState, + ctxTarget, client.ClientID, client.Header.GetHeight()-1, consensusState, ) chain.App.IBCKeeper.ClientKeeper.SetClientState( ctxTarget, ibctmtypes.NewClientState(client.ClientID, trustingPeriod, ubdPeriod, maxClockDrift, client.Header), @@ -329,9 +332,9 @@ func (chain *TestChain) updateClient(client *TestChain) { func (chain *TestChain) createConnection( connID, counterpartyConnID, clientID, counterpartyClientID string, - state connectionexported.State, + state ibctypes.State, ) connectiontypes.ConnectionEnd { - counterparty := connectiontypes.NewCounterparty(counterpartyClientID, counterpartyConnID, chain.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix()) + counterparty := connectiontypes.NewCounterparty(counterpartyClientID, counterpartyConnID, commitmenttypes.NewMerklePrefix(chain.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes())) connection := connectiontypes.ConnectionEnd{ State: state, ClientID: clientID, @@ -345,7 +348,7 @@ func (chain *TestChain) createConnection( func (chain *TestChain) createChannel( portID, channelID, counterpartyPortID, counterpartyChannelID string, - state channelexported.State, order channelexported.Order, connectionID string, + state ibctypes.State, order ibctypes.Order, connectionID string, ) channeltypes.Channel { counterparty := channeltypes.NewCounterparty(counterpartyPortID, counterpartyChannelID) channel := channeltypes.NewChannel(state, order, counterparty, @@ -358,8 +361,10 @@ func (chain *TestChain) createChannel( } func nextHeader(chain *TestChain) ibctmtypes.Header { - return ibctmtypes.CreateTestHeader(chain.Header.ChainID, chain.Header.Height+1, - chain.Header.Time.Add(time.Minute), chain.Vals, chain.Signers) + return ibctmtypes.CreateTestHeader( + chain.Header.SignedHeader.Header.ChainID, int64(chain.Header.GetHeight())+1, + chain.Header.GetTime().Add(time.Minute), chain.Vals, chain.Signers, + ) } type packetT struct { diff --git a/x/ibc/types/types.pb.go b/x/ibc/types/types.pb.go new file mode 100644 index 000000000000..2e626c14cf53 --- /dev/null +++ b/x/ibc/types/types.pb.go @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/ibc/types/types.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Order defines if a channel is ORDERED or UNORDERED +type Order int32 + +const ( + // zero-value for channel ordering + NONE Order = 0 + // packets can be delivered in any order, which may differ from the order in which they were sent. + UNORDERED Order = 1 + // packets are delivered exactly in the order which they were sent + ORDERED Order = 2 +) + +var Order_name = map[int32]string{ + 0: "NONE", + 1: "UNORDERED", + 2: "ORDERED", +} + +var Order_value = map[string]int32{ + "NONE": 0, + "UNORDERED": 1, + "ORDERED": 2, +} + +func (x Order) String() string { + return proto.EnumName(Order_name, int32(x)) +} + +func (Order) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_cc2eab1776b9fb6e, []int{0} +} + +// State defines if a channel or connection is in one of the following states: +// CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. +type State int32 + +const ( + // Default State + UNINITIALIZED State = 0 + // A channel or connection end has just started the opening handshake. + INIT State = 1 + // A channel or connection end has acknowledged the handshake step on the counterparty chain. + TRYOPEN State = 2 + // A channel or connection end has completed the handshake. Open channels are + // ready to send and receive packets. + OPEN State = 3 + // A channel end has been closed and can no longer be used to send or receive packets. + CLOSED State = 4 +) + +var State_name = map[int32]string{ + 0: "UNINITIALIZED", + 1: "INIT", + 2: "TRYOPEN", + 3: "OPEN", + 4: "CLOSED", +} + +var State_value = map[string]int32{ + "UNINITIALIZED": 0, + "INIT": 1, + "TRYOPEN": 2, + "OPEN": 3, + "CLOSED": 4, +} + +func (x State) String() string { + return proto.EnumName(State_name, int32(x)) +} + +func (State) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_cc2eab1776b9fb6e, []int{1} +} + +func init() { + proto.RegisterEnum("cosmos_sdk.x.ibc.v1.Order", Order_name, Order_value) + proto.RegisterEnum("cosmos_sdk.x.ibc.v1.State", State_name, State_value) +} + +func init() { proto.RegisterFile("x/ibc/types/types.proto", fileDescriptor_cc2eab1776b9fb6e) } + +var fileDescriptor_cc2eab1776b9fb6e = []byte{ + // 256 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xaf, 0xd0, 0xcf, 0x4c, + 0x4a, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0x86, 0x90, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, + 0xc2, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0xc5, 0x29, 0xd9, 0x7a, 0x15, 0x7a, 0x99, 0x49, + 0xc9, 0x7a, 0x65, 0x86, 0x52, 0x6a, 0x25, 0x19, 0x99, 0x45, 0x29, 0xf1, 0x05, 0x89, 0x45, 0x25, + 0x95, 0xfa, 0x60, 0x75, 0xfa, 0xe9, 0xf9, 0xe9, 0xf9, 0x08, 0x16, 0x44, 0xb3, 0x96, 0x31, 0x17, + 0xab, 0x7f, 0x51, 0x4a, 0x6a, 0x91, 0x10, 0x07, 0x17, 0x8b, 0x9f, 0xbf, 0x9f, 0xab, 0x00, 0x83, + 0x10, 0x2f, 0x17, 0x67, 0xa8, 0x9f, 0x7f, 0x90, 0x8b, 0x6b, 0x90, 0xab, 0x8b, 0x00, 0xa3, 0x10, + 0x37, 0x17, 0x3b, 0x8c, 0xc3, 0x24, 0xc5, 0xd2, 0xb1, 0x58, 0x8e, 0x41, 0xcb, 0x97, 0x8b, 0x35, + 0xb8, 0x24, 0xb1, 0x24, 0x55, 0x48, 0x90, 0x8b, 0x37, 0xd4, 0xcf, 0xd3, 0xcf, 0x33, 0xc4, 0xd3, + 0xd1, 0xc7, 0x33, 0xca, 0xd5, 0x45, 0x80, 0x01, 0x64, 0x0e, 0x48, 0x00, 0xa2, 0x31, 0x24, 0x28, + 0xd2, 0x3f, 0xc0, 0xd5, 0x4f, 0x80, 0x09, 0x24, 0x0c, 0x66, 0x31, 0x0b, 0x71, 0x71, 0xb1, 0x39, + 0xfb, 0xf8, 0x07, 0xbb, 0xba, 0x08, 0xb0, 0x40, 0x8c, 0x73, 0x72, 0x3a, 0xf1, 0x48, 0x8e, 0xf1, + 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, + 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x8d, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, + 0x5c, 0x7d, 0x88, 0x2f, 0xa1, 0x94, 0x6e, 0x71, 0x4a, 0xb6, 0x3e, 0x52, 0x80, 0x24, 0xb1, 0x81, + 0xbd, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xba, 0x54, 0x55, 0xd5, 0x26, 0x01, 0x00, 0x00, +} diff --git a/x/ibc/types/types.proto b/x/ibc/types/types.proto new file mode 100644 index 000000000000..dc7e750b4195 --- /dev/null +++ b/x/ibc/types/types.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +package cosmos_sdk.x.ibc.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/types"; + +import "third_party/proto/gogoproto/gogo.proto"; + +// Order defines if a channel is ORDERED or UNORDERED +enum Order { + option (gogoproto.goproto_enum_prefix) = false; + + // zero-value for channel ordering + NONE = 0; + // packets can be delivered in any order, which may differ from the order in which they were sent. + UNORDERED = 1; + // packets are delivered exactly in the order which they were sent + ORDERED = 2; +} + +// State defines if a channel or connection is in one of the following states: +// CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. +enum State { + option (gogoproto.goproto_enum_prefix) = false; + + // Default State + UNINITIALIZED = 0; + // A channel or connection end has just started the opening handshake. + INIT = 1; + // A channel or connection end has acknowledged the handshake step on the counterparty chain. + TRYOPEN = 2; + // A channel or connection end has completed the handshake. Open channels are + // ready to send and receive packets. + OPEN = 3; + // A channel end has been closed and can no longer be used to send or receive packets. + CLOSED = 4; +} \ No newline at end of file