Skip to content

Commit aa38d64

Browse files
authored
Set counterparty_connection_id to None in conn_open_init (#272)
1 parent 559a876 commit aa38d64

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Set counterparty connection ID to None in `conn_open_init` ([#174](https://github.com/cosmos/ibc-rs/issues/174))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Verify the message's counterparty connection ID in `conn_open_ack`
2+
instead of the store's ([#274](https://github.com/cosmos/ibc-rs/issues/274))

crates/ibc/src/core/ics03_connection/handler/conn_open_ack.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ pub(crate) fn process(
4040
let client_id_on_a = conn_end_on_a.client_id();
4141
let client_id_on_b = conn_end_on_a.counterparty().client_id();
4242

43-
let conn_id_on_b = conn_end_on_a
44-
.counterparty()
45-
.connection_id()
46-
.ok_or(ConnectionError::InvalidCounterparty)?;
47-
4843
// Proof verification.
4944
{
5045
let client_state_of_b_on_a = ctx_a.client_state(client_id_on_a)?;
@@ -73,7 +68,7 @@ pub(crate) fn process(
7368
prefix_on_b,
7469
&msg.proof_conn_end_on_b,
7570
consensus_state_of_b_on_a.root(),
76-
conn_id_on_b,
71+
&msg.conn_id_on_b,
7772
&expected_conn_end_on_b,
7873
)
7974
.map_err(ConnectionError::VerifyConnectionState)?;
@@ -115,7 +110,7 @@ pub(crate) fn process(
115110
output.emit(IbcEvent::OpenAckConnection(OpenAck::new(
116111
msg.conn_id_on_a.clone(),
117112
client_id_on_a.clone(),
118-
conn_id_on_b.clone(),
113+
msg.conn_id_on_b.clone(),
119114
client_id_on_b.clone(),
120115
)));
121116
output.log("success: conn_open_ack verification passed");

crates/ibc/src/core/ics03_connection/handler/conn_open_init.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Protocol logic specific to ICS3 messages of type `MsgConnectionOpenInit`.
22
3-
use crate::core::ics03_connection::connection::{ConnectionEnd, State};
3+
use crate::core::ics03_connection::connection::{ConnectionEnd, Counterparty, State};
44
use crate::core::ics03_connection::context::ConnectionReader;
55
use crate::core::ics03_connection::error::ConnectionError;
66
use crate::core::ics03_connection::events::OpenInit;
@@ -37,7 +37,11 @@ pub(crate) fn process(
3737
let conn_end_on_a = ConnectionEnd::new(
3838
State::Init,
3939
msg.client_id_on_a.clone(),
40-
msg.counterparty.clone(),
40+
Counterparty::new(
41+
msg.counterparty.client_id().clone(),
42+
None,
43+
msg.counterparty.prefix().clone(),
44+
),
4145
versions,
4246
msg.delay_period,
4347
);

0 commit comments

Comments
 (0)