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

Cleaner access to :code storage #183

Open
JoshOrndorff opened this issue Feb 20, 2024 · 0 comments
Open

Cleaner access to :code storage #183

JoshOrndorff opened this issue Feb 20, 2024 · 0 comments

Comments

@JoshOrndorff
Copy link
Contributor

Currently the runtime upgrade piece has a side effect of writing directly into storage at :code.

It seems cleaner to me (at the moment, but this is up for discussion) to have an access trait for the runtime storage and make pieces like the runtime upgrade piece reference the write access through the necessary accessor method.

Something similar is how I handled the relay parent block number storage for the parachain runtime.

impl SetRelayParentNumberStorage for RelayParentNumberStorage {
fn set(new_parent_number: u32) {
sp_io::storage::set(RELAY_PARENT_NUMBER_KEY, &new_parent_number.encode());
}
}

Depending how many of these "special" storage keys there are, maybe we could even formalize a notion of global storage item. But I'm not ready to go there quite yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant