Skip to content

Commit

Permalink
feat: core gRPC services (#842)
Browse files Browse the repository at this point in the history
* add grpc service dependencies

* client service implementation

* connection service implementation

* channel service implementation

* finish grpc service implementations

* QueryContext under grpc feature

* fix no-default-features lints

* use domain types

* return query block height

* happy lint

* immut router in validate

* client and connection param service

* implement upgrade service

* fix upgrade context

* rename struct fields and generics

* remove UpgradeValidationContext trait bound

* cargo fmt and clippy

* add ProvableContext

* add proofs to client service

* add proofs to connection service

* add proofs to channel service

* remove redundant trait method

* refactor ProvableContext trait bounds

* refactor service structs

* add service doc

* add context docs

* from impl for tonic status

* remove redundant map_errs

* fix cargo doc lint

* remove irrelevant comments

* handle empty sequence list

* a general variant of PackerError

* polish comments and logging

* remove grpc from default features

* mv grpc feature gated code under service

* mv files

* update mod files

* update prelude

* happy cargo doc

* happy cargo fmt

* support latest_height flag

* rm redundant trait method

* comment on grpc feature

* todo comment for pagination

* update client_status query

* rm redundant trait method

* add changelog entry

* nitpick

* rm allowed_clients

* update client params query

* update error message

Co-authored-by: Philippe Laferrière <plafer@protonmail.com>
Signed-off-by: Rano | Ranadeep <ranadip.bswas@gmail.com>

* revert immut ref on validate

will be fixed in separate PR

* rm tracing use

* document thread-safe params

* point changelog entry to issue

* rm FromStr from prelude

* doc strings with correct explanations

* rm reexports

---------

Signed-off-by: Rano | Ranadeep <ranadip.bswas@gmail.com>
Co-authored-by: Philippe Laferrière <plafer@protonmail.com>
  • Loading branch information
rnbguy and plafer authored Sep 15, 2023
1 parent b69d975 commit 0eeb7fc
Show file tree
Hide file tree
Showing 12 changed files with 1,252 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .changelog/unreleased/features/842-impl-grpc-services.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Blanket implementation of core gRPC services
([\#686](https://github.com/cosmos/ibc-rs/issues/686))
3 changes: 3 additions & 0 deletions crates/ibc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ std = [
]
parity-scale-codec = ["dep:parity-scale-codec", "dep:scale-info", "ibc-proto/parity-scale-codec"]
borsh = ["dep:borsh", "ibc-proto/borsh"]
# includes gRPC services for IBC core
grpc = ["dep:tonic", "ibc-proto/server"]

# This feature is required for token transfer (ICS-20)
serde = ["dep:serde", "dep:serde_derive", "serde_json", "ics23/serde"]
Expand Down Expand Up @@ -67,6 +69,7 @@ num-traits = { version = "0.2.15", default-features = false }
derive_more = { version = "0.99.17", default-features = false, features = ["from", "into", "display", "try_into"] }
uint = { version = "0.9", default-features = false }
primitive-types = { version = "0.12.0", default-features = false, features = ["serde_no_std"] }
tonic = { version = "0.9", optional = true }

## for codec encode or decode
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["full"], optional = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc/src/core/ics02_client/handler/create_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ where

let client_id = ClientId::new(client_type.clone(), id_counter).map_err(|e| {
ContextError::from(ClientError::ClientIdentifierConstructor {
client_type: client_state.client_type(),
client_type: client_type.clone(),
counter: id_counter,
validation_error: e,
})
Expand Down
2 changes: 2 additions & 0 deletions crates/ibc/src/core/ics04_channel/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ pub enum PacketError {
},
/// Cannot encode sequence `{sequence}`
CannotEncodeSequence { sequence: Sequence },
/// other error: `{description}`
Other { description: String },
}

impl From<IdentifierError> for ChannelError {
Expand Down
3 changes: 3 additions & 0 deletions crates/ibc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ pub mod clients;
pub mod core;
pub mod hosts;

#[cfg(feature = "grpc")]
pub mod services;

#[cfg(any(test, feature = "mocks"))]
pub mod mock;
#[cfg(any(test, feature = "mocks"))]
Expand Down
Loading

0 comments on commit 0eeb7fc

Please sign in to comment.