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

Additional unit tests for Client State #1873

Merged
merged 5 commits into from
Feb 18, 2022

Conversation

Wizdave97
Copy link
Contributor

@Wizdave97 Wizdave97 commented Feb 14, 2022

Partial fix for: https://github.com/informalsystems/ibc-rs/issues/1706

Description


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests: integration (for Hermes) or unit/mock tests (for modules).
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).

Reviewer checklist:

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

Copy link
Member

@adizere adizere left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution David! The tests added here helped me catch a small problem we have with our error types. I left a suggestion for fixing that.

@adizere adizere self-requested a review February 15, 2022 16:55
Copy link
Member

@adizere adizere left a comment

Choose a reason for hiding this comment

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

Good work!

Will let @hu55a1n1 have a final look & merge this if it looks good to him.

@adizere
Copy link
Member

adizere commented Feb 18, 2022

One more thing actually: it would be good to add a changelog entry. Documentation on how to do that is

It may be a good idea to read our contributing doc in its entirety.

Thank you @Wizdave97!

Copy link
Member

@hu55a1n1 hu55a1n1 left a comment

Choose a reason for hiding this comment

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

Nicely done!🌷 Your tests led me to realise that a few validation checks are not implemented. Preapproved, with some observations that are unrelated to this PR (will let @adizere weigh in here).


#[derive(Clone, Debug, PartialEq)]
struct ClientStateParams {
id: ChainId,
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to this issue, but I see that ibc-go restricts 07-tendermint ChainIds to tendermint::MaxChainID -> cosmos/ibc-go#177
@adizere Should we add this check to our ClientState::new ctor as well?

Copy link
Member

@adizere adizere Feb 18, 2022

Choose a reason for hiding this comment

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

Good idea, I think we should! Seems minor so we can do it in almost any module-related PR. I will capture the missing piece in a separate issue.

trusting_period: Duration,
unbonding_period: Duration,
max_clock_drift: Duration,
latest_height: Height,
Copy link
Member

Choose a reason for hiding this comment

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

We're also not checking if the latest_height's revision_number matches the ChainId's version.

Copy link
Member

Choose a reason for hiding this comment

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

I took the liberty to document all the missing checks in a separate issue: #1893

trust_level: TrustThreshold,
trusting_period: Duration,
unbonding_period: Duration,
max_clock_drift: Duration,
Copy link
Member

Choose a reason for hiding this comment

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

ibc-go doesn't allow a zero max_clock_drift. Not sure why this would be required. 🤔

max_clock_drift: Duration,
latest_height: Height,
proof_specs: ProofSpecs,
upgrade_path: Vec<String>,
Copy link
Member

Choose a reason for hiding this comment

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

Apparently, each key in upgrade_path must be non-empty and this must also be checked.

@adizere
Copy link
Member

adizere commented Feb 18, 2022

Nice findings @hu55a1n1. Documented them in cosmos/ibc-rs#22.

Again -- great work David!

@adizere adizere merged commit 0884781 into informalsystems:master Feb 18, 2022
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* add more unit tests for client state

* minor fixes

* update error string formatting

* add changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants