-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Child trie and state machine refactors #13006
base: master
Are you sure you want to change the base?
Conversation
and update some tests
@@ -208,7 +245,7 @@ pub trait Externalities: ExtensionStore { | |||
&mut self, | |||
child_info: &ChildInfo, | |||
state_version: StateVersion, | |||
) -> Vec<u8>; | |||
) -> Option<Vec<u8>>; |
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.
Returning "Option" here is only for the transient storage. Alternatively we could also have transient storage use there own 'root/hash' api.
child_info: &ChildInfo, | ||
key: &[u8], | ||
count: u32, | ||
) -> Option<Vec<StorageKey>> { |
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.
Note this rewrite is to return a Vec of the next keys, it is not necessary for default child trie but is for the transient storage: we can be conservative and keep old implemetation for default child trie (but would make sense to switch is api to a vec of next keys too).
Putting this out of draft, some change can be a bit controversial (can rollback them and specialize changes to the transient storage api only):
|
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
+1 for removing |
Yes it as actually more a DefaultMerkleTrie or DefaultTrie, actuallly
There is the transient btree storage and the blob storage (for the second one it is more a child state). |
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
will soon. |
This branch will effectively address paritytech/polkadot-sdk#245? |
Yes it target this one, but it is a version with many host function, I am testing a different approach in branch "https://github.com/cheme/substrate/tree/transient-global-mem" where I just expose a global wasm memory (change overlay with transaction support) and a few host function (for hashing and storing). |
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
#13940 is more prioritary for now, this can be close until then I think. |
This PR expose the refactor from my current transient storage branch: https://github.com/cheme/substrate/tree/transient).
The transient branch changeset is big too and I want to split it in different PR (and LOT of testing is still needed in the target branch, and maybe taking the Rfc/PPP process).
This first PR is focusing on substrate changes with no additional functionalities.
This will allow to focus this review on backward compatibility.
But some changes merely make sense when related to the full change set and consulting the mentioned full branch may be useful.
No need to merge this right now, it is more a preparatory PR to show and discuss changes and direction, so low priority.
Looking at it, I also wonder if removing ChildInfo enum for just name or ChildType + name in read api would be better.
In this PR
Change sp-externalities:
- by allowing to write on read access allow evolution such as:
-
append optimizing
: only write the appended content on write (store a Vec), and only resolve (concatenate and cache the changes) on read (for Improve performance ofstorage::append
polkadot-sdk#30).- access analysis: cache access info.
with_externality
scope and return the u64 there, and only for the case of wasm calling host: a bit beyond this pr scope).remove change trie extrinsic indexing in state-machine
In full branch
Generally I am not very happy with multiplexing some function under ChildInfo.
Blob and Btree transient storage are part of the child tree mechanism. This choice could allow easier implementation of non transient variant, but there may be some awkward interfacing (choosing between a generit child state function or a dedicated one).
Blob
chunked data (every changes are stored by chunks).
hashing is done on new host function that keep trace of hasher: this is very discutable
api
polkadot companion: paritytech/polkadot#6550
cumulus companion: paritytech/cumulus#2087