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

fix: revert frozen_height to 0 for active clients in conversions #1064

Merged
merged 4 commits into from
Jan 29, 2024

Conversation

Farhad-Shabani
Copy link
Member

@Farhad-Shabani Farhad-Shabani commented Jan 29, 2024

Description

In #1061, when converting an active Tendermint ClientState to its corresponding proto type, we set the frozen_height as None to ensure consistency when switching between domain and proto types. However, basecoin-rs revealed that the ibc-go driven chain can only properly decode the Protobuf encoded of an active ClientState value when the frozen_height is explicitly set to zero!

Integration test: informalsystems/basecoin-rs#151


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests.
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

Copy link

codecov bot commented Jan 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (06725c1) 67.06% compared to head (57dec21) 67.07%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1064      +/-   ##
==========================================
+ Coverage   67.06%   67.07%   +0.01%     
==========================================
  Files         204      204              
  Lines       20532    20543      +11     
==========================================
+ Hits        13769    13780      +11     
  Misses       6763     6763              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rnbguy
Copy link
Collaborator

rnbguy commented Jan 29, 2024

Am I correct to conclude that frozen_height doesn't need to be Option<Height>? We can just use Height - as it is never set toNone.

@rnbguy
Copy link
Collaborator

rnbguy commented Jan 29, 2024

I got my answer!

  1. RawClientState never has None for frozen_client (ibc-go convention). The active case is denoted by RawHeight { number: 0, height: 0 }.
  2. It's best to use Option<Height> and None will denote RawHeight { number: 0, height: 0 } which is invalid in our domain type Height.

Copy link
Collaborator

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggestion - otherwise, LGTM ✨

ibc-clients/ics07-tendermint/types/src/error.rs Outdated Show resolved Hide resolved
Co-authored-by: Rano | Ranadeep <ranadeep@informal.systems>
Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>
@Farhad-Shabani Farhad-Shabani changed the title fix: revert frozen_height to 0 for active clients in From<TmClientState> fix: revert frozen_height to 0 for active clients in conversions Jan 29, 2024
@Farhad-Shabani Farhad-Shabani merged commit 4a0990f into main Jan 29, 2024
15 checks passed
@Farhad-Shabani Farhad-Shabani deleted the farhad/set-raw-frozen-height-to-zero branch January 29, 2024 21:13
Farhad-Shabani added a commit that referenced this pull request Sep 9, 2024
…1064)

* fix: revert proto encoded frozen_height to height = zero

* fix: disallow proto frozen_height equal to None

* fix: test_update_synthetic_tendermint_client_duplicate_ok

* Update ibc-clients/ics07-tendermint/types/src/error.rs

Co-authored-by: Rano | Ranadeep <ranadeep@informal.systems>
Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>

---------

Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>
Co-authored-by: Rano | Ranadeep <ranadeep@informal.systems>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants