Skip to content
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

Merged
merged 17 commits into from
Feb 9, 2022

Conversation

gdanezis
Copy link
Collaborator

@gdanezis gdanezis commented Feb 7, 2022

@gdanezis gdanezis marked this pull request as draft February 7, 2022 20:37
@gdanezis gdanezis force-pushed the client_cleanup_aggregator branch from 781c7af to d39fc59 Compare February 8, 2022 08:10
@gdanezis gdanezis changed the title [fastx client] Use new client functions, and remove old logic [fastx client] Use new client functions, and remove old logic (Part 2) Feb 8, 2022
@gdanezis gdanezis marked this pull request as ready for review February 8, 2022 12:13
@gdanezis gdanezis force-pushed the client_cleanup_aggregator branch from 60ac64a to 8a5a772 Compare February 8, 2022 17:05
Base automatically changed from client_cleanup_aggregator to main February 8, 2022 17:49
@huitseeker
Copy link
Contributor

Adding @lxfind to review requests for alignment on direction of authority_aggregator.

Copy link
Contributor

@huitseeker huitseeker left a 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:

  1. for every #[test] fn overlong_test_about_frobnication,
  2. the test is transformed into // TODO: test frobnication in Part 2,
  3. 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() {
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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)]
Copy link
Contributor

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call!

Copy link
Collaborator Author

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

cleanup the comment?

Copy link
Collaborator Author

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() {
Copy link
Contributor

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) ?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

@lxfind
Copy link
Contributor

lxfind commented Feb 8, 2022

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.
Copy link
Contributor

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?

Copy link
Collaborator Author

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?

Copy link
Contributor

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.

Copy link
Collaborator Author

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

comment lost

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So sorry, rebase troubles

@gdanezis
Copy link
Collaborator Author

gdanezis commented Feb 8, 2022

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:

  1. for every #[test] fn overlong_test_about_frobnication,
  2. the test is transformed into // TODO: test frobnication in Part 2,
  3. 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.

Made an issue to track re-introducing the meaningful tests removes (I already brought back the one deleted by mistake): #396

Copy link
Contributor

@lxfind lxfind left a 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.
Copy link
Contributor

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.

@gdanezis gdanezis merged commit e669843 into main Feb 9, 2022
@gdanezis gdanezis deleted the sync-gives-certs branch February 9, 2022 10:57
mwtian pushed a commit that referenced this pull request Sep 12, 2022
mwtian pushed a commit to mwtian/sui that referenced this pull request Sep 29, 2022
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.

[fastx client] Logic of CertificateRequester and other places to get previous certificates is incorrect.
3 participants