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

Add storage size check to construct_runtime! #263

Open
ggwpez opened this issue Aug 12, 2022 · 5 comments
Open

Add storage size check to construct_runtime! #263

ggwpez opened this issue Aug 12, 2022 · 5 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

@ggwpez
Copy link
Member

ggwpez commented Aug 12, 2022

More of an idea:

Since we have paritytech/substrate#11699, we could add it to construct_runtime! with some sensible (and configurable) default.
This would help us and para-chain teams (eg. NodleCode/chain#655) to spot large storage structs, which bloat the PoV.

What do you think?

@kianenigma
Copy link
Contributor

Does it need to be in construct_runtime!? We can first start with just a normal test, no?

Also, we can have something like a runtime level set of IntegrityCheck implementations, and just pass them to construct_runtime.

@kianenigma
Copy link
Contributor

I think the right way to go about this is to first solve #218, then, if the runtime is being built in parachain mode, we automatically check this in construct_runtime!.

@ggwpez why was the linked PR never merged?

@ggwpez
Copy link
Member Author

ggwpez commented Mar 16, 2023

No particular reason. It went stale, but we should revive it.

@bkchr
Copy link
Member

bkchr commented Mar 16, 2023

If you want less magic, you can just provide this method for checking the storage size as method in frame-support or similar. Then everyone can write a test in their own runtime to call this function with the maximum size they want to support before it should fail.

@xlc
Copy link
Contributor

xlc commented Mar 16, 2023

There are already tests to check call encode size. We should be able to do something similar for storage.
One way is to generate a union enum of all the storage items and assert the encoded length

@juangirini juangirini transferred this issue from paritytech/substrate Aug 24, 2023
@the-right-joyce the-right-joyce added I5-enhancement An additional feature request. 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
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: Backlog
Development

No branches or pull requests

6 participants