Skip to content

Commit 0abbaeb

Browse files
authoredDec 7, 2024··
ibc-types: bump prost, tendermint, ibc-proto, ics23 (#94)
Updates the following dependencies: + ibc-proto: 0.42.2 -> 0.51.1 + ics23: 0.11.3 -> 0.12.0 + prost: 0.12.0 -> 0.13.3 + tendermint: 0.34.0 -> 0.40.0 + tendermint-light-client-verifier: 0.34.0 -> 0.40.0 + tendermint-proto: 0.34.0 -> 0.40.0 + tendermint-rpc: 0.34.0 -> 0.40.0 + tendermint-testgen: 0.34.0 -> 0.40.0 The bump to the latest tendermint version required bumping prost, which in turns required updates of ibc-proto and ics23 (where I opted for their latest releases, respectively). The two larger changes are: 1. From tendermint@v0.40.0 onward conversions between `core::time::Duration` and `protobuf.google.Duration` are now fallible. I introduced a newtype wrapper `CometBftDuration` to restore the previous behavior saturating at `i64::MAX` (for seconds) and `i32::MAX` (for nanos), respectively. 2. From `tendermint@v0.36.0` onward [`tendermint::abci::EventAttribute`](https://docs.rs/tendermint/0.36.0/tendermint/abci/enum.EventAttribute.html) became an enum with variants `V037` and `V034`, and introduced the fallible accessors `EventAttribute::key_str` and `EventAttribute::value_str`, in addition to the infallible `EventAttribute::key_bytes` and `EventAttribute::value_bytes`. This required changes in many `TryFrom<Event>` impls that would previously match on `&str` keys and directly move (or parse) `String` values. I chose to avoid extra error handling, instead matching on byte-string using `value_bytes()` (e.g. now `b"packet_src_channel" => {}` instead of the previous `"packet_src_channel" => {}`), and relying on `String::from_utf8_lossy` for the values.
1 parent 4cd8fc0 commit 0abbaeb

File tree

17 files changed

+819
-493
lines changed

17 files changed

+819
-493
lines changed
 

‎crates/ibc-types-core-channel/Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@ ibc-types-domain-type = { version = "0.14.1", path = "../ibc-types-domain-type",
6060
ibc-types-identifier = { version = "0.14.1", path = "../ibc-types-identifier", default-features = false }
6161
ibc-types-timestamp = { version = "0.14.1", path = "../ibc-types-timestamp", default-features = false }
6262
# Proto definitions for all IBC-related interfaces, e.g., connections or channels.
63-
ibc-proto = { version = "0.42.2", default-features = false }
63+
ibc-proto = { version = "0.51.1", default-features = false }
6464
## for borsh encode or decode
6565
borsh = {version = "0.10.0", default-features = false, optional = true }
6666
bytes = { version = "1.2.1", default-features = false }
6767
cfg-if = { version = "1.0.0", optional = true }
6868
derive_more = { version = "0.99.17", default-features = false, features = ["from", "into", "display"] }
6969
displaydoc = { version = "0.2", default-features = false }
70-
ics23 = { version = "0.11.3", default-features = false, features = ["host-functions"] }
70+
ics23 = { version = "0.12.0", default-features = false, features = ["host-functions"] }
7171
num-traits = { version = "0.2.15", default-features = false }
7272
## for codec encode or decode
7373
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["full"], optional = true }
7474
parking_lot = { version = "0.12.1", default-features = false, optional = true }
75-
prost = { version = "0.12", default-features = false }
75+
prost = { version = "0.13.3", default-features = false }
7676
safe-regex = { version = "0.2.5", default-features = false }
7777
# proc-macro2 to unbreak docs.rs build, see GH#56
7878
proc-macro2 = { version = "0.1", default-features = false }
@@ -87,15 +87,15 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive"
8787
anyhow = { version = "1", default-features = false }
8888

8989
[dependencies.tendermint]
90-
version = "0.34.0"
90+
version = "0.40.0"
9191
default-features = false
9292

9393
[dependencies.tendermint-proto]
94-
version = "0.34.0"
94+
version = "0.40.0"
9595
default-features = false
9696

9797
[dependencies.tendermint-testgen]
98-
version = "0.34.0"
98+
version = "0.40.0"
9999
optional = true
100100
default-features = false
101101

‎crates/ibc-types-core-channel/src/events/channel.rs

+139-75
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use alloc::borrow::ToOwned;
21
use ibc_types_core_connection::ConnectionId;
32
use tendermint::abci::{Event, TypedEvent};
43

4+
use crate::prelude::*;
55
use crate::{ChannelId, PortId, Version};
66

77
use super::Error;
@@ -56,23 +56,32 @@ impl TryFrom<Event> for OpenInit {
5656
let mut version = None;
5757

5858
for attr in event.attributes {
59-
match attr.key.as_ref() {
60-
"port_id" => {
61-
port_id = Some(PortId(attr.value));
59+
match attr.key_bytes() {
60+
b"port_id" => {
61+
port_id = Some(PortId(String::from_utf8_lossy(attr.value_bytes()).into()));
6262
}
63-
"channel_id" => {
64-
channel_id = Some(ChannelId(attr.value));
63+
b"channel_id" => {
64+
channel_id = Some(ChannelId(
65+
String::from_utf8_lossy(attr.value_bytes()).into(),
66+
));
6567
}
66-
"counterparty_port_id" => {
67-
counterparty_port_id = Some(PortId(attr.value));
68+
b"counterparty_port_id" => {
69+
counterparty_port_id =
70+
Some(PortId(String::from_utf8_lossy(attr.value_bytes()).into()));
6871
}
69-
"connection_id" => {
70-
connection_id = Some(ConnectionId(attr.value));
72+
b"connection_id" => {
73+
connection_id = Some(ConnectionId(
74+
String::from_utf8_lossy(attr.value_bytes()).into(),
75+
));
7176
}
72-
"version" => {
73-
version = Some(Version(attr.value));
77+
b"version" => {
78+
version = Some(Version(String::from_utf8_lossy(attr.value_bytes()).into()));
79+
}
80+
unknown => {
81+
return Err(Error::UnexpectedAttribute(
82+
String::from_utf8_lossy(unknown).into(),
83+
))
7484
}
75-
unknown => return Err(Error::UnexpectedAttribute(unknown.to_owned())),
7685
}
7786
}
7887

@@ -136,26 +145,37 @@ impl TryFrom<Event> for OpenTry {
136145
let mut version = None;
137146

138147
for attr in event.attributes {
139-
match attr.key.as_ref() {
140-
"port_id" => {
141-
port_id = Some(PortId(attr.value));
148+
match attr.key_bytes() {
149+
b"port_id" => {
150+
port_id = Some(PortId(String::from_utf8_lossy(attr.value_bytes()).into()));
151+
}
152+
b"channel_id" => {
153+
channel_id = Some(ChannelId(
154+
String::from_utf8_lossy(attr.value_bytes()).into(),
155+
));
142156
}
143-
"channel_id" => {
144-
channel_id = Some(ChannelId(attr.value));
157+
b"counterparty_port_id" => {
158+
counterparty_port_id =
159+
Some(PortId(String::from_utf8_lossy(attr.value_bytes()).into()));
145160
}
146-
"counterparty_port_id" => {
147-
counterparty_port_id = Some(PortId(attr.value));
161+
b"counterparty_channel_id" => {
162+
counterparty_channel_id = Some(ChannelId(
163+
String::from_utf8_lossy(attr.value_bytes()).into(),
164+
));
148165
}
149-
"counterparty_channel_id" => {
150-
counterparty_channel_id = Some(ChannelId(attr.value));
166+
b"connection_id" => {
167+
connection_id = Some(ConnectionId(
168+
String::from_utf8_lossy(attr.value_bytes()).into(),
169+
));
151170
}
152-
"connection_id" => {
153-
connection_id = Some(ConnectionId(attr.value));
171+
b"version" => {
172+
version = Some(Version(String::from_utf8_lossy(attr.value_bytes()).into()));
154173
}
155-
"version" => {
156-
version = Some(Version(attr.value));
174+
unknown => {
175+
return Err(Error::UnexpectedAttribute(
176+
String::from_utf8_lossy(unknown).into(),
177+
))
157178
}
158-
unknown => return Err(Error::UnexpectedAttribute(unknown.to_owned())),
159179
}
160180
}
161181

@@ -218,23 +238,34 @@ impl TryFrom<Event> for OpenAck {
218238
let mut connection_id = None;
219239

220240
for attr in event.attributes {
221-
match attr.key.as_ref() {
222-
"port_id" => {
223-
port_id = Some(PortId(attr.value));
241+
match attr.key_bytes() {
242+
b"port_id" => {
243+
port_id = Some(PortId(String::from_utf8_lossy(attr.value_bytes()).into()));
244+
}
245+
b"channel_id" => {
246+
channel_id = Some(ChannelId(
247+
String::from_utf8_lossy(attr.value_bytes()).into(),
248+
));
224249
}
225-
"channel_id" => {
226-
channel_id = Some(ChannelId(attr.value));
250+
b"counterparty_port_id" => {
251+
counterparty_port_id =
252+
Some(PortId(String::from_utf8_lossy(attr.value_bytes()).into()));
227253
}
228-
"counterparty_port_id" => {
229-
counterparty_port_id = Some(PortId(attr.value));
254+
b"counterparty_channel_id" => {
255+
counterparty_channel_id = Some(ChannelId(
256+
String::from_utf8_lossy(attr.value_bytes()).into(),
257+
));
230258
}
231-
"counterparty_channel_id" => {
232-
counterparty_channel_id = Some(ChannelId(attr.value));
259+
b"connection_id" => {
260+
connection_id = Some(ConnectionId(
261+
String::from_utf8_lossy(attr.value_bytes()).into(),
262+
));
233263
}
234-
"connection_id" => {
235-
connection_id = Some(ConnectionId(attr.value));
264+
unknown => {
265+
return Err(Error::UnexpectedAttribute(
266+
String::from_utf8_lossy(unknown).into(),
267+
))
236268
}
237-
unknown => return Err(Error::UnexpectedAttribute(unknown.to_owned())),
238269
}
239270
}
240271

@@ -296,23 +327,34 @@ impl TryFrom<Event> for OpenConfirm {
296327
let mut connection_id = None;
297328

298329
for attr in event.attributes {
299-
match attr.key.as_ref() {
300-
"port_id" => {
301-
port_id = Some(PortId(attr.value));
330+
match attr.key_bytes() {
331+
b"port_id" => {
332+
port_id = Some(PortId(String::from_utf8_lossy(attr.value_bytes()).into()));
302333
}
303-
"channel_id" => {
304-
channel_id = Some(ChannelId(attr.value));
334+
b"channel_id" => {
335+
channel_id = Some(ChannelId(
336+
String::from_utf8_lossy(attr.value_bytes()).into(),
337+
));
305338
}
306-
"counterparty_port_id" => {
307-
counterparty_port_id = Some(PortId(attr.value));
339+
b"counterparty_port_id" => {
340+
counterparty_port_id =
341+
Some(PortId(String::from_utf8_lossy(attr.value_bytes()).into()));
308342
}
309-
"counterparty_channel_id" => {
310-
counterparty_channel_id = Some(ChannelId(attr.value));
343+
b"counterparty_channel_id" => {
344+
counterparty_channel_id = Some(ChannelId(
345+
String::from_utf8_lossy(attr.value_bytes()).into(),
346+
));
311347
}
312-
"connection_id" => {
313-
connection_id = Some(ConnectionId(attr.value));
348+
b"connection_id" => {
349+
connection_id = Some(ConnectionId(
350+
String::from_utf8_lossy(attr.value_bytes()).into(),
351+
));
352+
}
353+
unknown => {
354+
return Err(Error::UnexpectedAttribute(
355+
String::from_utf8_lossy(unknown).into(),
356+
))
314357
}
315-
unknown => return Err(Error::UnexpectedAttribute(unknown.to_owned())),
316358
}
317359
}
318360

@@ -374,23 +416,34 @@ impl TryFrom<Event> for CloseInit {
374416
let mut connection_id = None;
375417

376418
for attr in event.attributes {
377-
match attr.key.as_ref() {
378-
"port_id" => {
379-
port_id = Some(PortId(attr.value));
419+
match attr.key_bytes() {
420+
b"port_id" => {
421+
port_id = Some(PortId(String::from_utf8_lossy(attr.value_bytes()).into()));
422+
}
423+
b"channel_id" => {
424+
channel_id = Some(ChannelId(
425+
String::from_utf8_lossy(attr.value_bytes()).into(),
426+
));
380427
}
381-
"channel_id" => {
382-
channel_id = Some(ChannelId(attr.value));
428+
b"counterparty_port_id" => {
429+
counterparty_port_id =
430+
Some(PortId(String::from_utf8_lossy(attr.value_bytes()).into()));
383431
}
384-
"counterparty_port_id" => {
385-
counterparty_port_id = Some(PortId(attr.value));
432+
b"counterparty_channel_id" => {
433+
counterparty_channel_id = Some(ChannelId(
434+
String::from_utf8_lossy(attr.value_bytes()).into(),
435+
));
386436
}
387-
"counterparty_channel_id" => {
388-
counterparty_channel_id = Some(ChannelId(attr.value));
437+
b"connection_id" => {
438+
connection_id = Some(ConnectionId(
439+
String::from_utf8_lossy(attr.value_bytes()).into(),
440+
));
389441
}
390-
"connection_id" => {
391-
connection_id = Some(ConnectionId(attr.value));
442+
unknown => {
443+
return Err(Error::UnexpectedAttribute(
444+
String::from_utf8_lossy(unknown).into(),
445+
))
392446
}
393-
unknown => return Err(Error::UnexpectedAttribute(unknown.to_owned())),
394447
}
395448
}
396449

@@ -452,23 +505,34 @@ impl TryFrom<Event> for CloseConfirm {
452505
let mut connection_id = None;
453506

454507
for attr in event.attributes {
455-
match attr.key.as_ref() {
456-
"port_id" => {
457-
port_id = Some(PortId(attr.value));
508+
match attr.key_bytes() {
509+
b"port_id" => {
510+
port_id = Some(PortId(String::from_utf8_lossy(attr.value_bytes()).into()));
511+
}
512+
b"channel_id" => {
513+
channel_id = Some(ChannelId(
514+
String::from_utf8_lossy(attr.value_bytes()).into(),
515+
));
458516
}
459-
"channel_id" => {
460-
channel_id = Some(ChannelId(attr.value));
517+
b"counterparty_port_id" => {
518+
counterparty_port_id =
519+
Some(PortId(String::from_utf8_lossy(attr.value_bytes()).into()));
461520
}
462-
"counterparty_port_id" => {
463-
counterparty_port_id = Some(PortId(attr.value));
521+
b"counterparty_channel_id" => {
522+
counterparty_channel_id = Some(ChannelId(
523+
String::from_utf8_lossy(attr.value_bytes()).into(),
524+
));
464525
}
465-
"counterparty_channel_id" => {
466-
counterparty_channel_id = Some(ChannelId(attr.value));
526+
b"connection_id" => {
527+
connection_id = Some(ConnectionId(
528+
String::from_utf8_lossy(attr.value_bytes()).into(),
529+
));
467530
}
468-
"connection_id" => {
469-
connection_id = Some(ConnectionId(attr.value));
531+
unknown => {
532+
return Err(Error::UnexpectedAttribute(
533+
String::from_utf8_lossy(unknown).into(),
534+
))
470535
}
471-
unknown => return Err(Error::UnexpectedAttribute(unknown.to_owned())),
472536
}
473537
}
474538

‎crates/ibc-types-core-channel/src/events/packet.rs

+467-294
Large diffs are not rendered by default.

‎crates/ibc-types-core-channel/src/events/tests.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,18 @@ fn ibc_to_abci_channel_events() {
135135
assert_eq!(t.kind, t.event.kind);
136136
assert_eq!(t.expected_keys.len(), t.event.attributes.len());
137137
for (i, e) in t.event.attributes.iter().enumerate() {
138-
assert_eq!(e.key, t.expected_keys[i], "key mismatch for {:?}", t.kind,);
138+
assert_eq!(
139+
e.key_bytes(),
140+
t.expected_keys[i].as_bytes(),
141+
"key mismatch for {:?}",
142+
t.kind,
143+
);
139144
}
140145
assert_eq!(t.expected_values.len(), t.event.attributes.len());
141146
for (i, e) in t.event.attributes.iter().enumerate() {
142147
assert_eq!(
143-
e.value, t.expected_values[i],
148+
e.value_bytes(),
149+
t.expected_values[i].as_bytes(),
144150
"value mismatch for {:?}",
145151
t.kind,
146152
);

‎crates/ibc-types-core-client/Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ bytes = { version = "1.2.1", default-features = false }
5454
cfg-if = { version = "1.0.0", optional = true }
5555
derive_more = { version = "0.99.17", default-features = false, features = ["from", "into", "display"] }
5656
displaydoc = { version = "0.2", default-features = false }
57-
ibc-proto = { version = "0.42.2", default-features = false }
57+
ibc-proto = { version = "0.51.1", default-features = false }
5858
ibc-types-domain-type = { version = "0.14.1", path = "../ibc-types-domain-type", default-features = false }
5959
ibc-types-identifier = { version = "0.14.1", path = "../ibc-types-identifier", default-features = false }
6060
ibc-types-timestamp = { version = "0.14.1", path = "../ibc-types-timestamp", default-features = false }
61-
ics23 = { version = "0.11.3", default-features = false, features = ["host-functions"] }
61+
ics23 = { version = "0.12.0", default-features = false, features = ["host-functions"] }
6262
num-traits = { version = "0.2.15", default-features = false }
6363
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["full"], optional = true }
64-
prost = { version = "0.12", default-features = false }
64+
prost = { version = "0.13.3", default-features = false }
6565
scale-info = { version = "2.1.2", default-features = false, features = ["derive"], optional = true }
6666
serde = { version = "1.0", default-features = false, optional = true }
6767
serde_derive = { version = "1.0.104", default-features = false, optional = true }
@@ -72,11 +72,11 @@ time = { version = "0.3", default-features = false }
7272
anyhow = { version = "1", default-features = false }
7373

7474
[dependencies.tendermint]
75-
version = "0.34.0"
75+
version = "0.40.0"
7676
default-features = false
7777

7878
[dependencies.tendermint-proto]
79-
version = "0.34.0"
79+
version = "0.40.0"
8080
default-features = false
8181

8282
[dev-dependencies]

‎crates/ibc-types-core-client/src/events.rs

+77-44
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,30 @@ impl TryFrom<Event> for CreateClient {
9595
let mut consensus_height = None;
9696

9797
for attr in event.attributes {
98-
match attr.key.as_ref() {
99-
"client_id" => {
100-
client_id = Some(ClientId(attr.value));
98+
match attr.key_bytes() {
99+
b"client_id" => {
100+
client_id = Some(ClientId(String::from_utf8_lossy(attr.value_bytes()).into()));
101101
}
102-
"client_type" => {
103-
client_type = Some(ClientType(attr.value));
102+
b"client_type" => {
103+
client_type = Some(ClientType(
104+
String::from_utf8_lossy(attr.value_bytes()).into(),
105+
));
104106
}
105-
"consensus_height" => {
106-
consensus_height =
107-
Some(attr.value.parse().map_err(|e| Error::ParseHeight {
108-
key: "consensus_height",
109-
e,
110-
})?);
107+
b"consensus_height" => {
108+
consensus_height = Some(
109+
String::from_utf8_lossy(attr.value_bytes())
110+
.parse()
111+
.map_err(|e| Error::ParseHeight {
112+
key: "consensus_height",
113+
e,
114+
})?,
115+
);
116+
}
117+
unknown => {
118+
return Err(Error::UnexpectedAttribute(
119+
String::from_utf8_lossy(unknown).into(),
120+
))
111121
}
112-
unknown => return Err(Error::UnexpectedAttribute(unknown.to_owned())),
113122
}
114123
}
115124

@@ -167,27 +176,36 @@ impl TryFrom<Event> for UpdateClient {
167176
let mut header = None;
168177

169178
for attr in value.attributes {
170-
match attr.key.as_ref() {
171-
"client_id" => {
172-
client_id = Some(ClientId(attr.value));
179+
match attr.key_bytes() {
180+
b"client_id" => {
181+
client_id = Some(ClientId(String::from_utf8_lossy(attr.value_bytes()).into()));
173182
}
174-
"client_type" => {
175-
client_type = Some(ClientType(attr.value));
183+
b"client_type" => {
184+
client_type = Some(ClientType(
185+
String::from_utf8_lossy(attr.value_bytes()).into(),
186+
));
176187
}
177-
"consensus_height" => {
178-
consensus_height =
179-
Some(attr.value.parse().map_err(|e| Error::ParseHeight {
180-
key: "consensus_height",
181-
e,
182-
})?);
188+
b"consensus_height" => {
189+
consensus_height = Some(
190+
String::from_utf8_lossy(attr.value_bytes())
191+
.parse()
192+
.map_err(|e| Error::ParseHeight {
193+
key: "consensus_height",
194+
e,
195+
})?,
196+
);
183197
}
184-
"header" => {
198+
b"header" => {
185199
header = Some(
186-
hex::decode(attr.value)
200+
hex::decode(attr.value_bytes())
187201
.map_err(|e| Error::ParseHex { key: "header", e })?,
188202
);
189203
}
190-
unknown => return Err(Error::UnexpectedAttribute(unknown.to_owned())),
204+
unknown => {
205+
return Err(Error::UnexpectedAttribute(
206+
String::from_utf8_lossy(unknown).into(),
207+
))
208+
}
191209
}
192210
}
193211

@@ -238,14 +256,20 @@ impl TryFrom<Event> for ClientMisbehaviour {
238256
let mut client_type = None;
239257

240258
for attr in value.attributes {
241-
match attr.key.as_ref() {
242-
"client_id" => {
243-
client_id = Some(ClientId(attr.value));
259+
match attr.key_bytes() {
260+
b"client_id" => {
261+
client_id = Some(ClientId(String::from_utf8_lossy(attr.value_bytes()).into()));
244262
}
245-
"client_type" => {
246-
client_type = Some(ClientType(attr.value));
263+
b"client_type" => {
264+
client_type = Some(ClientType(
265+
String::from_utf8_lossy(attr.value_bytes()).into(),
266+
));
267+
}
268+
unknown => {
269+
return Err(Error::UnexpectedAttribute(
270+
String::from_utf8_lossy(unknown).into(),
271+
))
247272
}
248-
unknown => return Err(Error::UnexpectedAttribute(unknown.to_owned())),
249273
}
250274
}
251275

@@ -295,21 +319,30 @@ impl TryFrom<Event> for UpgradeClient {
295319
let mut consensus_height = None;
296320

297321
for attr in value.attributes {
298-
match attr.key.as_ref() {
299-
"client_id" => {
300-
client_id = Some(ClientId(attr.value));
322+
match attr.key_bytes() {
323+
b"client_id" => {
324+
client_id = Some(ClientId(String::from_utf8_lossy(attr.value_bytes()).into()));
325+
}
326+
b"client_type" => {
327+
client_type = Some(ClientType(
328+
String::from_utf8_lossy(attr.value_bytes()).into(),
329+
));
301330
}
302-
"client_type" => {
303-
client_type = Some(ClientType(attr.value));
331+
b"consensus_height" => {
332+
consensus_height = Some(
333+
String::from_utf8_lossy(attr.value_bytes())
334+
.parse()
335+
.map_err(|e| Error::ParseHeight {
336+
key: "consensus_height",
337+
e,
338+
})?,
339+
);
304340
}
305-
"consensus_height" => {
306-
consensus_height =
307-
Some(attr.value.parse().map_err(|e| Error::ParseHeight {
308-
key: "consensus_height",
309-
e,
310-
})?);
341+
unknown => {
342+
return Err(Error::UnexpectedAttribute(
343+
String::from_utf8_lossy(unknown).into(),
344+
))
311345
}
312-
unknown => return Err(Error::UnexpectedAttribute(unknown.to_owned())),
313346
}
314347
}
315348

‎crates/ibc-types-core-commitment/Cargo.toml

+9-9
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ ibc-types-timestamp = { version = "0.14.1", path = "../ibc-types-timestamp", def
5959
ibc-types-identifier = { version = "0.14.1", path = "../ibc-types-identifier", default-features = false }
6060
ibc-types-domain-type = { version = "0.14.1", path = "../ibc-types-domain-type", default-features = false }
6161
# Proto definitions for all IBC-related interfaces, e.g., connections or channels.
62-
ibc-proto = { version = "0.42.2", default-features = false }
63-
ics23 = { version = "0.11.3", default-features = false, features = ["host-functions"] }
62+
ibc-proto = { version = "0.51.1", default-features = false }
63+
ics23 = { version = "0.12.0", default-features = false, features = ["host-functions"] }
6464
time = { version = "0.3", default-features = false }
6565
serde_derive = { version = "1.0.104", default-features = false, optional = true }
6666
serde = { version = "1.0", default-features = false, optional = true }
6767
serde_json = { version = "1", default-features = false, optional = true }
6868
erased-serde = { version = "0.3", default-features = false, features = ["alloc"], optional = true }
6969
tracing = { version = "0.1.36", default-features = false }
70-
prost = { version = "0.12", default-features = false }
70+
prost = { version = "0.13.3", default-features = false }
7171
bytes = { version = "1.2.1", default-features = false }
7272
safe-regex = { version = "0.2.5", default-features = false }
7373
subtle-encoding = { version = "0.5", default-features = false }
@@ -89,20 +89,20 @@ anyhow = "1"
8989
hex = { version = "0.4.3", default-features = false }
9090

9191
[dependencies.tendermint]
92-
version = "0.34.0"
92+
version = "0.40.0"
9393
default-features = false
9494

9595
[dependencies.tendermint-proto]
96-
version = "0.34.0"
96+
version = "0.40.0"
9797
default-features = false
9898

9999
[dependencies.tendermint-light-client-verifier]
100-
version = "0.34.0"
100+
version = "0.40.0"
101101
default-features = false
102102
features = ["rust-crypto"]
103103

104104
[dependencies.tendermint-testgen]
105-
version = "0.34.0"
105+
version = "0.40.0"
106106
optional = true
107107
default-features = false
108108

@@ -111,8 +111,8 @@ env_logger = "0.10.0"
111111
rstest = "0.16.0"
112112
tracing-subscriber = { version = "0.3.14", features = ["fmt", "env-filter", "json"]}
113113
test-log = { version = "0.2.10", features = ["trace"] }
114-
tendermint-rpc = { version = "0.34.0", features = ["http-client", "websocket-client"] }
115-
tendermint-testgen = { version = "0.34.0" } # Needed for generating (synthetic) light blocks.
114+
tendermint-rpc = { version = "0.40.0", features = ["http-client", "websocket-client"] }
115+
tendermint-testgen = { version = "0.40.0" } # Needed for generating (synthetic) light blocks.
116116
parking_lot = { version = "0.12.1" }
117117
cfg-if = { version = "1.0.0" }
118118

‎crates/ibc-types-core-connection/Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ bytes = { version = "1.2.1", default-features = false }
6161
cfg-if = { version = "1.0.0", optional = true }
6262
derive_more = { version = "0.99.17", default-features = false, features = ["from", "into", "display"] }
6363
displaydoc = { version = "0.2", default-features = false }
64-
ibc-proto = { version = "0.42.2", default-features = false }
65-
ics23 = { version = "0.11.3", default-features = false, features = ["host-functions"] }
64+
ibc-proto = { version = "0.51.1", default-features = false }
65+
ics23 = { version = "0.12.0", default-features = false, features = ["host-functions"] }
6666
num-traits = { version = "0.2.15", default-features = false }
6767
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["full"], optional = true }
6868
parking_lot = { version = "0.12.1", default-features = false, optional = true }
69-
prost = { version = "0.12", default-features = false }
69+
prost = { version = "0.13.3", default-features = false }
7070
safe-regex = { version = "0.2.5", default-features = false }
7171
scale-info = { version = "2.1.2", default-features = false, features = ["derive"], optional = true }
7272
serde = { version = "1.0", default-features = false, optional = true }
@@ -78,15 +78,15 @@ time = { version = "0.3", default-features = false }
7878
anyhow = { version = "1", default-features = false }
7979

8080
[dependencies.tendermint]
81-
version = "0.34.0"
81+
version = "0.40.0"
8282
default-features = false
8383

8484
[dependencies.tendermint-proto]
85-
version = "0.34.0"
85+
version = "0.40.0"
8686
default-features = false
8787

8888
[dependencies.tendermint-testgen]
89-
version = "0.34.0"
89+
version = "0.40.0"
9090
optional = true
9191
default-features = false
9292

‎crates/ibc-types-core-connection/src/events.rs

+37-29
Original file line numberDiff line numberDiff line change
@@ -103,48 +103,56 @@ impl TryFrom<Vec<abci::EventAttribute>> for Attributes {
103103
let mut counterparty_connection_id = None;
104104

105105
for attr in attributes {
106-
match attr.key.as_ref() {
107-
"connection_id" => {
108-
connection_id =
109-
Some(ConnectionId::from_str(attr.value.as_ref()).map_err(|e| {
110-
Error::ParseConnectionId {
106+
match attr.key_bytes() {
107+
b"connection_id" => {
108+
connection_id = Some(
109+
ConnectionId::from_str(&String::from_utf8_lossy(attr.value_bytes()))
110+
.map_err(|e| Error::ParseConnectionId {
111111
key: "connection_id",
112112
e,
113-
}
114-
})?);
113+
})?,
114+
);
115115
}
116-
"client_id" => {
117-
client_id = Some(ClientId::from_str(attr.value.as_ref()).map_err(|e| {
118-
Error::ParseClientId {
119-
key: "client_id",
120-
e,
121-
}
122-
})?);
116+
b"client_id" => {
117+
client_id = Some(
118+
ClientId::from_str(&String::from_utf8_lossy(attr.value_bytes())).map_err(
119+
|e| Error::ParseClientId {
120+
key: "client_id",
121+
e,
122+
},
123+
)?,
124+
);
123125
}
124-
"counterparty_connection_id" => {
125-
counterparty_connection_id = if attr.value.is_empty() {
126+
b"counterparty_connection_id" => {
127+
counterparty_connection_id = if attr.value_bytes().is_empty() {
126128
// Don't try to parse the connection ID if it was empty; set it to
127129
// None instead, since we'll reject empty connection IDs in parsing.
128130
None
129131
} else {
130-
Some(ConnectionId::from_str(attr.value.as_ref()).map_err(|e| {
131-
Error::ParseConnectionId {
132-
key: "counterparty_connection_id",
133-
e,
134-
}
135-
})?)
132+
Some(
133+
ConnectionId::from_str(&String::from_utf8_lossy(attr.value_bytes()))
134+
.map_err(|e| Error::ParseConnectionId {
135+
key: "counterparty_connection_id",
136+
e,
137+
})?,
138+
)
136139
};
137140
}
138-
"counterparty_client_id" => {
139-
counterparty_client_id =
140-
Some(ClientId::from_str(attr.value.as_ref()).map_err(|e| {
141-
Error::ParseClientId {
141+
b"counterparty_client_id" => {
142+
counterparty_client_id = Some(
143+
ClientId::from_str(&String::from_utf8_lossy(attr.value_bytes())).map_err(
144+
|e| Error::ParseClientId {
142145
key: "counterparty_client_id",
143146
e,
144-
}
145-
})?);
147+
},
148+
)?,
149+
);
150+
}
151+
other => {
152+
return Err(Error::UnexpectedAttribute(
153+
String::from_utf8_lossy(other).into(),
154+
))
146155
}
147-
_ => return Err(Error::UnexpectedAttribute(attr.key)),
148156
}
149157
}
150158

‎crates/ibc-types-domain-type/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ all-features = true
2020

2121
[dependencies]
2222
anyhow = { version = "1", default-features = false }
23-
prost = { version = "0.12", default-features = false }
23+
prost = { version = "0.13.3", default-features = false }
2424
bytes = { version = "1.2.1", default-features = false }

‎crates/ibc-types-identifier/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ parking_lot = { version = "0.12.1", default-features = false, optional = true }
4747
cfg-if = { version = "1.0.0", optional = true }
4848

4949
[dependencies.tendermint-testgen]
50-
version = "0.33"
50+
version = "0.40.0"
5151
optional = true
5252
default-features = false
5353

‎crates/ibc-types-lightclients-tendermint/Cargo.toml

+9-9
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ ibc-types-core-client = { version = "0.14.1", path = "../ibc-types-core-client",
6363
ibc-types-core-connection = { version = "0.14.1", path = "../ibc-types-core-connection", default-features = false }
6464
ibc-types-core-commitment = { version = "0.14.1", path = "../ibc-types-core-commitment", default-features = false }
6565
# Proto definitions for all IBC-related interfaces, e.g., connections or channels.
66-
ibc-proto = { version = "0.42.2", default-features = false }
67-
ics23 = { version = "0.11.3", default-features = false, features = ["host-functions"] }
66+
ibc-proto = { version = "0.51.1", default-features = false }
67+
ics23 = { version = "0.12.0", default-features = false, features = ["host-functions"] }
6868
time = { version = "0.3", default-features = false }
6969
serde_derive = { version = "1.0.104", default-features = false, optional = true }
7070
serde = { version = "1.0", default-features = false, optional = true }
7171
serde_json = { version = "1", default-features = false, optional = true }
7272
erased-serde = { version = "0.3", default-features = false, features = ["alloc"], optional = true }
7373
tracing = { version = "0.1.36", default-features = false }
74-
prost = { version = "0.12", default-features = false }
74+
prost = { version = "0.13.3", default-features = false }
7575
bytes = { version = "1.2.1", default-features = false }
7676
safe-regex = { version = "0.2.5", default-features = false }
7777
subtle-encoding = { version = "0.5", default-features = false }
@@ -92,20 +92,20 @@ cfg-if = { version = "1.0.0", optional = true }
9292
anyhow = { version = "1", default-features = false }
9393

9494
[dependencies.tendermint]
95-
version = "0.34.0"
95+
version = "0.40.0"
9696
default-features = false
9797

9898
[dependencies.tendermint-proto]
99-
version = "0.34.0"
99+
version = "0.40.0"
100100
default-features = false
101101

102102
[dependencies.tendermint-light-client-verifier]
103-
version = "0.34.0"
103+
version = "0.40.0"
104104
default-features = false
105105
features = ["rust-crypto"]
106106

107107
[dependencies.tendermint-testgen]
108-
version = "0.34.0"
108+
version = "0.40.0"
109109
optional = true
110110
default-features = false
111111

@@ -114,8 +114,8 @@ env_logger = "0.10.0"
114114
rstest = "0.16.0"
115115
tracing-subscriber = { version = "0.3.14", features = ["fmt", "env-filter", "json"]}
116116
test-log = { version = "0.2.10", features = ["trace"] }
117-
tendermint-rpc = { version = "0.34.0", features = ["http-client", "websocket-client"] }
118-
tendermint-testgen = { version = "0.34.0" } # Needed for generating (synthetic) light blocks.
117+
tendermint-rpc = { version = "0.40.0", features = ["http-client", "websocket-client"] }
118+
tendermint-testgen = { version = "0.40.0" } # Needed for generating (synthetic) light blocks.
119119
parking_lot = { version = "0.12.1" }
120120
cfg-if = { version = "1.0.0" }
121121

‎crates/ibc-types-lightclients-tendermint/src/client_state.rs

+39-3
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,51 @@ impl TryFrom<RawTmClientState> for ClientState {
350350
}
351351
}
352352

353+
/// A wrapper of [`core::time::Duration`] to infallibly convert to
354+
/// [`tendermint_proto::google::protobuf::Duration`].
355+
///
356+
/// In https://github.com/informalsystems/tendermint-rs/pull/1456,
357+
/// `tendermint-rs` made the conversion from the rust native duration to the
358+
/// protobuf well known type duration a fallible operation. This change was
359+
/// first released in `tendermint_proto@v0.40.0` and brings the conversion in
360+
/// line its definition in
361+
/// [`prost-types`](https://docs.rs/prost-types/0.13.3/prost_types/struct.Duration.html#impl-TryFrom%3CDuration%3E-for-Duration).
362+
/// However, this breaks the [`ibc_types_domain_type::DomainType`] impl for
363+
/// [`ClientState`], which requires that the conversion from the domain type to
364+
/// the wire type be infallible.
365+
#[derive(Debug)]
366+
struct CometBftDuration(core::time::Duration);
367+
368+
impl From<CometBftDuration> for tendermint_proto::google::protobuf::Duration {
369+
fn from(duration: CometBftDuration) -> Self {
370+
let duration = duration.0;
371+
let seconds = duration.as_secs();
372+
let seconds = if seconds > i64::MAX as u64 {
373+
i64::MAX
374+
} else {
375+
seconds as i64
376+
};
377+
let nanos = duration.subsec_nanos();
378+
let nanos = if nanos > i32::MAX as u32 {
379+
i32::MAX
380+
} else {
381+
nanos as i32
382+
};
383+
let mut duration = tendermint_proto::google::protobuf::Duration { seconds, nanos };
384+
duration.normalize();
385+
duration
386+
}
387+
}
388+
353389
impl From<ClientState> for RawTmClientState {
354390
fn from(value: ClientState) -> Self {
355391
#[allow(deprecated)]
356392
Self {
357393
chain_id: value.chain_id.to_string(),
358394
trust_level: Some(value.trust_level.into()),
359-
trusting_period: Some(value.trusting_period.into()),
360-
unbonding_period: Some(value.unbonding_period.into()),
361-
max_clock_drift: Some(value.max_clock_drift.into()),
395+
trusting_period: Some(CometBftDuration(value.trusting_period).into()),
396+
unbonding_period: Some(CometBftDuration(value.unbonding_period).into()),
397+
max_clock_drift: Some(CometBftDuration(value.max_clock_drift).into()),
362398
frozen_height: Some(value.frozen_height.map(|height| height.into()).unwrap_or(
363399
RawHeight {
364400
revision_number: 0,

‎crates/ibc-types-lightclients-tendermint/src/error.rs

+6
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ pub enum Error {
135135
},
136136
/// invalid raw client id: `{client_id}`
137137
InvalidRawClientId { client_id: String },
138+
/// can't map `{field}` to its wire format: `{reason}`
139+
DurationTooLarge {
140+
field: &'static str,
141+
// XXX: tendermint_proto::google::protobuf::duration::DurationError is behind a private module
142+
reason: String,
143+
},
138144
}
139145

140146
#[cfg(feature = "std")]

‎crates/ibc-types-path/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ displaydoc = { version = "0.2", default-features = false }
5656
num-traits = { version = "0.2.15", default-features = false }
5757
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["full"], optional = true }
5858
parking_lot = { version = "0.12.1", default-features = false, optional = true }
59-
prost = { version = "0.12", default-features = false }
59+
prost = { version = "0.13.3", default-features = false }
6060
scale-info = { version = "2.1.2", default-features = false, features = ["derive"], optional = true }
6161
serde = { version = "1.0", default-features = false, optional = true }
6262
serde_derive = { version = "1.0.104", default-features = false, optional = true }
6363
serde_json = { version = "1", default-features = false, optional = true }
6464
subtle-encoding = { version = "0.5", default-features = false }
6565
time = { version = "0.3", default-features = false }
66-
tendermint = { version = "0.34.0", default-features = false }
67-
tendermint-proto = { version = "0.34.0", default-features = false }
68-
tendermint-testgen = { version = "0.34.0", default-features = false, optional = true }
66+
tendermint = { version = "0.40.0", default-features = false }
67+
tendermint-proto = { version = "0.40.0", default-features = false }
68+
tendermint-testgen = { version = "0.40.0", default-features = false, optional = true }
6969

7070
[dev-dependencies]
7171
cfg-if = { version = "1.0.0" }

‎crates/ibc-types-timestamp/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ displaydoc = { version = "0.2", default-features = false }
4848
num-traits = { version = "0.2.15", default-features = false }
4949
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["full"], optional = true }
5050
parking_lot = { version = "0.12.1", default-features = false, optional = true }
51-
prost = { version = "0.12", default-features = false }
51+
prost = { version = "0.13.3", default-features = false }
5252
scale-info = { version = "2.1.2", default-features = false, features = ["derive"], optional = true }
5353
serde = { version = "1.0", default-features = false, optional = true }
5454
serde_derive = { version = "1.0.104", default-features = false, optional = true }
5555
serde_json = { version = "1", default-features = false, optional = true }
5656
subtle-encoding = { version = "0.5", default-features = false }
5757
time = { version = "0.3", default-features = false }
58-
tendermint = { version = "0.34.0", default-features = false }
59-
tendermint-proto = { version = "0.34.0", default-features = false }
60-
tendermint-testgen = { version = "0.34.0", default-features = false, optional = true }
58+
tendermint = { version = "0.40.0", default-features = false }
59+
tendermint-proto = { version = "0.40.0", default-features = false }
60+
tendermint-testgen = { version = "0.40.0", default-features = false, optional = true }
6161

6262
[dev-dependencies]
6363
cfg-if = { version = "1.0.0" }

‎crates/ibc-types-transfer/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ parking_lot = { version = "0.12.1", default-features = false, optional = true }
4747
cfg-if = { version = "1.0.0", optional = true }
4848

4949
[dependencies.tendermint-testgen]
50-
version = "0.33"
50+
version = "0.40.0"
5151
optional = true
5252
default-features = false
5353

0 commit comments

Comments
 (0)
Please sign in to comment.