[ICS24] Enhancements and fixes for ChainId
handling and validation
#761
Labels
A: breaking
Admin: breaking change that may impact operators
A: bug
Admin: something isn't working
O: maintainability
Objective: cause to ease modification, fault corrections and improve code understanding
Milestone
Problem Statement
Upon reviewing our existing design around
ChainId
the following issues/suggestions were brought up, some of which were raised thanks to @mina86 in #698, #721, and #725.Utilize existing identifier validator functions for both character and length checks, ofc with some customization, given that:
ChainId
s like-1
andcomsos hub-1
(with whitespace) are considered valid!MaxChainIdLen - 20
(consideringu64::MAX
length), as it can lead to an overflow.Redundant
is_epoch_format
call byfrom_string
inChainId
creatingUse
revision_number
instead ofversion
to get naming consistent with other places (Looking atHeight
andHeightTimeout
) and takingibc-go
as the reference implementation.Unclear why invalid identifiers create a default
ChainId
withversion = 0
. This should be documented or completely disallow creatingChainId
with strings not in format. This way conversions from a string can fail, and the error ofFromStr
can't be infallible.Remove default implementation for
ChainId
. We can’t assume anything about that.Highlight
Taking ICS-24 as our reference for identifier validation (As it is so for other identifiers as well), basically, we should not enforce stricter checks on the identifier's format, and leave it up to users if needed. Even though we may allow creating odd
ChainId
likechainA-a-1
or--chainA-1
,Some related issues in
ibc-go
The text was updated successfully, but these errors were encountered: