@@ -94,29 +94,38 @@ impl<'a> GenesisConfigBuilderRuntimeCaller<'a> {
9494 Ok ( ext. into_storages ( ) )
9595 }
9696
97- /// Patch default `GenesisConfig ` using given JSON patch and store it in the storage.
97+ /// Patch default `RuntimeGenesisConfig ` using given JSON patch and store it in the storage.
9898 ///
99- /// This function generates the `GenesisConfig` for the runtime by applying a provided JSON
100- /// patch. The patch modifies the default `GenesisConfig` allowing customization of the specific
101- /// keys. The resulting `GenesisConfig` is then deserialized from the patched JSON
102- /// representation and stored in the storage.
99+ /// Refer to [get_storage_for_patch] for info how patch is applied.
100+ pub fn get_storage_for_patch ( & self , patch : Value ) -> core:: result:: Result < Storage , String > {
101+ let config = self . get_config_for_patch ( patch) ?;
102+ self . get_storage_for_config ( config)
103+ }
104+
105+ /// Creates a `RuntimeGenesisConfig`, by applying given `patch` to default
106+ /// `RuntimeGenesisConfig`.
107+ ///
108+ /// This function generates the `RuntimeGenesisConfig` for the runtime by applying a provided
109+ /// JSON patch. The patch modifies the default `RuntimeGenesisConfig` allowing customization of
110+ /// the specific keys. The resulting `RuntimeGenesisConfig` is then returned.
103111 ///
104112 /// If the provided JSON patch is incorrect or the deserialization fails the error will be
105113 /// returned.
106114 ///
107- /// The patching process modifies the default `GenesisConfig` according to the following rules:
115+ /// The patching process modifies the default `RuntimeGenesisConfig` according to the following
116+ /// rules:
108117 /// 1. Existing keys in the default configuration will be overridden by the corresponding values
109118 /// in the patch.
110119 /// 2. If a key exists in the patch but not in the default configuration, it will be added to
111- /// the resulting `GenesisConfig `.
120+ /// the resulting `RuntimeGenesisConfig `.
112121 /// 3. Keys in the default configuration that have null values in the patch will be removed from
113- /// the resulting `GenesisConfig `. This is helpful for changing enum variant value.
122+ /// the resulting `RuntimeGenesisConfig `. This is helpful for changing enum variant value.
114123 ///
115- /// Please note that the patch may contain full `GenesisConfig `.
116- pub fn get_storage_for_patch ( & self , patch : Value ) -> core:: result:: Result < Storage , String > {
124+ /// Please note that the patch may contain full `RuntimeGenesisConfig `.
125+ pub fn get_config_for_patch ( & self , patch : Value ) -> core:: result:: Result < Value , String > {
117126 let mut config = self . get_default_config ( ) ?;
118127 json_patch:: merge ( & mut config, & patch) ;
119- self . get_storage_for_config ( config)
128+ Ok ( config)
120129 }
121130}
122131
0 commit comments