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] Refactored transfer_object/move_call/push to use execute_transaction #269

Merged
merged 12 commits into from
Jan 27, 2022

Conversation

patrickkuo
Copy link
Contributor

@patrickkuo patrickkuo commented Jan 26, 2022

  • Refactored broadcast_and_execute to handle multiple inputs
  • Renamed execute_transfer to execute_transaction
  • Refactored execute_transaction to work with object_transfer, move_call, and publish
  • lot of refactoring to simplify the code

@patrickkuo patrickkuo changed the base branch from main to pat/client-error-handling January 26, 2022 00:51
@patrickkuo patrickkuo self-assigned this Jan 26, 2022
@patrickkuo patrickkuo added this to the Milestone 3 milestone Jan 26, 2022
@patrickkuo patrickkuo force-pushed the pat/client-error-handling branch from e09e762 to 87955be Compare January 26, 2022 13:07
@patrickkuo patrickkuo force-pushed the pat/client-refactoring branch 3 times, most recently from 704485d to 04ce530 Compare January 26, 2022 15:52
@patrickkuo patrickkuo changed the base branch from pat/client-error-handling to main January 26, 2022 16:11
* bug fix: execute_transfer will not be able to execute twice if previous request failed, causing `pending_transfer` to stick.
…ransfer_object

* Added From<anyhow::Error> for FastPayError
* some refactoring
* new test for receive_object
* new error for incorrect recipient
…on`, added `execute_transaction_without_confirmation` to simplify the code
@patrickkuo patrickkuo force-pushed the pat/client-refactoring branch from 04ce530 to 5d8638f Compare January 26, 2022 16:18
@patrickkuo patrickkuo marked this pull request as ready for review January 26, 2022 18:20
@oxade
Copy link
Contributor

oxade commented Jan 26, 2022

LGTM, but I'm biased because I want this to go in asap, so I'll let others review :)

@@ -250,16 +251,16 @@ impl<A> Requester for CertificateRequester<A>
where
A: AuthorityClient + Send + Sync + 'static + Clone,
{
type Key = SequenceNumber;
type Key = (ObjectID, SequenceNumber);
type Value = Result<CertifiedOrder, FastPayError>;

/// Try to find a certificate for the given sender and sequence number.
Copy link
Contributor

Choose a reason for hiding this comment

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

Update comment

errors: error_scores.into_keys().collect(),
})
}

async fn communicate_transfers(
/// Broadcast confirmation orders and execute handle order.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't fully understand this comment. What does "execute handle order" mean?
Could you also add comment regarding the return type?

@@ -476,79 +491,76 @@ where
async fn broadcast_and_execute<'a, V, F: 'a>(
&'a mut self,
Copy link
Contributor

Choose a reason for hiding this comment

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

Update function doc comment

@@ -718,65 +687,60 @@ where
}
}

/// Execute (or retry) a transfer order. Update local balance.
async fn execute_transfer(
/// Execute (or retry) a order. Update local balance.
Copy link
Contributor

Choose a reason for hiding this comment

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

"local balance" seems out-of-dated.

Ok((new_certificate, response.signed_effects.unwrap().effects))
}

/// Execute (or retry) a order. Update local balance.
Copy link
Contributor

Choose a reason for hiding this comment

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

Update comment

@patrickkuo patrickkuo merged commit 7d7cb32 into main Jan 27, 2022
@huitseeker huitseeker deleted the pat/client-refactoring branch February 2, 2022 13:05
@huitseeker huitseeker restored the pat/client-refactoring branch February 2, 2022 13:11
@huitseeker huitseeker deleted the pat/client-refactoring branch February 2, 2022 13:13
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.

3 participants