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

refactor: duplicate ibc-core to ibc-eureka-core #1369

Open
wants to merge 5 commits into
base: feat/ibc-eureka
Choose a base branch
from
Open
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
29 changes: 29 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ members = [
"ibc-query",
"ibc-testkit",

"ibc-eureka-core/ics26-routing/types",
"ibc-eureka-core/ics23-commitment/types",
"ibc-eureka-core/ics04-channel/types",
"ibc-eureka-core/ics25-handler/types",
"ibc-eureka-core/ics24-host",
"ibc-eureka-core/ics26-routing",
"ibc-eureka-core/ics04-channel",
"ibc-eureka-core/ics25-handler",
"ibc-eureka-core",

# internal crates that are not published
"tests-integration",
]
Expand Down Expand Up @@ -75,6 +85,8 @@ ibc-apps = { version = "0.55.1", path = "./ibc-apps", default-features = f
ibc-primitives = { version = "0.55.1", path = "./ibc-primitives", default-features = false }
ibc-testkit = { version = "0.55.1", path = "./ibc-testkit", default-features = false }

ibc-eureka-core = { version = "0.55.1", path = "./ibc-eureka-core", default-features = false }

ibc-derive = { version = "0.9.0", path = "./ibc-derive" }

ibc-core-client = { version = "0.55.1", path = "./ibc-core/ics02-client", default-features = false }
Expand All @@ -85,6 +97,13 @@ ibc-core-handler = { version = "0.55.1", path = "./ibc-core/ics25-handler", d
ibc-core-router = { version = "0.55.1", path = "./ibc-core/ics26-routing", default-features = false }
ibc-query = { version = "0.55.1", path = "./ibc-query", default-features = false }

ibc-eureka-core-client = { version = "0.55.1", path = "./ibc-eureka-core/ics02-client", default-features = false }
ibc-eureka-core-connection = { version = "0.55.1", path = "./ibc-eureka-core/ics03-connection", default-features = false }
ibc-eureka-core-channel = { version = "0.55.1", path = "./ibc-eureka-core/ics04-channel", default-features = false }
ibc-eureka-core-host = { version = "0.55.1", path = "./ibc-eureka-core/ics24-host", default-features = false }
ibc-eureka-core-handler = { version = "0.55.1", path = "./ibc-eureka-core/ics25-handler", default-features = false }
ibc-eureka-core-router = { version = "0.55.1", path = "./ibc-eureka-core/ics26-routing", default-features = false }

ibc-client-tendermint = { version = "0.55.1", path = "./ibc-clients/ics07-tendermint", default-features = false }

ibc-app-transfer = { version = "0.55.1", path = "./ibc-apps/ics20-transfer", default-features = false }
Expand All @@ -104,6 +123,16 @@ ibc-client-wasm-types = { version = "0.55.1", path = "./ibc-clients/ics08-
ibc-app-transfer-types = { version = "0.55.1", path = "./ibc-apps/ics20-transfer/types", default-features = false }
ibc-app-nft-transfer-types = { version = "0.55.1", path = "./ibc-apps/ics721-nft-transfer/types", default-features = false }

ibc-eureka-core-client-context = { version = "0.55.1", path = "./ibc-eureka-core/ics02-client/context", default-features = false }
ibc-eureka-core-client-types = { version = "0.55.1", path = "./ibc-eureka-core/ics02-client/types", default-features = false }
ibc-eureka-core-channel-types = { version = "0.55.1", path = "./ibc-eureka-core/ics04-channel/types", default-features = false }
ibc-eureka-core-connection-types = { version = "0.55.1", path = "./ibc-eureka-core/ics03-connection/types", default-features = false }
ibc-eureka-core-commitment-types = { version = "0.55.1", path = "./ibc-eureka-core/ics23-commitment/types", default-features = false }
ibc-eureka-core-host-cosmos = { version = "0.55.1", path = "./ibc-eureka-core/ics24-host/cosmos", default-features = false }
ibc-eureka-core-host-types = { version = "0.55.1", path = "./ibc-eureka-core/ics24-host/types", default-features = false }
ibc-eureka-core-handler-types = { version = "0.55.1", path = "./ibc-eureka-core/ics25-handler/types", default-features = false }
ibc-eureka-core-router-types = { version = "0.55.1", path = "./ibc-eureka-core/ics26-routing/types", default-features = false }

ibc-proto = { version = "0.47.1", default-features = false }

# cosmos dependencies
Expand Down
84 changes: 84 additions & 0 deletions ibc-eureka-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[package]
name = "ibc-eureka-core"
version = { workspace = true }
authors = { workspace = true }
edition = { workspace = true }
rust-version = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
keywords = [ "blockchain", "cosmos", "ibc", "core" ]
readme = "README.md"

description = """
Maintained by `ibc-rs`, re-exports a comprehensive set of libraries that implement 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-eureka-core-client = { workspace = true }
ibc-eureka-core-connection = { workspace = true }
ibc-eureka-core-channel = { workspace = true }
ibc-eureka-core-commitment-types = { workspace = true }
ibc-eureka-core-host = { workspace = true }
ibc-eureka-core-router = { workspace = true }
ibc-eureka-core-handler = { workspace = true }
ibc-derive = { workspace = true }
ibc-primitives = { workspace = true }

[features]
default = [ "std" ]
std = [
"ibc-eureka-core-client/std",
"ibc-eureka-core-connection/std",
"ibc-eureka-core-channel/std",
"ibc-eureka-core-commitment-types/std",
"ibc-eureka-core-host/std",
"ibc-eureka-core-router/std",
"ibc-eureka-core-handler/std",
"ibc-primitives/std",
]
serde = [
"ibc-eureka-core-client/serde",
"ibc-eureka-core-connection/serde",
"ibc-eureka-core-channel/serde",
"ibc-eureka-core-commitment-types/serde",
"ibc-eureka-core-host/serde",
"ibc-eureka-core-router/serde",
"ibc-eureka-core-handler/serde",
"ibc-primitives/serde",
]
borsh = [
"ibc-eureka-core-client/borsh",
"ibc-eureka-core-connection/borsh",
"ibc-eureka-core-channel/borsh",
"ibc-eureka-core-commitment-types/borsh",
"ibc-eureka-core-host/borsh",
"ibc-eureka-core-router/borsh",
"ibc-eureka-core-handler/borsh",
"ibc-primitives/borsh",
]
schema = [
"ibc-eureka-core-client/schema",
"ibc-eureka-core-connection/schema",
"ibc-eureka-core-channel/schema",
"ibc-eureka-core-commitment-types/schema",
"ibc-eureka-core-host/schema",
"ibc-eureka-core-router/schema",
"ibc-eureka-core-handler/schema",
"ibc-primitives/schema",
"serde",
"std",
]
parity-scale-codec = [
"ibc-eureka-core-client/parity-scale-codec",
"ibc-eureka-core-connection/parity-scale-codec",
"ibc-eureka-core-channel/parity-scale-codec",
"ibc-eureka-core-commitment-types/parity-scale-codec",
"ibc-eureka-core-host/parity-scale-codec",
"ibc-eureka-core-router/parity-scale-codec",
"ibc-eureka-core-handler/parity-scale-codec",
"ibc-primitives/parity-scale-codec",
]
128 changes: 128 additions & 0 deletions ibc-eureka-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# IBC Core

This is the top-level library that re-exports the Inter-Blockchain Communication
(IBC) core modules as a meta-crate. It serves to simplify the process of
importing and integrating various IBC core modules into your blockchain.

IBC is a distributed protocol that enables communication between distinct
sovereign blockchains and IBC core is the part of the protocol that handles the
transport, authentication, and ordering (TAO) of data packets.

The structure within the `ibc-eureka-core` crate is designed to provide flexibility for
external users. You can choose to utilize the entire `ibc-eureka-core` crate, or
selectively import specific libraries. From there, you also have the flexibility
of bringing in an entire sub-module (e.g. the `ibc-eureka-core-client` crate), or only
a module's associated data structures (e.g. `ibc-eureka-core-client-types`).

This versatility empowers hosts, including chain integrators, relayers, or any
IBC tooling projects, to build their solution on top of the layers that best
suit their particular requirements.

## Sub-Crates

Currently, the `ibc-eureka-core` crate contains the implementation of the following IBC
core specifications:

### ICS-02: Client Semantics

- [ibc-eureka-core-client](./../ibc-eureka-core/ics02-client)
- [ibc-eureka-core-client-context](./../ibc-eureka-core/ics02-client/context)
- [ibc-eureka-core-client-types](./../ibc-eureka-core/ics02-client/types)

### ICS-03: Connection Semantics

- [ibc-eureka-core-connection](./../ibc-eureka-core/ics03-connection)
- [ibc-eureka-core-connection-types](./../ibc-eureka-core/ics03-connection/types)

### ICS-04: Channel and Packet Semantics

- [ibc-eureka-core-channel](./../ibc-eureka-core/ics04-channel)
- [ibc-eureka-core-channel-types](./../ibc-eureka-core/ics04-channel/types)

### ICS-24: Host Requirements

- [ibc-eureka-core-host](./../ibc-eureka-core/ics24-host)
- [ibc-eureka-core-host-cosmos](./../ibc-eureka-core/ics24-host/cosmos)
- [ibc-eureka-core-host-types](./../ibc-eureka-core/ics24-host/types)

### ICS-25: Handler Interface

- [ibc-eureka-core-handler](./../ibc-eureka-core/ics25-handler)
- [ibc-eureka-core-handler-types](./../ibc-eureka-core/ics25-handler/types)

### ICS-26: Routing Module

- [ibc-eureka-core-routing](./../ibc-eureka-core/ics26-routing)
- [ibc-eureka-core-routing-types](./../ibc-eureka-core/ics26-routing/types)

## Divergence from the Interchain Standards (ICS)

This crate diverges from the [ICS specification](https://github.com/cosmos/ibc)
in a number of ways. See below for more details.

### Module system: no support for untrusted modules

ICS-24 (Host Requirements) gives the [following
requirement](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#module-system)
about the module system that the host state machine must support:

> The host state machine must support a module system, whereby self-contained,
> potentially mutually distrusted packages of code can safely execute on the
> same ledger [...].

**This crate currently does not support mutually distrusted packages**. That is,
modules on the host state machine are assumed to be fully trusted. In practice,
this means that every module has either been written by the host state machine
developers, or fully vetted by them.

### Port system: No object capability system

ICS-05 (Port Allocation) requires the host system to support either
object-capability reference or source authentication for modules.

> In the former object-capability case, the IBC handler must have the ability to
> generate object-capabilities, unique, opaque references which can be passed to
> a module and will not be duplicable by other modules. [...] In the latter
> source authentication case, the IBC handler must have the ability to securely
> read the source identifier of the calling module, a unique string for each
> module in the host state machine, which cannot be altered by the module or
> faked by another module.

**This crate currently requires neither of the host system**. Since modules are
assumed to be trusted, there is no need for this object capability system that
protects resources for potentially malicious modules.

For more background on this, see [this issue](https://github.com/informalsystems/ibc-rs/issues/2159).

### Port system: transferring and releasing a port

ICS-05 (Port Allocation) requires the IBC handler to permit [transferring
ownership of a
port](https://github.com/cosmos/ibc/tree/master/spec/core/ics-005-port-allocation#transferring-ownership-of-a-port)
and [releasing a
port](https://github.com/cosmos/ibc/tree/master/spec/core/ics-005-port-allocation#releasing-a-port).

We currently support neither.

### Asynchronous acknowledgements

The standard gives the ability for modules to [acknowledge packets
asynchronously](https://github.com/cosmos/ibc/tree/main/spec/core/ics-004-channel-and-packet-semantics#writing-acknowledgements).
This allows modules to receive the packet, but only applying the changes at a
later time (after which they would write the acknowledgement).

We currently force applications to process the packets as part of
`onRecvPacket()`. If you need asynchronous acknowledgements for your
application, please open an issue.

Note that this still makes us 100% compatible with `ibc-go`.

## Contributing

IBC is specified in English in the [cosmos/ibc
repo](https://github.com/cosmos/ibc). Any protocol changes or clarifications
should be contributed there.

If you're interested in contributing, please take a look at the
[CONTRIBUTING](./../CONTRIBUTING.md) guidelines. We welcome and appreciate
community contributions!
71 changes: 71 additions & 0 deletions ibc-eureka-core/ics02-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[package]
name = "ibc-eureka-core-client"
version = { workspace = true }
authors = { workspace = true }
edition = { workspace = true }
rust-version = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
keywords = [ "blockchain", "cosmos", "ibc", "light-client" ]
readme = "./../README.md"

description = """
Maintained by `ibc-rs`, contains the implementation of ICS-02 Client Semantics and
re-exports essential data structures and domain types from `ibc-eureka-core-client-types` crate.
"""

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

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

[features]
default = [ "std" ]
std = [
"ibc-eureka-core-client-types/std",
"ibc-eureka-core-client-context/std",
"ibc-eureka-core-commitment-types/std",
"ibc-eureka-core-host/std",
"ibc-eureka-core-handler-types/std",
"ibc-primitives/std",
]
serde = [
"ibc-eureka-core-client-types/serde",
"ibc-eureka-core-client-context/serde",
"ibc-eureka-core-commitment-types/serde",
"ibc-eureka-core-host/serde",
"ibc-eureka-core-handler-types/serde",
"ibc-primitives/serde",
]
borsh = [
"ibc-eureka-core-client-types/borsh",
"ibc-eureka-core-client-context/borsh",
"ibc-eureka-core-commitment-types/borsh",
"ibc-eureka-core-host/borsh",
"ibc-eureka-core-handler-types/borsh",
"ibc-primitives/borsh",
]
schema = [
"ibc-eureka-core-client-types/schema",
"ibc-eureka-core-client-context/schema",
"ibc-eureka-core-commitment-types/schema",
"ibc-eureka-core-host/schema",
"ibc-eureka-core-handler-types/schema",
"ibc-primitives/schema",
"serde",
"std",
]
parity-scale-codec = [
"ibc-eureka-core-client-types/parity-scale-codec",
"ibc-eureka-core-client-context/parity-scale-codec",
"ibc-eureka-core-commitment-types/parity-scale-codec",
"ibc-eureka-core-host/parity-scale-codec",
"ibc-eureka-core-handler-types/parity-scale-codec",
"ibc-primitives/parity-scale-codec",
]
Loading
Loading