chore: regenerate umbrella crate, fix feature propagation

This commit is contained in:
2025-12-16 11:28:32 +03:00
parent dd6d48f528
commit 620b0e3aa0
1358 changed files with 9464 additions and 7656 deletions
@@ -412,8 +412,9 @@ fn valid_call_weight_test() {
let info = tx.get_dispatch_info();
let len = tx.using_encoded(|e| e.len());
let checked = Checkable::check(tx, &pezframe_system::ChainContext::<Runtime>::default())
.expect("Transaction is general so signature is good");
let checked =
Checkable::check(tx, &pezframe_system::ChainContext::<Runtime>::default())
.expect("Transaction is general so signature is good");
checked
.validate::<Runtime>(TransactionSource::External, &info, len)
@@ -498,8 +499,9 @@ fn call_validity() {
let info = tx.get_dispatch_info();
let len = tx.using_encoded(|e| e.len());
let checked = Checkable::check(tx, &pezframe_system::ChainContext::<Runtime>::default())
.expect("Transaction is general so signature is good");
let checked =
Checkable::check(tx, &pezframe_system::ChainContext::<Runtime>::default())
.expect("Transaction is general so signature is good");
let res = checked.validate::<Runtime>(TransactionSource::External, &info, len);
assert_eq!(res, validate_res);
@@ -61,7 +61,8 @@ pub mod pezpallet {
type Balance: Parameter + Default + TypeInfo;
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
}
#[pezpallet::pezpallet]
@@ -97,7 +97,8 @@ pub mod module {
#[pezpallet::config]
pub trait Config: pezframe_system::Config {
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
}
#[pezpallet::call]
@@ -21,8 +21,8 @@ use pezframe_support::{
assert_ok, derive_impl,
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Parameter, Pays},
dispatch_context::with_context,
pezpallet_prelude::{StorageInfoTrait, ValueQuery},
parameter_types,
pezpallet_prelude::{StorageInfoTrait, ValueQuery},
storage::{unhashed, unhashed::contains_prefixed_key},
traits::{
ConstU32, GetCallIndex, GetCallName, GetStorageVersion, OnFinalize, OnGenesis,
@@ -33,7 +33,6 @@ use pezframe_support::{
OrdNoBound, PartialOrdNoBound,
};
use pezframe_system::offchain::{CreateSignedTransaction, CreateTransactionBase, SigningTypes};
use scale_info::{meta_type, TypeInfo};
use pezsp_io::{
hashing::{blake2_128, twox_128, twox_64},
TestExternalities,
@@ -43,6 +42,7 @@ use pezsp_runtime::{
traits::{Block as BlockT, Dispatchable},
DispatchError, ModuleError,
};
use scale_info::{meta_type, TypeInfo};
parameter_types! {
/// Used to control if the storage version should be updated.
@@ -149,7 +149,8 @@ pub mod pezpallet {
type Balance: Parameter + Default + TypeInfo;
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
}
#[pezpallet::extra_constants]
@@ -678,7 +679,8 @@ pub mod pallet2 {
}
}
/// Test that the supertrait check works when we pass some parameter to the `pezframe_system::Config`.
/// Test that the supertrait check works when we pass some parameter to the
/// `pezframe_system::Config`.
#[pezframe_support::pezpallet]
pub mod pallet3 {
#[pezpallet::config]
@@ -704,7 +706,8 @@ pub mod pallet4 {
impl<T: Config> Pezpallet<T> {}
}
/// Test that the supertrait check works when we pass some parameter to the `pezframe_system::Config`.
/// Test that the supertrait check works when we pass some parameter to the
/// `pezframe_system::Config`.
#[pezframe_support::pezpallet]
pub mod pallet5 {
#[pezpallet::config]
@@ -973,7 +976,10 @@ fn error_expand() {
);
assert_eq!(<pezpallet::Error::<Runtime> as PalletError>::MAX_ENCODED_SIZE, 3);
#[cfg(feature = "frame-feature-testing")]
assert_eq!(format!("{:?}", pezpallet::Error::<Runtime>::FeatureTest), String::from("FeatureTest"),);
assert_eq!(
format!("{:?}", pezpallet::Error::<Runtime>::FeatureTest),
String::from("FeatureTest"),
);
}
#[test]
@@ -993,8 +999,9 @@ fn inherent_expand() {
let inherents = InherentData::new().create_extrinsics();
let expected =
vec![UncheckedExtrinsic::new_bare(RuntimeCall::Example(pezpallet::Call::foo_no_post_info {}))];
let expected = vec![UncheckedExtrinsic::new_bare(RuntimeCall::Example(
pezpallet::Call::foo_no_post_info {},
))];
assert_eq!(expected, inherents);
let block = Block::new(
@@ -1006,7 +1013,9 @@ fn inherent_expand() {
Digest::default(),
),
vec![
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pezpallet::Call::foo_no_post_info {})),
UncheckedExtrinsic::new_bare(RuntimeCall::Example(
pezpallet::Call::foo_no_post_info {},
)),
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pezpallet::Call::foo {
foo: 1,
bar: 0,
@@ -1025,7 +1034,9 @@ fn inherent_expand() {
Digest::default(),
),
vec![
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pezpallet::Call::foo_no_post_info {})),
UncheckedExtrinsic::new_bare(RuntimeCall::Example(
pezpallet::Call::foo_no_post_info {},
)),
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pezpallet::Call::foo {
foo: 0,
bar: 0,
@@ -1043,9 +1054,9 @@ fn inherent_expand() {
BlakeTwo256::hash(b"test"),
Digest::default(),
),
vec![UncheckedExtrinsic::new_bare(RuntimeCall::Example(pezpallet::Call::foo_storage_layer {
foo: 0,
}))],
vec![UncheckedExtrinsic::new_bare(RuntimeCall::Example(
pezpallet::Call::foo_storage_layer { foo: 0 },
))],
);
let mut inherent = InherentData::new();
@@ -1081,12 +1092,14 @@ fn validate_unsigned_expand() {
};
let call = pezpallet::Call::<Runtime>::foo_no_post_info {};
let validity = pezpallet::Pezpallet::validate_unsigned(TransactionSource::Local, &call).unwrap_err();
let validity =
pezpallet::Pezpallet::validate_unsigned(TransactionSource::Local, &call).unwrap_err();
assert_eq!(validity, TransactionValidityError::Invalid(InvalidTransaction::Call));
let call = pezpallet::Call::<Runtime>::foo_storage_layer { foo: 0 };
let validity = pezpallet::Pezpallet::validate_unsigned(TransactionSource::External, &call).unwrap();
let validity =
pezpallet::Pezpallet::validate_unsigned(TransactionSource::External, &call).unwrap();
assert_eq!(validity, ValidTransaction::default());
}
@@ -1332,7 +1345,10 @@ fn pezpallet_hooks_expand() {
#[test]
fn pezpallet_on_genesis() {
TestExternalities::default().execute_with(|| {
assert_eq!(pezpallet::Pezpallet::<Runtime>::on_chain_storage_version(), StorageVersion::new(0));
assert_eq!(
pezpallet::Pezpallet::<Runtime>::on_chain_storage_version(),
StorageVersion::new(0)
);
pezpallet::Pezpallet::<Runtime>::on_genesis();
assert_eq!(
pezpallet::Pezpallet::<Runtime>::in_code_storage_version(),
@@ -1346,7 +1362,10 @@ fn migrate_from_pallet_version_to_storage_version() {
const PALLET_VERSION_STORAGE_KEY_POSTFIX: &[u8] = b":__PALLET_VERSION__:";
fn pezpallet_version_key(name: &str) -> [u8; 32] {
pezframe_support::storage::storage_prefix(name.as_bytes(), PALLET_VERSION_STORAGE_KEY_POSTFIX)
pezframe_support::storage::storage_prefix(
name.as_bytes(),
PALLET_VERSION_STORAGE_KEY_POSTFIX,
)
}
TestExternalities::default().execute_with(|| {
@@ -2335,8 +2354,8 @@ fn pezpallet_on_chain_storage_version_initializes_correctly() {
AllPalletsWithSystem,
>;
// Simple example of a pezpallet with in-code version 10 being added to the runtime for the first
// time.
// Simple example of a pezpallet with in-code version 10 being added to the runtime for the
// first time.
TestExternalities::default().execute_with(|| {
let in_code_version = Example::in_code_storage_version();
@@ -2345,8 +2364,8 @@ fn pezpallet_on_chain_storage_version_initializes_correctly() {
let exists = contains_prefixed_key(&pezpallet_hashed_prefix);
assert_eq!(exists, false);
// [`pezframe_support::traits::BeforeAllRuntimeMigrations`] hook should initialize the storage
// version.
// [`pezframe_support::traits::BeforeAllRuntimeMigrations`] hook should initialize the
// storage version.
Executive::execute_on_runtime_upgrade();
// Check that the storage version was initialized to the in-code version
@@ -2533,7 +2552,9 @@ fn test_error_feature_parsing() {
#[test]
fn pezpallet_metadata() {
use pezsp_metadata_ir::{EnumDeprecationInfoIR, ItemDeprecationInfoIR, VariantDeprecationInfoIR};
use pezsp_metadata_ir::{
EnumDeprecationInfoIR, ItemDeprecationInfoIR, VariantDeprecationInfoIR,
};
let pallets = Runtime::metadata_ir().pallets;
let example = pallets[0].clone();
let example2 = pallets[1].clone();
@@ -16,8 +16,8 @@
// limitations under the License.
use pezframe_support::{derive_impl, traits::ConstU32};
use scale_info::meta_type;
use pezsp_metadata_ir::PalletAssociatedTypeMetadataIR;
use scale_info::meta_type;
pub type BlockNumber = u64;
pub type Header = pezsp_runtime::generic::Header<u32, pezsp_runtime::traits::BlakeTwo256>;
@@ -36,7 +36,8 @@ pub mod pezpallet {
pub trait Config: pezframe_system::Config {
// Runtime events already propagated to the metadata.
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
// Constants are already propagated.
#[pezpallet::constant]
@@ -61,7 +62,8 @@ pub mod pallet2 {
pub trait Config: pezframe_system::Config {
// Runtime events already propagated to the metadata.
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
// Constants are already propagated.
#[pezpallet::constant]
@@ -98,7 +100,8 @@ pub mod pallet3 {
pub trait Config: pezframe_system::Config {
// Runtime events already propagated to the metadata.
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
// Constants are already propagated.
#[pezpallet::constant]
@@ -193,7 +196,11 @@ fn associated_types_metadata() {
pretty_assertions::assert_eq!(pezpallet.associated_types, vec![]);
// Collect by default types that implement TypeInfo or Parameter.
let pezpallet = ir.pallets.iter().find(|pezpallet| pezpallet.name == "DefaultInclusion").unwrap();
let pezpallet = ir
.pallets
.iter()
.find(|pezpallet| pezpallet.name == "DefaultInclusion")
.unwrap();
pretty_assertions::assert_eq!(
pezpallet.associated_types,
vec![
@@ -211,7 +218,11 @@ fn associated_types_metadata() {
);
// Explicitly include associated types.
let pezpallet = ir.pallets.iter().find(|pezpallet| pezpallet.name == "ExplicitInclusion").unwrap();
let pezpallet = ir
.pallets
.iter()
.find(|pezpallet| pezpallet.name == "ExplicitInclusion")
.unwrap();
pretty_assertions::assert_eq!(
pezpallet.associated_types,
vec![PalletAssociatedTypeMetadataIR {
@@ -19,8 +19,8 @@ use core::any::TypeId;
use pezframe_support::{
derive_impl,
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Pays},
pezpallet_prelude::ValueQuery,
parameter_types,
pezpallet_prelude::ValueQuery,
storage::unhashed,
traits::{
ConstU32, GetCallName, OnFinalize, OnGenesis, OnInitialize, OnRuntimeUpgrade,
@@ -409,7 +409,10 @@ fn error_expand() {
);
assert_eq!(
format!("{:?}", pezpallet::Error::<Runtime, pezpallet::Instance1>::InsufficientProposersBalance),
format!(
"{:?}",
pezpallet::Error::<Runtime, pezpallet::Instance1>::InsufficientProposersBalance
),
String::from("InsufficientProposersBalance"),
);
assert_eq!(
@@ -613,21 +616,30 @@ fn storage_expand() {
k.extend(1u8.using_encoded(blake2_128_concat));
k.extend(2u16.using_encoded(twox_64_concat));
assert_eq!(unhashed::get::<u32>(&k), Some(3u32));
assert_eq!(&k[..32], &<pezpallet::DoubleMap<Runtime, pezpallet::Instance1>>::final_prefix());
assert_eq!(
&k[..32],
&<pezpallet::DoubleMap<Runtime, pezpallet::Instance1>>::final_prefix()
);
<pezpallet::DoubleMap2<Runtime, pezpallet::Instance1>>::insert(&1, &2, &3);
let mut k = [twox_128(b"Instance1Example"), twox_128(b"DoubleMap2")].concat();
k.extend(1u16.using_encoded(twox_64_concat));
k.extend(2u32.using_encoded(blake2_128_concat));
assert_eq!(unhashed::get::<u64>(&k), Some(3u64));
assert_eq!(&k[..32], &<pezpallet::DoubleMap2<Runtime, pezpallet::Instance1>>::final_prefix());
assert_eq!(
&k[..32],
&<pezpallet::DoubleMap2<Runtime, pezpallet::Instance1>>::final_prefix()
);
<pezpallet::DoubleMap3<Runtime, pezpallet::Instance1>>::insert(&1, &2, &3);
let mut k = [twox_128(b"Instance1Example"), twox_128(b"DoubleMap3")].concat();
k.extend(1u32.using_encoded(blake2_128_concat));
k.extend(2u64.using_encoded(twox_64_concat));
assert_eq!(unhashed::get::<u128>(&k), Some(3u128));
assert_eq!(&k[..32], &<pezpallet::DoubleMap3<Runtime, pezpallet::Instance1>>::final_prefix());
assert_eq!(
&k[..32],
&<pezpallet::DoubleMap3<Runtime, pezpallet::Instance1>>::final_prefix()
);
assert_eq!(
<pezpallet::DoubleMap3<Runtime, pezpallet::Instance1>>::get(2, 3),
Err(pezpallet::Error::<Runtime, pezpallet::Instance1>::NonExistentStorageValue),
@@ -902,14 +914,18 @@ fn metadata() {
],
}),
calls: Some(scale_info::meta_type::<pezpallet::Call<Runtime>>().into()),
event: Some(PalletEventMetadata { ty: scale_info::meta_type::<pezpallet::Event<Runtime>>() }),
event: Some(PalletEventMetadata {
ty: scale_info::meta_type::<pezpallet::Event<Runtime>>(),
}),
constants: vec![PalletConstantMetadata {
name: "MyGetParam",
ty: scale_info::meta_type::<u32>(),
value: vec![10, 0, 0, 0],
docs: vec![],
}],
error: Some(PalletErrorMetadata { ty: scale_info::meta_type::<pezpallet::Error<Runtime>>() }),
error: Some(PalletErrorMetadata {
ty: scale_info::meta_type::<pezpallet::Error<Runtime>>(),
}),
};
let mut example_pallet_instance1_metadata = example_pallet_metadata.clone();
@@ -917,19 +933,22 @@ fn metadata() {
example_pallet_instance1_metadata.index = 2;
match example_pallet_instance1_metadata.calls {
Some(ref mut calls_meta) => {
calls_meta.ty = scale_info::meta_type::<pezpallet::Call<Runtime, pezpallet::Instance1>>();
calls_meta.ty =
scale_info::meta_type::<pezpallet::Call<Runtime, pezpallet::Instance1>>();
},
_ => unreachable!(),
}
match example_pallet_instance1_metadata.event {
Some(ref mut event_meta) => {
event_meta.ty = scale_info::meta_type::<pezpallet::Event<Runtime, pezpallet::Instance1>>();
event_meta.ty =
scale_info::meta_type::<pezpallet::Event<Runtime, pezpallet::Instance1>>();
},
_ => unreachable!(),
}
match example_pallet_instance1_metadata.error {
Some(ref mut error_meta) => {
error_meta.ty = scale_info::meta_type::<pezpallet::Error<Runtime, pezpallet::Instance1>>();
error_meta.ty =
scale_info::meta_type::<pezpallet::Error<Runtime, pezpallet::Instance1>>();
},
_ => unreachable!(),
}
@@ -76,7 +76,7 @@ pezframe_support::construct_runtime!(
#[cfg(feature = "experimental")]
#[test]
fn module_error_outer_enum_expand_explicit() {
use common::outer_enums::{pezpallet, pallet2};
use common::outer_enums::{pallet2, pezpallet};
// The Runtime has *all* parts explicitly defined.
// Check that all error types are propagated
@@ -76,7 +76,7 @@ pezframe_support::construct_runtime!(
#[cfg(feature = "experimental")]
#[test]
fn module_error_outer_enum_expand_implicit() {
use common::outer_enums::{pezpallet, pallet2};
use common::outer_enums::{pallet2, pezpallet};
// The Runtime has *all* parts implicitly defined.
// Check that all error types are propagated
@@ -29,7 +29,6 @@ use pezframe_system::{
limits::{BlockLength, BlockWeights},
DispatchEventInfo,
};
use scale_info::TypeInfo;
use pezsp_core::sr25519;
use pezsp_runtime::{
generic,
@@ -37,6 +36,7 @@ use pezsp_runtime::{
DispatchError, ModuleError,
};
use pezsp_version::RuntimeVersion;
use scale_info::TypeInfo;
parameter_types! {
pub static IntegrityTestExec: u32 = 0;
@@ -102,7 +102,8 @@ mod module2 {
#[pezpallet::config]
pub trait Config: pezframe_system::Config {
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
}
#[pezpallet::hooks]
@@ -238,7 +239,8 @@ pub mod module3 {
#[pezpallet::config]
pub trait Config: pezframe_system::Config {
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
}
#[pezpallet::call]
@@ -624,7 +626,10 @@ fn event_codec() {
#[test]
fn call_codec() {
use codec::Encode;
assert_eq!(RuntimeCall::System(pezframe_system::Call::remark { remark: vec![1] }).encode()[0], 30);
assert_eq!(
RuntimeCall::System(pezframe_system::Call::remark { remark: vec![1] }).encode()[0],
30
);
assert_eq!(RuntimeCall::Module1_1(module1::Call::fail {}).encode()[0], 31);
assert_eq!(RuntimeCall::Module2(module2::Call::fail {}).encode()[0], 32);
assert_eq!(RuntimeCall::Module1_2(module1::Call::fail {}).encode()[0], 33);
@@ -759,9 +764,9 @@ fn test_metadata() {
v14::{StorageEntryType::Plain, *},
*,
};
use scale_info::meta_type;
use pezsp_core::Encode;
use pezsp_metadata_ir::StorageEntryModifierIR::Optional;
use scale_info::meta_type;
fn maybe_docs(doc: Vec<&'static str>) -> Vec<&'static str> {
if cfg!(feature = "no-metadata-docs") {
@@ -29,7 +29,6 @@ use pezframe_system::{
limits::{BlockLength, BlockWeights},
DispatchEventInfo,
};
use scale_info::TypeInfo;
use pezsp_core::sr25519;
use pezsp_runtime::{
generic,
@@ -37,6 +36,7 @@ use pezsp_runtime::{
DispatchError, ModuleError,
};
use pezsp_version::RuntimeVersion;
use scale_info::TypeInfo;
parameter_types! {
pub static IntegrityTestExec: u32 = 0;
@@ -102,7 +102,8 @@ mod module2 {
#[pezpallet::config]
pub trait Config: pezframe_system::Config {
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
}
#[pezpallet::hooks]
@@ -238,7 +239,8 @@ pub mod module3 {
#[pezpallet::config]
pub trait Config: pezframe_system::Config {
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
}
#[pezpallet::call]
@@ -624,7 +626,10 @@ fn event_codec() {
#[test]
fn call_codec() {
use codec::Encode;
assert_eq!(RuntimeCall::System(pezframe_system::Call::remark { remark: vec![1] }).encode()[0], 30);
assert_eq!(
RuntimeCall::System(pezframe_system::Call::remark { remark: vec![1] }).encode()[0],
30
);
assert_eq!(RuntimeCall::Module1_1(module1::Call::fail {}).encode()[0], 31);
assert_eq!(RuntimeCall::Module2(module2::Call::fail {}).encode()[0], 32);
assert_eq!(RuntimeCall::Module1_2(module1::Call::fail {}).encode()[0], 33);
@@ -759,9 +764,9 @@ fn test_metadata() {
v14::{StorageEntryType::Plain, *},
*,
};
use scale_info::meta_type;
use pezsp_core::Encode;
use pezsp_metadata_ir::StorageEntryModifierIR::Optional;
use scale_info::meta_type;
fn maybe_docs(doc: Vec<&'static str>) -> Vec<&'static str> {
if cfg!(feature = "no-metadata-docs") {
@@ -17,12 +17,12 @@
#![allow(useless_deprecated)]
use pezframe_support::{derive_impl, traits::ConstU32};
use scale_info::{form::MetaForm, meta_type};
use pezsp_metadata_ir::{
ItemDeprecationInfoIR, RuntimeApiMetadataIR, RuntimeApiMethodMetadataIR,
RuntimeApiMethodParamMetadataIR,
};
use pezsp_runtime::traits::Block as BlockT;
use scale_info::{form::MetaForm, meta_type};
pub type BlockNumber = u64;
pub type Header = pezsp_runtime::generic::Header<u32, pezsp_runtime::traits::BlakeTwo256>;