mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 09:51:10 +00:00
Moves Block to frame_system instead of construct_runtime and removes Header and BlockNumber (#14437)
* Initial setup * Adds node block * Uses UncheckedExtrinsic and removes Where section * Updates frame_system to use Block * Adds deprecation warning * Fixes pallet-timestamp * Removes Header and BlockNumber * Addresses review comments * Addresses review comments * Adds comment about compiler bug * Removes where clause * Refactors code * Fixes errors in cargo check * Fixes errors in cargo check * Fixes warnings in cargo check * Formatting * Fixes construct_runtime tests * Uses import instead of full path for BlockNumber * Uses import instead of full path for Header * Formatting * Fixes construct_runtime tests * Fixes imports in benchmarks * Formatting * Fixes construct_runtime tests * Formatting * Minor updates * Fixes construct_runtime ui tests * Fixes construct_runtime ui tests with 1.70 * Fixes docs * Fixes docs * Adds u128 mock block type * Fixes split example * fixes for cumulus * ".git/.scripts/commands/fmt/fmt.sh" * Updates new tests * Fixes fully-qualified path in few places * Formatting * Update frame/examples/default-config/src/lib.rs Co-authored-by: Juan <juangirini@gmail.com> * Update frame/support/procedural/src/construct_runtime/mod.rs Co-authored-by: Juan <juangirini@gmail.com> * ".git/.scripts/commands/fmt/fmt.sh" * Addresses some review comments * Fixes build * ".git/.scripts/commands/fmt/fmt.sh" * Update frame/democracy/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/democracy/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/support/procedural/src/construct_runtime/mod.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/support/procedural/src/construct_runtime/mod.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Addresses review comments * Updates trait bounds * Minor fix * ".git/.scripts/commands/fmt/fmt.sh" * Removes unnecessary bound * ".git/.scripts/commands/fmt/fmt.sh" * Updates test * Fixes build * Adds a bound for header * ".git/.scripts/commands/fmt/fmt.sh" * Removes where block * Minor fix * Minor fix * Fixes tests * ".git/.scripts/commands/update-ui/update-ui.sh" 1.70 * Updates test * Update primitives/runtime/src/traits.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update primitives/runtime/src/traits.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Updates doc * Updates doc --------- Co-authored-by: command-bot <> Co-authored-by: Juan <juangirini@gmail.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -30,7 +30,7 @@ use frame_support::{
|
||||
traits::{EnsureOrigin, Get},
|
||||
BoundedVec,
|
||||
};
|
||||
use frame_system::RawOrigin as SystemOrigin;
|
||||
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin as SystemOrigin};
|
||||
use sp_io::crypto::{sr25519_generate, sr25519_sign};
|
||||
use sp_runtime::{
|
||||
traits::{Bounded, IdentifyAccount, One},
|
||||
@@ -589,7 +589,7 @@ benchmarks_instance_pallet! {
|
||||
let (item, ..) = mint_item::<T, I>(0);
|
||||
let delegate: T::AccountId = account("delegate", 0, SEED);
|
||||
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
|
||||
let deadline = T::BlockNumber::max_value();
|
||||
let deadline = BlockNumberFor::<T>::max_value();
|
||||
}: _(SystemOrigin::Signed(caller.clone()), collection, item, delegate_lookup, Some(deadline))
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::TransferApproved { collection, item, owner: caller, delegate, deadline: Some(deadline) }.into());
|
||||
@@ -601,7 +601,7 @@ benchmarks_instance_pallet! {
|
||||
let delegate: T::AccountId = account("delegate", 0, SEED);
|
||||
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
|
||||
let origin = SystemOrigin::Signed(caller.clone()).into();
|
||||
let deadline = T::BlockNumber::max_value();
|
||||
let deadline = BlockNumberFor::<T>::max_value();
|
||||
Nfts::<T, I>::approve_transfer(origin, collection, item, delegate_lookup.clone(), Some(deadline))?;
|
||||
}: _(SystemOrigin::Signed(caller.clone()), collection, item, delegate_lookup)
|
||||
verify {
|
||||
@@ -614,7 +614,7 @@ benchmarks_instance_pallet! {
|
||||
let delegate: T::AccountId = account("delegate", 0, SEED);
|
||||
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
|
||||
let origin = SystemOrigin::Signed(caller.clone()).into();
|
||||
let deadline = T::BlockNumber::max_value();
|
||||
let deadline = BlockNumberFor::<T>::max_value();
|
||||
Nfts::<T, I>::approve_transfer(origin, collection, item, delegate_lookup.clone(), Some(deadline))?;
|
||||
}: _(SystemOrigin::Signed(caller.clone()), collection, item)
|
||||
verify {
|
||||
|
||||
@@ -24,7 +24,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
collection: T::CollectionId,
|
||||
item: T::ItemId,
|
||||
delegate: T::AccountId,
|
||||
maybe_deadline: Option<<T as SystemConfig>::BlockNumber>,
|
||||
maybe_deadline: Option<frame_system::pallet_prelude::BlockNumberFor<T>>,
|
||||
) -> DispatchResult {
|
||||
ensure!(
|
||||
Self::is_pallet_feature_enabled(PalletFeature::Approvals),
|
||||
|
||||
@@ -29,7 +29,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
desired_collection_id: T::CollectionId,
|
||||
maybe_desired_item_id: Option<T::ItemId>,
|
||||
maybe_price: Option<PriceWithDirection<ItemPrice<T, I>>>,
|
||||
duration: <T as SystemConfig>::BlockNumber,
|
||||
duration: frame_system::pallet_prelude::BlockNumberFor<T>,
|
||||
) -> DispatchResult {
|
||||
ensure!(
|
||||
Self::is_pallet_feature_enabled(PalletFeature::Swaps),
|
||||
|
||||
@@ -61,7 +61,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
collection: T::CollectionId,
|
||||
mint_settings: MintSettings<
|
||||
BalanceOf<T, I>,
|
||||
<T as SystemConfig>::BlockNumber,
|
||||
frame_system::pallet_prelude::BlockNumberFor<T>,
|
||||
T::CollectionId,
|
||||
>,
|
||||
) -> DispatchResult {
|
||||
|
||||
@@ -171,7 +171,7 @@ pub mod pallet {
|
||||
|
||||
/// The max duration in blocks for deadlines.
|
||||
#[pallet::constant]
|
||||
type MaxDeadlineDuration: Get<<Self as SystemConfig>::BlockNumber>;
|
||||
type MaxDeadlineDuration: Get<BlockNumberFor<Self>>;
|
||||
|
||||
/// The max number of attributes a user could set per call.
|
||||
#[pallet::constant]
|
||||
@@ -343,7 +343,7 @@ pub mod pallet {
|
||||
T::CollectionId,
|
||||
T::ItemId,
|
||||
PriceWithDirection<ItemPrice<T, I>>,
|
||||
<T as SystemConfig>::BlockNumber,
|
||||
BlockNumberFor<T>,
|
||||
>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -414,7 +414,7 @@ pub mod pallet {
|
||||
item: T::ItemId,
|
||||
owner: T::AccountId,
|
||||
delegate: T::AccountId,
|
||||
deadline: Option<<T as SystemConfig>::BlockNumber>,
|
||||
deadline: Option<BlockNumberFor<T>>,
|
||||
},
|
||||
/// An approval for a `delegate` account to transfer the `item` of an item
|
||||
/// `collection` was cancelled by its `owner`.
|
||||
@@ -509,7 +509,7 @@ pub mod pallet {
|
||||
desired_collection: T::CollectionId,
|
||||
desired_item: Option<T::ItemId>,
|
||||
price: Option<PriceWithDirection<ItemPrice<T, I>>>,
|
||||
deadline: <T as SystemConfig>::BlockNumber,
|
||||
deadline: BlockNumberFor<T>,
|
||||
},
|
||||
/// The swap was cancelled.
|
||||
SwapCancelled {
|
||||
@@ -518,7 +518,7 @@ pub mod pallet {
|
||||
desired_collection: T::CollectionId,
|
||||
desired_item: Option<T::ItemId>,
|
||||
price: Option<PriceWithDirection<ItemPrice<T, I>>>,
|
||||
deadline: <T as SystemConfig>::BlockNumber,
|
||||
deadline: BlockNumberFor<T>,
|
||||
},
|
||||
/// The swap has been claimed.
|
||||
SwapClaimed {
|
||||
@@ -529,7 +529,7 @@ pub mod pallet {
|
||||
received_item: T::ItemId,
|
||||
received_item_owner: T::AccountId,
|
||||
price: Option<PriceWithDirection<ItemPrice<T, I>>>,
|
||||
deadline: <T as SystemConfig>::BlockNumber,
|
||||
deadline: BlockNumberFor<T>,
|
||||
},
|
||||
/// New attributes have been set for an `item` of the `collection`.
|
||||
PreSignedAttributesSet {
|
||||
@@ -1236,7 +1236,7 @@ pub mod pallet {
|
||||
collection: T::CollectionId,
|
||||
item: T::ItemId,
|
||||
delegate: AccountIdLookupOf<T>,
|
||||
maybe_deadline: Option<<T as SystemConfig>::BlockNumber>,
|
||||
maybe_deadline: Option<BlockNumberFor<T>>,
|
||||
) -> DispatchResult {
|
||||
let maybe_check_origin = T::ForceOrigin::try_origin(origin)
|
||||
.map(|_| None)
|
||||
@@ -1659,11 +1659,7 @@ pub mod pallet {
|
||||
pub fn update_mint_settings(
|
||||
origin: OriginFor<T>,
|
||||
collection: T::CollectionId,
|
||||
mint_settings: MintSettings<
|
||||
BalanceOf<T, I>,
|
||||
<T as SystemConfig>::BlockNumber,
|
||||
T::CollectionId,
|
||||
>,
|
||||
mint_settings: MintSettings<BalanceOf<T, I>, BlockNumberFor<T>, T::CollectionId>,
|
||||
) -> DispatchResult {
|
||||
let maybe_check_origin = T::ForceOrigin::try_origin(origin)
|
||||
.map(|_| None)
|
||||
@@ -1759,7 +1755,7 @@ pub mod pallet {
|
||||
desired_collection: T::CollectionId,
|
||||
maybe_desired_item: Option<T::ItemId>,
|
||||
maybe_price: Option<PriceWithDirection<ItemPrice<T, I>>>,
|
||||
duration: <T as SystemConfig>::BlockNumber,
|
||||
duration: BlockNumberFor<T>,
|
||||
) -> DispatchResult {
|
||||
let origin = ensure_signed(origin)?;
|
||||
Self::do_create_swap(
|
||||
|
||||
@@ -27,19 +27,14 @@ use frame_support::{
|
||||
use sp_core::H256;
|
||||
use sp_keystore::{testing::MemoryKeystore, KeystoreExt};
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify},
|
||||
BuildStorage, MultiSignature,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
type Block = frame_system::mocking::MockBlock<Test>;
|
||||
|
||||
construct_runtime!(
|
||||
pub enum Test where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
pub enum Test
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
@@ -58,12 +53,11 @@ impl frame_system::Config for Test {
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
type Hashing = BlakeTwo256;
|
||||
type AccountId = AccountId;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU64<250>;
|
||||
type DbWeight = ();
|
||||
|
||||
@@ -26,6 +26,7 @@ use frame_support::{
|
||||
traits::Get,
|
||||
BoundedBTreeMap, BoundedBTreeSet,
|
||||
};
|
||||
use frame_system::pallet_prelude::BlockNumberFor;
|
||||
use scale_info::{build::Fields, meta_type, Path, Type, TypeInfo, TypeParameter};
|
||||
|
||||
pub(super) type DepositBalanceOf<T, I = ()> =
|
||||
@@ -34,7 +35,7 @@ pub(super) type CollectionDetailsFor<T, I> =
|
||||
CollectionDetails<<T as SystemConfig>::AccountId, DepositBalanceOf<T, I>>;
|
||||
pub(super) type ApprovalsOf<T, I = ()> = BoundedBTreeMap<
|
||||
<T as SystemConfig>::AccountId,
|
||||
Option<<T as SystemConfig>::BlockNumber>,
|
||||
Option<BlockNumberFor<T>>,
|
||||
<T as Config<I>>::ApprovalsLimit,
|
||||
>;
|
||||
pub(super) type ItemAttributesApprovals<T, I = ()> =
|
||||
@@ -56,23 +57,20 @@ pub(super) type ItemTipOf<T, I = ()> = ItemTip<
|
||||
<T as SystemConfig>::AccountId,
|
||||
BalanceOf<T, I>,
|
||||
>;
|
||||
pub(super) type CollectionConfigFor<T, I = ()> = CollectionConfig<
|
||||
BalanceOf<T, I>,
|
||||
<T as SystemConfig>::BlockNumber,
|
||||
<T as Config<I>>::CollectionId,
|
||||
>;
|
||||
pub(super) type CollectionConfigFor<T, I = ()> =
|
||||
CollectionConfig<BalanceOf<T, I>, BlockNumberFor<T>, <T as Config<I>>::CollectionId>;
|
||||
pub(super) type PreSignedMintOf<T, I = ()> = PreSignedMint<
|
||||
<T as Config<I>>::CollectionId,
|
||||
<T as Config<I>>::ItemId,
|
||||
<T as SystemConfig>::AccountId,
|
||||
<T as SystemConfig>::BlockNumber,
|
||||
BlockNumberFor<T>,
|
||||
BalanceOf<T, I>,
|
||||
>;
|
||||
pub(super) type PreSignedAttributesOf<T, I = ()> = PreSignedAttributes<
|
||||
<T as Config<I>>::CollectionId,
|
||||
<T as Config<I>>::ItemId,
|
||||
<T as SystemConfig>::AccountId,
|
||||
<T as SystemConfig>::BlockNumber,
|
||||
BlockNumberFor<T>,
|
||||
>;
|
||||
|
||||
/// Information about a collection.
|
||||
|
||||
Reference in New Issue
Block a user