-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
[fastx client] Use new client functions, and remove old logic (Part 2) #381
Conversation
781c7af
to
d39fc59
Compare
0bd6dae
to
9b2b5e5
Compare
60ac64a
to
8a5a772
Compare
9b2b5e5
to
795e7fd
Compare
Adding @lxfind to review requests for alignment on direction of |
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.
OK, so while I love red diffs as much as the next overworked dev, the thing that would help me figure out whether out coverage goes down the drain is this:
- for every
#[test] fn overlong_test_about_frobnication
, - the test is transformed into
// TODO: test frobnication
in Part 2, - then part 3 deletes the comment in question and replaces it with
#[test] fn sleek_frobnication_test
That way as a reviewer, I can focus on those tests not replaced by a placeholder (deleted) and check that the deletion makes sense.
@@ -766,184 +764,6 @@ async fn test_client_state_sync_with_transferred_object() { | |||
assert_eq!(1, client2.store().certificates.iter().count()); | |||
} | |||
|
|||
#[tokio::test] | |||
async fn test_client_certificate_state() { |
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.
Have we chosen a path on what we want to do with sequence numbers yet?
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.
No but I think we keep them for the moment. This test however is heavily relying on the assumption that the client maintain a list of all certificates of its objects, and upon updating authorities it downloads all certificates. This was used to replay the certificates in a sequence -- which is the fastpay way of updating. I will not fix this test, but rather will go and delete any client logic that still relies on this linear-certificate logic.
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 is the essence of the #290 issue this is resolving.
@@ -3065,6 +1715,7 @@ async fn client_object(client: &mut dyn Client, object_id: ObjectID) -> (ObjectR | |||
} | |||
|
|||
// A helper function to make tests less verbose | |||
#[allow(dead_code)] |
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.
Maybe making this pub(crate)
would help?
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 call!
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.
Actually this creates more issues than it solves, due to private types leaking.
// Get the object created from the call | ||
let (new_obj_ref, _) = order_effects.created[0]; | ||
let (_, published_effects) = pub_res.unwrap(); | ||
// let published_effects = order_info_resp.signed_effects.unwrap().effects; |
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.
cleanup the comment?
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.
Sorry, cleaned these up now (there were many).
} | ||
|
||
#[tokio::test] | ||
async fn test_transfer_pending_orders() { |
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.
Doesn't that leave the whole pending_orders logic untested (however imperfectly) ?
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.
Oops -- good catch. I took this one out by mistake.
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.
Now its back, but less specific.
So happy to see all the old code getting deleted! |
@@ -520,7 +452,9 @@ where | |||
|
|||
/// This function returns a map between object references owned and authorities that hold the objects | |||
/// at this version, as well as a list of authorities that responsed to the query for the objects owned. | |||
pub async fn get_all_owned_objects( | |||
/// | |||
/// We do not expose this function to users, as its output is hard for callers to interpet. |
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.
Update doc comment on the return value 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.
Not sure what you mean?
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 mean the doc comment of this function seems out-of-dated and we should update them to reflect the current semantics of the return values.
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.
Done!
), | ||
FastPayError, | ||
> { | ||
// First get a map of all objects at least a quorum of authorities think we hold. |
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.
comment lost
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.
So sorry, rebase troubles
Made an issue to track re-introducing the meaningful tests removes (I already brought back the one deleted by mistake): #396 |
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.
LGTM!
@@ -520,7 +452,9 @@ where | |||
|
|||
/// This function returns a map between object references owned and authorities that hold the objects | |||
/// at this version, as well as a list of authorities that responsed to the query for the objects owned. | |||
pub async fn get_all_owned_objects( | |||
/// | |||
/// We do not expose this function to users, as its output is hard for callers to interpet. |
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 mean the doc comment of this function seems out-of-dated and we should update them to reflect the current semantics of the return values.
189b40c
to
3bc3287
Compare
The final step in closing:
CertificateRequester
and other places to get previous certificates is incorrect. #290Future PR: