Deploy pallet-parameters to rococo and fix dynamic_params name expand (#4006)

Changes:
- Add pallet-parameters to Rococo to configure the NIS and preimage
pallet.
- Fix names of expanded dynamic params. Apparently, `to_class_case`
removes suffix `s`, and `Nis` becomes `Ni` 😑. Now using
`to_pascal_case`.

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Alessandro Siniscalchi <asiniscalchi@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: command-bot <>
This commit is contained in:
Oliver Tale-Yazdi
2024-04-13 14:20:42 +03:00
committed by GitHub
parent 1bca825cc2
commit 30c58fa22a
9 changed files with 198 additions and 14 deletions
@@ -16,6 +16,7 @@
// limitations under the License.
#![cfg(any(test, feature = "runtime-benchmarks"))]
#![allow(non_snake_case)]
//! Mock runtime that configures the `pallet_example_basic` to use dynamic params for testing.
@@ -66,6 +67,20 @@ pub mod dynamic_params {
#[codec(index = 0)]
pub static Key3: u128 = 4;
}
#[dynamic_pallet_params]
#[codec(index = 2)]
pub mod nis {
#[codec(index = 0)]
pub static Target: u64 = 0;
}
#[dynamic_pallet_params]
#[codec(index = 3)]
pub mod somE_weird_SPElLInG_s {
#[codec(index = 0)]
pub static V: u64 = 0;
}
}
#[docify::export(benchmarking_default)]
@@ -98,6 +113,8 @@ mod custom_origin {
}
match key {
RuntimeParametersKey::SomEWeirdSPElLInGS(_) |
RuntimeParametersKey::Nis(_) |
RuntimeParametersKey::Pallet1(_) => ensure_root(origin.clone()),
RuntimeParametersKey::Pallet2(_) => ensure_signed(origin.clone()).map(|_| ()),
}
@@ -91,7 +91,7 @@ impl ToTokens for DynamicParamModAttr {
let mut quoted_enum = quote! {};
for m in self.inner_mods() {
let aggregate_name =
syn::Ident::new(&m.ident.to_string().to_class_case(), m.ident.span());
syn::Ident::new(&m.ident.to_string().to_pascal_case(), m.ident.span());
let mod_name = &m.ident;
let mut attrs = m.attrs.clone();
@@ -222,8 +222,10 @@ impl ToTokens for DynamicPalletParamAttr {
let (params_mod, parameter_pallet, runtime_params) =
(&self.inner_mod, &self.meta.parameter_pallet, &self.meta.runtime_params);
let aggregate_name =
syn::Ident::new(&params_mod.ident.to_string().to_class_case(), params_mod.ident.span());
let aggregate_name = syn::Ident::new(
&params_mod.ident.to_string().to_pascal_case(),
params_mod.ident.span(),
);
let (mod_name, vis) = (&params_mod.ident, &params_mod.vis);
let statics = self.statics();