Skip to content

Commit a5deb27

Browse files
chore: source_client instead of channel_id in IBCv2 (#2450)
* chore: source_client instead of channel_id in IBCv2 * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 5c4a893 commit a5deb27

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

contracts/ibc2/schema/ibc2.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,22 @@
3838
"type": "object",
3939
"required": [
4040
"ibc2_packet_receive_counter",
41-
"last_channel_id",
42-
"last_packet_seq"
41+
"last_packet_seq",
42+
"last_source_client"
4343
],
4444
"properties": {
4545
"ibc2_packet_receive_counter": {
4646
"type": "integer",
4747
"format": "uint32",
4848
"minimum": 0.0
4949
},
50-
"last_channel_id": {
51-
"type": "string"
52-
},
5350
"last_packet_seq": {
5451
"type": "integer",
5552
"format": "uint64",
5653
"minimum": 0.0
54+
},
55+
"last_source_client": {
56+
"type": "string"
5757
}
5858
},
5959
"additionalProperties": false

contracts/ibc2/schema/raw/response_to_query_state.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
"type": "object",
55
"required": [
66
"ibc2_packet_receive_counter",
7-
"last_channel_id",
8-
"last_packet_seq"
7+
"last_packet_seq",
8+
"last_source_client"
99
],
1010
"properties": {
1111
"ibc2_packet_receive_counter": {
1212
"type": "integer",
1313
"format": "uint32",
1414
"minimum": 0.0
1515
},
16-
"last_channel_id": {
17-
"type": "string"
18-
},
1916
"last_packet_seq": {
2017
"type": "integer",
2118
"format": "uint64",
2219
"minimum": 0.0
20+
},
21+
"last_source_client": {
22+
"type": "string"
2323
}
2424
},
2525
"additionalProperties": false

contracts/ibc2/src/contract.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn instantiate(
1818
STATE_KEY,
1919
&to_json_vec(&State {
2020
ibc2_packet_receive_counter: 0,
21-
last_channel_id: "".to_owned(),
21+
last_source_client: "".to_owned(),
2222
last_packet_seq: 0,
2323
})?,
2424
);
@@ -58,7 +58,7 @@ pub fn ibc2_packet_receive(
5858
STATE_KEY,
5959
&to_json_vec(&State {
6060
ibc2_packet_receive_counter: state.ibc2_packet_receive_counter + 1,
61-
last_channel_id: msg.source_client.clone(),
61+
last_source_client: msg.source_client.clone(),
6262
last_packet_seq: msg.packet_sequence,
6363
})?,
6464
);
@@ -70,7 +70,7 @@ pub fn ibc2_packet_receive(
7070
msg.payload.value,
7171
);
7272
let new_msg = Ibc2Msg::SendPacket {
73-
channel_id: msg.source_client,
73+
source_client: msg.source_client,
7474
payloads: vec![new_payload],
7575
timeout: env.block.time.plus_seconds(60_u64),
7676
};
@@ -86,7 +86,7 @@ pub fn ibc2_packet_receive(
8686
if json_payload.send_async_ack_for_prev_msg {
8787
Ok(
8888
resp.add_message(cosmwasm_std::Ibc2Msg::WriteAcknowledgement {
89-
channel_id: state.last_channel_id,
89+
source_client: state.last_source_client,
9090
packet_sequence: state.last_packet_seq,
9191
ack: IbcAcknowledgement::new([1, 2, 3]),
9292
}),

contracts/ibc2/src/state.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
44
#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
55
pub struct State {
66
pub ibc2_packet_receive_counter: u32,
7-
pub last_channel_id: String,
7+
pub last_source_client: String,
88
pub last_packet_seq: u64,
99
}
1010

packages/std/src/ibc2.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ impl Ibc2Payload {
4747
pub enum Ibc2Msg {
4848
/// Sends an Ibc2 packet with given payloads over the existing channel.
4949
SendPacket {
50-
channel_id: String,
50+
source_client: String,
5151
timeout: Timestamp,
5252
payloads: Vec<Ibc2Payload>,
5353
},
5454
/// Acknowledges a packet that this contract received over IBC.
5555
/// This allows acknowledging a packet that was not acknowledged yet in the `ibc2_packet_receive` call.
5656
WriteAcknowledgement {
5757
/// Existing channel where the packet was received
58-
channel_id: String,
58+
source_client: String,
5959
/// Sequence number of the packet that was received
6060
packet_sequence: u64,
6161
/// The acknowledgement to send back

0 commit comments

Comments
 (0)