Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement convenient path methods + add iteration key #1091

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [ibc-core-host] Add iteration key for cross-compatibility with `ibc-go` used
for iterating over consensus states
([\#1090](https://github.com/cosmos/ibc-rs/issues/1090))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [ibc-core-host] Improve path segment access by exposing path prefixes and
implementing some convenient parent/leaf methods
([\#1089](https://github.com/cosmos/ibc-rs/issues/1089))
8 changes: 4 additions & 4 deletions ibc-clients/ics07-tendermint/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@

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

ctx.store_client_state(ClientStatePath::new(client_id), self.clone().into())?;
ctx.store_client_state(ClientStatePath::new(client_id.clone()), self.clone().into())?;
ctx.store_consensus_state(
ClientConsensusStatePath::new(
client_id.clone(),
Expand Down Expand Up @@ -389,7 +389,7 @@
TmConsensusState::from(new_consensus_state).into(),
)?;
ctx.store_client_state(
ClientStatePath::new(client_id),
ClientStatePath::new(client_id.clone()),
ClientState::from(new_client_state).into(),
)?;
ctx.store_update_meta(
Expand Down Expand Up @@ -419,7 +419,7 @@
let wrapped_frozen_client_state = ClientState::from(frozen_client_state);

ctx.store_client_state(
ClientStatePath::new(client_id),
ClientStatePath::new(client_id.clone()),
wrapped_frozen_client_state.into(),
)?;

Expand Down Expand Up @@ -480,7 +480,7 @@
let host_height = CommonContext::host_height(ctx)?;

ctx.store_client_state(
ClientStatePath::new(client_id),
ClientStatePath::new(client_id.clone()),

Check warning on line 483 in ibc-clients/ics07-tendermint/src/client_state.rs

View check run for this annotation

Codecov / codecov/patch

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

Added line #L483 was not covered by tests
ClientState::from(new_client_state).into(),
)?;
ctx.store_consensus_state(
Expand Down
2 changes: 1 addition & 1 deletion ibc-core/ics03-connection/src/handler/conn_open_ack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ where
prefix_on_b,
&msg.proof_client_state_of_a_on_b,
consensus_state_of_b_on_a.root(),
Path::ClientState(ClientStatePath::new(vars.client_id_on_b())),
Path::ClientState(ClientStatePath::new(vars.client_id_on_b().clone())),
msg.client_state_of_a_on_b.to_vec(),
)
.map_err(|e| ConnectionError::ClientStateVerificationFailure {
Expand Down
2 changes: 1 addition & 1 deletion ibc-core/ics03-connection/src/handler/conn_open_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ where

ctx_a.increase_connection_counter()?;
ctx_a.store_connection_to_client(
&ClientConnectionPath::new(&msg.client_id_on_a),
&ClientConnectionPath::new(msg.client_id_on_a),
conn_id_on_a.clone(),
)?;
ctx_a.store_connection(&ConnectionPath::new(&conn_id_on_a), conn_end_on_a)?;
Expand Down
4 changes: 2 additions & 2 deletions ibc-core/ics03-connection/src/handler/conn_open_try.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ where
prefix_on_a,
&msg.proof_client_state_of_b_on_a,
consensus_state_of_a_on_b.root(),
Path::ClientState(ClientStatePath::new(client_id_on_a)),
Path::ClientState(ClientStatePath::new(client_id_on_a.clone())),
msg.client_state_of_b_on_a.to_vec(),
)
.map_err(|e| ConnectionError::ClientStateVerificationFailure {
Expand Down Expand Up @@ -162,7 +162,7 @@ where

ctx_b.increase_connection_counter()?;
ctx_b.store_connection_to_client(
&ClientConnectionPath::new(&msg.client_id_on_b),
&ClientConnectionPath::new(msg.client_id_on_b),
vars.conn_id_on_b.clone(),
)?;
ctx_b.store_connection(&ConnectionPath::new(&vars.conn_id_on_b), vars.conn_end_on_b)?;
Expand Down
Loading
Loading