Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
add comment on Option<()> to answer FAQ
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier committed Jun 1, 2020
1 parent a01bafd commit 2a079cc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion runtime/parachains/src/initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ pub trait Trait: system::Trait + configuration::Trait + paras::Trait { }
decl_storage! {
trait Store for Module<T: Trait> as Initializer {
/// Whether the parachains modules have been initialized within this block.
/// Should never hit the trie.
///
/// Semantically a bool, but this guarantees it should never hit the trie,
/// as this is cleared in `on_finalize` and Frame optimizes `None` values to be empty values.
///
/// As a bool, `set(false)` and `remove()` both lead to the next `get()` being false, but one of
/// them writes to the trie and one does not. This confusion makes `Option<()>` more suitable for
/// the semantics of this variable.
HasInitialized: Option<()>;
}
}
Expand Down

0 comments on commit 2a079cc

Please sign in to comment.