-
Notifications
You must be signed in to change notification settings - Fork 221
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
Light client: bisection, store, requester #100
Conversation
- implement `can_trust` according to the latest spec CanTrustBisection (wip) - add a `Requester` and a `Store` trait - sue refs in parameters (as they are used in several places and we don't want to Copy)
- reduce params to clippy threshold (7); still a lot ... - rename vars for better readability
- rename expired to is_within_trust_period to be closer to the spec - use TrusteState trait in check_support params - use TrusteState in lite tests
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.
Had a first pass with a bunch of style and doc improvements. We should probably rename types.rs
given that it only holds traits.
@liamsi You mentioned that it could use more tests. Could you enumerate what cases/flows you'd like to cover?
tendermint/src/lite/verifier.rs
Outdated
)?; | ||
store.add(&pivot_header)?; | ||
let pivot_trusted = TS::new(pivot_header, pivot_next_vals); | ||
can_trust( |
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 we see calls to the same function with slightly adjusted parameters this function body could benefit from inline comments expanding of what the order of events is. This will lessen the cognitive burden on the reader.
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.
Added some inline comments. Is it more understandable now?
I like
Unit tests for |
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.
Great start, thanks Ismail, but it seems there are a few bugs, some of which are reflected in the spec, and we need to be clearer about validator sets.
I'll leave some more comments on the spec.
* MockHeader and test_is_within_trust_period * remove Validator trait; make ValidatorSet associated to Commit (#105) * remove Validator trait; make ValidatorSet associated to Commit * remove stale comment
* Review comments: - update some comments / documentation - verify vals (not next vals) - store header and vals in trusted state * One offs & renaming related to trusted state
- an_trust -> can_trust_bisection - remove a redundant check for trust period - remove redundant adding state to the store (added TODO)
// and stores the now trusted header again. | ||
// Figure out if we want to store it here or in can_trust_bisection! | ||
// My understanding is: with the current impl, we either bubbled up an | ||
// error, or, successfully added sh2 (and its nex vals) to the trusted store here. |
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.
* use ? instead of return Err(err) * remove unused errors * move a validation and add TODOs about them * check_support returns early for sequential case * drop let _ = * add comment to voting_power_in about signers
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.
Comments addressed or tracked for follow up
Needs tests with concrete impls of store and requester. (e.g. simple in memory store in form of a map and a mocked rpc client).
ref: #96