mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 20:17:57 +00:00
Replace parameter_types with ConstU32 &c. (#10402)
* remove parameter types and use const type
* remove parameter types and use const type
* Delete {
* Delete count,
* refractor for beefy, benchmarking, child bounties, and collective pallets
* refractor for pallet contracts
* refractor for elections
* refractor for more pallets
* fix CI issues
* fix CI issues
* fix CI issues
* fix CI issues
* remove warning to fix CI issue
* remove warning to fix CI issue
refractor for pallet preimage
* remove warning to fix CI issue
refractor for pallet proxy
* remove warning to fix CI issue
refractor for pallet recovery
refractor for pallet randomness-collective-flip
* remove warning to fix CI issue
refractor for pallet scored-pool
refractor for pallet scheduler
refractor for pallet session
* remove warning to fix CI issue
refractor for pallet society, support, system, timestamp, tips
* remove warning to fix CI issue
refractor for pallet transaction_payment, transaction_storage, treasury, uniques, utility
* remove warning to fix CI issue
* cargo +nightly fmt
* CI fix
* more param refractor on beefy-mmr
* refractor for beefy
* Update frame/babe/src/mock.rs
* Update frame/babe/src/mock.rs
* Update frame/bounties/src/tests.rs
* Update frame/tips/src/tests.rs
* Delete mock.rs
* Update frame/examples/basic/src/tests.rs
* Apply suggestions from code review
* Update frame/im-online/src/mock.rs
* Update frame/im-online/src/mock.rs
* Update frame/offences/benchmarking/src/mock.rs
* Update frame/session/benchmarking/src/mock.rs
* Update frame/support/test/tests/pallet_compatibility.rs
* Update frame/support/test/tests/pallet_compatibility_instance.rs
* Update frame/treasury/src/tests.rs
* Update test-utils/runtime/src/lib.rs
* some cleanup
* fmt
* remove unused
Co-authored-by: Damilare <dakinlose@teamapt.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -1404,6 +1404,7 @@ mod test {
|
||||
use super::*;
|
||||
use crate::{assert_ok, hash::Identity, Twox128};
|
||||
use bounded_vec::BoundedVec;
|
||||
use frame_support::traits::ConstU32;
|
||||
use generator::StorageValue as _;
|
||||
use sp_core::hashing::twox_128;
|
||||
use sp_io::TestExternalities;
|
||||
@@ -1714,22 +1715,17 @@ mod test {
|
||||
});
|
||||
}
|
||||
|
||||
crate::parameter_types! {
|
||||
pub const Seven: u32 = 7;
|
||||
pub const Four: u32 = 4;
|
||||
}
|
||||
|
||||
crate::generate_storage_alias! { Prefix, Foo => Value<WeakBoundedVec<u32, Seven>> }
|
||||
crate::generate_storage_alias! { Prefix, FooMap => Map<(u32, Twox128), BoundedVec<u32, Seven>> }
|
||||
crate::generate_storage_alias! { Prefix, Foo => Value<WeakBoundedVec<u32, ConstU32<7>>> }
|
||||
crate::generate_storage_alias! { Prefix, FooMap => Map<(u32, Twox128), BoundedVec<u32, ConstU32<7>>> }
|
||||
crate::generate_storage_alias! {
|
||||
Prefix,
|
||||
FooDoubleMap => DoubleMap<(u32, Twox128), (u32, Twox128), BoundedVec<u32, Seven>>
|
||||
FooDoubleMap => DoubleMap<(u32, Twox128), (u32, Twox128), BoundedVec<u32, ConstU32<7>>>
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn try_append_works() {
|
||||
TestExternalities::default().execute_with(|| {
|
||||
let bounded: WeakBoundedVec<u32, Seven> = vec![1, 2, 3].try_into().unwrap();
|
||||
let bounded: WeakBoundedVec<u32, ConstU32<7>> = vec![1, 2, 3].try_into().unwrap();
|
||||
Foo::put(bounded);
|
||||
assert_ok!(Foo::try_append(4));
|
||||
assert_ok!(Foo::try_append(5));
|
||||
@@ -1740,7 +1736,7 @@ mod test {
|
||||
});
|
||||
|
||||
TestExternalities::default().execute_with(|| {
|
||||
let bounded: BoundedVec<u32, Seven> = vec![1, 2, 3].try_into().unwrap();
|
||||
let bounded: BoundedVec<u32, ConstU32<7>> = vec![1, 2, 3].try_into().unwrap();
|
||||
FooMap::insert(1, bounded);
|
||||
|
||||
assert_ok!(FooMap::try_append(1, 4));
|
||||
@@ -1755,17 +1751,17 @@ mod test {
|
||||
assert_ok!(FooMap::try_append(2, 4));
|
||||
assert_eq!(
|
||||
FooMap::get(2).unwrap(),
|
||||
BoundedVec::<u32, Seven>::try_from(vec![4]).unwrap(),
|
||||
BoundedVec::<u32, ConstU32<7>>::try_from(vec![4]).unwrap(),
|
||||
);
|
||||
assert_ok!(FooMap::try_append(2, 5));
|
||||
assert_eq!(
|
||||
FooMap::get(2).unwrap(),
|
||||
BoundedVec::<u32, Seven>::try_from(vec![4, 5]).unwrap(),
|
||||
BoundedVec::<u32, ConstU32<7>>::try_from(vec![4, 5]).unwrap(),
|
||||
);
|
||||
});
|
||||
|
||||
TestExternalities::default().execute_with(|| {
|
||||
let bounded: BoundedVec<u32, Seven> = vec![1, 2, 3].try_into().unwrap();
|
||||
let bounded: BoundedVec<u32, ConstU32<7>> = vec![1, 2, 3].try_into().unwrap();
|
||||
FooDoubleMap::insert(1, 1, bounded);
|
||||
|
||||
assert_ok!(FooDoubleMap::try_append(1, 1, 4));
|
||||
@@ -1780,12 +1776,12 @@ mod test {
|
||||
assert_ok!(FooDoubleMap::try_append(2, 1, 4));
|
||||
assert_eq!(
|
||||
FooDoubleMap::get(2, 1).unwrap(),
|
||||
BoundedVec::<u32, Seven>::try_from(vec![4]).unwrap(),
|
||||
BoundedVec::<u32, ConstU32<7>>::try_from(vec![4]).unwrap(),
|
||||
);
|
||||
assert_ok!(FooDoubleMap::try_append(2, 1, 5));
|
||||
assert_eq!(
|
||||
FooDoubleMap::get(2, 1).unwrap(),
|
||||
BoundedVec::<u32, Seven>::try_from(vec![4, 5]).unwrap(),
|
||||
BoundedVec::<u32, ConstU32<7>>::try_from(vec![4, 5]).unwrap(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user