Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamline Msg trait and rename to ToProto #995

Merged
merged 9 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[ibc-primitives]` streamline `Msg` trait and rename to `ToProto`
([#993](https://github.com/cosmos/ibc-rs/issues/993))
10 changes: 1 addition & 9 deletions ibc-apps/ics20-transfer/types/src/msgs/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ibc_core::channel::types::timeout::TimeoutHeight;
use ibc_core::handler::types::error::ContextError;
use ibc_core::host::types::identifiers::{ChannelId, PortId};
use ibc_core::primitives::prelude::*;
use ibc_core::primitives::{Msg, Timestamp};
use ibc_core::primitives::Timestamp;
use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::applications::transfer::v1::MsgTransfer as RawMsgTransfer;
use ibc_proto::Protobuf;
Expand Down Expand Up @@ -47,14 +47,6 @@ pub struct MsgTransfer {
pub timeout_timestamp_on_b: Timestamp,
}

impl Msg for MsgTransfer {
type Raw = RawMsgTransfer;

fn type_url(&self) -> String {
TYPE_URL.to_string()
}
}

impl TryFrom<RawMsgTransfer> for MsgTransfer {
type Error = TokenTransferError;

Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics02-client/types/src/msgs/create_client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Definition of domain type message `MsgCreateClient`.

use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::core::client::v1::MsgCreateClient as RawMsgCreateClient;
use ibc_proto::Protobuf;
Expand Down Expand Up @@ -33,14 +33,6 @@ impl MsgCreateClient {
}
}

impl Msg for MsgCreateClient {
type Raw = RawMsgCreateClient;

fn type_url(&self) -> String {
CREATE_CLIENT_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgCreateClient> for MsgCreateClient {}

impl TryFrom<RawMsgCreateClient> for MsgCreateClient {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics02-client/types/src/msgs/misbehaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use ibc_core_host_types::identifiers::ClientId;
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::google::protobuf::Any as ProtoAny;
use ibc_proto::ibc::core::client::v1::MsgSubmitMisbehaviour as RawMsgSubmitMisbehaviour;
use ibc_proto::Protobuf;
Expand All @@ -27,14 +27,6 @@ pub struct MsgSubmitMisbehaviour {
pub signer: Signer,
}

impl Msg for MsgSubmitMisbehaviour {
type Raw = RawMsgSubmitMisbehaviour;

fn type_url(&self) -> String {
SUBMIT_MISBEHAVIOUR_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgSubmitMisbehaviour> for MsgSubmitMisbehaviour {}

impl TryFrom<RawMsgSubmitMisbehaviour> for MsgSubmitMisbehaviour {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics02-client/types/src/msgs/update_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use ibc_core_host_types::identifiers::ClientId;
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::core::client::v1::MsgUpdateClient as RawMsgUpdateClient;
use ibc_proto::Protobuf;
Expand All @@ -27,14 +27,6 @@ pub struct MsgUpdateClient {
pub signer: Signer,
}

impl Msg for MsgUpdateClient {
type Raw = RawMsgUpdateClient;

fn type_url(&self) -> String {
UPDATE_CLIENT_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgUpdateClient> for MsgUpdateClient {}

impl TryFrom<RawMsgUpdateClient> for MsgUpdateClient {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics02-client/types/src/msgs/upgrade_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use ibc_core_commitment_types::commitment::CommitmentProofBytes;
use ibc_core_commitment_types::error::CommitmentError;
use ibc_core_host_types::identifiers::ClientId;
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::core::client::v1::MsgUpgradeClient as RawMsgUpgradeClient;
use ibc_proto::Protobuf;
Expand Down Expand Up @@ -38,14 +38,6 @@ pub struct MsgUpgradeClient {
pub signer: Signer,
}

impl Msg for MsgUpgradeClient {
type Raw = RawMsgUpgradeClient;

fn type_url(&self) -> String {
UPGRADE_CLIENT_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgUpgradeClient> for MsgUpgradeClient {}

impl From<MsgUpgradeClient> for RawMsgUpgradeClient {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics03-connection/types/src/msgs/conn_open_ack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ibc_core_client_types::Height;
use ibc_core_commitment_types::commitment::CommitmentProofBytes;
use ibc_core_host_types::identifiers::ConnectionId;
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenAck as RawMsgConnectionOpenAck;
use ibc_proto::Protobuf;
Expand Down Expand Up @@ -44,14 +44,6 @@ pub struct MsgConnectionOpenAck {
pub proof_consensus_state_of_a: Option<CommitmentProofBytes>,
}

impl Msg for MsgConnectionOpenAck {
type Raw = RawMsgConnectionOpenAck;

fn type_url(&self) -> String {
CONN_OPEN_ACK_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgConnectionOpenAck> for MsgConnectionOpenAck {}

impl TryFrom<RawMsgConnectionOpenAck> for MsgConnectionOpenAck {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics03-connection/types/src/msgs/conn_open_confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ibc_core_client_types::Height;
use ibc_core_commitment_types::commitment::CommitmentProofBytes;
use ibc_core_host_types::identifiers::ConnectionId;
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenConfirm as RawMsgConnectionOpenConfirm;
use ibc_proto::Protobuf;

Expand All @@ -28,14 +28,6 @@ pub struct MsgConnectionOpenConfirm {
pub signer: Signer,
}

impl Msg for MsgConnectionOpenConfirm {
type Raw = RawMsgConnectionOpenConfirm;

fn type_url(&self) -> String {
CONN_OPEN_CONFIRM_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgConnectionOpenConfirm> for MsgConnectionOpenConfirm {}

impl TryFrom<RawMsgConnectionOpenConfirm> for MsgConnectionOpenConfirm {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics03-connection/types/src/msgs/conn_open_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::time::Duration;

use ibc_core_host_types::identifiers::ClientId;
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenInit as RawMsgConnectionOpenInit;
use ibc_proto::Protobuf;

Expand All @@ -25,14 +25,6 @@ pub struct MsgConnectionOpenInit {
pub signer: Signer,
}

impl Msg for MsgConnectionOpenInit {
type Raw = RawMsgConnectionOpenInit;

fn type_url(&self) -> String {
CONN_OPEN_INIT_TYPE_URL.to_string()
}
}

/// This module encapsulates the workarounds we need to do to implement
/// `BorshSerialize` and `BorshDeserialize` on `MsgConnectionOpenInit`
#[cfg(feature = "borsh")]
Expand Down
9 changes: 1 addition & 8 deletions ibc-core/ics03-connection/types/src/msgs/conn_open_try.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ibc_core_client_types::Height;
use ibc_core_commitment_types::commitment::CommitmentProofBytes;
use ibc_core_host_types::identifiers::ClientId;
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenTry as RawMsgConnectionOpenTry;
use ibc_proto::Protobuf;
Expand Down Expand Up @@ -50,13 +50,6 @@ pub struct MsgConnectionOpenTry {
pub previous_connection_id: String,
}

impl Msg for MsgConnectionOpenTry {
type Raw = RawMsgConnectionOpenTry;

fn type_url(&self) -> String {
CONN_OPEN_TRY_TYPE_URL.to_string()
}
}
#[allow(deprecated)]
#[cfg(feature = "borsh")]
mod borsh_impls {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics04-channel/types/src/msgs/acknowledgement.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ibc_core_client_types::Height;
use ibc_core_commitment_types::commitment::CommitmentProofBytes;
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::ibc::core::channel::v1::MsgAcknowledgement as RawMsgAcknowledgement;
use ibc_proto::Protobuf;

Expand Down Expand Up @@ -30,14 +30,6 @@ pub struct MsgAcknowledgement {
pub signer: Signer,
}

impl Msg for MsgAcknowledgement {
type Raw = RawMsgAcknowledgement;

fn type_url(&self) -> String {
ACKNOWLEDGEMENT_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgAcknowledgement> for MsgAcknowledgement {}

impl TryFrom<RawMsgAcknowledgement> for MsgAcknowledgement {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics04-channel/types/src/msgs/chan_close_confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ibc_core_client_types::Height;
use ibc_core_commitment_types::commitment::CommitmentProofBytes;
use ibc_core_host_types::identifiers::{ChannelId, PortId};
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::ibc::core::channel::v1::MsgChannelCloseConfirm as RawMsgChannelCloseConfirm;
use ibc_proto::Protobuf;

Expand All @@ -29,14 +29,6 @@ pub struct MsgChannelCloseConfirm {
pub signer: Signer,
}

impl Msg for MsgChannelCloseConfirm {
type Raw = RawMsgChannelCloseConfirm;

fn type_url(&self) -> String {
CHAN_CLOSE_CONFIRM_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgChannelCloseConfirm> for MsgChannelCloseConfirm {}

impl TryFrom<RawMsgChannelCloseConfirm> for MsgChannelCloseConfirm {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics04-channel/types/src/msgs/chan_close_init.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ibc_core_host_types::identifiers::{ChannelId, PortId};
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::ibc::core::channel::v1::MsgChannelCloseInit as RawMsgChannelCloseInit;
use ibc_proto::Protobuf;

Expand All @@ -24,14 +24,6 @@ pub struct MsgChannelCloseInit {
pub signer: Signer,
}

impl Msg for MsgChannelCloseInit {
type Raw = RawMsgChannelCloseInit;

fn type_url(&self) -> String {
CHAN_CLOSE_INIT_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgChannelCloseInit> for MsgChannelCloseInit {}

impl TryFrom<RawMsgChannelCloseInit> for MsgChannelCloseInit {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics04-channel/types/src/msgs/chan_open_ack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ibc_core_client_types::Height;
use ibc_core_commitment_types::commitment::CommitmentProofBytes;
use ibc_core_host_types::identifiers::{ChannelId, PortId};
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::ibc::core::channel::v1::MsgChannelOpenAck as RawMsgChannelOpenAck;
use ibc_proto::Protobuf;

Expand Down Expand Up @@ -30,14 +30,6 @@ pub struct MsgChannelOpenAck {
pub signer: Signer,
}

impl Msg for MsgChannelOpenAck {
type Raw = RawMsgChannelOpenAck;

fn type_url(&self) -> String {
CHAN_OPEN_ACK_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgChannelOpenAck> for MsgChannelOpenAck {}

impl TryFrom<RawMsgChannelOpenAck> for MsgChannelOpenAck {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics04-channel/types/src/msgs/chan_open_confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ibc_core_client_types::Height;
use ibc_core_commitment_types::commitment::CommitmentProofBytes;
use ibc_core_host_types::identifiers::{ChannelId, PortId};
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::ibc::core::channel::v1::MsgChannelOpenConfirm as RawMsgChannelOpenConfirm;
use ibc_proto::Protobuf;

Expand All @@ -29,14 +29,6 @@ pub struct MsgChannelOpenConfirm {
pub signer: Signer,
}

impl Msg for MsgChannelOpenConfirm {
type Raw = RawMsgChannelOpenConfirm;

fn type_url(&self) -> String {
CHAN_OPEN_CONFIRM_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgChannelOpenConfirm> for MsgChannelOpenConfirm {}

impl TryFrom<RawMsgChannelOpenConfirm> for MsgChannelOpenConfirm {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics04-channel/types/src/msgs/chan_open_init.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ibc_core_host_types::identifiers::{ConnectionId, PortId};
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::ibc::core::channel::v1::MsgChannelOpenInit as RawMsgChannelOpenInit;
use ibc_proto::Protobuf;

Expand Down Expand Up @@ -39,14 +39,6 @@ impl MsgChannelOpenInit {
}
}

impl Msg for MsgChannelOpenInit {
type Raw = RawMsgChannelOpenInit;

fn type_url(&self) -> String {
CHAN_OPEN_INIT_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgChannelOpenInit> for MsgChannelOpenInit {}

impl TryFrom<RawMsgChannelOpenInit> for MsgChannelOpenInit {
Expand Down
10 changes: 1 addition & 9 deletions ibc-core/ics04-channel/types/src/msgs/chan_open_try.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ibc_core_client_types::Height;
use ibc_core_commitment_types::commitment::CommitmentProofBytes;
use ibc_core_host_types::identifiers::{ChannelId, ConnectionId, PortId};
use ibc_primitives::prelude::*;
use ibc_primitives::{Msg, Signer};
use ibc_primitives::Signer;
use ibc_proto::ibc::core::channel::v1::MsgChannelOpenTry as RawMsgChannelOpenTry;
use ibc_proto::Protobuf;

Expand Down Expand Up @@ -47,14 +47,6 @@ impl MsgChannelOpenTry {
}
}

impl Msg for MsgChannelOpenTry {
type Raw = RawMsgChannelOpenTry;

fn type_url(&self) -> String {
CHAN_OPEN_TRY_TYPE_URL.to_string()
}
}

impl Protobuf<RawMsgChannelOpenTry> for MsgChannelOpenTry {}

impl TryFrom<RawMsgChannelOpenTry> for MsgChannelOpenTry {
Expand Down
Loading
Loading