ibc/
lib.rs

1#![no_std]
2#![forbid(unsafe_code)]
3#![cfg_attr(not(test), deny(clippy::unwrap_used))]
4#![cfg_attr(not(test), deny(clippy::disallowed_methods, clippy::disallowed_types))]
5#![deny(
6    warnings,
7    trivial_casts,
8    trivial_numeric_casts,
9    unused_import_braces,
10    unused_qualifications,
11    rust_2018_idioms
12)]
13//! This library re-exports implementations of all the Inter-Blockchain
14//! Communication (IBC) specifications available in [`ibc-rs`][ibc-rs]
15//! repository. IBC is a distributed protocol that enables communication between
16//! distinct sovereign blockchains.
17//!
18//! The layout of this crate mirrors the organization of the [IBC
19//! Standard][ibc-standard]:
20//!
21//! - [Core](core) implements the transport, authentication, and ordering layers
22//!   of the IBC protocol.
23//!
24//! - [Clients](clients) consists of implementations of client verification
25//!   algorithms (following the base client interface that is defined in `Core`)
26//!   for specific consensus algorithms. A chain uses these verification
27//!   algorithms to verify the state of remote chains.
28//!
29//! - [Applications](apps) consists of implementations of some IBC applications.
30//!   This is the part of the protocol that abstracts away the core protocol and
31//!   focuses solely on business logic.
32//!
33//! [ibc-standard]: https://github.com/cosmos/ibc
34//! [ibc-rs]: https://github.com/cosmos/ibc-rs
35
36#[cfg(any(test, feature = "std"))]
37extern crate std;
38
39/// Re-exports primitive types and traits from the `ibc-primitives` crate.
40pub mod primitives {
41    pub use ibc_primitives::*;
42}
43
44/// Re-exports implementations of all the IBC core (TAO) modules.
45pub mod core {
46    #[doc(inline)]
47    pub use ibc_core::*;
48}
49
50/// Re-exports implementations of IBC light clients.
51pub mod clients {
52    #[doc(inline)]
53    pub use ibc_clients::*;
54}
55
56/// Re-exports implementations of various IBC applications.
57pub mod apps {
58    #[doc(inline)]
59    pub use ibc_apps::*;
60}
61
62/// Re-exports Cosmos-specific utility types, traits, and implementations.
63pub mod cosmos_host {
64    pub use ibc_core_host_cosmos::*;
65}
66
67/// Re-exports convenient derive macros from `ibc-derive` crate.
68pub mod derive {
69    /// A derive macro for implementing the
70    /// [`ClientState`](crate::core::client::context::client_state::ClientState)
71    /// trait for enums. Enums with variants that also implement the
72    /// [`ClientState`](crate::core::client::context::client_state::ClientState)
73    /// trait can leverage this macro for automatic implementation.
74    ///
75    /// To specify the generic arguments for `ClientState`, use the following
76    /// attributes:
77    ///
78    /// - `#[validation(<YourClientValidationContext>)]`
79    /// - `#[execution(<YourClientExecutionContext>)]`
80    ///
81    /// The argument to the `validation` or `execution` attributes may contain
82    /// lifetimes or generic types, and even that types might be bounded by
83    /// traits. For instance:
84    ///
85    /// - `#[validation(Context<S>)]`
86    /// - `#[validation(Context<'a, S>)]`
87    /// - `#[validation(Context<'a, S: Clone>)]`
88    pub use ibc_derive::IbcClientState as ClientState;
89    /// A derive macro for implementing the
90    /// [`ConsensusState`](crate::core::client::context::consensus_state::ConsensusState)
91    /// trait for enums. Enums with variants that also implement the
92    /// [`ConsensusState`](crate::core::client::context::consensus_state::ConsensusState)
93    /// trait can leverage this macro for automatic implementation..
94    pub use ibc_derive::IbcConsensusState as ConsensusState;
95}