From 30c7b70532f5a379d1b8ca45e11cbf80cfe3e1e5 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Wed, 18 Nov 2020 13:02:20 -0600 Subject: [PATCH] fix: upgrade the proto definitions --- .../proto/ibc/core/channel/v1/channel.proto | 148 +----------------- .../proto/ibc/core/client/v1/client.proto | 62 +------- .../cosmic-swingset/x/swingset/genesis.go | 5 +- .../cosmic-swingset/x/swingset/handler.go | 2 +- 4 files changed, 16 insertions(+), 201 deletions(-) diff --git a/packages/cosmic-swingset/third_party/proto/ibc/core/channel/v1/channel.proto b/packages/cosmic-swingset/third_party/proto/ibc/core/channel/v1/channel.proto index 342f4d32e72..302a4806895 100644 --- a/packages/cosmic-swingset/third_party/proto/ibc/core/channel/v1/channel.proto +++ b/packages/cosmic-swingset/third_party/proto/ibc/core/channel/v1/channel.proto @@ -6,142 +6,6 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/client.proto"; -// MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It -// is called by a relayer on Chain A. -message MsgChannelOpenInit { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - Channel channel = 3 [(gogoproto.nullable) = false]; - string signer = 4; -} - -// MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel -// on Chain B. -message MsgChannelOpenTry { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string desired_channel_id = 2 [(gogoproto.moretags) = "yaml:\"desired_channel_id\""]; - string counterparty_chosen_channel_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_chosen_channel_id\""]; - Channel channel = 4 [(gogoproto.nullable) = false]; - string counterparty_version = 5 [(gogoproto.moretags) = "yaml:\"counterparty_version\""]; - bytes proof_init = 6 [(gogoproto.moretags) = "yaml:\"proof_init\""]; - ibc.core.client.v1.Height proof_height = 7 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 8; -} - -// MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge -// the change of channel state to TRYOPEN on Chain B. -message MsgChannelOpenAck { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - string counterparty_channel_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_channel_id\""]; - string counterparty_version = 4 [(gogoproto.moretags) = "yaml:\"counterparty_version\""]; - bytes proof_try = 5 [(gogoproto.moretags) = "yaml:\"proof_try\""]; - ibc.core.client.v1.Height proof_height = 6 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 7; -} - -// MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to -// acknowledge the change of channel state to OPEN on Chain A. -message MsgChannelOpenConfirm { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - bytes proof_ack = 3 [(gogoproto.moretags) = "yaml:\"proof_ack\""]; - ibc.core.client.v1.Height proof_height = 4 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 5; -} - -// MsgChannelCloseInit defines a msg sent by a Relayer to Chain A -// to close a channel with Chain B. -message MsgChannelCloseInit { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - string signer = 3; -} - -// MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B -// to acknowledge the change of channel state to CLOSED on Chain A. -message MsgChannelCloseConfirm { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - bytes proof_init = 3 [(gogoproto.moretags) = "yaml:\"proof_init\""]; - ibc.core.client.v1.Height proof_height = 4 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 5; -} - -// MsgRecvPacket receives incoming IBC packet -message MsgRecvPacket { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - Packet packet = 1 [(gogoproto.nullable) = false]; - bytes proof = 2; - ibc.core.client.v1.Height proof_height = 3 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 4; -} - -// MsgTimeout receives timed-out packet -message MsgTimeout { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - Packet packet = 1 [(gogoproto.nullable) = false]; - bytes proof = 2; - ibc.core.client.v1.Height proof_height = 3 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - uint64 next_sequence_recv = 4 [(gogoproto.moretags) = "yaml:\"next_sequence_recv\""]; - string signer = 5; -} - -// MsgTimeoutOnClose timed-out packet upon counterparty channel closure. -message MsgTimeoutOnClose { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - Packet packet = 1 [(gogoproto.nullable) = false]; - bytes proof = 2; - bytes proof_close = 3 [(gogoproto.moretags) = "yaml:\"proof_close\""]; - ibc.core.client.v1.Height proof_height = 4 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - uint64 next_sequence_recv = 5 [(gogoproto.moretags) = "yaml:\"next_sequence_recv\""]; - string signer = 6; -} - -// MsgAcknowledgement receives incoming IBC acknowledgement -message MsgAcknowledgement { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - Packet packet = 1 [(gogoproto.nullable) = false]; - bytes acknowledgement = 2; - bytes proof = 3; - ibc.core.client.v1.Height proof_height = 4 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 5; -} - // 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. @@ -250,9 +114,11 @@ message Packet { uint64 timeout_timestamp = 8 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""]; } -// PacketAckCommitment defines the genesis type necessary to retrieve and store -// acknowlegements. -message PacketAckCommitment { +// PacketState defines the generic type necessary to retrieve and store +// packet commitments, acknowledgements, and receipts. +// Caller is responsible for knowing the context necessary to interpret this +// state as a commitment, acknowledgement, or a receipt. +message PacketState { option (gogoproto.goproto_getters) = false; // channel port identifier. @@ -261,8 +127,8 @@ message PacketAckCommitment { string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; // packet sequence. uint64 sequence = 3; - // packet commitment hash. - bytes hash = 4; + // embedded data that represents packet state. + bytes data = 4; } // Acknowledgement is the recommended acknowledgement format to be used by diff --git a/packages/cosmic-swingset/third_party/proto/ibc/core/client/v1/client.proto b/packages/cosmic-swingset/third_party/proto/ibc/core/client/v1/client.proto index f6241439b8b..a5d2b0f19e7 100644 --- a/packages/cosmic-swingset/third_party/proto/ibc/core/client/v1/client.proto +++ b/packages/cosmic-swingset/third_party/proto/ibc/core/client/v1/client.proto @@ -48,62 +48,6 @@ message ClientUpdateProposal { google.protobuf.Any header = 4; } -// MsgCreateClient defines a message to create an IBC client -message MsgCreateClient { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; - // light client state - google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; - // consensus state associated with the client that corresponds to a given - // height. - google.protobuf.Any consensus_state = 3 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; - // signer address - string signer = 4; -} - -// MsgUpdateClient defines an sdk.Msg to update a IBC client state using -// the given header. -message MsgUpdateClient { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; - // header to update the light client - google.protobuf.Any header = 2; - // signer address - string signer = 3; -} - -// MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client state -message MsgUpgradeClient { - // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; - // upgraded client state - google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; - // proof that old chain committed to new client - bytes proof_upgrade = 3 [(gogoproto.moretags) = "yaml:\"proof_upgrade\""]; - // signer address - string signer = 4; -} - -// MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for -// light client misbehaviour. -message MsgSubmitMisbehaviour { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; - // misbehaviour used for freezing the light client - google.protobuf.Any misbehaviour = 2; - // signer address - string signer = 3; -} - // Height is a monotonically increasing data type // that can be compared against another Height for the purposes of updating and // freezing clients @@ -122,3 +66,9 @@ message Height { // the height within the given version uint64 version_height = 2 [(gogoproto.moretags) = "yaml:\"version_height\""]; } + +// Params defines the set of IBC light client parameters. +message Params { + // allowed_clients defines the list of allowed client state types. + repeated string allowed_clients = 1 [(gogoproto.moretags) = "yaml:\"allowed_clients\""]; +} diff --git a/packages/cosmic-swingset/x/swingset/genesis.go b/packages/cosmic-swingset/x/swingset/genesis.go index fc0b134f94e..3a8188d6dca 100644 --- a/packages/cosmic-swingset/x/swingset/genesis.go +++ b/packages/cosmic-swingset/x/swingset/genesis.go @@ -19,9 +19,8 @@ func ValidateGenesis(data *types.GenesisState) error { } func DefaultGenesisState() *types.GenesisState { - return &types.GenesisState{ - Storage: make(map[string]string), - } + gs := NewGenesisState() + return gs } func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) []abci.ValidatorUpdate { diff --git a/packages/cosmic-swingset/x/swingset/handler.go b/packages/cosmic-swingset/x/swingset/handler.go index bcac31fdd7d..2a400477a94 100644 --- a/packages/cosmic-swingset/x/swingset/handler.go +++ b/packages/cosmic-swingset/x/swingset/handler.go @@ -139,7 +139,7 @@ func handleMsgSendPacket(ctx sdk.Context, keeper Keeper, msg *MsgSendPacket) (*s type provisionAction struct { *MsgProvision - Type string `json:"type"` // IBC_EVENT + Type string `json:"type"` // PLEASE_PROVISION BlockHeight int64 `json:"blockHeight"` BlockTime int64 `json:"blockTime"` }