-
Notifications
You must be signed in to change notification settings - Fork 141
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
Value with Callback (auto unlocks) #24
Conversation
I was thinking about security of this and it still seems ok.
|
Co-Authored-By: Maksym Zavershynskyi <35039879+nearmax@users.noreply.github.com> Co-Authored-By: Alexey <alexey@fckt.dev>
Co-Authored-By: Alexey <alexey@fckt.dev>
Please take a look again. Added diagram, receipts and separated scenarios for better explanation. |
|
||
Let's look at receipts (See [How runtime works](#how-runtime-work)): | ||
|
||
```rust |
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.
The transition to specific receipts is unclear. This pseudocode here demonstrates how receipts are created and updated during the execution of exchange
method on dex
. I think this should be stated more explicitly.
predecessor_id: "dex", | ||
input_data_ids: [], | ||
output_data_receivers: [], | ||
actions: [FunctionCall { method_name: "trasnferFrom", ... }], |
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.
We need an explanation on how locks are passed to the function calls, i.e. specify the args.
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.
Added args where it makes sense
predecessor_id: "dex", | ||
input_data_ids: ["data-id-1", "data-id-2"], | ||
// 2 new data receivers we added for the received input data | ||
output_data_receivers: [ |
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 confusing. It says we don't actually add them to output_data_receivers
, but just account for them. Maybe comment out this field here to empathize that it is not actually added.
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.
We need a different name for it.
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.
What I meant, it the receipt would look like this if we append new output data receivers to the exiting output data receivers.
|
||
/// `dex` returns this callback (A7) using `return_promise`. | ||
// This modifies A7, by redirecting output from A4. | ||
ActionReceipt { |
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 this functionality is already implemented in the current runtime, when we use return_promise
, correct?
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.
Yes
id: "D5", | ||
receiver_id: "fun", | ||
predecessor_id: "dex", | ||
data_id: "data-id-3", |
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.
Generating this receipt requires modification to the runtime, correct?
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. It's how it works. We always generate a data receipt.
} | ||
|
||
/// `dex` returns this callback using `return_promise`. | ||
// No receipts are modified, but execution outcome for A1 changes to reflect to wait for A4. |
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.
but execution outcome for A1 changes
where I can see it?
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.
It's part of status
in ExecutionOutcome
in Runtime: https://github.com/nearprotocol/nearcore/blob/d869465f0400678b5df9e29d3bd926e8887d2337/runtime/runtime/src/lib.rs#L728
Going to write a new NEP (in short form first). Keeping this for eduction. Spoiler: We'll use Safes which is similar to move operator |
WIP for the next version: #26 |
No description provided.