Skip to content

Commit

Permalink
feat: restructure ibc crate (#975)
Browse files Browse the repository at this point in the history
* feat: migrate `applications` module under the `ibc` crate into `ibc-apps` (#967)

* feat: restructure and split off applications codebase into ibc-apps dir

* imp: rename transfer dir to ics20_transfer

* feat: add ibc-apps crate

* fix: remove redundant dep + fix cargo doc

* docs: add README and descriptions

* docs: update main README page

* nit: docstrings

* nit: docstrings

* imp: rename folder to ics20-transfer

* chore: move serializers into ics20-transfer/types

* fix: apply reviewer comments

* imp: add docstring for cosmos_adr028_escrow_address

* fix: add missing features + use workspace deps for ibc crates

* imp: place re-exports under mod

* nit: apply suggestions from code review

Co-authored-by: Sean Chen <seanchen11235@gmail.com>
Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>

* fix: cargo fmt

---------

Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>
Co-authored-by: Sean Chen <seanchen11235@gmail.com>

* docs: ADR-008 to restructure the `ibc` crate (#966)

* docs: write ADR for ibc crate restructure

* fix: mistaken adr007 file naming

* chore: markdown adjustment

* fix: apply suggestions from code review

Co-authored-by: Sean Chen <seanchen11235@gmail.com>
Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>

* docs: explanation for *-types interaction with ibc-proto

---------

Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>
Co-authored-by: Sean Chen <seanchen11235@gmail.com>

* feat: migrate `core`, `clients` modules into `ibc-core`, `ibc-clients` crates (#969)

* feat: migrate `core` module under the `ibc` crate into `ibc-core`

feat: migrate `core` module under the `ibc` crate into `ibc-core`

feat: migrate `applications` module under the `ibc` crate into `ibc-apps` (#967)

* feat: restructure and split off applications codebase into ibc-apps dir

* imp: rename transfer dir to ics20_transfer

* feat: add ibc-apps crate

* fix: remove redundant dep + fix cargo doc

* docs: add README and descriptions

* docs: update main README page

* nit: docstrings

* nit: docstrings

* imp: rename folder to ics20-transfer

* chore: move serializers into ics20-transfer/types

* fix: apply reviewer comments

* imp: add docstring for cosmos_adr028_escrow_address

* fix: add missing features + use workspace deps for ibc crates

* imp: place re-exports under mod

* nit: apply suggestions from code review

Co-authored-by: Sean Chen <seanchen11235@gmail.com>
Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>

* fix: cargo fmt

---------

Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>
Co-authored-by: Sean Chen <seanchen11235@gmail.com>

feat: restructure and split off applications codebase into ibc-apps dir

refactor: nits from nightly clippy (#962)

* use enum tuple variants directly

* use first() over get(0)

* use infallible conversion

* rm redundant export

* cargo fmt

ci: spell check on GitHub workflows (#964)

* typos github action

* cutom config for typos

* fix spelling to counterparty

* fix spelling to transfer

imp: rename transfer dir to ics20_transfer

feat: add ibc-apps crate

fix: remove redundant dep + fix cargo doc

docs: add README and descriptions

docs: update main README page

nit: docstrings

nit: docstrings

imp: rename folder to ics20-transfer

chore: move serializers into ics20-transfer/types

fix: apply reviewer comments

imp: add docstring for cosmos_adr028_escrow_address

fix: add missing features + use workspace deps for ibc crates

imp: place re-exports under mod

feat: ibc core codebase overhaul (part-1)

feat: ibc core codebase overhaul (part-2)

chore: comment out ibc-query & ibc-testkit

fix: add missing features

nit

* fix: re-export ibc_apps in the ibc crate

* chore: adjust features + add description for crates

* fix: CI catches

* fix: no_std

* imp: define ics25-handler + move tendermint-specific impls into ibc-core-host-tendermint

* fix: cargo doc

* docs: add and edit READMEs

* fix: cargo hack catches

* fix: cargo udeps catches

* chore: ajdust README tables

* docs: further README adjustments

* fix: typo

* chore: another review of comments & READMEs

* imp: move Any and Protobuf to ibc-primitives

* fix: missing std features

* Split out ibc-clients crate (#971)

* Migrate crates/ibc-clients

* Fix dependencies in types directory

* Fix dependencies in ibc-clients crate

* Delete ibc/ics07_tendermint directory

* Resolve dependencies in ibc crate

* Resolve dependencies in ibc-clients crate

* Wrap ClientState type in a newtype wrapper

* Address all compilation errors

* Migrate crates/ibc-clients

* Fix dependencies in types directory

* Fix dependencies in ibc-clients crate

* Delete ibc/ics07_tendermint directory

* Resolve dependencies in ibc crate

* Resolve dependencies in ibc-clients crate

* Wrap ClientState type in a newtype wrapper

* Address all compilation errors

* Add default feature `std` for ibc-clients crate

* Change cfg derivation

* Fixing import paths

* Fix import paths for ibc-client-tendermint crate

* Fix merge conflicts

* Fix merge conflicts

* Fix merge conflicts

* Fix remaining compilation errors in ics07-tendermint crate

* chore: adjust import paths, features and READMEs

* fix: CI catches

* fix: add serde dep for ibc-client-tendermint

* fix: serde_tests

* imp: rename ClientState to ClientStateWrapper

---------

Co-authored-by: Farhad Shabani <farhad.shabani@gmail.com>

* docs: improve crates descriptions

* fix: apply reviewer comments

* Delete some unused modules and add some documentation

* Add TODO to use u64::dev_ceil

* Formatting of ibc-primitives README

* fix: ibc-primitives serde feature

---------

Co-authored-by: Sean Chen <seanchen11235@gmail.com>

* imp: move crates into the root directory

* chore: add unclogs + fix broken links

* fix: additional deps and features adjustment

* fix: cargo fmt, clippy

* imp: review ibc-core-host-cosmos crate

* fix: move consensus_state API implementation into ibc-client-tendermint

* Delete empty ics07-tendermint/types README

* fix: apply suggestions from code review

Co-authored-by: Sean Chen <seanchen11235@gmail.com>
Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>

* fix: adjust comments, markdowns

* nit: further touchups

---------

Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>
Co-authored-by: Sean Chen <seanchen11235@gmail.com>
  • Loading branch information
Farhad-Shabani and seanchen1991 committed Nov 22, 2023
1 parent bf77378 commit 4421b0d
Show file tree
Hide file tree
Showing 358 changed files with 8,187 additions and 4,657 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Move ICS-20 and ICS-27 implementations to the respective part of `ibc-apps`
and `ibc-clients` crates, as part of the `ibc` crate restructuring effort.
([\#716](https://github.com/cosmos/ibc-rs/issues/716))
5 changes: 5 additions & 0 deletions .changelog/unreleased/breaking-changes/965-restructure-ibc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Restructure `ibc-rs` codebase by organizing it into smaller self-contained,
modular libraries, enabling the selective import of specific domain types or
module implementations, either individually or in combination, providing
enhanced flexibility and ease of use.
([\#965](https://github.com/cosmos/ibc-rs/issues/965))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Re-export essential proto types from the underlying `ibc-*-*-types` crates,
removing the necessity for a direct dependency on `ibc-proto` in projects
integrating `ibc-rs` ([\#697](https://github.com/cosmos/ibc-rs/issues/697))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Rename `{submodule}.rs` with corresponding `{submodule}` directory to
`{submodule}/mod.rs` ([\#771](https://github.com/cosmos/ibc-rs/issues/771))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Remove redundant `#[test_log::test]` attributes in test modules
([\#948](https://github.com/cosmos/ibc-rs/issues/948))
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- Expose various fields, types and functions in `ibc-rs` as public including:
- `validate` and `execute` handler functions for all the IBC message types.
- `TYPE_URL` constants.
- Any private fields within the domain message types.
- Any private fields within the Tendermint `ClientState` and `ConsensusState`
([\#976](https://github.com/cosmos/ibc-rs/issues/976))
7 changes: 5 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "crates/ibc"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "cargo"
directory: "ci/no-std-check"
schedule:
interval: "weekly"
- package-ecosystem: "cargo"
directory: "ci/cw-check"
schedule:
interval: "weekly"
8 changes: 7 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ on:
- .github/workflows/coverage.yml
- Cargo.toml
- ci/**
- crates/**
- ibc/**
- ibc-core/**
- ibc-apps/**
- ibc-data-types/**
- ibc-clients/**
- ibc-primitives/**
- ibc-query/**
push:
branches:
- main
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/cw-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ on:
- Cargo.toml
- Cargo.lock
- ci/cw-check/**
- crates/**

- ci/**
- ibc/**
- ibc-core/**
- ibc-apps/**
- ibc-data-types/**
- ibc-clients/**
- ibc-primitives/**
- ibc-query/**
- ibc-derive/**
jobs:
cw-check:
runs-on: ubuntu-20.04
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/no-std.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,27 @@ on:
- Cargo.toml
- Cargo.lock
- ci/no-std-check/**
- crates/**
- ci/**
- ibc/**
- ibc-core/**
- ibc-apps/**
- ibc-data-types/**
- ibc-clients/**
- ibc-primitives/**
push:
branches: main
paths:
- .github/workflows/no-std.yml
- Cargo.toml
- Cargo.lock
- ci/no-std-check/**
- crates/**

- ci/**
- ibc/**
- ibc-core/**
- ibc-apps/**
- ibc-data-types/**
- ibc-clients/**
- ibc-primitives/**
jobs:
check-no-std-panic-conflict:
name: Check no_std panic conflict
Expand Down
24 changes: 20 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,31 @@ on:
- .github/workflows/rust.yml
- Cargo.toml
- ci/**
- crates/**
- ibc/**
- ibc-core/**
- ibc-apps/**
- ibc-data-types/**
- ibc-clients/**
- ibc-primitives/**
- ibc-query/**
- ibc-testkit/**
- ibc-derive/**
push:
branches: main
paths:
- .github/workflows/rust.yml
- Cargo.toml
- ci/**
- crates/**

- ibc/**
- ibc-core/**
- ibc-apps/**
- ibc-data-types/**
- ibc-clients/**
- ibc-primitives/**
- ibc-query/**
- ibc-testkit/**
- ibc-derive/**

env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 1
Expand All @@ -31,7 +47,7 @@ jobs:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"

fmt:
nightly_fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
46 changes: 2 additions & 44 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ repository:
- [Pull Requests](#pull-requests) - what makes a good pull request
- [Forking](#forking) - fork the repo to make pull requests
- [Changelog](#changelog) - changes must be recorded in the changelog
- [Releases](#releases) - how to release new version of the crates

## Decision Making

Expand Down Expand Up @@ -109,7 +108,7 @@ single commit for the PR with all the commit messages.
If the issue you worked on was tagged `A: low-priority`, we'll do our best to
review it in a timely manner, but please expect longer wait times for a review
in general. If a low priority issue is important to you, please leave a comment
explaining why, and we will reprioritize it!
explaining why, and we will re-prioritize it!

## Responsibilities of a PR Reviewer

Expand Down Expand Up @@ -200,7 +199,7 @@ See those changelogs for examples.
We currently split changes for a given release between these four sections: Breaking
Changes, Features, Improvements, Bug Fixes.

Entries in the changelog should initially be logged in the __Unreleased__ section, which
Entries in the changelog should initially be logged in the **Unreleased** section, which
represents a "staging area" for accumulating all the changes throughout a
release (see [Pull Requests](#pull-requests) below). With each release,
the entries then move from this section into their permanent place under a
Expand Down Expand Up @@ -232,44 +231,3 @@ Any change that effects multiple APIs/users should be recorded multiply - for
instance, a change to some core protocol data structure might need to be
reflected both as breaking the core protocol but also breaking any APIs where core data structures are
exposed.

## Releases

Our release process is as follows:

1. In a new branch `release/vX.Y.Z`, update the [changelog](#changelog) to reflect and summarize all changes in
the release. This involves:
1. Running `unclog build -u` and copy pasting the output at the top
of the `CHANGELOG.md` file, making sure to update the header with
the new version.
2. Running `unclog release --editor <editor> --version vX.Y.Z` to create a summary of all of the changes
in this release.
1. Your text editor will open. Write the release summary, and close the editor.
1. Make sure to include a comment on whether or not the release contains consensus-breaking changes.
2. Add this same summary to `CHANGELOG.md` as well.
3. Committing the updated `CHANGELOG.md` file and `.changelog` directory to the repo.
2. Push this to a branch `release/vX.Y.Z` according to the version number of
the anticipated release (e.g. `release/v0.18.0`) and open a **draft PR**.
3. If there were changes in the `ibc-derive` crate, we need to publish a new version of that crate.
1. bump the version in `crates/ibc-derive/Cargo.toml`
2. Publish `ibc-derive` with `cargo publish -p ibc-derive`
4. Bump the versions of relevant crates (`ibc` and `ibc-query`) in their
`Cargo.toml` to the new version, and push these changes to the release PR.
- If you released a new version of `ibc-derive` in step 3, make sure to update that dependency.
5. Run `cargo doc -p ibc --all-features --open` locally to double-check that all the
documentation compiles and seems up-to-date and coherent. Fix any potential
issues here and push them to the release PR.
6. Run `cargo publish -p ibc --dry-run` to double-check that publishing will work. Fix
any potential issues here and push them to the release PR.
7. Mark the PR as **Ready for Review** and incorporate feedback on the release.
8. Once approved, merge the PR, and pull the `main` branch.
9. Run `cargo publish -p ibc` and `cargo publish -p ibc-query` to publish the crates.
10. Create a signed tag and push it to GitHub: `git tag -s -a vX.Y.Z`. In the
tag message, write the version and the link to the corresponding section of
the changelog.
- Push the tag with `git push --tags`
11. Once the tag is pushed, create a GitHub release and append
`[📖CHANGELOG](https://github.com/cosmos/ibc-rs/blob/main/CHANGELOG.md#vXYZ)`
to the release description.

All done! 🎉
110 changes: 77 additions & 33 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
[workspace]
resolver = "2"
members = [
"crates/ibc",
"crates/ibc-derive",
"crates/ibc-testkit",
"crates/ibc-query",
"ibc",
"ibc-data-types",
"ibc-primitives",
"ibc-core",
"ibc-clients",
"ibc-apps",
"ibc-testkit",
"ibc-query",
"ibc-derive",
"ibc-core/ics02-client",
"ibc-core/ics02-client/types",
"ibc-core/ics03-connection",
"ibc-core/ics03-connection/types",
"ibc-core/ics04-channel",
"ibc-core/ics04-channel/types",
"ibc-core/ics23-commitment/types",
"ibc-core/ics24-host",
"ibc-core/ics24-host/types",
"ibc-core/ics24-host/cosmos",
"ibc-core/ics25-handler",
"ibc-core/ics25-handler/types",
"ibc-core/ics26-routing",
"ibc-core/ics26-routing/types",
"ibc-clients/ics07-tendermint",
"ibc-clients/ics07-tendermint/types",
"ibc-apps/ics20-transfer",
"ibc-apps/ics20-transfer/types",
]
exclude = [
"ci/cw-check",
Expand All @@ -22,41 +45,62 @@ authors = ["Informal Systems <hello@informal.systems>"]

[workspace.dependencies]
# external dependencies
borsh = {version = "0.10", default-features = false }
bytes = { version = "1.5.0", default-features = false }
displaydoc = { version = "0.2", default-features = false }
derive_more = { version = "0.99.17", default-features = false, features = ["from", "into", "display", "try_into"] }
env_logger = "0.10.0"
num-traits = { version = "0.2.17", default-features = false }
parking_lot = { version = "0.12.1", default-features = false }
primitive-types = { version = "0.12.2", default-features = false, features = ["serde_no_std"] }
prost = { version = "0.12", default-features = false }
rstest = "0.18.2"
schemars = { version = "0.8.15"}
sha2 = { version = "0.10.8", default-features = false }
serde = { version = "1.0", default-features = false }
serde_derive = { version = "1.0", default-features = false }
serde_json = { package = "serde-json-wasm", version = "1.0.0" , default-features = false }
subtle-encoding = { version = "0.5", default-features = false }
test-log = { version = "0.2.13", features = ["trace"] }
time = { version = ">=0.3.0, <0.3.31", default-features = false }
tracing = { version = "0.1.40", default-features = false }
tracing-subscriber = { version = "0.3.17", features = ["fmt", "env-filter", "json"] }
typed-builder = { version = "0.18.0"}
borsh = { version = "0.10", default-features = false }
bytes = { version = "1.5.0", default-features = false }
displaydoc = { version = "0.2", default-features = false }
derive_more = { version = "0.99.17", default-features = false, features = ["from", "into", "display", "try_into"] }
num-traits = { version = "0.2.17", default-features = false }
primitive-types = { version = "0.12.2", default-features = false, features = ["serde_no_std"] }
prost = { version = "0.12", default-features = false }
rstest = "0.18.2"
schemars = { version = "0.8.15" }
sha2 = { version = "0.10.8", default-features = false }
serde = { version = "1.0", default-features = false }
serde_json = { package = "serde-json-wasm", version = "1.0.0" , default-features = false }
subtle-encoding = { version = "0.5", default-features = false }
time = { version = ">=0.3.0, <0.3.31", default-features = false }

# ibc dependencies
ibc-derive = { version = "0.3.0", path = "../ibc-derive" }
ibc = { version = "0.47.0", path = "./ibc", default-features = false }
ibc-core = { version = "0.47.0", path = "./ibc-core", default-features = false }
ibc-clients = { version = "0.47.0", path = "./ibc-clients", default-features = false }
ibc-apps = { version = "0.47.0", path = "./ibc-apps", default-features = false }
ibc-primitives = { version = "0.47.0", path = "./ibc-primitives", default-features = false }
ibc-testkit = { version = "0.47.0", path = "./ibc-testkit" }
ibc-derive = { version = "0.3.0", path = "./ibc-derive" }

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

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

ibc-proto = { version = "0.38.0", default-features = false }
ics23 = { version = "0.11", default-features = false }
ics23 = { version = "0.11", default-features = false }

# cosmos dependencies
tendermint = { version = "0.34.0", default-features = false }
tendermint-light-client = { version = "0.34.0", default-features = false }
tendermint = { version = "0.34.0", default-features = false }
tendermint-light-client = { version = "0.34.0", default-features = false }
tendermint-light-client-verifier = { version = "0.34.0", default-features = false }
tendermint-proto = { version = "0.34.0", default-features = false }
tendermint-rpc = { version = "0.34.0", default-features = false }
tendermint-testgen = { version = "0.34.0", default-features = false }
tendermint-proto = { version = "0.34.0", default-features = false }
tendermint-rpc = { version = "0.34.0", default-features = false }
tendermint-testgen = { version = "0.34.0", default-features = false }

# parity dependencies
parity-scale-codec = { version = "3.6.5", default-features = false, features = ["full"] }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
Loading

0 comments on commit 4421b0d

Please sign in to comment.