-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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
Conversation
e09e762
to
87955be
Compare
704485d
to
04ce530
Compare
* 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
04ce530
to
5d8638f
Compare
LGTM, but I'm biased because I want this to go in asap, so I'll let others review :) |
fastpay_core/src/client.rs
Outdated
@@ -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. |
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 comment
fastpay_core/src/client.rs
Outdated
errors: error_scores.into_keys().collect(), | ||
}) | ||
} | ||
|
||
async fn communicate_transfers( | ||
/// Broadcast confirmation orders and execute handle order. |
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 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, |
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 function doc comment
fastpay_core/src/client.rs
Outdated
@@ -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. |
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.
"local balance" seems out-of-dated.
fastpay_core/src/client.rs
Outdated
Ok((new_certificate, response.signed_effects.unwrap().effects)) | ||
} | ||
|
||
/// Execute (or retry) a order. Update local balance. |
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 comment
broadcast_and_execute
to handle multiple inputsexecute_transfer
toexecute_transaction
execute_transaction
to work withobject_transfer
,move_call
, andpublish