@@ -24,7 +24,9 @@ use ibc::primitives::Timestamp;
2424
2525use super :: testapp:: ibc:: core:: types:: { LightClientState , MockIbcStore } ;
2626use crate :: fixtures:: core:: context:: TestContextConfig ;
27- use crate :: hosts:: { HostClientState , MockHost , TendermintHost , TestBlock , TestHeader , TestHost } ;
27+ use crate :: hosts:: {
28+ HostClientState , HostConsensusState , MockHost , TendermintHost , TestBlock , TestHeader , TestHost ,
29+ } ;
2830use crate :: relayer:: error:: RelayerError ;
2931use crate :: testapp:: ibc:: clients:: { AnyClientState , AnyConsensusState } ;
3032use crate :: testapp:: ibc:: core:: router:: MockRouter ;
@@ -36,6 +38,8 @@ pub struct StoreGenericTestContext<S, H>
3638where
3739 S : ProvableStore + Debug ,
3840 H : TestHost ,
41+ AnyClientState : From < HostClientState < H > > ,
42+ AnyConsensusState : From < HostConsensusState < H > > ,
3943 HostClientState < H > : ClientStateValidation < MockIbcStore < S > > ,
4044{
4145 /// The multi store of the context.
@@ -68,6 +72,8 @@ impl<S, H> Default for StoreGenericTestContext<S, H>
6872where
6973 S : ProvableStore + Debug + Default ,
7074 H : TestHost ,
75+ AnyClientState : From < HostClientState < H > > ,
76+ AnyConsensusState : From < HostConsensusState < H > > ,
7177 HostClientState < H > : ClientStateValidation < MockIbcStore < S > > ,
7278{
7379 fn default ( ) -> Self {
8288 S : ProvableStore + Debug ,
8389 H : TestHost ,
8490 HostClientState < H > : ClientStateValidation < MockIbcStore < S > > ,
91+ AnyClientState : From < HostClientState < H > > ,
92+ AnyConsensusState : From < HostConsensusState < H > > ,
8593{
8694 /// Returns an immutable reference to the IBC store.
8795 pub fn ibc_store ( & self ) -> & MockIbcStore < S > {
@@ -170,12 +178,12 @@ where
170178 /// and consensus, and prepares the context for the next block. This includes
171179 /// the latest consensus state and the latest IBC commitment proof.
172180 pub fn begin_block ( & mut self ) {
173- let consensus_state = self
174- . host
175- . latest_block ( )
176- . into_header ( )
177- . into_consensus_state ( )
178- . into ( ) ;
181+ let consensus_state = AnyConsensusState :: from (
182+ self . host
183+ . latest_block ( )
184+ . into_header ( )
185+ . into_consensus_state ( ) ,
186+ ) ;
179187
180188 let ibc_commitment_proof = self
181189 . multi_store
@@ -347,11 +355,17 @@ where
347355 ) -> Self
348356 where
349357 RH : TestHost ,
358+ AnyClientState : From < HostClientState < RH > > ,
359+ AnyConsensusState : From < HostConsensusState < RH > > ,
350360 {
351- self = self . with_client_state ( client_id, light_client. client_state . into ( ) ) ;
361+ self = self . with_client_state ( client_id, AnyClientState :: from ( light_client. client_state ) ) ;
352362
353363 for ( height, consensus_state) in light_client. consensus_states {
354- self = self . with_consensus_state ( client_id, height, consensus_state. into ( ) ) ;
364+ self = self . with_consensus_state (
365+ client_id,
366+ height,
367+ AnyConsensusState :: from ( consensus_state) ,
368+ ) ;
355369
356370 self . ibc_store
357371 . store_update_meta (
@@ -512,6 +526,8 @@ mod tests {
512526 pub struct Test < H : TestHost >
513527 where
514528 H : TestHost ,
529+ AnyClientState : From < HostClientState < H > > ,
530+ AnyConsensusState : From < HostConsensusState < H > > ,
515531 HostConsensusState < H > : ConsensusState ,
516532 HostClientState < H > : ClientStateValidation < DefaultIbcStore > ,
517533 {
@@ -522,6 +538,8 @@ mod tests {
522538 fn run_tests < H > ( sub_title : & str )
523539 where
524540 H : TestHost ,
541+ AnyClientState : From < HostClientState < H > > ,
542+ AnyConsensusState : From < HostConsensusState < H > > ,
525543 HostConsensusState < H > : ConsensusState ,
526544 HostClientState < H > : ClientStateValidation < DefaultIbcStore > ,
527545 {
0 commit comments