Skip to content

Commit

Permalink
imp: define ics25-handler + move tendermint-specific impls into ibc-c…
Browse files Browse the repository at this point in the history
…ore-host-tendermint
  • Loading branch information
Farhad-Shabani committed Nov 19, 2023
1 parent c212436 commit 5436c99
Show file tree
Hide file tree
Showing 129 changed files with 496 additions and 388 deletions.
14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ members = [
"crates/ibc-core/ics04-channel",
"crates/ibc-core/ics04-channel/types",
"crates/ibc-core/ics23-commitment/types",
"crates/ibc-core/ics24-host",
"crates/ibc-core/ics24-host/types",
"crates/ibc-core/ics24-host/tendermint",
"crates/ibc-core/ics25-handler",
"crates/ibc-core/ics25-handler/types",
"crates/ibc-core/ics26-routing",
"crates/ibc-core/ics26-routing/types",
"crates/ibc-core/context",
"crates/ibc-core/context/types",
"crates/ibc-core/extra",
"crates/ibc-apps/ics20-transfer",
"crates/ibc-apps/ics20-transfer/types",
]
Expand Down Expand Up @@ -74,19 +75,20 @@ ibc-derive = { version = "0.3.0", path = "./crates/ibc-derive" }
ibc-core-client = { version = "0.47.0", path = "./crates/ibc-core/ics02-client", default-features = false }
ibc-core-connection = { version = "0.47.0", path = "./crates/ibc-core/ics03-connection", default-features = false }
ibc-core-channel = { version = "0.47.0", path = "./crates/ibc-core/ics04-channel", default-features = false }
ibc-core-host = { version = "0.47.0", path = "./crates/ibc-core/ics24-host", default-features = false }
ibc-core-handler = { version = "0.47.0", path = "./crates/ibc-core/ics25-handler", default-features = false }
ibc-core-router = { version = "0.47.0", path = "./crates/ibc-core/ics26-routing", default-features = false }
ibc-core-context = { version = "0.47.0", path = "./crates/ibc-core/context", default-features = false }
ibc-core-extra = { version = "0.47.0", path = "./crates/ibc-core/extra", default-features = false }
ibc-app-transfer = { version = "0.47.0", path = "./crates/ibc-apps/ics20-transfer", default-features = false }

ibc-core-client-context = { version = "0.47.0", path = "./crates/ibc-core/ics02-client/context", default-features = false }
ibc-core-client-types = { version = "0.47.0", path = "./crates/ibc-core/ics02-client/types", default-features = false }
ibc-core-channel-types = { version = "0.47.0", path = "./crates/ibc-core/ics04-channel/types", default-features = false }
ibc-core-connection-types = { version = "0.47.0", path = "./crates/ibc-core/ics03-connection/types", default-features = false }
ibc-core-commitment-types = { version = "0.47.0", path = "./crates/ibc-core/ics23-commitment/types", default-features = false }
ibc-core-host-tendermint = { version = "0.47.0", path = "./crates/ibc-core/ics24-host/tendermint", default-features = false }
ibc-core-host-types = { version = "0.47.0", path = "./crates/ibc-core/ics24-host/types", default-features = false }
ibc-core-handler-types = { version = "0.47.0", path = "./crates/ibc-core/ics25-handler/types", default-features = false }
ibc-core-router-types = { version = "0.47.0", path = "./crates/ibc-core/ics26-routing/types", default-features = false }
ibc-core-context-types = { version = "0.47.0", path = "./crates/ibc-core/context/types", default-features = false }
ibc-app-transfer-types = { version = "0.47.0", path = "./crates/ibc-apps/ics20-transfer/types", default-features = false }

ibc-proto = { version = "0.38.0", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc-apps/ics20-transfer/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use ibc_app_transfer_types::error::TokenTransferError;
use ibc_app_transfer_types::{PrefixedCoin, PrefixedDenom, VERSION};
use ibc_core::host::identifiers::{ChannelId, PortId};
use ibc_core::host::types::identifiers::{ChannelId, PortId};
use ibc_core::primitives::prelude::*;
use ibc_core::primitives::Signer;
use sha2::{Digest, Sha256};
Expand Down
4 changes: 2 additions & 2 deletions crates/ibc-apps/ics20-transfer/src/handler/send_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use ibc_app_transfer_types::{is_sender_chain_source, MODULE_ID_STR};
use ibc_core::channel::context::{SendPacketExecutionContext, SendPacketValidationContext};
use ibc_core::channel::handler::{send_packet_execute, send_packet_validate};
use ibc_core::channel::types::packet::Packet;
use ibc_core::context::types::events::MessageEvent;
use ibc_core::host::path::{ChannelEndPath, SeqSendPath};
use ibc_core::handler::types::events::MessageEvent;
use ibc_core::host::types::path::{ChannelEndPath, SeqSendPath};
use ibc_core::primitives::prelude::*;
use ibc_core::router::types::event::ModuleEvent;

Expand Down
4 changes: 2 additions & 2 deletions crates/ibc-apps/ics20-transfer/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use ibc_core::channel::types::acknowledgement::{Acknowledgement, Acknowledgement
use ibc_core::channel::types::channel::{Counterparty, Order};
use ibc_core::channel::types::packet::Packet;
use ibc_core::channel::types::Version;
use ibc_core::context::types::error::ContextError;
use ibc_core::host::identifiers::{ChannelId, ConnectionId, PortId};
use ibc_core::handler::types::error::ContextError;
use ibc_core::host::types::identifiers::{ChannelId, ConnectionId, PortId};
use ibc_core::primitives::prelude::*;
use ibc_core::primitives::Signer;
use ibc_core::router::types::module::ModuleExtras;
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc-apps/ics20-transfer/types/src/denom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use core::fmt::{Display, Error as FmtError, Formatter};
use core::str::FromStr;

use derive_more::{Display, From};
use ibc_core::host::identifiers::{ChannelId, PortId};
use ibc_core::host::types::identifiers::{ChannelId, PortId};
use ibc_core::primitives::prelude::*;
use ibc_proto::ibc::applications::transfer::v1::DenomTrace as RawDenomTrace;

Expand Down
6 changes: 3 additions & 3 deletions crates/ibc-apps/ics20-transfer/types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use core::str::Utf8Error;
use displaydoc::Display;
use ibc_core::channel::types::acknowledgement::StatusValue;
use ibc_core::channel::types::channel::Order;
use ibc_core::context::types::error::ContextError;
use ibc_core::host::error::IdentifierError;
use ibc_core::host::identifiers::{ChannelId, PortId};
use ibc_core::handler::types::error::ContextError;
use ibc_core::host::types::error::IdentifierError;
use ibc_core::host::types::identifiers::{ChannelId, PortId};
use ibc_core::primitives::prelude::*;
use uint::FromDecStrErr;

Expand Down
4 changes: 2 additions & 2 deletions crates/ibc-apps/ics20-transfer/types/src/msgs/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
use ibc_core::channel::types::error::PacketError;
use ibc_core::channel::types::timeout::TimeoutHeight;
use ibc_core::context::types::error::ContextError;
use ibc_core::host::identifiers::{ChannelId, PortId};
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_proto::google::protobuf::Any;
Expand Down
36 changes: 18 additions & 18 deletions crates/ibc-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ repository = { workspace = true }
keywords = ["blockchain", "cosmos", "ibc"]
readme = "README.md"
description = """
`ibc-core` provides a comprehensive set of libraries for IBC core (TAO) layers,
`ibc-core` re-exports a comprehensive set of libraries for IBC core (TAO) modules,
facilitating seamless integration of IBC core business logic into any blockchain system.
"""

[package.metadata.docs.rs]
all-features = true

[dependencies]
ibc-core-client = { workspace = true }
ibc-core-connection = { workspace = true }
ibc-core-channel = { workspace = true }
ibc-core-client = { workspace = true }
ibc-core-connection = { workspace = true }
ibc-core-channel = { workspace = true }
ibc-core-commitment-types = { workspace = true }
ibc-core-router = { workspace = true }
ibc-core-context = { workspace = true }
ibc-core-host-types = { workspace = true }
ibc-primitives = { workspace = true }
ibc-core-host = { workspace = true }
ibc-core-router = { workspace = true }
ibc-core-handler = { workspace = true }
ibc-primitives = { workspace = true }

[features]
default = ["std"]
Expand All @@ -33,43 +33,43 @@ std = [
"ibc-core-connection/std",
"ibc-core-channel/std",
"ibc-core-commitment-types/std",
"ibc-core-host/std",
"ibc-core-router/std",
"ibc-core-context/std",
"ibc-core-host-types/std",
"ibc-core-handler/std",
]
serde = [
"ibc-core-client/serde",
"ibc-core-connection/serde",
"ibc-core-channel/serde",
"ibc-core-commitment-types/serde",
"ibc-core-host/serde",
"ibc-core-router/serde",
"ibc-core-context/serde",
"ibc-core-host-types/serde",
"ibc-core-handler/serde",
]
borsh = [
"ibc-core-client/borsh",
"ibc-core-connection/borsh",
"ibc-core-channel/borsh",
"ibc-core-commitment-types/borsh",
"ibc-core-host/borsh",
"ibc-core-router/borsh",
"ibc-core-context/borsh",
"ibc-core-host-types/borsh",
"ibc-core-handler/borsh",
]
schema = [
"ibc-core-client/schema",
"ibc-core-connection/schema",
"ibc-core-channel/schema",
"ibc-core-commitment-types/schema",
"ibc-core-host/schema",
"ibc-core-router/schema",
"ibc-core-context/schema",
"ibc-core-host-types/schema",
"ibc-core-handler/schema",
]
parity-scale-codec = [
"ibc-core-client/parity-scale-codec",
"ibc-core-connection/parity-scale-codec",
"ibc-core-channel/parity-scale-codec",
"ibc-core-host/parity-scale-codec",
"ibc-core-router/parity-scale-codec",
"ibc-core-context/parity-scale-codec",
"ibc-core-host-types/parity-scale-codec",
"ibc-core-handler/parity-scale-codec",
"ibc-primitives/parity-scale-codec",
]
2 changes: 0 additions & 2 deletions crates/ibc-core/extra/src/lib.rs

This file was deleted.

24 changes: 12 additions & 12 deletions crates/ibc-core/ics02-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ prost = { workspace = true }
ibc-core-client-types = { workspace = true }
ibc-core-client-context = { workspace = true }
ibc-core-commitment-types = { workspace = true }
ibc-core-host-types = { workspace = true }
ibc-core-context = { workspace = true }
ibc-core-host = { workspace = true }
ibc-core-handler-types = { workspace = true }
ibc-derive = { workspace = true }
ibc-primitives = { workspace = true }

Expand All @@ -36,32 +36,32 @@ std = [
"ibc-core-client-types/std",
"ibc-core-client-context/std",
"ibc-core-commitment-types/std",
"ibc-core-host-types/std",
"ibc-core-context/std",
"ibc-core-host/std",
"ibc-core-handler-types/std",
"ibc-primitives/std",
]
serde = [
"ibc-core-client-types/serde",
"ibc-core-client-context/serde",
"ibc-core-commitment-types/serde",
"ibc-core-host-types/serde",
"ibc-core-context/serde",
"ibc-core-host/serde",
"ibc-core-handler-types/serde",
"ibc-primitives/serde",
]
borsh = [
"ibc-core-client-types/borsh",
"ibc-core-client-context/borsh",
"ibc-core-commitment-types/borsh",
"ibc-core-host-types/borsh",
"ibc-core-context/borsh",
"ibc-core-host/borsh",
"ibc-core-handler-types/borsh",
"ibc-primitives/borsh",
]
schema = [
"ibc-core-client-types/schema",
"ibc-core-client-context/schema",
"ibc-core-commitment-types/schema",
"ibc-core-host-types/schema",
"ibc-core-context/schema",
"ibc-core-host/schema",
"ibc-core-handler-types/schema",
"ibc-primitives/schema",
"serde",
"std"
Expand All @@ -70,7 +70,7 @@ parity-scale-codec = [
"ibc-core-client-types/parity-scale-codec",
"ibc-core-client-context/parity-scale-codec",
"ibc-core-commitment-types/parity-scale-codec",
"ibc-core-context/parity-scale-codec",
"ibc-core-host-types/parity-scale-codec",
"ibc-core-host/parity-scale-codec",
"ibc-core-handler-types/parity-scale-codec",
"ibc-primitives/parity-scale-codec",
]
12 changes: 6 additions & 6 deletions crates/ibc-core/ics02-client/context/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ subtle-encoding = { workspace = true }
ibc-core-client-types = { workspace = true }
ibc-core-commitment-types = { workspace = true }
ibc-core-host-types = { workspace = true }
ibc-core-context-types = { workspace = true }
ibc-core-handler-types = { workspace = true }
ibc-derive = { workspace = true }
ibc-primitives = { workspace = true }

Expand All @@ -46,35 +46,35 @@ std = [
"ibc-core-client-types/std",
"ibc-core-commitment-types/std",
"ibc-core-host-types/std",
"ibc-core-context-types/std",
"ibc-core-handler-types/std",
"ibc-primitives/std",
"tendermint/std",
]
serde = [
"ibc-core-client-types/serde",
"ibc-core-commitment-types/serde",
"ibc-core-host-types/serde",
"ibc-core-context-types/serde",
"ibc-core-handler-types/serde",
"ibc-primitives/serde",
]
borsh = [
"ibc-core-client-types/borsh",
"ibc-core-commitment-types/borsh",
"ibc-core-host-types/borsh",
"ibc-core-context-types/borsh",
"ibc-core-handler-types/borsh",
"ibc-primitives/borsh",
]
schema = [
"ibc-core-client-types/schema",
"ibc-core-host-types/schema",
"ibc-core-context-types/schema",
"ibc-core-handler-types/schema",
"serde",
"std"
]
parity-scale-codec = [
"ibc-core-client-types/parity-scale-codec",
"ibc-core-commitment-types/parity-scale-codec",
"ibc-core-host-types/parity-scale-codec",
"ibc-core-context-types/parity-scale-codec",
"ibc-core-handler-types/parity-scale-codec",
"ibc-primitives/parity-scale-codec",
]
2 changes: 1 addition & 1 deletion crates/ibc-core/ics02-client/context/src/context.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ibc_core_client_types::Height;
use ibc_core_context_types::error::ContextError;
use ibc_core_handler_types::error::ContextError;
use ibc_core_host_types::identifiers::ClientId;
use ibc_core_host_types::path::{ClientConsensusStatePath, ClientStatePath};
use ibc_primitives::Timestamp;
Expand Down
8 changes: 4 additions & 4 deletions crates/ibc-core/ics02-client/src/handler/create_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use ibc_core_client_context::client_state::{ClientStateCommon, ClientStateExecut
use ibc_core_client_types::error::ClientError;
use ibc_core_client_types::events::CreateClient;
use ibc_core_client_types::msgs::MsgCreateClient;
use ibc_core_context::types::error::ContextError;
use ibc_core_context::types::events::{IbcEvent, MessageEvent};
use ibc_core_context::{ExecutionContext, ValidationContext};
use ibc_core_host_types::identifiers::ClientId;
use ibc_core_handler_types::error::ContextError;
use ibc_core_handler_types::events::{IbcEvent, MessageEvent};
use ibc_core_host::types::identifiers::ClientId;
use ibc_core_host::{ExecutionContext, ValidationContext};
use ibc_primitives::prelude::*;

pub fn validate<Ctx>(ctx: &Ctx, msg: MsgCreateClient) -> Result<(), ContextError>
Expand Down
6 changes: 3 additions & 3 deletions crates/ibc-core/ics02-client/src/handler/update_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use ibc_core_client_types::error::ClientError;
use ibc_core_client_types::events::{ClientMisbehaviour, UpdateClient};
use ibc_core_client_types::msgs::MsgUpdateOrMisbehaviour;
use ibc_core_client_types::UpdateKind;
use ibc_core_context::types::error::ContextError;
use ibc_core_context::types::events::{IbcEvent, MessageEvent};
use ibc_core_context::{ExecutionContext, ValidationContext};
use ibc_core_handler_types::error::ContextError;
use ibc_core_handler_types::events::{IbcEvent, MessageEvent};
use ibc_core_host::{ExecutionContext, ValidationContext};
use ibc_primitives::prelude::*;
use prost::Message;

Expand Down
8 changes: 4 additions & 4 deletions crates/ibc-core/ics02-client/src/handler/upgrade_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use ibc_core_client_context::consensus_state::ConsensusState;
use ibc_core_client_types::error::ClientError;
use ibc_core_client_types::events::UpgradeClient;
use ibc_core_client_types::msgs::MsgUpgradeClient;
use ibc_core_context::types::error::ContextError;
use ibc_core_context::types::events::{IbcEvent, MessageEvent};
use ibc_core_context::{ExecutionContext, ValidationContext};
use ibc_core_host_types::path::ClientConsensusStatePath;
use ibc_core_handler_types::error::ContextError;
use ibc_core_handler_types::events::{IbcEvent, MessageEvent};
use ibc_core_host::types::path::ClientConsensusStatePath;
use ibc_core_host::{ExecutionContext, ValidationContext};
use ibc_primitives::prelude::*;

pub fn validate<Ctx>(ctx: &Ctx, msg: MsgUpgradeClient) -> Result<(), ContextError>
Expand Down
Loading

0 comments on commit 5436c99

Please sign in to comment.