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(voyager): fetch state proof in queue #875

Merged
merged 2 commits into from
Nov 1, 2023
Merged
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
3 changes: 1 addition & 2 deletions .ignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
uniond/vendor
unionpd/vendor
**/vendor
2 changes: 1 addition & 1 deletion lib/unionlabs/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{

/// `IbcPath` represents the path to a light client's ibc storage. The values stored at each path
/// are strongly typed, i.e. `connections/{connection_id}` always stores a [`ConnectionEnd`].
pub trait IbcPath<This: Chain, Counterparty>: Display + Clone + Sized {
pub trait IbcPath<This: Chain, Counterparty: Chain>: Display + Clone + Sized {
type Output: Debug + Clone + Serialize;
}

Expand Down
32 changes: 29 additions & 3 deletions voyager/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,22 @@ use futures::Future;
use serde::{Deserialize, Serialize};
use unionlabs::{
ethereum_consts_traits::{Mainnet, Minimal},
ibc::core::client::height::{HeightFromStrError, IsHeight},
ibc::core::{
channel::channel::Channel,
client::height::{HeightFromStrError, IsHeight},
connection::connection_end::ConnectionEnd,
},
id::{ChannelId, ConnectionId, PortId},
traits::{self, Chain},
};

use crate::{
chain::proof::{IbcStateRead, IbcStateReadPaths, StateProof},
chain::proof::{IbcStateRead, IbcStateReadPaths},
config::{self, ChainConfig, EvmChainConfig},
msg::{
aggregate::LightClientSpecificAggregate,
data::LightClientSpecificData,
fetch::{FetchUpdateHeaders, LightClientSpecificFetch},
fetch::{FetchStateProof, FetchUpdateHeaders, LightClientSpecificFetch},
msg::Msg,
DoAggregate, RelayerMsg,
},
Expand Down Expand Up @@ -118,6 +123,25 @@ pub trait LightClientBase: Send + Sync + Sized {

fn from_chain(chain: Self::HostChain) -> Self;

fn channel(
&self,
channel_id: ChannelId,
port_id: PortId,
at: HeightOf<Self::HostChain>,
) -> impl Future<Output = Channel> + '_;

fn connection(
&self,
connection_id: ConnectionId,
at: HeightOf<Self::HostChain>,
) -> impl Future<
Output = ConnectionEnd<
Self::ClientId,
<Self::Counterparty as LightClientBase>::ClientId,
String,
>,
> + '_;

// TODO: Use state_proof instead
fn query_client_state(
&self,
Expand Down Expand Up @@ -157,6 +181,8 @@ pub trait LightClient: LightClientBase<Counterparty = Self::BaseCounterparty> {
/// Error type for [`Self::msg`].
type MsgError: MaybeRecoverableError;

fn proof(&self, msg: FetchStateProof<Self>) -> RelayerMsg;

fn msg(&self, msg: Msg<Self>) -> impl Future<Output = Result<(), Self::MsgError>> + '_;

fn do_fetch(&self, msg: Self::Fetch) -> impl Future<Output = Vec<RelayerMsg>> + '_;
Expand Down
Loading