@@ -121,7 +121,6 @@ where
121
121
122
122
#[ cfg( test) ]
123
123
mod tests {
124
- use core:: ops:: Add ;
125
124
use core:: str:: FromStr ;
126
125
use core:: time:: Duration ;
127
126
@@ -145,7 +144,7 @@ mod tests {
145
144
use crate :: core:: timestamp:: Timestamp ;
146
145
use crate :: mock:: client_state:: { client_type as mock_client_type, MockClientState } ;
147
146
use crate :: mock:: context:: {
148
- AnyClientState , AnyConsensusState , MockClientConfig , MockContext , MockContextConfig ,
147
+ AnyConsensusState , MockClientConfig , MockContext , MockContextConfig ,
149
148
} ;
150
149
use crate :: mock:: header:: MockHeader ;
151
150
use crate :: mock:: host:: { HostBlock , HostType } ;
@@ -883,7 +882,9 @@ mod tests {
883
882
884
883
let timestamp = Timestamp :: now ( ) ;
885
884
886
- let mut ctx_a = MockContextConfig :: builder ( )
885
+ let trusting_period = Duration :: from_secs ( 64 ) ;
886
+
887
+ let mut ctx = MockContextConfig :: builder ( )
887
888
. host_id ( ChainId :: new ( "mockgaiaA" , 1 ) . unwrap ( ) )
888
889
. latest_height ( Height :: new ( 1 , 1 ) . unwrap ( ) )
889
890
. latest_timestamp ( timestamp)
@@ -895,39 +896,18 @@ mod tests {
895
896
. client_state_height ( client_height)
896
897
. client_type ( tm_client_type ( ) )
897
898
. latest_timestamp ( timestamp)
899
+ . trusting_period ( trusting_period)
898
900
. build ( ) ,
899
901
) ;
900
902
901
- let mut ctx_b = MockContextConfig :: builder ( )
902
- . host_id ( chain_id_b. clone ( ) )
903
- . host_type ( HostType :: SyntheticTendermint )
904
- . latest_height ( update_height)
905
- . latest_timestamp ( timestamp)
906
- . build ( ) ;
907
-
903
+ while ctx. host_timestamp ( ) . expect ( "no error" )
904
+ < ( timestamp + trusting_period) . expect ( "no error" )
908
905
{
909
- let client_state = match ctx_a. client_state ( & client_id) . unwrap ( ) {
910
- AnyClientState :: Tendermint ( tm_client_state) => tm_client_state,
911
- _ => panic ! ( "never fails. not mock client" ) ,
912
- } ;
913
-
914
- let client_trusting_period = client_state. trusting_period ;
915
-
916
- let future_timestamp = ctx_a
917
- . host_timestamp ( )
918
- . expect ( "never fails" )
919
- . add ( client_trusting_period)
920
- . expect ( "overflow" ) ;
921
-
922
- ctx_a. advance_host_chain_height_with_timestamp ( future_timestamp) ;
923
- ctx_b. advance_host_chain_height_with_timestamp ( future_timestamp) ;
906
+ ctx. advance_host_chain_height ( ) ;
924
907
}
925
908
926
- let client_state = ctx_a . client_state ( & client_id) . unwrap ( ) ;
909
+ let client_state = ctx . client_state ( & client_id) . unwrap ( ) ;
927
910
928
- assert ! ( client_state
929
- . status( & ctx_a, & client_id)
930
- . unwrap( )
931
- . is_expired( ) ) ;
911
+ assert ! ( client_state. status( & ctx, & client_id) . unwrap( ) . is_expired( ) ) ;
932
912
}
933
913
}
0 commit comments