Skip to content

Commit 3fbace5

Browse files
feat: implement convenient path methods + add iteration key (#1091)
* feat: implement convenient path methods + add iterateConsensusState key * imp: just keeping iteration key func * nitpicking
1 parent 850957c commit 3fbace5

File tree

11 files changed

+258
-65
lines changed

11 files changed

+258
-65
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- [ibc-core-host] Add iteration key for cross-compatibility with `ibc-go` used
2+
for iterating over consensus states
3+
([\#1090](https://github.com/cosmos/ibc-rs/issues/1090))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- [ibc-core-host] Improve path segment access by exposing path prefixes and
2+
implementing some convenient parent/leaf methods
3+
([\#1089](https://github.com/cosmos/ibc-rs/issues/1089))

ibc-clients/ics07-tendermint/src/client_state.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ where
328328

329329
let tm_consensus_state = TmConsensusState::try_from(consensus_state)?;
330330

331-
ctx.store_client_state(ClientStatePath::new(client_id), self.clone().into())?;
331+
ctx.store_client_state(ClientStatePath::new(client_id.clone()), self.clone().into())?;
332332
ctx.store_consensus_state(
333333
ClientConsensusStatePath::new(
334334
client_id.clone(),
@@ -389,7 +389,7 @@ where
389389
TmConsensusState::from(new_consensus_state).into(),
390390
)?;
391391
ctx.store_client_state(
392-
ClientStatePath::new(client_id),
392+
ClientStatePath::new(client_id.clone()),
393393
ClientState::from(new_client_state).into(),
394394
)?;
395395
ctx.store_update_meta(
@@ -419,7 +419,7 @@ where
419419
let wrapped_frozen_client_state = ClientState::from(frozen_client_state);
420420

421421
ctx.store_client_state(
422-
ClientStatePath::new(client_id),
422+
ClientStatePath::new(client_id.clone()),
423423
wrapped_frozen_client_state.into(),
424424
)?;
425425

@@ -480,7 +480,7 @@ where
480480
let host_height = CommonContext::host_height(ctx)?;
481481

482482
ctx.store_client_state(
483-
ClientStatePath::new(client_id),
483+
ClientStatePath::new(client_id.clone()),
484484
ClientState::from(new_client_state).into(),
485485
)?;
486486
ctx.store_consensus_state(

ibc-core/ics03-connection/src/handler/conn_open_ack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ where
100100
prefix_on_b,
101101
&msg.proof_client_state_of_a_on_b,
102102
consensus_state_of_b_on_a.root(),
103-
Path::ClientState(ClientStatePath::new(vars.client_id_on_b())),
103+
Path::ClientState(ClientStatePath::new(vars.client_id_on_b().clone())),
104104
msg.client_state_of_a_on_b.to_vec(),
105105
)
106106
.map_err(|e| ConnectionError::ClientStateVerificationFailure {

ibc-core/ics03-connection/src/handler/conn_open_init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ where
7474

7575
ctx_a.increase_connection_counter()?;
7676
ctx_a.store_connection_to_client(
77-
&ClientConnectionPath::new(&msg.client_id_on_a),
77+
&ClientConnectionPath::new(msg.client_id_on_a),
7878
conn_id_on_a.clone(),
7979
)?;
8080
ctx_a.store_connection(&ConnectionPath::new(&conn_id_on_a), conn_end_on_a)?;

ibc-core/ics03-connection/src/handler/conn_open_try.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ where
9595
prefix_on_a,
9696
&msg.proof_client_state_of_b_on_a,
9797
consensus_state_of_a_on_b.root(),
98-
Path::ClientState(ClientStatePath::new(client_id_on_a)),
98+
Path::ClientState(ClientStatePath::new(client_id_on_a.clone())),
9999
msg.client_state_of_b_on_a.to_vec(),
100100
)
101101
.map_err(|e| ConnectionError::ClientStateVerificationFailure {
@@ -162,7 +162,7 @@ where
162162

163163
ctx_b.increase_connection_counter()?;
164164
ctx_b.store_connection_to_client(
165-
&ClientConnectionPath::new(&msg.client_id_on_b),
165+
&ClientConnectionPath::new(msg.client_id_on_b),
166166
vars.conn_id_on_b.clone(),
167167
)?;
168168
ctx_b.store_connection(&ConnectionPath::new(&vars.conn_id_on_b), vars.conn_end_on_b)?;

0 commit comments

Comments
 (0)