-
Notifications
You must be signed in to change notification settings - Fork 226
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
Implement verify_light() and verify_light_trusting() #1226
Implement verify_light() and verify_light_trusting() #1226
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.
The changes look good so far. It would be nice if the names matched so that the code compiles.
We may also need some more tests for the newly added functionality.
Codecov Report
@@ Coverage Diff @@
## main #1226 +/- ##
======================================
Coverage 64.2% 64.3%
======================================
Files 244 245 +1
Lines 21364 21485 +121
======================================
+ Hits 13734 13821 +87
- Misses 7630 7664 +34
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
This seems good to me, thanks @hu55a1n1! Could you please add a changelog entry for this?
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.
Looks good!
light-client/src/tests.rs
Outdated
trait IntoResult<T, E> { | ||
fn into_result(self, ok: T) -> Result<T, E>; | ||
} | ||
|
||
impl<T> IntoResult<T, Verdict> for Verdict { | ||
fn into_result(self, ok: T) -> Result<T, Verdict> { | ||
match self { | ||
Verdict::Success => Ok(ok), | ||
error => Err(error), | ||
} | ||
} | ||
} |
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.
Nit: the purpose of this could look more obvious if this were just a helper function. Then again, method chaining is neat.
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.
As an aside, not related to this PR: why did there have to be a non-idiomatic Verdict
, rather than a Result<(), VerificationError>
where VerificationError
would be an enum or otherwise easily matchable to that variant?
Basically, what the existing impl From<Result<(), VerificationError>> for Verdict
does could be just how the Result
returned value is supposed to be used if you care about the NotEnoughTrust
case. Cc @romac
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.
Agreed, let's do 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.
Agreed, let's do that.
I didn't mean this to be done in scope for this PR, which so far has not introduced breaking changes, but if you think it would be good and easy thing to do in the next release, I'm all for it.
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.
Indeed, let's target this for 0.27.
Thanks, @mzabaluev, @thanethomson and @romac for reviewing this. @ancazamfir pointed out that the misbehaviour handling in IBC used the same logic as the update handling (i.e. |
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 @hu55a1n1! Left a few comments but in general it looks good. Could we see cosmos/ibc-rs#215 updates before we merge this?
Co-authored-by: Anca Zamfir <[email protected]>
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 will approve as it looks great, thanks @hu55a1n1
If you can make the API name in this discussion it's great. I also added two very minor comments.
Co-authored-by: Anca Zamfir <[email protected]>
…hub.com:informalsystems/tendermint-rs into hu55a1n1/1222-impl-verify-commit-light-trusting
Done -> c0f2469 |
Closes: #1222
.changelog/