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

feat: core gRPC services #842

Merged
merged 58 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
a23a61a
add grpc service dependencies
rnbguy Jul 27, 2023
ee98869
client service implementation
rnbguy Jul 27, 2023
a906971
connection service implementation
rnbguy Jul 27, 2023
b8efb63
channel service implementation
rnbguy Jul 27, 2023
505b16f
finish grpc service implementations
rnbguy Aug 24, 2023
0963245
QueryContext under grpc feature
rnbguy Aug 24, 2023
efcbc88
fix no-default-features lints
rnbguy Aug 24, 2023
0931f24
use domain types
rnbguy Aug 24, 2023
cb75129
return query block height
rnbguy Aug 24, 2023
6eb22d3
happy lint
rnbguy Aug 24, 2023
cc38d8d
immut router in validate
rnbguy Aug 28, 2023
42c7f7a
client and connection param service
rnbguy Aug 28, 2023
3bb8f54
implement upgrade service
rnbguy Aug 28, 2023
f0ee9ec
fix upgrade context
rnbguy Aug 28, 2023
2c4354f
rename struct fields and generics
rnbguy Aug 28, 2023
bf40f92
remove UpgradeValidationContext trait bound
rnbguy Aug 28, 2023
67cd50b
cargo fmt and clippy
rnbguy Aug 28, 2023
c2d0476
add ProvableContext
rnbguy Aug 29, 2023
89316ea
add proofs to client service
rnbguy Aug 29, 2023
0ae557c
add proofs to connection service
rnbguy Aug 29, 2023
bbb1a64
add proofs to channel service
rnbguy Aug 29, 2023
c7c6594
remove redundant trait method
rnbguy Aug 29, 2023
ca23b38
refactor ProvableContext trait bounds
rnbguy Aug 29, 2023
de6d10e
refactor service structs
rnbguy Aug 29, 2023
981b154
add service doc
rnbguy Aug 29, 2023
e2898d9
add context docs
rnbguy Aug 29, 2023
09485a1
from impl for tonic status
rnbguy Aug 30, 2023
33ff797
remove redundant map_errs
rnbguy Aug 30, 2023
b995f18
fix cargo doc lint
rnbguy Aug 30, 2023
721b6bb
remove irrelevant comments
rnbguy Aug 31, 2023
a87d88c
handle empty sequence list
rnbguy Sep 4, 2023
5536594
a general variant of PackerError
rnbguy Sep 5, 2023
76c139b
polish comments and logging
rnbguy Sep 5, 2023
b3961e4
remove grpc from default features
rnbguy Sep 7, 2023
576a754
mv grpc feature gated code under service
rnbguy Sep 7, 2023
3ecad3c
mv files
rnbguy Sep 7, 2023
c6ea817
update mod files
rnbguy Sep 7, 2023
3dab9ed
update prelude
rnbguy Sep 7, 2023
d6d4a9a
happy cargo doc
rnbguy Sep 7, 2023
7725e53
happy cargo fmt
rnbguy Sep 7, 2023
e94deaa
support latest_height flag
rnbguy Sep 7, 2023
7b62cbb
rm redundant trait method
rnbguy Sep 7, 2023
db0d453
comment on grpc feature
rnbguy Sep 8, 2023
5546eb7
todo comment for pagination
rnbguy Sep 8, 2023
ddf40d2
update client_status query
rnbguy Sep 8, 2023
cb64ee1
rm redundant trait method
rnbguy Sep 8, 2023
0ffa854
add changelog entry
rnbguy Sep 8, 2023
49b2e25
nitpick
rnbguy Sep 11, 2023
9975840
rm allowed_clients
rnbguy Sep 12, 2023
7b9f375
update client params query
rnbguy Sep 12, 2023
f8f8afe
update error message
rnbguy Sep 12, 2023
63cbb64
revert immut ref on validate
rnbguy Sep 12, 2023
4f35d9f
rm tracing use
rnbguy Sep 12, 2023
b7bd700
document thread-safe params
rnbguy Sep 13, 2023
75ca4ca
point changelog entry to issue
rnbguy Sep 13, 2023
292abf7
rm FromStr from prelude
rnbguy Sep 14, 2023
7513fc8
doc strings with correct explanations
rnbguy Sep 14, 2023
9ebe9e5
rm reexports
rnbguy Sep 14, 2023
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
3 changes: 3 additions & 0 deletions crates/ibc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ std = [
parity-scale-codec = ["dep:parity-scale-codec", "dep:scale-info", "ibc-proto/parity-scale-codec"]
borsh = ["dep:borsh", "ibc-proto/borsh"]

grpc = ["dep:tonic", "ibc-proto/server"]
rnbguy marked this conversation as resolved.
Show resolved Hide resolved

# 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
3 changes: 1 addition & 2 deletions crates/ibc/src/core/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ use crate::core::ics04_channel::error::ChannelError;
use crate::core::ics04_channel::error::PacketError;
use crate::core::ics04_channel::packet::{Receipt, Sequence};
use crate::core::ics23_commitment::commitment::CommitmentPrefix;
use crate::core::ics24_host::identifier::ClientId;
use crate::core::ics24_host::identifier::ConnectionId;
use crate::core::ics24_host::identifier::{ClientId, ConnectionId};
use crate::core::ics24_host::path::{
AckPath, ChannelEndPath, ClientConnectionPath, ClientConsensusStatePath, CommitmentPath,
ConnectionPath, ReceiptPath, SeqAckPath, SeqRecvPath, SeqSendPath,
Expand Down
6 changes: 1 addition & 5 deletions crates/ibc/src/core/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ pub fn dispatch(
/// That is, the state transition of message `i` must be applied before
/// message `i+1` is validated. This is equivalent to calling
/// `dispatch()` on each successively.
pub fn validate<Ctx>(
ctx: &Ctx,
router: &mut impl Router,
msg: MsgEnvelope,
) -> Result<(), RouterError>
pub fn validate<Ctx>(ctx: &Ctx, router: &impl Router, msg: MsgEnvelope) -> Result<(), RouterError>
rnbguy marked this conversation as resolved.
Show resolved Hide resolved
where
Ctx: ValidationContext,
{
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 @@ -171,6 +171,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 @@ -53,6 +53,9 @@ pub mod clients;
pub mod core;
pub mod hosts;

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

#[cfg(any(test, feature = "mocks"))]
pub mod mock;
rnbguy marked this conversation as resolved.
Show resolved Hide resolved
#[cfg(any(test, feature = "mocks"))]
Expand Down
1 change: 1 addition & 0 deletions crates/ibc/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub use core::prelude::v1::*;
// https://doc.rust-lang.org/src/alloc/prelude/v1.rs.html
pub use alloc::borrow::ToOwned;
pub use alloc::boxed::Box;
pub use alloc::str::FromStr;
plafer marked this conversation as resolved.
Show resolved Hide resolved
pub use alloc::string::{String, ToString};
pub use alloc::vec::Vec;

Expand Down
Loading
Loading