@@ -15,7 +15,8 @@ impl<E> ClientStateExecution<E> for ClientState
15
15
where
16
16
E : ExtClientExecutionContext ,
17
17
E :: ClientStateRef : From < ClientStateType > ,
18
- E :: ConsensusStateRef : Convertible < ConsensusStateType , ClientError > ,
18
+ ConsensusStateType : Convertible < E :: ConsensusStateRef > ,
19
+ <ConsensusStateType as TryFrom < E :: ConsensusStateRef > >:: Error : Into < ClientError > ,
19
20
{
20
21
fn initialise (
21
22
& self ,
@@ -93,12 +94,12 @@ pub fn initialise<E>(
93
94
where
94
95
E : ExtClientExecutionContext ,
95
96
E :: ClientStateRef : From < ClientStateType > ,
96
- E :: ConsensusStateRef : Convertible < ConsensusStateType , ClientError > ,
97
+ ConsensusStateType : Convertible < E :: ConsensusStateRef > ,
97
98
{
98
99
let host_timestamp = ExtClientValidationContext :: host_timestamp ( ctx) ?;
99
100
let host_height = ExtClientValidationContext :: host_height ( ctx) ?;
100
101
101
- let tm_consensus_state = ConsensusStateType :: try_from ( consensus_state) ?;
102
+ let tm_consensus_state: ConsensusStateType = consensus_state. try_into ( ) ?;
102
103
103
104
ctx. store_client_state (
104
105
ClientStatePath :: new ( client_id. clone ( ) ) ,
@@ -138,7 +139,8 @@ pub fn update_state<E>(
138
139
where
139
140
E : ExtClientExecutionContext ,
140
141
E :: ClientStateRef : From < ClientStateType > ,
141
- E :: ConsensusStateRef : Convertible < ConsensusStateType , ClientError > ,
142
+ ConsensusStateType : Convertible < E :: ConsensusStateRef > ,
143
+ <ConsensusStateType as TryFrom < E :: ConsensusStateRef > >:: Error : Into < ClientError > ,
142
144
{
143
145
let header = TmHeader :: try_from ( header) ?;
144
146
let header_height = header. height ( ) ;
@@ -237,10 +239,10 @@ pub fn update_on_upgrade<E>(
237
239
where
238
240
E : ExtClientExecutionContext ,
239
241
E :: ClientStateRef : From < ClientStateType > ,
240
- E :: ConsensusStateRef : Convertible < ConsensusStateType , ClientError > ,
242
+ ConsensusStateType : Convertible < E :: ConsensusStateRef > ,
241
243
{
242
244
let mut upgraded_tm_client_state = ClientState :: try_from ( upgraded_client_state) ?;
243
- let upgraded_tm_cons_state = ConsensusStateType :: try_from ( upgraded_consensus_state) ?;
245
+ let upgraded_tm_cons_state: ConsensusStateType = upgraded_consensus_state. try_into ( ) ?;
244
246
245
247
upgraded_tm_client_state. 0 . zero_custom_fields ( ) ;
246
248
@@ -317,7 +319,8 @@ pub fn prune_oldest_consensus_state<E>(
317
319
where
318
320
E : ClientExecutionContext + ExtClientValidationContext ,
319
321
E :: ClientStateRef : From < ClientStateType > ,
320
- E :: ConsensusStateRef : Convertible < ConsensusStateType , ClientError > ,
322
+ ConsensusStateType : Convertible < E :: ConsensusStateRef > ,
323
+ <ConsensusStateType as TryFrom < E :: ConsensusStateRef > >:: Error : Into < ClientError > ,
321
324
{
322
325
let mut heights = ctx. consensus_state_heights ( client_id) ?;
323
326
@@ -330,7 +333,8 @@ where
330
333
height. revision_height ( ) ,
331
334
) ;
332
335
let consensus_state = ctx. consensus_state ( & client_consensus_state_path) ?;
333
- let tm_consensus_state = consensus_state. try_into ( ) ?;
336
+ let tm_consensus_state: ConsensusStateType =
337
+ consensus_state. try_into ( ) . map_err ( Into :: into) ?;
334
338
335
339
let host_timestamp =
336
340
ctx. host_timestamp ( ) ?
@@ -380,7 +384,7 @@ pub fn update_on_recovery<E>(
380
384
where
381
385
E : ExtClientExecutionContext ,
382
386
E :: ClientStateRef : From < ClientStateType > ,
383
- E :: ConsensusStateRef : Convertible < ConsensusStateType , ClientError > ,
387
+ ConsensusStateType : Convertible < E :: ConsensusStateRef > ,
384
388
{
385
389
let substitute_client_state = ClientState :: try_from ( substitute_client_state) ?
386
390
. inner ( )
@@ -401,7 +405,7 @@ where
401
405
let host_timestamp = E :: host_timestamp ( ctx) ?;
402
406
let host_height = E :: host_height ( ctx) ?;
403
407
404
- let tm_consensus_state = ConsensusStateType :: try_from ( substitute_consensus_state) ?;
408
+ let tm_consensus_state: ConsensusStateType = substitute_consensus_state. try_into ( ) ?;
405
409
406
410
ctx. store_consensus_state (
407
411
ClientConsensusStatePath :: new (
0 commit comments