Skip to content

Light client: bisection, store, requester#100

Merged
ebuchman merged 12 commits intomasterfrom
ismail/light_store_requests_bisect
Dec 29, 2019
Merged

Light client: bisection, store, requester#100
ebuchman merged 12 commits intomasterfrom
ismail/light_store_requests_bisect

Conversation

@liamsi
Copy link
Contributor

@liamsi liamsi commented Dec 19, 2019

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

  • Referenced an issue explaining the need for the change
  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGES.md

 - 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
@liamsi liamsi requested a review from ebuchman December 20, 2019 10:34
@liamsi liamsi marked this pull request as ready for review December 20, 2019 10:34
@liamsi liamsi requested a review from brapse December 20, 2019 10:41
xla
xla previously requested changes Dec 20, 2019
Copy link
Contributor

@xla xla left a 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?

)?;
store.add(&pivot_header)?;
let pivot_trusted = TS::new(pivot_header, pivot_next_vals);
can_trust(
Copy link
Contributor

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.

Copy link
Contributor Author

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?

@liamsi
Copy link
Contributor Author

liamsi commented Dec 20, 2019

We should probably rename types.rs given that it only holds traits.

I like interfaces.rs. I would like to re-structure this in a separate PR if possible.

You mentioned that it could use more tests. Could you enumerate what cases/flows you'd like to cover?

Unit tests for verify_header and can_trust. We can probably re-use the JSON files in tests/lite to mock a simple requestor (and a store). Hope to write down my thoughts in more detail later.

Copy link
Contributor

@ebuchman ebuchman left a 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.

@liamsi liamsi mentioned this pull request Dec 28, 2019
5 tasks
ebuchman and others added 3 commits December 28, 2019 15:12
* 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.
Copy link
Contributor Author

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
@liamsi liamsi requested a review from xla December 29, 2019 18:17
Copy link
Contributor

@ebuchman ebuchman left a comment

Choose a reason for hiding this comment

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

All the review comments have been addressed or tracked in issues #110, #111, #112, #113. Let's merge this and keep working on things in new PRs.

@ebuchman ebuchman dismissed xla’s stale review December 29, 2019 18:45

Comments addressed or tracked for follow up

@ebuchman ebuchman merged commit 1de3770 into master Dec 29, 2019
@ebuchman ebuchman deleted the ismail/light_store_requests_bisect branch December 29, 2019 18:45
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