Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ICS24] Enhancements and fixes for ChainId handling and validation #761

Closed
Tracked by #807
Farhad-Shabani opened this issue Jul 13, 2023 · 0 comments · Fixed by #762
Closed
Tracked by #807

[ICS24] Enhancements and fixes for ChainId handling and validation #761

Farhad-Shabani opened this issue Jul 13, 2023 · 0 comments · Fixed by #762
Assignees
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

Comments

@Farhad-Shabani
Copy link
Member

Farhad-Shabani commented Jul 13, 2023

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:

    • (bug)ChainIds like -1 and comsos hub-1 (with whitespace) are considered valid!
    • (bug) The ChainId's length check for the new Tendermint client creation is incorrect. It shouldn't allow lengths greater than MaxChainIdLen - 20 (considering u64::MAX length), as it can lead to an overflow.
  • Redundant is_epoch_format call by from_string in ChainId creating

  • Use revision_number instead of version to get naming consistent with other places (Looking at Height and HeightTimeout) and taking ibc-go as the reference implementation.

  • Unclear why invalid identifiers create a default ChainId with version = 0. This should be documented or completely disallow creating ChainId with strings not in format. This way conversions from a string can fail, and the error of FromStr 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 like chainA-a-1 or --chainA-1,

Some related issues in ibc-go

@Farhad-Shabani Farhad-Shabani added A: bug Admin: something isn't working A: breaking Admin: breaking change that may impact operators O: maintainability Objective: cause to ease modification, fault corrections and improve code understanding labels Jul 13, 2023
@github-project-automation github-project-automation bot moved this to 📥 To Do in ibc-rs Jul 13, 2023
@Farhad-Shabani Farhad-Shabani self-assigned this Jul 14, 2023
@Farhad-Shabani Farhad-Shabani changed the title [ICS24] Refactor ChainId abstraction [ICS24] Enhancements and fixes for ChainId handling and validation Jul 18, 2023
@github-project-automation github-project-automation bot moved this from 📥 To Do to ✅ Done in ibc-rs Jul 28, 2023
@Farhad-Shabani Farhad-Shabani added this to the v0.43.1 milestone Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant