-
Notifications
You must be signed in to change notification settings - Fork 71
CoreJam #31
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
CoreJam #31
Changes from 1 commit
006a9ff
d7ec165
4384db4
a096282
e97e109
7f9aa0b
e4a117b
c4f2e0d
8e99271
607963e
e71b6ce
3c1d2e5
329e24f
dae162c
b2a05ba
6d5a175
5fd33ac
eb7dab2
0b5b7ab
26fd0ed
ddbb534
3d6859d
e4110e6
85db6ec
eb93fda
d6bb203
1cb5f0d
95987d3
d87f686
d64f568
a1eaff8
3a368ac
52fa112
26ed3f2
f0dea5e
62436a6
8b321a7
e32333d
e33e467
4d45769
aaaaae3
9360c19
23470a2
7d34d4a
259e466
cfea18f
6d27b30
0123124
c15ef01
9e1b05e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -412,19 +412,27 @@ fn weight_remaining() -> Weight; | |
| fn set_work_storage(key: &[u8], value: &[u8]) -> Result<(), ()>; | ||
| fn remove_work_storage(key: &[u8]); | ||
| fn ump_enqueue(message: &[u8]) -> Result<(), ()>; | ||
| fn transfer(destination: WorkClass, amount: u128, memo: &[u8]) -> Result<Vec<u8>, ()>; | ||
| fn transfer(destination: WorkClass, amount: u128, memo: &[u8], weight: Weight) -> Result<Vec<u8>, ()>; | ||
| ``` | ||
|
|
||
| Read-access to the entire Relay-chain state is allowed. No direct write access may be provided since `accumulate` is untrusted code. `set_work_storage` may fail if an insufficient deposit is held under the Work Class's account. | ||
|
|
||
| UMP messages for the Relay-chain to interpret may be enqueued through `ump_enqueue` function. For this to succeed, the Relay-chain must have pre-authorized the use of UMP for this endpoint. | ||
|
|
||
| Simple transfers of data and balance between Work Classes are possible by the `transfer` function. This is an entirely synchronous function which transfers the execution over to a `destination` Work Class as well as the provided `amount`. During this execution, no `checkpoint()`ing is permitted. The operation may result in error in which case all changes to state are reverted, including the balance transfer. (Weight is still used.) Since this generally requires the sending Work Class to trust the receiver not to burn their Weight, transfers will probably happen in a semi-federated fashion, with trusted hubs forming as clearing houses, both to avert any possibility of Weight misuse and to move most transfers in-core. | ||
|
|
||
| Full access to a child trie specific to the Work Class is provided through the `work_storage` host functions. Since `accumulate` is permissionless and untrusted code, we must ensure that its child trie does not grow to degrade the Relay-chain's overall performance or place untenable requirements on the storage of full-nodes. To this goal, we require an account sovereign to the Work Class to be holding an amount of funds proportional to the overall storage footprint of its Child Trie. `set_work_storage` may return an error should the balance requirement not be met. | ||
|
|
||
| Host functions are provided allowing any state changes to be committed at fail-safe checkpoints to provide resilience in case of weight overrun (or even buggy code which panics). The amount of weight remaining may also be queried without setting a checkpoint. `Weight` is expressed in a regular fashion for a solo-chain (i.e. one-dimensional). | ||
|
|
||
| Simple transfers of data and balance between Work Classes are possible by the `transfer` function. This is an entirely synchronous function which transfers the execution over to a `destination` Work Class as well as the provided `amount` into their account. | ||
|
|
||
| A new VM is set up with code according to the Work Class's `accumulate` code blob, but with a secondary entry point whose prototype is: | ||
|
|
||
| ```rust | ||
| fn on_transfer(source: WorkClass, amount: u128, memo: Vec<u8>) -> Result<Vec<u8>, ()>; | ||
| ``` | ||
|
|
||
| During this execution, all host functions above may be used except `checkpoint()`. The operation may result in error in which case all changes to state are reverted, including the balance transfer. (Weight is still used.) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is so, that a weight overrun is not fatal and the service' tasks can proceed, albeit at a lower rate? For the panic case, I assume the idea is that a code upgrade is provided, fixing the situation and then we can proceed with the check point. Although is a check point still valid, once we changed the code?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was changed in the latest prototype; |
||
|
|
||
| Other host functions, including some to access Relay-chain hosted services such as the Balances and Storage Pallet may also be provided commensurate with this executing on-chain. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: so we will never remove balances pallet from relaychain.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Balances wouldn't be hosted by the balances pallet since most of its functionality (extrinsics, ED, holds, freezes) is unneeded. |
||
|
|
||
| _(Note for discussion: Should we be considering light-client proof size at all here?)_ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.