Off-Narrative-Labs / Tuxedo

Write UTXO-based Substrate Runtimes
https://off-narrative-labs.github.io/Tuxedo/
Apache License 2.0
56 stars 17 forks source link

Cleaner access to `:code` storage #183

Open JoshOrndorff opened 7 months ago

JoshOrndorff commented 7 months ago

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. https://github.com/Off-Narrative-Labs/Tuxedo/blob/1ad23430126711d6fca8899e4f00306e76bf98f8/tuxedo-parachain-core/src/lib.rs#L93-L97

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.