1+ use core:: fmt:: Debug ;
2+
3+ use basecoin_store:: context:: ProvableStore ;
14use ibc:: core:: channel:: types:: packet:: Packet ;
25use ibc:: core:: client:: context:: client_state:: ClientStateValidation ;
36use ibc:: core:: host:: types:: identifiers:: { ChannelId , ClientId , ConnectionId , PortId } ;
47use ibc:: core:: host:: types:: path:: ChannelEndPath ;
58use ibc:: core:: host:: ValidationContext ;
69use ibc:: primitives:: Signer ;
710
8- use crate :: context:: TestContext ;
11+ use crate :: context:: StoreGenericTestContext ;
912use crate :: hosts:: { HostClientState , HostConsensusState , TestHost } ;
1013use crate :: relayer:: utils:: TypedRelayerOps ;
1114use crate :: testapp:: ibc:: clients:: { AnyClientState , AnyConsensusState } ;
12- use crate :: testapp:: ibc:: core:: types:: DefaultIbcStore ;
15+ use crate :: testapp:: ibc:: core:: types:: MockIbcStore ;
1316
1417/// A relayer context that allows interaction between two [`TestContext`] instances.
15- pub struct RelayerContext < A , B >
18+ pub struct RelayerContext < A , B , S >
1619where
1720 A : TestHost ,
1821 B : TestHost ,
22+ S : ProvableStore + Debug ,
1923 AnyClientState : From < HostClientState < A > > ,
2024 AnyConsensusState : From < HostConsensusState < A > > ,
2125 AnyClientState : From < HostClientState < B > > ,
2226 AnyConsensusState : From < HostConsensusState < B > > ,
23- HostClientState < A > : ClientStateValidation < DefaultIbcStore > ,
24- HostClientState < B > : ClientStateValidation < DefaultIbcStore > ,
27+ HostClientState < A > : ClientStateValidation < MockIbcStore < S , AnyClientState , AnyConsensusState > > ,
28+ HostClientState < B > : ClientStateValidation < MockIbcStore < S , AnyClientState , AnyConsensusState > > ,
2529{
26- ctx_a : TestContext < A > ,
27- ctx_b : TestContext < B > ,
30+ ctx_a : StoreGenericTestContext < S , A > ,
31+ ctx_b : StoreGenericTestContext < S , B > ,
2832}
2933
30- impl < A , B > RelayerContext < A , B >
34+ impl < A , B , S > RelayerContext < A , B , S >
3135where
3236 A : TestHost ,
3337 B : TestHost ,
38+ S : ProvableStore + Debug ,
3439 AnyClientState : From < HostClientState < A > > ,
3540 AnyConsensusState : From < HostConsensusState < A > > ,
3641 AnyClientState : From < HostClientState < B > > ,
3742 AnyConsensusState : From < HostConsensusState < B > > ,
38- HostClientState < A > : ClientStateValidation < DefaultIbcStore > ,
39- HostClientState < B > : ClientStateValidation < DefaultIbcStore > ,
43+ HostClientState < A > : ClientStateValidation < MockIbcStore < S , AnyClientState , AnyConsensusState > > ,
44+ HostClientState < B > : ClientStateValidation < MockIbcStore < S , AnyClientState , AnyConsensusState > > ,
4045{
4146 /// Creates a new relayer context with the given [`TestContext`] instances.
42- pub fn new ( ctx_a : TestContext < A > , ctx_b : TestContext < B > ) -> Self {
47+ pub fn new ( ctx_a : StoreGenericTestContext < S , A > , ctx_b : StoreGenericTestContext < S , B > ) -> Self {
4348 Self { ctx_a, ctx_b }
4449 }
4550
4651 /// Returns an immutable reference to the first context.
47- pub fn get_ctx_a ( & self ) -> & TestContext < A > {
52+ pub fn get_ctx_a ( & self ) -> & StoreGenericTestContext < S , A > {
4853 & self . ctx_a
4954 }
5055
5156 /// Returns an immutable reference to the second context.
52- pub fn get_ctx_b ( & self ) -> & TestContext < B > {
57+ pub fn get_ctx_b ( & self ) -> & StoreGenericTestContext < S , B > {
5358 & self . ctx_b
5459 }
5560
5661 /// Returns a mutable reference to the first context.
57- pub fn get_ctx_a_mut ( & mut self ) -> & mut TestContext < A > {
62+ pub fn get_ctx_a_mut ( & mut self ) -> & mut StoreGenericTestContext < S , A > {
5863 & mut self . ctx_a
5964 }
6065
6166 /// Returns a mutable reference to the second context.
62- pub fn get_ctx_b_mut ( & mut self ) -> & mut TestContext < B > {
67+ pub fn get_ctx_b_mut ( & mut self ) -> & mut StoreGenericTestContext < S , B > {
6368 & mut self . ctx_b
6469 }
6570
6671 /// Creates a light client of second context on the first context.
6772 /// Returns the client identifier of the created client.
6873 pub fn create_client_on_a ( & mut self , signer : Signer ) -> ClientId {
69- TypedRelayerOps :: < A , B > :: create_client_on_a ( & mut self . ctx_a , & self . ctx_b , signer)
74+ TypedRelayerOps :: < A , B , S > :: create_client_on_a ( & mut self . ctx_a , & self . ctx_b , signer)
7075 }
7176
7277 /// Creates a light client of first context on the second context.
7378 /// Returns the client identifier of the created client.
7479 pub fn create_client_on_b ( & mut self , signer : Signer ) -> ClientId {
75- TypedRelayerOps :: < B , A > :: create_client_on_a ( & mut self . ctx_b , & self . ctx_a , signer)
80+ TypedRelayerOps :: < B , A , S > :: create_client_on_a ( & mut self . ctx_b , & self . ctx_a , signer)
7681 }
7782
7883 /// Updates the client on the first context with the latest header of the second context.
7984 pub fn update_client_on_a_with_sync ( & mut self , client_id_on_a : ClientId , signer : Signer ) {
80- TypedRelayerOps :: < A , B > :: update_client_on_a_with_sync (
85+ TypedRelayerOps :: < A , B , S > :: update_client_on_a_with_sync (
8186 & mut self . ctx_a ,
8287 & mut self . ctx_b ,
8388 client_id_on_a,
8792
8893 /// Updates the client on the second context with the latest header of the first context.
8994 pub fn update_client_on_b_with_sync ( & mut self , client_id_on_b : ClientId , signer : Signer ) {
90- TypedRelayerOps :: < B , A > :: update_client_on_a_with_sync (
95+ TypedRelayerOps :: < B , A , S > :: update_client_on_a_with_sync (
9196 & mut self . ctx_b ,
9297 & mut self . ctx_a ,
9398 client_id_on_b,
@@ -103,7 +108,7 @@ where
103108 client_id_on_b : ClientId ,
104109 signer : Signer ,
105110 ) -> ( ConnectionId , ConnectionId ) {
106- TypedRelayerOps :: < A , B > :: create_connection_on_a (
111+ TypedRelayerOps :: < A , B , S > :: create_connection_on_a (
107112 & mut self . ctx_a ,
108113 & mut self . ctx_b ,
109114 client_id_on_a,
@@ -120,7 +125,7 @@ where
120125 client_id_on_a : ClientId ,
121126 signer : Signer ,
122127 ) -> ( ConnectionId , ConnectionId ) {
123- TypedRelayerOps :: < B , A > :: create_connection_on_a (
128+ TypedRelayerOps :: < B , A , S > :: create_connection_on_a (
124129 & mut self . ctx_b ,
125130 & mut self . ctx_a ,
126131 client_id_on_b,
@@ -155,7 +160,7 @@ where
155160 . client_id ( )
156161 . clone ( ) ;
157162
158- TypedRelayerOps :: < A , B > :: create_channel_on_a (
163+ TypedRelayerOps :: < A , B , S > :: create_channel_on_a (
159164 & mut self . ctx_a ,
160165 & mut self . ctx_b ,
161166 client_id_on_a,
@@ -194,7 +199,7 @@ where
194199 . client_id ( )
195200 . clone ( ) ;
196201
197- TypedRelayerOps :: < B , A > :: create_channel_on_a (
202+ TypedRelayerOps :: < B , A , S > :: create_channel_on_a (
198203 & mut self . ctx_b ,
199204 & mut self . ctx_a ,
200205 client_id_on_b,
@@ -248,7 +253,7 @@ where
248253 . client_id ( )
249254 . clone ( ) ;
250255
251- TypedRelayerOps :: < A , B > :: close_channel_on_a (
256+ TypedRelayerOps :: < A , B , S > :: close_channel_on_a (
252257 & mut self . ctx_a ,
253258 & mut self . ctx_b ,
254259 client_id_on_a,
@@ -302,7 +307,7 @@ where
302307 . client_id ( )
303308 . clone ( ) ;
304309
305- TypedRelayerOps :: < B , A > :: close_channel_on_a (
310+ TypedRelayerOps :: < B , A , S > :: close_channel_on_a (
306311 & mut self . ctx_b ,
307312 & mut self . ctx_a ,
308313 client_id_on_b,
@@ -358,7 +363,7 @@ where
358363 . client_id ( )
359364 . clone ( ) ;
360365
361- TypedRelayerOps :: < A , B > :: submit_packet_on_b (
366+ TypedRelayerOps :: < A , B , S > :: submit_packet_on_b (
362367 & mut self . ctx_a ,
363368 & mut self . ctx_b ,
364369 packet,
@@ -411,7 +416,7 @@ where
411416 . client_id ( )
412417 . clone ( ) ;
413418
414- TypedRelayerOps :: < A , B > :: timeout_packet_from_a (
419+ TypedRelayerOps :: < A , B , S > :: timeout_packet_from_a (
415420 & mut self . ctx_a ,
416421 & mut self . ctx_b ,
417422 packet,
@@ -464,7 +469,7 @@ where
464469 . client_id ( )
465470 . clone ( ) ;
466471
467- TypedRelayerOps :: < A , B > :: timeout_packet_from_a_on_channel_close (
472+ TypedRelayerOps :: < A , B , S > :: timeout_packet_from_a_on_channel_close (
468473 & mut self . ctx_a ,
469474 & mut self . ctx_b ,
470475 packet,
0 commit comments