From ecdddfe67f57968f6f1ca667242eed3c6561ffad Mon Sep 17 00:00:00 2001 From: benluelo Date: Wed, 1 Nov 2023 22:13:43 +0000 Subject: [PATCH] chore: cleanup --- lib/chain-utils/src/evm.rs | 2 +- lib/chain-utils/src/union.rs | 2 +- lib/ics-008-wasm-client/src/storage_utils.rs | 3 +- .../fuzz/fuzz_targets/duration/checked_add.rs | 2 +- .../fuzz/fuzz_targets/duration/from_str.rs | 2 +- .../fuzz/fuzz_targets/duration/roundtrip.rs | 2 +- .../fuzz/fuzz_targets/timestamp/roundtrip.rs | 2 +- lib/unionlabs/src/cosmos/crypto.rs | 2 +- .../src/cosmos/staking/commission.rs | 2 +- lib/unionlabs/src/cosmos/staking/validator.rs | 2 +- lib/unionlabs/src/{ibc => }/google.rs | 0 .../src/{ibc => }/google/protobuf.rs | 0 .../src/{ibc => }/google/protobuf/any.rs | 1 + .../src/{ibc => }/google/protobuf/duration.rs | 0 .../{ibc => }/google/protobuf/timestamp.rs | 2 +- lib/unionlabs/src/ibc.rs | 1 - .../src/ibc/core/client/msg_update_client.rs | 3 +- .../ibc/lightclients/cometbls/client_state.rs | 3 +- lib/unionlabs/src/lib.rs | 5 +- .../src/tendermint/types/commit_sig.rs | 2 +- lib/unionlabs/src/tendermint/types/header.rs | 2 +- .../cometbls-light-client/src/client.rs | 2 +- tools/todo-comment.nix | 1 + voyager/src/chain/evm.rs | 2 +- voyager/src/chain/union.rs | 4 +- voyager/src/msg.rs | 349 +----------------- voyager/src/msg/aggregate.rs | 332 +++++++++++++++++ voyager/src/queue.rs | 53 +-- 28 files changed, 362 insertions(+), 421 deletions(-) rename lib/unionlabs/src/{ibc => }/google.rs (100%) rename lib/unionlabs/src/{ibc => }/google/protobuf.rs (100%) rename lib/unionlabs/src/{ibc => }/google/protobuf/any.rs (98%) rename lib/unionlabs/src/{ibc => }/google/protobuf/duration.rs (100%) rename lib/unionlabs/src/{ibc => }/google/protobuf/timestamp.rs (99%) create mode 100644 voyager/src/msg/aggregate.rs diff --git a/lib/chain-utils/src/evm.rs b/lib/chain-utils/src/evm.rs index 343ecb77e8..3a17494e75 100644 --- a/lib/chain-utils/src/evm.rs +++ b/lib/chain-utils/src/evm.rs @@ -32,12 +32,12 @@ use unionlabs::{ ConnectionOpenAck, ConnectionOpenConfirm, ConnectionOpenInit, ConnectionOpenTry, CreateClient, IbcEvent, RecvPacket, SendPacket, }, + google::protobuf::any::Any, ibc::{ core::{ channel::channel::Channel, client::height::Height, connection::connection_end::ConnectionEnd, }, - google::protobuf::any::Any, lightclients::{cometbls, ethereum, tendermint::fraction::Fraction, wasm}, }, id::{ChannelId, ClientId, ConnectionId, PortId}, diff --git a/lib/chain-utils/src/union.rs b/lib/chain-utils/src/union.rs index 03a3f04566..3fde262b3e 100644 --- a/lib/chain-utils/src/union.rs +++ b/lib/chain-utils/src/union.rs @@ -9,9 +9,9 @@ use tendermint_rpc::{query::Query, Client, Order, WebSocketClient, WebSocketClie use unionlabs::{ ethereum::H256, events::{IbcEvent, TryFromTendermintEventError, WriteAcknowledgement}, + google::protobuf::{any::Any, duration::Duration}, ibc::{ core::{client::height::Height, commitment::merkle_root::MerkleRoot}, - google::protobuf::{any::Any, duration::Duration}, lightclients::{cometbls, wasm}, }, id::ClientId, diff --git a/lib/ics-008-wasm-client/src/storage_utils.rs b/lib/ics-008-wasm-client/src/storage_utils.rs index e8ec3b06ea..eccea0254c 100644 --- a/lib/ics-008-wasm-client/src/storage_utils.rs +++ b/lib/ics-008-wasm-client/src/storage_utils.rs @@ -2,7 +2,8 @@ use core::fmt::Debug; use cosmwasm_std::{CustomQuery, Deps, DepsMut}; use unionlabs::{ - ibc::{core::client::height::Height, google::protobuf::any::Any, lightclients::wasm}, + google::protobuf::any::Any, + ibc::{core::client::height::Height, lightclients::wasm}, IntoProto, Proto, TryFromProto, TryFromProtoErrorOf, }; diff --git a/lib/unionlabs/fuzz/fuzz_targets/duration/checked_add.rs b/lib/unionlabs/fuzz/fuzz_targets/duration/checked_add.rs index 0d5b69e953..9e8fbc5259 100644 --- a/lib/unionlabs/fuzz/fuzz_targets/duration/checked_add.rs +++ b/lib/unionlabs/fuzz/fuzz_targets/duration/checked_add.rs @@ -1,7 +1,7 @@ #![no_main] use libfuzzer_sys::fuzz_target; -use unionlabs::ibc::google::protobuf::duration::Duration; +use unionlabs::google::protobuf::duration::Duration; fuzz_target!(|data: (Duration, Duration)| { let (a, b) = data; diff --git a/lib/unionlabs/fuzz/fuzz_targets/duration/from_str.rs b/lib/unionlabs/fuzz/fuzz_targets/duration/from_str.rs index 7d0b1f60ae..36fcc657af 100644 --- a/lib/unionlabs/fuzz/fuzz_targets/duration/from_str.rs +++ b/lib/unionlabs/fuzz/fuzz_targets/duration/from_str.rs @@ -1,7 +1,7 @@ #![no_main] use libfuzzer_sys::fuzz_target; -use unionlabs::ibc::google::protobuf::duration::Duration; +use unionlabs::google::protobuf::duration::Duration; fuzz_target!(|data: &str| { let _ = data.parse::(); diff --git a/lib/unionlabs/fuzz/fuzz_targets/duration/roundtrip.rs b/lib/unionlabs/fuzz/fuzz_targets/duration/roundtrip.rs index dc926810a5..17d370b315 100644 --- a/lib/unionlabs/fuzz/fuzz_targets/duration/roundtrip.rs +++ b/lib/unionlabs/fuzz/fuzz_targets/duration/roundtrip.rs @@ -1,7 +1,7 @@ #![no_main] use libfuzzer_sys::fuzz_target; -use unionlabs::{ibc::google::protobuf::duration::Duration, test_utils::*}; +use unionlabs::{google::protobuf::duration::Duration, test_utils::*}; fuzz_target!(|data: Duration| { assert_proto_roundtrip(&data); diff --git a/lib/unionlabs/fuzz/fuzz_targets/timestamp/roundtrip.rs b/lib/unionlabs/fuzz/fuzz_targets/timestamp/roundtrip.rs index 0c8c7f06f1..a329f02342 100644 --- a/lib/unionlabs/fuzz/fuzz_targets/timestamp/roundtrip.rs +++ b/lib/unionlabs/fuzz/fuzz_targets/timestamp/roundtrip.rs @@ -1,7 +1,7 @@ #![no_main] use libfuzzer_sys::fuzz_target; -use unionlabs::{ibc::google::protobuf::timestamp::Timestamp, test_utils::*}; +use unionlabs::{google::protobuf::timestamp::Timestamp, test_utils::*}; fuzz_target!(|data: Timestamp| { assert_proto_roundtrip(&data); diff --git a/lib/unionlabs/src/cosmos/crypto.rs b/lib/unionlabs/src/cosmos/crypto.rs index 08187d2ad1..76f2bb2861 100644 --- a/lib/unionlabs/src/cosmos/crypto.rs +++ b/lib/unionlabs/src/cosmos/crypto.rs @@ -3,7 +3,7 @@ use std::fmt::Debug; use serde::{Deserialize, Serialize}; use crate::{ - errors::InvalidLength, ibc::google::protobuf::any::Any, IntoProto, Proto, TryFromProto, + errors::InvalidLength, google::protobuf::any::Any, IntoProto, Proto, TryFromProto, TryFromProtoBytesError, TypeUrl, }; diff --git a/lib/unionlabs/src/cosmos/staking/commission.rs b/lib/unionlabs/src/cosmos/staking/commission.rs index eba0f49d59..1b159d507a 100644 --- a/lib/unionlabs/src/cosmos/staking/commission.rs +++ b/lib/unionlabs/src/cosmos/staking/commission.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use crate::{ cosmos::staking::commission_rates::CommissionRates, errors::{required, MissingField}, - ibc::google::protobuf::timestamp::Timestamp, + google::protobuf::timestamp::Timestamp, Proto, TryFromProtoErrorOf, TypeUrl, }; diff --git a/lib/unionlabs/src/cosmos/staking/validator.rs b/lib/unionlabs/src/cosmos/staking/validator.rs index 23fc97c794..f02f8283ad 100644 --- a/lib/unionlabs/src/cosmos/staking/validator.rs +++ b/lib/unionlabs/src/cosmos/staking/validator.rs @@ -8,7 +8,7 @@ use crate::{ staking::{bond_status::BondStatus, commission::Commission, description::Description}, }, errors::{required, MissingField, UnknownEnumVariant}, - ibc::google::protobuf::timestamp::Timestamp, + google::protobuf::timestamp::Timestamp, Proto, TryFromProtoErrorOf, TypeUrl, }; diff --git a/lib/unionlabs/src/ibc/google.rs b/lib/unionlabs/src/google.rs similarity index 100% rename from lib/unionlabs/src/ibc/google.rs rename to lib/unionlabs/src/google.rs diff --git a/lib/unionlabs/src/ibc/google/protobuf.rs b/lib/unionlabs/src/google/protobuf.rs similarity index 100% rename from lib/unionlabs/src/ibc/google/protobuf.rs rename to lib/unionlabs/src/google/protobuf.rs diff --git a/lib/unionlabs/src/ibc/google/protobuf/any.rs b/lib/unionlabs/src/google/protobuf/any.rs similarity index 98% rename from lib/unionlabs/src/ibc/google/protobuf/any.rs rename to lib/unionlabs/src/google/protobuf/any.rs index f76f31d1d2..0e347aa7e5 100644 --- a/lib/unionlabs/src/ibc/google/protobuf/any.rs +++ b/lib/unionlabs/src/google/protobuf/any.rs @@ -16,6 +16,7 @@ use crate::{ #[derive(Debug, Clone, PartialEq)] pub struct Any(pub T); +/// TODO(unionlabs/union#876): Properly implement google.protobuf.Any json serde impl<'de, T> Deserialize<'de> for Any where T: Deserialize<'de> + TryFromProto, diff --git a/lib/unionlabs/src/ibc/google/protobuf/duration.rs b/lib/unionlabs/src/google/protobuf/duration.rs similarity index 100% rename from lib/unionlabs/src/ibc/google/protobuf/duration.rs rename to lib/unionlabs/src/google/protobuf/duration.rs diff --git a/lib/unionlabs/src/ibc/google/protobuf/timestamp.rs b/lib/unionlabs/src/google/protobuf/timestamp.rs similarity index 99% rename from lib/unionlabs/src/ibc/google/protobuf/timestamp.rs rename to lib/unionlabs/src/google/protobuf/timestamp.rs index 0990d9c2e1..2f29b0e5ca 100644 --- a/lib/unionlabs/src/ibc/google/protobuf/timestamp.rs +++ b/lib/unionlabs/src/google/protobuf/timestamp.rs @@ -9,7 +9,7 @@ use serde::{ use crate::{ bounded::{BoundedI32, BoundedI64, BoundedIntError}, - ibc::google::protobuf::duration::{Duration, NANOS_PER_SECOND}, + google::protobuf::duration::{Duration, NANOS_PER_SECOND}, Proto, TypeUrl, }; diff --git a/lib/unionlabs/src/ibc.rs b/lib/unionlabs/src/ibc.rs index 3e9615f169..c37ae57d0c 100644 --- a/lib/unionlabs/src/ibc.rs +++ b/lib/unionlabs/src/ibc.rs @@ -1,4 +1,3 @@ pub mod applications; pub mod core; -pub mod google; pub mod lightclients; diff --git a/lib/unionlabs/src/ibc/core/client/msg_update_client.rs b/lib/unionlabs/src/ibc/core/client/msg_update_client.rs index fcdd6243e9..ae7d625b95 100644 --- a/lib/unionlabs/src/ibc/core/client/msg_update_client.rs +++ b/lib/unionlabs/src/ibc/core/client/msg_update_client.rs @@ -1,8 +1,7 @@ use serde::{Deserialize, Serialize}; use crate::{ - ibc::google::protobuf::any::Any, traits, CosmosAccountId, IntoProto, MsgIntoProto, Proto, - TypeUrl, + google::protobuf::any::Any, traits, CosmosAccountId, IntoProto, MsgIntoProto, Proto, TypeUrl, }; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] diff --git a/lib/unionlabs/src/ibc/lightclients/cometbls/client_state.rs b/lib/unionlabs/src/ibc/lightclients/cometbls/client_state.rs index 268006ddb5..16b72ddbe7 100644 --- a/lib/unionlabs/src/ibc/lightclients/cometbls/client_state.rs +++ b/lib/unionlabs/src/ibc/lightclients/cometbls/client_state.rs @@ -2,7 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ errors::{required, MissingField}, - ibc::{core::client::height::Height, google::protobuf::duration::Duration}, + google::protobuf::duration::Duration, + ibc::core::client::height::Height, Proto, TryFromProtoErrorOf, TypeUrl, }; diff --git a/lib/unionlabs/src/lib.rs b/lib/unionlabs/src/lib.rs index 007bb1fbcc..e4052348e8 100644 --- a/lib/unionlabs/src/lib.rs +++ b/lib/unionlabs/src/lib.rs @@ -16,6 +16,9 @@ use sha2::Digest; use crate::{errors::TryFromBranchError, ethereum::H256, id::Bounded, validated::Validated}; +/// Wrapper types around protos defined in , matching the proto module structure. +pub mod google; + /// Defines types that wrap the IBC specification, matching the proto module structure. This also includes `union` extensions to ibc (i.e. types defined in `union.ibc`). pub mod ibc; @@ -438,9 +441,9 @@ pub mod traits { use crate::{ ethereum::{H256, U256}, ethereum_consts_traits::ChainSpec, + google::protobuf::any::Any, ibc::{ core::client::height::{Height, IsHeight}, - google::protobuf::any::Any, lightclients::{cometbls, ethereum, wasm}, }, id::{ChannelId, PortId}, diff --git a/lib/unionlabs/src/tendermint/types/commit_sig.rs b/lib/unionlabs/src/tendermint/types/commit_sig.rs index 36b833296a..702e4c064d 100644 --- a/lib/unionlabs/src/tendermint/types/commit_sig.rs +++ b/lib/unionlabs/src/tendermint/types/commit_sig.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use crate::{ errors::{required, InvalidLength, MissingField}, ethereum::{Address, H512}, - ibc::google::protobuf::timestamp::Timestamp, + google::protobuf::timestamp::Timestamp, tendermint::types::block_id_flag::BlockIdFlag, Proto, TryFromProtoErrorOf, TypeUrl, }; diff --git a/lib/unionlabs/src/tendermint/types/header.rs b/lib/unionlabs/src/tendermint/types/header.rs index 1a7f74198e..2d5e6ed5d9 100644 --- a/lib/unionlabs/src/tendermint/types/header.rs +++ b/lib/unionlabs/src/tendermint/types/header.rs @@ -6,7 +6,7 @@ use crate::{ bounded::{BoundedI64, BoundedIntError}, errors::{required, InvalidLength, MissingField}, ethereum::{Address, H256}, - ibc::google::protobuf::timestamp::Timestamp, + google::protobuf::timestamp::Timestamp, tendermint::{types::block_id::BlockId, version::consensus::Consensus}, Proto, TryFromProtoErrorOf, TypeUrl, }; diff --git a/light-clients/cometbls-light-client/src/client.rs b/light-clients/cometbls-light-client/src/client.rs index 7f44015457..3c3136d072 100644 --- a/light-clients/cometbls-light-client/src/client.rs +++ b/light-clients/cometbls-light-client/src/client.rs @@ -7,9 +7,9 @@ use ics008_wasm_client::{ }; use prost::Message; use unionlabs::{ + google::protobuf::timestamp::Timestamp, ibc::{ core::{client::height::Height, commitment::merkle_root::MerkleRoot}, - google::protobuf::timestamp::Timestamp, lightclients::cometbls::{ client_state::ClientState, consensus_state::ConsensusState, header::Header, }, diff --git a/tools/todo-comment.nix b/tools/todo-comment.nix index f3ef391c5b..0bd995daf9 100644 --- a/tools/todo-comment.nix +++ b/tools/todo-comment.nix @@ -6,6 +6,7 @@ name = "tdc"; runtimeInputs = with pkgs; [ gh coreutils ]; text = '' + gh auth login TODO_ID=$(gh issue create -t "$1" -b "_Generated by the devShell's \`tdc\` cli_" --label "todo comment" -a "@me" | tail -n 1 | sed 's|https://github.com/\(.*\)/issues/\(.*\)|\1#\2|'); echo "TODO($TODO_ID): $1" ''; diff --git a/voyager/src/chain/evm.rs b/voyager/src/chain/evm.rs index f0c72299f9..ffeb414baf 100644 --- a/voyager/src/chain/evm.rs +++ b/voyager/src/chain/evm.rs @@ -37,6 +37,7 @@ use unionlabs::{ Address, }, ethereum_consts_traits::{ChainSpec, Mainnet, Minimal}, + google::protobuf::any::Any, ibc::{ core::{ client::{ @@ -45,7 +46,6 @@ use unionlabs::{ }, connection::connection_end::ConnectionEnd, }, - google::protobuf::any::Any, lightclients::{ ethereum::{ self, diff --git a/voyager/src/chain/union.rs b/voyager/src/chain/union.rs index dc0b9bc931..d951c78e0f 100644 --- a/voyager/src/chain/union.rs +++ b/voyager/src/chain/union.rs @@ -24,12 +24,12 @@ use unionlabs::{ bounded::BoundedI64, ethereum::{Address, H256, H512}, ethereum_consts_traits::{ChainSpec, Mainnet, Minimal}, + google::protobuf::{any::Any, timestamp::Timestamp}, ibc::{ core::{ client::{height::Height, msg_update_client::MsgUpdateClient}, connection::connection_end::ConnectionEnd, }, - google::protobuf::{any::Any, timestamp::Timestamp}, lightclients::{cometbls, ethereum, wasm}, }, id::ClientId, @@ -411,7 +411,7 @@ where tendermint::block::CommitSig::BlockIdFlagAbsent => CommitSig { block_id_flag: BlockIdFlag::Absent, validator_address: Address([0; 20]), - timestamp: unionlabs::ibc::google::protobuf::timestamp::Timestamp { + timestamp: unionlabs::google::protobuf::timestamp::Timestamp { seconds: 0.try_into().unwrap(), nanos: 0.try_into().unwrap(), }, diff --git a/voyager/src/msg.rs b/voyager/src/msg.rs index 4e22f4997c..70129c1431 100644 --- a/voyager/src/msg.rs +++ b/voyager/src/msg.rs @@ -31,6 +31,7 @@ use crate::{ }, }; +pub mod aggregate; pub mod data; pub mod event; pub mod fetch; @@ -368,354 +369,6 @@ macro_rules! any_enum { pub(crate) use any_enum; -// TODO: Move to file -pub mod aggregate { - use std::fmt::Display; - - use frame_support_procedural::{CloneNoBound, DebugNoBound, PartialEqNoBound}; - use serde::{Deserialize, Serialize}; - use unionlabs::{ - ethereum::H256, - events::{ - ChannelOpenAck, ChannelOpenInit, ChannelOpenTry, ConnectionOpenAck, ConnectionOpenInit, - ConnectionOpenTry, RecvPacket, SendPacket, - }, - }; - - use super::ChainIdOf; - use crate::{ - chain::{ChainOf, HeightOf, LightClient, LightClientBase}, - msg::fetch::FetchStateProof, - }; - - any_enum! { - /// Aggregate data, using data from [`AggregateData`] - #[any = AnyAggregate] - pub enum Aggregate { - ConnectionOpenTry(AggregateConnectionOpenTry), - ConnectionOpenAck(AggregateConnectionOpenAck), - ConnectionOpenConfirm(AggregateConnectionOpenConfirm), - - ChannelOpenTry(AggregateChannelOpenTry), - ChannelOpenAck(AggregateChannelOpenAck), - ChannelOpenConfirm(AggregateChannelOpenConfirm), - - RecvPacket(AggregateRecvPacket), - AckPacket(AggregateAckPacket), - - ConnectionFetchFromChannelEnd(AggregateConnectionFetchFromChannelEnd), - - // Aggregate that fetches the connection info from the channel - ChannelHandshakeUpdateClient(AggregateChannelHandshakeUpdateClient), - - PacketUpdateClient(AggregatePacketUpdateClient), - - WaitForTrustedHeight(AggregateWaitForTrustedHeight), - - FetchCounterpartyStateproof(AggregateFetchCounterpartyStateProof), - - UpdateClientFromClientId(AggregateUpdateClientFromClientId), - - UpdateClient(AggregateUpdateClient), - UpdateClientWithCounterpartyChainIdData(AggregateUpdateClientWithCounterpartyChainId), - - CreateClient(AggregateCreateClient), - - ConsensusStateProofAtLatestHeight(ConsensusStateProofAtLatestHeight), - - AggregateMsgAfterUpdate(AggregateMsgAfterUpdate), - - LightClientSpecific(LightClientSpecificAggregate), - } - } - - impl Display for Aggregate { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Aggregate::ConnectionOpenTry(_) => write!(f, "ConnectionOpenTry"), - Aggregate::ConnectionOpenAck(_) => write!(f, "ConnectionOpenAck"), - Aggregate::ConnectionOpenConfirm(_) => write!(f, "ConnectionOpenConfirm"), - Aggregate::ChannelOpenTry(_) => write!(f, "ChannelOpenTry"), - Aggregate::ChannelOpenAck(_) => write!(f, "ChannelOpenAck"), - Aggregate::ChannelOpenConfirm(_) => write!(f, "ChannelOpenConfirm"), - Aggregate::RecvPacket(_) => write!(f, "RecvPacket"), - Aggregate::AckPacket(_) => write!(f, "AckPacket"), - Aggregate::ConnectionFetchFromChannelEnd(_) => { - write!(f, "ConnectionFetchFromChannelEnd") - } - Aggregate::ChannelHandshakeUpdateClient(_) => { - write!(f, "ChannelHandshakeUpdateClient") - } - Aggregate::PacketUpdateClient(msg) => { - write!( - f, - "PacketUpdateClient::{}", - match msg.packet_event { - PacketEvent::Send(_) => "Send", - PacketEvent::Recv(_) => "Recv", - } - ) - } - Aggregate::WaitForTrustedHeight(_) => write!(f, "WaitForTrustedHeight"), - Aggregate::FetchCounterpartyStateproof(_) => { - write!(f, "FetchCounterpartyStateproof") - } - Aggregate::UpdateClientFromClientId(_) => write!(f, "UpdateClientFromClientId"), - Aggregate::UpdateClient(_) => write!(f, "UpdateClient"), - Aggregate::UpdateClientWithCounterpartyChainIdData(_) => { - write!(f, "UpdateClientWithCounterpartyChainIdData") - } - Aggregate::CreateClient(_) => write!(f, "CreateClient"), - Aggregate::ConsensusStateProofAtLatestHeight(_) => { - write!(f, "ConsensusStateProofAtLatestHeight") - } - Aggregate::AggregateMsgAfterUpdate(msg) => { - write!(f, "AggregateMsgAfterUpdate::")?; - match msg { - AggregateMsgAfterUpdate::ConnectionOpenTry(_) => { - write!(f, "ConnectionOpenTry") - } - AggregateMsgAfterUpdate::ConnectionOpenAck(_) => { - write!(f, "ConnectionOpenAck") - } - AggregateMsgAfterUpdate::ConnectionOpenConfirm(_) => { - write!(f, "ConnectionOpenConfirm") - } - AggregateMsgAfterUpdate::ChannelOpenTry(_) => write!(f, "ChannelOpenTry"), - AggregateMsgAfterUpdate::ChannelOpenAck(_) => write!(f, "ChannelOpenAck"), - AggregateMsgAfterUpdate::ChannelOpenConfirm(_) => { - write!(f, "ChannelOpenConfirm") - } - AggregateMsgAfterUpdate::RecvPacket(_) => write!(f, "RecvPacket"), - AggregateMsgAfterUpdate::AckPacket(_) => write!(f, "AckPacket"), - } - } - Aggregate::LightClientSpecific(agg) => write!(f, "LightClientSpecific({})", agg.0), - } - } - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateConnectionOpenTry { - pub event_height: HeightOf, - pub event: ConnectionOpenInit::ClientId>, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateConnectionOpenAck { - pub event_height: HeightOf, - pub event: ConnectionOpenTry::ClientId>, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateConnectionOpenConfirm { - pub event_height: HeightOf, - pub event: ConnectionOpenAck::ClientId>, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateChannelOpenTry { - pub event_height: HeightOf, - pub event: ChannelOpenInit, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateChannelOpenAck { - pub event_height: HeightOf, - pub event: ChannelOpenTry, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateChannelOpenConfirm { - pub event_height: HeightOf, - pub event: ChannelOpenAck, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateRecvPacket { - pub event_height: HeightOf, - pub event: SendPacket, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateAckPacket { - pub event_height: HeightOf, - pub event: RecvPacket, - // HACK: Need to pass the block hash through, figure out a better/cleaner way to do this - pub block_hash: H256, - pub counterparty_client_id: ::ClientId, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateConnectionFetchFromChannelEnd { - pub at: HeightOf>, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateChannelHandshakeUpdateClient { - // Will be threaded through to the update msg - pub update_to: HeightOf, - pub event_height: HeightOf, - pub channel_handshake_event: ChannelHandshakeEvent, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub enum ChannelHandshakeEvent { - Init(ChannelOpenInit), - Try(ChannelOpenTry), - Ack(ChannelOpenAck), - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregatePacketUpdateClient { - // Will be threaded through to the update msg - pub update_to: HeightOf, - pub event_height: HeightOf, - pub block_hash: H256, - pub packet_event: PacketEvent, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub enum PacketEvent { - Send(SendPacket), - Recv(RecvPacket), - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateFetchCounterpartyStateProof { - pub counterparty_client_id: ::ClientId, - pub fetch: FetchStateProof, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateUpdateClientFromClientId { - pub client_id: L::ClientId, - pub counterparty_client_id: ::ClientId, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateUpdateClient { - pub update_to: HeightOf, - pub client_id: L::ClientId, - pub counterparty_client_id: ::ClientId, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateWaitForTrustedHeight { - pub wait_for: HeightOf, - pub client_id: L::ClientId, - pub counterparty_client_id: ::ClientId, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateUpdateClientWithCounterpartyChainId { - pub update_to: HeightOf, - pub client_id: L::ClientId, - pub counterparty_client_id: ::ClientId, - pub counterparty_chain_id: ChainIdOf, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateMsgUpdateClient { - pub update_to: HeightOf, - pub client_id: L::ClientId, - pub counterparty_client_id: ::ClientId, - pub counterparty_chain_id: ChainIdOf, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct AggregateCreateClient { - pub config: L::Config, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct ConsensusStateProofAtLatestHeight { - pub client_id: L::ClientId, - pub at: HeightOf>, - } - - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub struct LightClientSpecificAggregate(pub L::Aggregate); - - /// Messages that will be re-queued after an update. - #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - #[serde(bound(serialize = "", deserialize = ""))] - pub enum AggregateMsgAfterUpdate { - ConnectionOpenTry(AggregateConnectionOpenTry), - ConnectionOpenAck(AggregateConnectionOpenAck), - ConnectionOpenConfirm(AggregateConnectionOpenConfirm), - - ChannelOpenTry(AggregateChannelOpenTry), - ChannelOpenAck(AggregateChannelOpenAck), - ChannelOpenConfirm(AggregateChannelOpenConfirm), - - RecvPacket(AggregateRecvPacket), - AckPacket(AggregateAckPacket), - } - - // #[derive( - // DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize, derive_more::Display, - // )] - // #[serde(bound(serialize = "", deserialize = ""))] - // pub enum AggregateAnyStateProof { - // #[display(fmt = "{_0}")] - // ClientState( - // AggregateStateProof< - // L, - // ClientStatePath<::ClientId>, - // >, - // ), - // #[display(fmt = "{_0}")] - // ClientConsensusState( - // AggregateStateProof< - // L, - // ClientConsensusStatePath< - // as unionlabs::traits::Chain>::ClientId, - // HeightOf>, - // >, - // >, - // ), - // #[display(fmt = "{_0}")] - // Connection(AggregateStateProof), - // #[display(fmt = "{_0}")] - // ChannelEnd(AggregateStateProof), - // #[display(fmt = "{_0}")] - // Commitment(AggregateStateProof), - // #[display(fmt = "{_0}")] - // Acknowledgement(AggregateStateProof), - // } - - // #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] - // #[serde(bound(serialize = "", deserialize = ""))] - // pub struct AggregateStateProof> { - // height: HeightOf>, - // #[serde(skip)] - // pub __marker: PhantomData

, - // } -} - pub trait IbcPathExt: IbcPath, ChainOf> { type Data: TryFrom + Into; type Proof: TryFrom + Into; diff --git a/voyager/src/msg/aggregate.rs b/voyager/src/msg/aggregate.rs new file mode 100644 index 0000000000..4f67d66452 --- /dev/null +++ b/voyager/src/msg/aggregate.rs @@ -0,0 +1,332 @@ +use std::fmt::Display; + +use frame_support_procedural::{CloneNoBound, DebugNoBound, PartialEqNoBound}; +use serde::{Deserialize, Serialize}; +use unionlabs::{ + ethereum::H256, + events::{ + ChannelOpenAck, ChannelOpenInit, ChannelOpenTry, ConnectionOpenAck, ConnectionOpenInit, + ConnectionOpenTry, RecvPacket, SendPacket, + }, +}; + +use super::ChainIdOf; +use crate::{ + chain::{ChainOf, HeightOf, LightClient, LightClientBase}, + msg::{any_enum, fetch::FetchStateProof}, +}; + +any_enum! { + /// Aggregate data, using data from [`AggregateData`] + #[any = AnyAggregate] + pub enum Aggregate { + ConnectionOpenTry(AggregateConnectionOpenTry), + ConnectionOpenAck(AggregateConnectionOpenAck), + ConnectionOpenConfirm(AggregateConnectionOpenConfirm), + + ChannelOpenTry(AggregateChannelOpenTry), + ChannelOpenAck(AggregateChannelOpenAck), + ChannelOpenConfirm(AggregateChannelOpenConfirm), + + RecvPacket(AggregateRecvPacket), + AckPacket(AggregateAckPacket), + + ConnectionFetchFromChannelEnd(AggregateConnectionFetchFromChannelEnd), + + // Aggregate that fetches the connection info from the channel + ChannelHandshakeUpdateClient(AggregateChannelHandshakeUpdateClient), + + PacketUpdateClient(AggregatePacketUpdateClient), + + WaitForTrustedHeight(AggregateWaitForTrustedHeight), + + FetchCounterpartyStateproof(AggregateFetchCounterpartyStateProof), + + UpdateClientFromClientId(AggregateUpdateClientFromClientId), + + UpdateClient(AggregateUpdateClient), + UpdateClientWithCounterpartyChainIdData(AggregateUpdateClientWithCounterpartyChainId), + + CreateClient(AggregateCreateClient), + + AggregateMsgAfterUpdate(AggregateMsgAfterUpdate), + + LightClientSpecific(LightClientSpecificAggregate), + } +} + +impl Display for Aggregate { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Aggregate::ConnectionOpenTry(_) => write!(f, "ConnectionOpenTry"), + Aggregate::ConnectionOpenAck(_) => write!(f, "ConnectionOpenAck"), + Aggregate::ConnectionOpenConfirm(_) => write!(f, "ConnectionOpenConfirm"), + Aggregate::ChannelOpenTry(_) => write!(f, "ChannelOpenTry"), + Aggregate::ChannelOpenAck(_) => write!(f, "ChannelOpenAck"), + Aggregate::ChannelOpenConfirm(_) => write!(f, "ChannelOpenConfirm"), + Aggregate::RecvPacket(_) => write!(f, "RecvPacket"), + Aggregate::AckPacket(_) => write!(f, "AckPacket"), + Aggregate::ConnectionFetchFromChannelEnd(_) => { + write!(f, "ConnectionFetchFromChannelEnd") + } + Aggregate::ChannelHandshakeUpdateClient(_) => { + write!(f, "ChannelHandshakeUpdateClient") + } + Aggregate::PacketUpdateClient(msg) => { + write!( + f, + "PacketUpdateClient::{}", + match msg.packet_event { + PacketEvent::Send(_) => "Send", + PacketEvent::Recv(_) => "Recv", + } + ) + } + Aggregate::WaitForTrustedHeight(_) => write!(f, "WaitForTrustedHeight"), + Aggregate::FetchCounterpartyStateproof(_) => { + write!(f, "FetchCounterpartyStateproof") + } + Aggregate::UpdateClientFromClientId(_) => write!(f, "UpdateClientFromClientId"), + Aggregate::UpdateClient(_) => write!(f, "UpdateClient"), + Aggregate::UpdateClientWithCounterpartyChainIdData(_) => { + write!(f, "UpdateClientWithCounterpartyChainIdData") + } + Aggregate::CreateClient(_) => write!(f, "CreateClient"), + Aggregate::AggregateMsgAfterUpdate(msg) => { + write!(f, "AggregateMsgAfterUpdate::")?; + match msg { + AggregateMsgAfterUpdate::ConnectionOpenTry(_) => { + write!(f, "ConnectionOpenTry") + } + AggregateMsgAfterUpdate::ConnectionOpenAck(_) => { + write!(f, "ConnectionOpenAck") + } + AggregateMsgAfterUpdate::ConnectionOpenConfirm(_) => { + write!(f, "ConnectionOpenConfirm") + } + AggregateMsgAfterUpdate::ChannelOpenTry(_) => write!(f, "ChannelOpenTry"), + AggregateMsgAfterUpdate::ChannelOpenAck(_) => write!(f, "ChannelOpenAck"), + AggregateMsgAfterUpdate::ChannelOpenConfirm(_) => { + write!(f, "ChannelOpenConfirm") + } + AggregateMsgAfterUpdate::RecvPacket(_) => write!(f, "RecvPacket"), + AggregateMsgAfterUpdate::AckPacket(_) => write!(f, "AckPacket"), + } + } + Aggregate::LightClientSpecific(agg) => write!(f, "LightClientSpecific({})", agg.0), + } + } +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateConnectionOpenTry { + pub event_height: HeightOf, + pub event: ConnectionOpenInit::ClientId>, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateConnectionOpenAck { + pub event_height: HeightOf, + pub event: ConnectionOpenTry::ClientId>, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateConnectionOpenConfirm { + pub event_height: HeightOf, + pub event: ConnectionOpenAck::ClientId>, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateChannelOpenTry { + pub event_height: HeightOf, + pub event: ChannelOpenInit, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateChannelOpenAck { + pub event_height: HeightOf, + pub event: ChannelOpenTry, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateChannelOpenConfirm { + pub event_height: HeightOf, + pub event: ChannelOpenAck, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateRecvPacket { + pub event_height: HeightOf, + pub event: SendPacket, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateAckPacket { + pub event_height: HeightOf, + pub event: RecvPacket, + // HACK: Need to pass the block hash through, figure out a better/cleaner way to do this + pub block_hash: H256, + pub counterparty_client_id: ::ClientId, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateConnectionFetchFromChannelEnd { + pub at: HeightOf>, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateChannelHandshakeUpdateClient { + // Will be threaded through to the update msg + pub update_to: HeightOf, + pub event_height: HeightOf, + pub channel_handshake_event: ChannelHandshakeEvent, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub enum ChannelHandshakeEvent { + Init(ChannelOpenInit), + Try(ChannelOpenTry), + Ack(ChannelOpenAck), +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregatePacketUpdateClient { + // Will be threaded through to the update msg + pub update_to: HeightOf, + pub event_height: HeightOf, + pub block_hash: H256, + pub packet_event: PacketEvent, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub enum PacketEvent { + Send(SendPacket), + Recv(RecvPacket), +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateFetchCounterpartyStateProof { + pub counterparty_client_id: ::ClientId, + pub fetch: FetchStateProof, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateUpdateClientFromClientId { + pub client_id: L::ClientId, + pub counterparty_client_id: ::ClientId, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateUpdateClient { + pub update_to: HeightOf, + pub client_id: L::ClientId, + pub counterparty_client_id: ::ClientId, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateWaitForTrustedHeight { + pub wait_for: HeightOf, + pub client_id: L::ClientId, + pub counterparty_client_id: ::ClientId, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateUpdateClientWithCounterpartyChainId { + pub update_to: HeightOf, + pub client_id: L::ClientId, + pub counterparty_client_id: ::ClientId, + pub counterparty_chain_id: ChainIdOf, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateMsgUpdateClient { + pub update_to: HeightOf, + pub client_id: L::ClientId, + pub counterparty_client_id: ::ClientId, + pub counterparty_chain_id: ChainIdOf, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct AggregateCreateClient { + pub config: L::Config, +} + +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub struct LightClientSpecificAggregate(pub L::Aggregate); + +/// Messages that will be re-queued after an update. +#[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +#[serde(bound(serialize = "", deserialize = ""))] +pub enum AggregateMsgAfterUpdate { + ConnectionOpenTry(AggregateConnectionOpenTry), + ConnectionOpenAck(AggregateConnectionOpenAck), + ConnectionOpenConfirm(AggregateConnectionOpenConfirm), + + ChannelOpenTry(AggregateChannelOpenTry), + ChannelOpenAck(AggregateChannelOpenAck), + ChannelOpenConfirm(AggregateChannelOpenConfirm), + + RecvPacket(AggregateRecvPacket), + AckPacket(AggregateAckPacket), +} + +// #[derive( +// DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize, derive_more::Display, +// )] +// #[serde(bound(serialize = "", deserialize = ""))] +// pub enum AggregateAnyStateProof { +// #[display(fmt = "{_0}")] +// ClientState( +// AggregateStateProof< +// L, +// ClientStatePath<::ClientId>, +// >, +// ), +// #[display(fmt = "{_0}")] +// ClientConsensusState( +// AggregateStateProof< +// L, +// ClientConsensusStatePath< +// as unionlabs::traits::Chain>::ClientId, +// HeightOf>, +// >, +// >, +// ), +// #[display(fmt = "{_0}")] +// Connection(AggregateStateProof), +// #[display(fmt = "{_0}")] +// ChannelEnd(AggregateStateProof), +// #[display(fmt = "{_0}")] +// Commitment(AggregateStateProof), +// #[display(fmt = "{_0}")] +// Acknowledgement(AggregateStateProof), +// } + +// #[derive(DebugNoBound, CloneNoBound, PartialEqNoBound, Serialize, Deserialize)] +// #[serde(bound(serialize = "", deserialize = ""))] +// pub struct AggregateStateProof> { +// height: HeightOf>, +// #[serde(skip)] +// pub __marker: PhantomData

, +// } diff --git a/voyager/src/queue.rs b/voyager/src/queue.rs index 9e10a580db..fc309c6382 100644 --- a/voyager/src/queue.rs +++ b/voyager/src/queue.rs @@ -68,8 +68,8 @@ use crate::{ AggregateFetchCounterpartyStateProof, AggregateMsgAfterUpdate, AggregatePacketUpdateClient, AggregateRecvPacket, AggregateUpdateClient, AggregateUpdateClientFromClientId, AggregateUpdateClientWithCounterpartyChainId, - AggregateWaitForTrustedHeight, ChannelHandshakeEvent, - ConsensusStateProofAtLatestHeight, LightClientSpecificAggregate, PacketEvent, + AggregateWaitForTrustedHeight, ChannelHandshakeEvent, LightClientSpecificAggregate, + PacketEvent, }, data, data::{ @@ -1645,16 +1645,6 @@ where data, )] .into(), - Aggregate::ConsensusStateProofAtLatestHeight(make_consensus_state_proof) => { - [aggregate_data::do_aggregate::( - Identified { - chain_id, - data: make_consensus_state_proof, - }, - data, - )] - .into() - } Aggregate::AggregateMsgAfterUpdate(aggregate) => [aggregate_data::do_aggregate::( Identified { chain_id, @@ -2115,45 +2105,6 @@ where } } -// TODO: Remove, unused -impl UseAggregate for identified!(ConsensusStateProofAtLatestHeight) -where - identified!(TrustedClientState): IsAggregateData, - AnyLightClientIdentified: From)>, - AggregateReceiver: From)>, -{ - type AggregatedData = HList![identified!(TrustedClientState)]; - - fn aggregate( - Identified { - chain_id: this_chain_id, - data: ConsensusStateProofAtLatestHeight { client_id, at }, - }: Self, - hlist_pat![Identified { - chain_id: self_chain_id, - data: TrustedClientState { - fetched_at: _, - client_id: latest_trusted_client_state_client_id, - trusted_client_state - }, - }]: Self::AggregatedData, - ) -> RelayerMsg { - assert_eq!(this_chain_id, self_chain_id); - assert_eq!(client_id, latest_trusted_client_state_client_id); - - fetch::( - this_chain_id, - FetchStateProof { - at, - path: proof::Path::ClientConsensusStatePath(ClientConsensusStatePath { - client_id: client_id.into(), - height: trusted_client_state.height(), - }), - }, - ) - } -} - impl UseAggregate for identified!(AggregateMsgAfterUpdate) where identified!(TrustedClientState): IsAggregateData,