Skip to content

Commit

Permalink
Set counterparty_connection_id to None in conn_open_init (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinji authored Dec 1, 2022
1 parent e6ed727 commit 509c9b9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions .changelog/unreleased/bug-fixes/174-fix-conn-open-cpty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Set counterparty connection ID to None in `conn_open_init` ([#174](https://github.com/cosmos/ibc-rs/issues/174))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Verify the message's counterparty connection ID in `conn_open_ack`
instead of the store's ([#274](https://github.com/cosmos/ibc-rs/issues/274))
9 changes: 2 additions & 7 deletions crates/ibc/src/core/ics03_connection/handler/conn_open_ack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ pub(crate) fn process(
let client_id_on_a = conn_end_on_a.client_id();
let client_id_on_b = conn_end_on_a.counterparty().client_id();

let conn_id_on_b = conn_end_on_a
.counterparty()
.connection_id()
.ok_or(ConnectionError::InvalidCounterparty)?;

// Proof verification.
{
let client_state_of_b_on_a = ctx_a.client_state(client_id_on_a)?;
Expand Down Expand Up @@ -73,7 +68,7 @@ pub(crate) fn process(
prefix_on_b,
&msg.proof_conn_end_on_b,
consensus_state_of_b_on_a.root(),
conn_id_on_b,
&msg.conn_id_on_b,
&expected_conn_end_on_b,
)
.map_err(ConnectionError::VerifyConnectionState)?;
Expand Down Expand Up @@ -115,7 +110,7 @@ pub(crate) fn process(
output.emit(IbcEvent::OpenAckConnection(OpenAck::new(
msg.conn_id_on_a.clone(),
client_id_on_a.clone(),
conn_id_on_b.clone(),
msg.conn_id_on_b.clone(),
client_id_on_b.clone(),
)));
output.log("success: conn_open_ack verification passed");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Protocol logic specific to ICS3 messages of type `MsgConnectionOpenInit`.
use crate::core::ics03_connection::connection::{ConnectionEnd, State};
use crate::core::ics03_connection::connection::{ConnectionEnd, Counterparty, State};
use crate::core::ics03_connection::context::ConnectionReader;
use crate::core::ics03_connection::error::ConnectionError;
use crate::core::ics03_connection::events::OpenInit;
Expand Down Expand Up @@ -37,7 +37,11 @@ pub(crate) fn process(
let conn_end_on_a = ConnectionEnd::new(
State::Init,
msg.client_id_on_a.clone(),
msg.counterparty.clone(),
Counterparty::new(
msg.counterparty.client_id().clone(),
None,
msg.counterparty.prefix().clone(),
),
versions,
msg.delay_period,
);
Expand Down

0 comments on commit 509c9b9

Please sign in to comment.