Skip to content
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

Better child storage support #368

Closed
Tracked by #264
xlc opened this issue Jul 24, 2019 · 6 comments
Closed
Tracked by #264

Better child storage support #368

xlc opened this issue Jul 24, 2019 · 6 comments
Labels
D1-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. I5-enhancement An additional feature request. T1-FRAME This PR/Issue is related to core FRAME, the framework.

Comments

@xlc
Copy link
Contributor

xlc commented Jul 24, 2019

Improve decl_storage macro or create a new decl_child_storage macro to provide a proper support of child storage.

Currently child storage can only be used with raw key which requires some boilerplate code to use and easy to make mistake (e.g. pick a bad hasher). Those information also are not exposed on metadata which makes JS SDK implementation hard.

Usage of child storage should be similar to StorageMap / StorageValue for better developer experience.

Previous discussion: paritytech/polkadot#315 (comment)

@gui1117
Copy link
Contributor

gui1117 commented Jul 24, 2019

I can imagine this:

StorageName child($ChildString): map storage_type => storage_type;

This storage instead of inserting into top storage it will insert into the child trie with at the place $String.
$ChildString could default to ModuleName ++ " " ++ StorageName.
But I'm not sure about having a default one, like maybe some modules wants to put two storage into the same child trie and other modules wants to put every storage into a different child trie. Having no default seems better.

Also $ChildString could be hashed but I see no value of it, is there some ?

Does that fits all need ? also if someone doesn't want its stuff to be hashed in the childtrie (because it is already isolated from everything else) then we can introduce Identity Hasher.

@gui1117
Copy link
Contributor

gui1117 commented Jul 24, 2019

Also do we want those child trie to be created in genesis or do we want them to be created on first insert ?
I would say option 1

@kianenigma
Copy link
Contributor

+1. It was mentioned in some previous conversations that would be good to, exactly as mentioned, allow syntax like:

StorageName child($ChildString): map storage_type => storage_type;

@cheme
Copy link
Contributor

cheme commented Jul 26, 2019

I had an experimental branch with full switch to child module.
Current state is 'does not work when running the node' so it will probably require implementing the switch optionally to spot the issues.
https://github.com/cheme/substrate/tree/child_module_storage , I guess it can help starting with this issue.

@shawntabrizi
Copy link
Member

shawntabrizi commented Jan 12, 2022

We still need this, but with the new FRAME v2 macros.

Could be a good project for a more advance hiring exercise.

@juangirini juangirini transferred this issue from paritytech/substrate Aug 24, 2023
@the-right-joyce the-right-joyce added I5-enhancement An additional feature request. C1-mentor A task where a mentor is available. Please indicate in the issue who the mentor could be. T1-FRAME This PR/Issue is related to core FRAME, the framework. D1-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. and removed J0-enhancement labels Aug 25, 2023
claravanstaden pushed a commit to Snowfork/polkadot-sdk that referenced this issue Dec 8, 2023
paritytech#368)

* update

* fix tests

* fast test

* ethapp tests working

* eth erc20 working

* fix eth erc20

* done

* no p

* np P

* rehydrate

* fix

* fixed

* refactor

* fixz

* fix

* fixes

* write start

* script extra
@ggwpez ggwpez removed the C1-mentor A task where a mentor is available. Please indicate in the issue who the mentor could be. label Feb 5, 2024
@xlc
Copy link
Contributor Author

xlc commented Feb 28, 2024

no one love child storage

@xlc xlc closed this as completed Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D1-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. I5-enhancement An additional feature request. T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
Status: Done
Development

No branches or pull requests

8 participants