Skip to content

Cleaner access to :code storage #183

@JoshOrndorff

Description

@JoshOrndorff

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions