-
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 dist.sys] Augment fastnft to deal with many input and output objects per transactions #39
Conversation
fastpay_core/src/authority.rs
Outdated
if let Some(_existing_signed_order) = lock { | ||
if _existing_signed_order.order == signed_order.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.
So here you're correctly avoiding any shadowing issue by not putting signed_order.order
in your pattern, great!
But you could also do, perhaps more simply, if lock == Some(signed_order.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.
Hm, but I need to do something different in all three cases:
-
Some(lock) == lock
-
Some(lock) =/= lock
-
None
if let Some(existing_signed_order) = lock { if existing_signed_order.order == signed_order.order { // For some reason we are re-inserting the same order. Not optimal but correct. continue; } else { // We are trying to set the lock to a different order, this is unsafe. return Err(FastPayError::OrderLockReset); } }
So if I do the equality test instead of the let binding, then I will have to add a subsequent if to test if it is none, not equal, and then return the Err, right? Is there a better pattern?
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.
yeah sorry I read too fast. This may be useful, but it's equivalent to what you have;
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b09a069e4a42cb50528ca5c871d73967
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.
Quick comments to attract @patrickkuo attention to returns.
// Add new object, init locks and remove old ones | ||
self.insert_object(output_object); | ||
self.init_order_lock(output_ref); | ||
} | ||
|
||
let info = self.make_object_info(object_id)?; | ||
Ok(info) |
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.
@patrickkuo I am now at the point when I am thinking what the 'handle_order' and 'handle_confirmation_order' should return, since now many objects could be changed / created / deleted by an order. Since you are looking at the client, what are your thoughts on what you need? We would have to make the authority return this.
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.
Since I don't have a complete list of client operation at the moment so I will suggest we leave it for now?
The ops I knew we need on objects so far are:
Create, Transfer, Split, Combine, and Delete (and Clone?), I will create an issue to discuss this.
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.
Lets make an issue to discuss all this, and leave this question out of this PR -- thanks!
fd31f8c
to
5e6655f
Compare
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.
one small comment, otherwise LGTM
fastpay_core/src/authority.rs
Outdated
} | ||
OrderKind::Call(c) => { | ||
let sender = c.sender.to_address_hack(); | ||
OrderKind::Call(_c) => { |
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.
is _c intentional?
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 catch, changed it to 'c'
This handles the issue #8 . It involves:
Out of scope: