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

Cosmos grpc fallbackprovider #3139

Merged
merged 24 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e7c1dfa
feat: first working FallbackProvider refactor
daniel-savu Jan 5, 2024
3528598
chore: clean up
daniel-savu Jan 5, 2024
bfa4a86
Merge branch 'main' into dan/cosmos-fallback-provider
daniel-savu Jan 5, 2024
9c2b2e1
progress on moving FallbackProvider logic into hyperlane-core
daniel-savu Jan 7, 2024
0c6eea3
fix: use async-rwlock instead of tokio for a solana-compatible build
daniel-savu Jan 8, 2024
7c22e19
fix: clippy
daniel-savu Jan 8, 2024
4959696
wip on working fallback provider abstraction
daniel-savu Jan 9, 2024
7c68996
Merge branch 'main' into dan/cosmos-fallbackprovider
daniel-savu Jan 26, 2024
a8bba33
feat: cosmos fallback implementation that compiles
daniel-savu Jan 28, 2024
6bfb047
wip: unit tests for cosmos fallback provider
daniel-savu Jan 29, 2024
ef687c9
test: cosmos fallback provider
daniel-savu Jan 29, 2024
8e009f8
wip: end of attempts to use grpc middleware; will fall back at applic…
daniel-savu Jan 29, 2024
72185c4
feat: potentially working cosmos fallback provider
daniel-savu Jan 30, 2024
6da3cac
Merge branch 'main' into dan/cosmos-fallbackprovider
daniel-savu Jan 30, 2024
a347aff
chore: clean up
daniel-savu Jan 30, 2024
22cbb09
feat(cosmos): `grpcUrl` -> `grpcUrls` agents config
daniel-savu Jan 30, 2024
46c46ed
Merge branch 'main' into dan/cosmos-fallbackprovider
daniel-savu Jan 30, 2024
da16430
feat(cosmos): add `customGrpcUrls` agent config
daniel-savu Jan 31, 2024
e6d060f
chore: improve logging and test cosmos fallbackprovider e2e
daniel-savu Jan 31, 2024
f1ffa73
fixes
daniel-savu Feb 5, 2024
9eb831c
Merge branch 'main' into dan/cosmos-fallbackprovider
daniel-savu Feb 5, 2024
d0779f6
chore: rm comment
daniel-savu Feb 5, 2024
14ccd7a
fix: feature flag tokio
daniel-savu Feb 5, 2024
ffa787f
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-monorepo in…
daniel-savu Feb 5, 2024
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
1 change: 1 addition & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/chains/hyperlane-cosmos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ hyper = { workspace = true }
hyper-tls = { workspace = true }
injective-protobuf = { workspace = true }
injective-std = { workspace = true }
itertools = { workspace = true }
once_cell = { workspace = true }
protobuf = { workspace = true }
ripemd = { workspace = true }
Expand Down
7 changes: 7 additions & 0 deletions rust/chains/hyperlane-cosmos/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use cosmrs::proto::prost;
use hyperlane_core::ChainCommunicationError;
use std::fmt::Debug;

/// Errors from the crates specific to the hyperlane-cosmos
/// implementation.
Expand Down Expand Up @@ -28,6 +29,9 @@ pub enum HyperlaneCosmosError {
/// Tonic error
#[error("{0}")]
Tonic(#[from] tonic::transport::Error),
/// Tonic codegen error
#[error("{0}")]
TonicGenError(#[from] tonic::codegen::StdError),
/// Tendermint RPC Error
#[error(transparent)]
TendermintError(#[from] tendermint_rpc::error::Error),
Expand All @@ -37,6 +41,9 @@ pub enum HyperlaneCosmosError {
/// Protobuf error
#[error("{0}")]
Protobuf(#[from] protobuf::ProtobufError),
/// Fallback providers failed
#[error("Fallback providers failed. (Errors: {0:?})")]
FallbackProvidersFailed(Vec<HyperlaneCosmosError>),
}

impl From<HyperlaneCosmosError> for ChainCommunicationError {
Expand Down
1 change: 1 addition & 0 deletions rust/chains/hyperlane-cosmos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod multisig_ism;
mod payloads;
mod providers;
mod routing_ism;
mod rpc_clients;
mod signers;
mod trait_builder;
mod types;
Expand Down
4 changes: 2 additions & 2 deletions rust/chains/hyperlane-cosmos/src/payloads/aggregate_ism.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct VerifyRequest {
pub verify: VerifyRequestInner,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct VerifyRequestInner {
pub metadata: String,
pub message: String,
Expand Down
2 changes: 1 addition & 1 deletion rust/chains/hyperlane-cosmos/src/payloads/general.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct EmptyStruct {}

#[derive(Serialize, Deserialize, Debug, Clone)]
Expand Down
12 changes: 6 additions & 6 deletions rust/chains/hyperlane-cosmos/src/payloads/ism_routes.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use super::general::EmptyStruct;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct IsmRouteRequest {
pub route: IsmRouteRequestInner,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct IsmRouteRequestInner {
pub message: String, // hexbinary
}
Expand All @@ -16,22 +16,22 @@ pub struct IsmRouteRespnose {
pub ism: String,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct QueryRoutingIsmGeneralRequest<T> {
pub routing_ism: T,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct QueryRoutingIsmRouteResponse {
pub ism: String,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct QueryIsmGeneralRequest<T> {
pub ism: T,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct QueryIsmModuleTypeRequest {
pub module_type: EmptyStruct,
}
Expand Down
20 changes: 10 additions & 10 deletions rust/chains/hyperlane-cosmos/src/payloads/mailbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,52 @@ use serde::{Deserialize, Serialize};
use super::general::EmptyStruct;

// Requests
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GeneralMailboxQuery<T> {
pub mailbox: T,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct CountRequest {
pub count: EmptyStruct,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct NonceRequest {
pub nonce: EmptyStruct,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RecipientIsmRequest {
pub recipient_ism: RecipientIsmRequestInner,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RecipientIsmRequestInner {
pub recipient_addr: String, // hexbinary
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DefaultIsmRequest {
pub default_ism: EmptyStruct,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DeliveredRequest {
pub message_delivered: DeliveredRequestInner,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DeliveredRequestInner {
pub id: String, // hexbinary
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ProcessMessageRequest {
pub process: ProcessMessageRequestInner,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ProcessMessageRequestInner {
pub metadata: String,
pub message: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ use super::general::EmptyStruct;

const TREE_DEPTH: usize = 32;

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MerkleTreeGenericRequest<T> {
pub merkle_hook: T,
}

// --------- Requests ---------

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MerkleTreeRequest {
pub tree: EmptyStruct,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MerkleTreeCountRequest {
pub count: EmptyStruct,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct CheckPointRequest {
pub check_point: EmptyStruct,
}
Expand Down
4 changes: 2 additions & 2 deletions rust/chains/hyperlane-cosmos/src/payloads/multisig_ism.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct VerifyInfoRequest {
pub verify_info: VerifyInfoRequestInner,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct VerifyInfoRequestInner {
pub message: String, // hexbinary
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ use serde::{Deserialize, Serialize};

use super::general::EmptyStruct;

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GetAnnouncedValidatorsRequest {
pub get_announced_validators: EmptyStruct,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GetAnnounceStorageLocationsRequest {
pub get_announce_storage_locations: GetAnnounceStorageLocationsRequestInner,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GetAnnounceStorageLocationsRequestInner {
pub validators: Vec<String>,
}
Expand Down
Loading
Loading