validate_prefix_length
can avoid creating new String
s
#943
Labels
O: optimization
Objective: aims to optimize performance, allocations and computations
Milestone
Bug Summary
validate_prefix_length
unnecessarily creates a newString
usingu64::MIN
andu64::MAX
which can be avoided.Details
The current implementation looks as follows.
ibc-rs/crates/ibc/src/core/ics24_host/identifier/validate.rs
Lines 59 to 79 in ccca3ff
Instead of doing
we can directly pass
prefix
with{min,max}_id_length
with negative offset forformat!("-{}", u64::MIN)
.And, similar for
u64::MAX
with offset21
. But we need to be careful that these subtractions don't underflow.Version
v0.47.0
The text was updated successfully, but these errors were encountered: