pub trait Module: Debug {
Show 17 methods
// Required methods
fn on_chan_open_init_validate(
&self,
order: Order,
connection_hops: &[ConnectionId],
port_id: &PortId,
channel_id: &ChannelId,
counterparty: &Counterparty,
version: &Version,
) -> Result<Version, ChannelError>;
fn on_chan_open_init_execute(
&mut self,
order: Order,
connection_hops: &[ConnectionId],
port_id: &PortId,
channel_id: &ChannelId,
counterparty: &Counterparty,
version: &Version,
) -> Result<(ModuleExtras, Version), ChannelError>;
fn on_chan_open_try_validate(
&self,
order: Order,
connection_hops: &[ConnectionId],
port_id: &PortId,
channel_id: &ChannelId,
counterparty: &Counterparty,
counterparty_version: &Version,
) -> Result<Version, ChannelError>;
fn on_chan_open_try_execute(
&mut self,
order: Order,
connection_hops: &[ConnectionId],
port_id: &PortId,
channel_id: &ChannelId,
counterparty: &Counterparty,
counterparty_version: &Version,
) -> Result<(ModuleExtras, Version), ChannelError>;
fn on_recv_packet_execute(
&mut self,
packet: &Packet,
relayer: &Signer,
) -> (ModuleExtras, Option<Acknowledgement>);
fn on_acknowledgement_packet_validate(
&self,
_packet: &Packet,
_acknowledgement: &Acknowledgement,
_relayer: &Signer,
) -> Result<(), ChannelError>;
fn on_acknowledgement_packet_execute(
&mut self,
_packet: &Packet,
_acknowledgement: &Acknowledgement,
_relayer: &Signer,
) -> (ModuleExtras, Result<(), ChannelError>);
fn on_timeout_packet_validate(
&self,
packet: &Packet,
relayer: &Signer,
) -> Result<(), ChannelError>;
fn on_timeout_packet_execute(
&mut self,
packet: &Packet,
relayer: &Signer,
) -> (ModuleExtras, Result<(), ChannelError>);
// Provided methods
fn on_chan_open_ack_validate(
&self,
_port_id: &PortId,
_channel_id: &ChannelId,
_counterparty_version: &Version,
) -> Result<(), ChannelError> { ... }
fn on_chan_open_ack_execute(
&mut self,
_port_id: &PortId,
_channel_id: &ChannelId,
_counterparty_version: &Version,
) -> Result<ModuleExtras, ChannelError> { ... }
fn on_chan_open_confirm_validate(
&self,
_port_id: &PortId,
_channel_id: &ChannelId,
) -> Result<(), ChannelError> { ... }
fn on_chan_open_confirm_execute(
&mut self,
_port_id: &PortId,
_channel_id: &ChannelId,
) -> Result<ModuleExtras, ChannelError> { ... }
fn on_chan_close_init_validate(
&self,
_port_id: &PortId,
_channel_id: &ChannelId,
) -> Result<(), ChannelError> { ... }
fn on_chan_close_init_execute(
&mut self,
_port_id: &PortId,
_channel_id: &ChannelId,
) -> Result<ModuleExtras, ChannelError> { ... }
fn on_chan_close_confirm_validate(
&self,
_port_id: &PortId,
_channel_id: &ChannelId,
) -> Result<(), ChannelError> { ... }
fn on_chan_close_confirm_execute(
&mut self,
_port_id: &PortId,
_channel_id: &ChannelId,
) -> Result<ModuleExtras, ChannelError> { ... }
}
Required Methods§
fn on_chan_open_init_validate( &self, order: Order, connection_hops: &[ConnectionId], port_id: &PortId, channel_id: &ChannelId, counterparty: &Counterparty, version: &Version, ) -> Result<Version, ChannelError>
fn on_chan_open_init_execute( &mut self, order: Order, connection_hops: &[ConnectionId], port_id: &PortId, channel_id: &ChannelId, counterparty: &Counterparty, version: &Version, ) -> Result<(ModuleExtras, Version), ChannelError>
fn on_chan_open_try_validate( &self, order: Order, connection_hops: &[ConnectionId], port_id: &PortId, channel_id: &ChannelId, counterparty: &Counterparty, counterparty_version: &Version, ) -> Result<Version, ChannelError>
fn on_chan_open_try_execute( &mut self, order: Order, connection_hops: &[ConnectionId], port_id: &PortId, channel_id: &ChannelId, counterparty: &Counterparty, counterparty_version: &Version, ) -> Result<(ModuleExtras, Version), ChannelError>
Sourcefn on_recv_packet_execute(
&mut self,
packet: &Packet,
relayer: &Signer,
) -> (ModuleExtras, Option<Acknowledgement>)
fn on_recv_packet_execute( &mut self, packet: &Packet, relayer: &Signer, ) -> (ModuleExtras, Option<Acknowledgement>)
ICS-26 onRecvPacket
callback implementation.
§Note on optional acknowledgements
Acknowledgements can be committed asynchronously, hence
the Option
type. In general, acknowledgements should
be committed to storage, accompanied by an ack event,
as soon as a packet is received. This will be done
automatically as long as Some(ack)
is returned from
this callback. However, in some cases, such as when
implementing a multiple hop packet delivery protocol,
a packet can only be acknowledged after it has reached
the last hop.
§Committing a packet asynchronously
Event emission and state updates for packet acknowledgements
can be performed asynchronously using emit_packet_acknowledgement_event
and commit_packet_acknowledgment
, respectively.
fn on_acknowledgement_packet_validate( &self, _packet: &Packet, _acknowledgement: &Acknowledgement, _relayer: &Signer, ) -> Result<(), ChannelError>
fn on_acknowledgement_packet_execute( &mut self, _packet: &Packet, _acknowledgement: &Acknowledgement, _relayer: &Signer, ) -> (ModuleExtras, Result<(), ChannelError>)
Sourcefn on_timeout_packet_validate(
&self,
packet: &Packet,
relayer: &Signer,
) -> Result<(), ChannelError>
fn on_timeout_packet_validate( &self, packet: &Packet, relayer: &Signer, ) -> Result<(), ChannelError>
Note: MsgTimeout
and MsgTimeoutOnClose
use the same callback
Sourcefn on_timeout_packet_execute(
&mut self,
packet: &Packet,
relayer: &Signer,
) -> (ModuleExtras, Result<(), ChannelError>)
fn on_timeout_packet_execute( &mut self, packet: &Packet, relayer: &Signer, ) -> (ModuleExtras, Result<(), ChannelError>)
Note: MsgTimeout
and MsgTimeoutOnClose
use the same callback