-
Notifications
You must be signed in to change notification settings - Fork 352
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
Additional unit tests for Client State #1873
Conversation
There was a problem hiding this 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.
There was a problem hiding this 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.
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! |
There was a problem hiding this 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, |
There was a problem hiding this comment.
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 ChainId
s to tendermint::MaxChainID
-> cosmos/ibc-go#177
@adizere Should we add this check to our ClientState::new
ctor as well?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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>, |
There was a problem hiding this comment.
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.
Nice findings @hu55a1n1. Documented them in cosmos/ibc-rs#22. Again -- great work David! |
* add more unit tests for client state * minor fixes * update error string formatting * add changelog
Partial fix for: https://github.com/informalsystems/ibc-rs/issues/1706
Description
PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.