Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
006a9ff
Add CoreJam draft
gavofyork Sep 20, 2023
d7ec165
weight and prune
gavofyork Sep 21, 2023
4384db4
Prerequisites, initial checks, migration, a few other bits.
gavofyork Sep 25, 2023
a096282
Rename for proposing.
gavofyork Sep 25, 2023
e97e109
Typos and clarifications
gavofyork Sep 26, 2023
7f9aa0b
Ordering: Soft and Hard
gavofyork Sep 26, 2023
e4a117b
Remove superfluous
gavofyork Sep 26, 2023
c4f2e0d
Correct number
gavofyork Sep 26, 2023
8e99271
Tidy ordering
gavofyork Sep 27, 2023
607963e
More clarity
gavofyork Sep 27, 2023
e71b6ce
Cleanups
gavofyork Sep 27, 2023
3c1d2e5
More cleanups
gavofyork Sep 27, 2023
329e24f
Compatibility
gavofyork Sep 27, 2023
dae162c
More cleanups
gavofyork Sep 27, 2023
b2a05ba
Register becomes Report
gavofyork Sep 28, 2023
6d5a175
UMP/HRMP compat
gavofyork Sep 30, 2023
5fd33ac
More on copmat
gavofyork Sep 30, 2023
eb7dab2
Move para
gavofyork Sep 30, 2023
0b5b7ab
Typo
gavofyork Sep 30, 2023
26fd0ed
Update text/0031-corejam.md
gavofyork Oct 2, 2023
ddbb534
Remove , introduce Beefy and state roots
gavofyork Oct 4, 2023
3d6859d
Update text/0031-corejam.md
gavofyork Oct 4, 2023
e4110e6
Update text/0031-corejam.md
gavofyork Oct 13, 2023
85db6ec
Update text/0031-corejam.md
gavofyork Oct 13, 2023
eb93fda
Update text/0031-corejam.md
gavofyork Oct 13, 2023
d6bb203
Update text/0031-corejam.md
gavofyork Oct 13, 2023
1cb5f0d
Update text/0031-corejam.md
gavofyork Oct 16, 2023
95987d3
Update text/0031-corejam.md
gavofyork Oct 16, 2023
d87f686
Update text/0031-corejam.md
gavofyork Oct 16, 2023
d64f568
Apply suggestions from code review
gavofyork Oct 16, 2023
a1eaff8
tweaks
gavofyork Oct 17, 2023
3a368ac
Merge branch 'gav-corejam' of https://github.com/polkadot-fellows/RFC…
gavofyork Oct 18, 2023
52fa112
Add host function `transfer`
gavofyork Oct 18, 2023
26ed3f2
Smart contract stuff
gavofyork Oct 18, 2023
f0dea5e
Ensure that context is checked prior to is_authorized
gavofyork Oct 18, 2023
62436a6
fix
gavofyork Oct 18, 2023
8b321a7
Update text/0031-corejam.md
gavofyork Oct 18, 2023
e32333d
Update text/0031-corejam.md
gavofyork Oct 18, 2023
e33e467
Update text/0031-corejam.md
gavofyork Oct 18, 2023
4d45769
No more ICT
gavofyork Oct 20, 2023
aaaaae3
Merge branch 'gav-corejam' of https://github.com/polkadot-fellows/RFC…
gavofyork Oct 20, 2023
9360c19
Update 0031-corejam.md
gavofyork Oct 21, 2023
23470a2
Update 0031-corejam.md
gavofyork Oct 21, 2023
7d34d4a
Explanation
gavofyork Oct 23, 2023
259e466
Rename Work Class -> Service
gavofyork Oct 23, 2023
cfea18f
Explanation
gavofyork Oct 27, 2023
6d27b30
Note about lookup
gavofyork Oct 27, 2023
0123124
Merge branch 'gav-corejam' of https://github.com/polkadot-fellows/RFC…
gavofyork Oct 27, 2023
c15ef01
Terminology
gavofyork Oct 27, 2023
9e1b05e
Update text/0031-corejam.md
gavofyork Dec 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Smart contract stuff
  • Loading branch information
gavofyork committed Oct 18, 2023
commit 26ed3f28a2364d74b9c6ef57a8b67ea1fe21073b
14 changes: 11 additions & 3 deletions text/0031-corejam.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

@gavofyork gavofyork Dec 11, 2023

Choose a reason for hiding this comment

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

This was changed in the latest prototype; on_transfer now executes at the end of the block.


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.
Copy link
Member

Choose a reason for hiding this comment

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

Note: so we will never remove balances pallet from relaychain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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?)_
Expand Down