diff --git a/polkadot/runtime/common/src/claims/mod.rs b/polkadot/runtime/common/src/claims/mod.rs index f48e40ee188789f91733cab5f6486fcc94760461..9e084688b4e558ec3917e6651e2a15204adaa4cd 100644 --- a/polkadot/runtime/common/src/claims/mod.rs +++ b/polkadot/runtime/common/src/claims/mod.rs @@ -130,7 +130,7 @@ impl Default for StatementKind { #[derive( Clone, Copy, PartialEq, Eq, Encode, Decode, Default, RuntimeDebug, TypeInfo, MaxEncodedLen, )] -pub struct EthereumAddress([u8; 20]); +pub struct EthereumAddress(pub [u8; 20]); impl Serialize for EthereumAddress { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> @@ -239,11 +239,11 @@ pub mod pallet { /// The statement kind that must be signed, if any. #[pallet::storage] - pub(super) type Signing<T> = StorageMap<_, Identity, EthereumAddress, StatementKind>; + pub type Signing<T> = StorageMap<_, Identity, EthereumAddress, StatementKind>; /// Pre-claimed Ethereum accounts, by the Account ID that they are claimed to. #[pallet::storage] - pub(super) type Preclaims<T: Config> = StorageMap<_, Identity, T::AccountId, EthereumAddress>; + pub type Preclaims<T: Config> = StorageMap<_, Identity, T::AccountId, EthereumAddress>; #[pallet::genesis_config] #[derive(DefaultNoBound)] diff --git a/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs b/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs index fc650ae55a785b08ab609feb07337d099231904c..38530fd3f5aa5c7346b4158593ffd72df1e13b39 100644 --- a/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs +++ b/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs @@ -160,13 +160,13 @@ pub mod mock_msg_queue { type XcmExecutor: ExecuteXcm<Self::RuntimeCall>; } - #[pallet::call] - impl<T: Config> Pallet<T> {} - #[pallet::pallet] #[pallet::without_storage_info] pub struct Pallet<T>(_); + #[pallet::call] + impl<T: Config> Pallet<T> {} + #[pallet::storage] #[pallet::getter(fn parachain_id)] pub(super) type ParachainId<T: Config> = StorageValue<_, ParaId, ValueQuery>; diff --git a/prdoc/pr_7579.prdoc b/prdoc/pr_7579.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..3f7cbda6492935f3c92cffbbbead8575b172831f --- /dev/null +++ b/prdoc/pr_7579.prdoc @@ -0,0 +1,57 @@ +title: '[AHM] Make pallet types public' +doc: +- audience: Runtime Dev + description: Preparation for AHM and making stuff public. +crates: +- name: cumulus-pallet-dmp-queue + bump: minor +- name: cumulus-pallet-xcm + bump: minor +- name: polkadot-runtime-common + bump: minor +- name: polkadot-runtime-parachains + bump: minor +- name: pallet-bags-list + bump: minor +- name: pallet-conviction-voting + bump: minor +- name: pallet-fast-unstake + bump: minor +- name: pallet-multisig + bump: minor +- name: pallet-nomination-pools + bump: minor +- name: pallet-preimage + bump: minor +- name: pallet-scheduler + bump: minor +- name: pallet-vesting + bump: minor +- name: staging-parachain-info + bump: minor +- name: xcm-simulator + bump: minor +- name: pallet-asset-conversion + bump: minor +- name: pallet-assets-freezer + bump: minor +- name: pallet-assets + bump: minor +- name: pallet-authority-discovery + bump: minor +- name: pallet-core-fellowship + bump: minor +- name: pallet-delegated-staking + bump: minor +- name: pallet-example-view-functions + bump: minor +- name: pallet-salary + bump: minor +- name: pallet-society + bump: minor +- name: frame-support + bump: minor +- name: pallet-treasury + bump: minor +- name: pallet-uniques + bump: minor diff --git a/substrate/frame/asset-conversion/src/types.rs b/substrate/frame/asset-conversion/src/types.rs index 27c0e8e68805ea7716ed7371aeed532be906fa47..1fc989e71675dac378a9b8d9dfd0ffbb759003e3 100644 --- a/substrate/frame/asset-conversion/src/types.rs +++ b/substrate/frame/asset-conversion/src/types.rs @@ -29,7 +29,7 @@ use sp_runtime::traits::TryConvert; /// 1. `asset(asset1, amount_in)` take from `user` and move to the pool(asset1, asset2); /// 2. `asset(asset2, amount_out2)` transfer from pool(asset1, asset2) to pool(asset2, asset3); /// 3. `asset(asset3, amount_out3)` move from pool(asset2, asset3) to `user`. -pub(super) type BalancePath<T> = Vec<(<T as Config>::AssetKind, <T as Config>::Balance)>; +pub type BalancePath<T> = Vec<(<T as Config>::AssetKind, <T as Config>::Balance)>; /// Credit of [Config::Assets]. pub type CreditOf<T> = Credit<<T as frame_system::Config>::AccountId, <T as Config>::Assets>; diff --git a/substrate/frame/assets-freezer/src/lib.rs b/substrate/frame/assets-freezer/src/lib.rs index 61a695a6f5b8111b7f9eb06927655c84e2ef1713..e298658f16dbc5e0c004b773f4aed9e08acc36c5 100644 --- a/substrate/frame/assets-freezer/src/lib.rs +++ b/substrate/frame/assets-freezer/src/lib.rs @@ -105,7 +105,7 @@ pub mod pallet { /// A map that stores freezes applied on an account for a given AssetId. #[pallet::storage] - pub(super) type Freezes<T: Config<I>, I: 'static = ()> = StorageDoubleMap< + pub type Freezes<T: Config<I>, I: 'static = ()> = StorageDoubleMap< _, Blake2_128Concat, T::AssetId, @@ -120,7 +120,7 @@ pub mod pallet { /// A map that stores the current total frozen balance for every account on a given AssetId. #[pallet::storage] - pub(super) type FrozenBalances<T: Config<I>, I: 'static = ()> = StorageDoubleMap< + pub type FrozenBalances<T: Config<I>, I: 'static = ()> = StorageDoubleMap< _, Blake2_128Concat, T::AssetId, diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index 9ea346c4cf3fde31c26fa5e940618ce473b693ee..6e946d610e07365f9225f339c80fd9d7fa5d9ecf 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -419,7 +419,7 @@ pub mod pallet { #[pallet::storage] /// Details of an asset. - pub(super) type Asset<T: Config<I>, I: 'static = ()> = StorageMap< + pub type Asset<T: Config<I>, I: 'static = ()> = StorageMap< _, Blake2_128Concat, T::AssetId, @@ -428,7 +428,7 @@ pub mod pallet { #[pallet::storage] /// The holdings of a specific account for a specific asset. - pub(super) type Account<T: Config<I>, I: 'static = ()> = StorageDoubleMap< + pub type Account<T: Config<I>, I: 'static = ()> = StorageDoubleMap< _, Blake2_128Concat, T::AssetId, @@ -441,7 +441,7 @@ pub mod pallet { /// Approved balance transfers. First balance is the amount approved for transfer. Second /// is the amount of `T::Currency` reserved for storing this. /// First key is the asset ID, second key is the owner and third key is the delegate. - pub(super) type Approvals<T: Config<I>, I: 'static = ()> = StorageNMap< + pub type Approvals<T: Config<I>, I: 'static = ()> = StorageNMap< _, ( NMapKey<Blake2_128Concat, T::AssetId>, @@ -453,7 +453,7 @@ pub mod pallet { #[pallet::storage] /// Metadata of an asset. - pub(super) type Metadata<T: Config<I>, I: 'static = ()> = StorageMap< + pub type Metadata<T: Config<I>, I: 'static = ()> = StorageMap< _, Blake2_128Concat, T::AssetId, diff --git a/substrate/frame/assets/src/types.rs b/substrate/frame/assets/src/types.rs index 9a60a13f5a71c993d460666f860d8e64731267a3..baa530565bceae25ba7f8fbb39b9456a963e8cd2 100644 --- a/substrate/frame/assets/src/types.rs +++ b/substrate/frame/assets/src/types.rs @@ -24,21 +24,21 @@ use frame_support::{ }; use sp_runtime::{traits::Convert, FixedPointNumber, FixedU128}; -pub(super) type DepositBalanceOf<T, I = ()> = +pub type DepositBalanceOf<T, I = ()> = <<T as Config<I>>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance; -pub(super) type AssetAccountOf<T, I> = AssetAccount< +pub type AssetAccountOf<T, I> = AssetAccount< <T as Config<I>>::Balance, DepositBalanceOf<T, I>, <T as Config<I>>::Extra, <T as SystemConfig>::AccountId, >; -pub(super) type ExistenceReasonOf<T, I> = +pub type ExistenceReasonOf<T, I> = ExistenceReason<DepositBalanceOf<T, I>, <T as SystemConfig>::AccountId>; /// AssetStatus holds the current state of the asset. It could either be Live and available for use, /// or in a Destroying state. #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] -pub(super) enum AssetStatus { +pub enum AssetStatus { /// The asset is active and able to be used. Live, /// Whether the asset is frozen for non-admin transfers. @@ -51,30 +51,30 @@ pub(super) enum AssetStatus { #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] pub struct AssetDetails<Balance, AccountId, DepositBalance> { /// Can change `owner`, `issuer`, `freezer` and `admin` accounts. - pub(super) owner: AccountId, + pub owner: AccountId, /// Can mint tokens. - pub(super) issuer: AccountId, + pub issuer: AccountId, /// Can thaw tokens, force transfers and burn tokens from any account. - pub(super) admin: AccountId, + pub admin: AccountId, /// Can freeze tokens. - pub(super) freezer: AccountId, + pub freezer: AccountId, /// The total supply across all accounts. - pub(super) supply: Balance, + pub supply: Balance, /// The balance deposited for this asset. This pays for the data stored here. - pub(super) deposit: DepositBalance, + pub deposit: DepositBalance, /// The ED for virtual accounts. - pub(super) min_balance: Balance, + pub min_balance: Balance, /// If `true`, then any account with this asset is given a provider reference. Otherwise, it /// requires a consumer reference. - pub(super) is_sufficient: bool, + pub is_sufficient: bool, /// The total number of accounts. - pub(super) accounts: u32, + pub accounts: u32, /// The total number of accounts for which we have placed a self-sufficient reference. - pub(super) sufficients: u32, + pub sufficients: u32, /// The total number of approvals. - pub(super) approvals: u32, + pub approvals: u32, /// The status of the asset - pub(super) status: AssetStatus, + pub status: AssetStatus, } /// Data concerning an approval. @@ -82,9 +82,9 @@ pub struct AssetDetails<Balance, AccountId, DepositBalance> { pub struct Approval<Balance, DepositBalance> { /// The amount of funds approved for the balance transfer from the owner to some delegated /// target. - pub(super) amount: Balance, + pub amount: Balance, /// The amount reserved on the owner's account to hold this item in storage. - pub(super) deposit: DepositBalance, + pub deposit: DepositBalance, } #[test] @@ -118,7 +118,7 @@ impl<Balance, AccountId> ExistenceReason<Balance, AccountId> where AccountId: Clone, { - pub(crate) fn take_deposit(&mut self) -> Option<Balance> { + pub fn take_deposit(&mut self) -> Option<Balance> { if !matches!(self, ExistenceReason::DepositHeld(_)) { return None } @@ -131,7 +131,7 @@ where } } - pub(crate) fn take_deposit_from(&mut self) -> Option<(AccountId, Balance)> { + pub fn take_deposit_from(&mut self) -> Option<(AccountId, Balance)> { if !matches!(self, ExistenceReason::DepositFrom(..)) { return None } @@ -163,11 +163,11 @@ pub enum AccountStatus { } impl AccountStatus { /// Returns `true` if frozen or blocked. - pub(crate) fn is_frozen(&self) -> bool { + pub fn is_frozen(&self) -> bool { matches!(self, AccountStatus::Frozen | AccountStatus::Blocked) } /// Returns `true` if blocked. - pub(crate) fn is_blocked(&self) -> bool { + pub fn is_blocked(&self) -> bool { matches!(self, AccountStatus::Blocked) } } @@ -178,13 +178,13 @@ pub struct AssetAccount<Balance, DepositBalance, Extra, AccountId> { /// /// The part of the `balance` may be frozen by the [`Config::Freezer`]. The on-hold portion is /// not included here and is tracked by the [`Config::Holder`]. - pub(super) balance: Balance, + pub balance: Balance, /// The status of the account. - pub(super) status: AccountStatus, + pub status: AccountStatus, /// The reason for the existence of the account. - pub(super) reason: ExistenceReason<DepositBalance, AccountId>, + pub reason: ExistenceReason<DepositBalance, AccountId>, /// Additional "sidecar" data, in case some other pallet wants to use this storage item. - pub(super) extra: Extra, + pub extra: Extra, } #[derive(Clone, Encode, Decode, Eq, PartialEq, Default, RuntimeDebug, MaxEncodedLen, TypeInfo)] @@ -192,15 +192,15 @@ pub struct AssetMetadata<DepositBalance, BoundedString> { /// The balance deposited for this metadata. /// /// This pays for the data stored in this struct. - pub(super) deposit: DepositBalance, + pub deposit: DepositBalance, /// The user friendly name of this asset. Limited in length by `StringLimit`. - pub(super) name: BoundedString, + pub name: BoundedString, /// The ticker symbol for this asset. Limited in length by `StringLimit`. - pub(super) symbol: BoundedString, + pub symbol: BoundedString, /// The number of decimals this asset uses to represent one unit. - pub(super) decimals: u8, + pub decimals: u8, /// Whether the asset metadata may be changed by a non Force origin. - pub(super) is_frozen: bool, + pub is_frozen: bool, } /// Trait for allowing a minimum balance on the account to be specified, beyond the @@ -275,28 +275,28 @@ impl<AssetId, AccountId, Balance> BalanceOnHold<AssetId, AccountId, Balance> for } #[derive(Copy, Clone, PartialEq, Eq)] -pub(super) struct TransferFlags { +pub struct TransferFlags { /// The debited account must stay alive at the end of the operation; an error is returned if /// this cannot be achieved legally. - pub(super) keep_alive: bool, + pub keep_alive: bool, /// Less than the amount specified needs be debited by the operation for it to be considered /// successful. If `false`, then the amount debited will always be at least the amount /// specified. - pub(super) best_effort: bool, + pub best_effort: bool, /// Any additional funds debited (due to minimum balance requirements) should be burned rather /// than credited to the destination account. - pub(super) burn_dust: bool, + pub burn_dust: bool, } #[derive(Copy, Clone, PartialEq, Eq)] -pub(super) struct DebitFlags { +pub struct DebitFlags { /// The debited account must stay alive at the end of the operation; an error is returned if /// this cannot be achieved legally. - pub(super) keep_alive: bool, + pub keep_alive: bool, /// Less than the amount specified needs be debited by the operation for it to be considered /// successful. If `false`, then the amount debited will always be at least the amount /// specified. - pub(super) best_effort: bool, + pub best_effort: bool, } impl From<TransferFlags> for DebitFlags { diff --git a/substrate/frame/authority-discovery/src/lib.rs b/substrate/frame/authority-discovery/src/lib.rs index 220b39292b57598cdc1def77baef6874d7165c95..f8039b8b9137c3fb68163eada497be88ce485b4d 100644 --- a/substrate/frame/authority-discovery/src/lib.rs +++ b/substrate/frame/authority-discovery/src/lib.rs @@ -51,12 +51,12 @@ pub mod pallet { #[pallet::storage] /// Keys of the current authority set. - pub(super) type Keys<T: Config> = + pub type Keys<T: Config> = StorageValue<_, WeakBoundedVec<AuthorityId, T::MaxAuthorities>, ValueQuery>; #[pallet::storage] /// Keys of the next authority set. - pub(super) type NextKeys<T: Config> = + pub type NextKeys<T: Config> = StorageValue<_, WeakBoundedVec<AuthorityId, T::MaxAuthorities>, ValueQuery>; #[derive(frame_support::DefaultNoBound)] diff --git a/substrate/frame/bags-list/src/lib.rs b/substrate/frame/bags-list/src/lib.rs index ae65cc0783c93aa58330bb75298d819b6b81d7b5..606b07b6e7b6f302b013cf2a9a9ec8738208e0b9 100644 --- a/substrate/frame/bags-list/src/lib.rs +++ b/substrate/frame/bags-list/src/lib.rs @@ -253,14 +253,14 @@ pub mod pallet { /// /// Nodes store links forward and back within their respective bags. #[pallet::storage] - pub(crate) type ListNodes<T: Config<I>, I: 'static = ()> = + pub type ListNodes<T: Config<I>, I: 'static = ()> = CountedStorageMap<_, Twox64Concat, T::AccountId, list::Node<T, I>>; /// A bag stored in storage. /// /// Stores a `Bag` struct, which stores head and tail pointers to itself. #[pallet::storage] - pub(crate) type ListBags<T: Config<I>, I: 'static = ()> = + pub type ListBags<T: Config<I>, I: 'static = ()> = StorageMap<_, Twox64Concat, T::Score, list::Bag<T, I>>; #[pallet::event] @@ -273,7 +273,6 @@ pub mod pallet { } #[pallet::error] - #[cfg_attr(test, derive(PartialEq))] pub enum Error<T, I = ()> { /// A error in the list interface implementation. List(ListError), diff --git a/substrate/frame/bags-list/src/list/mod.rs b/substrate/frame/bags-list/src/list/mod.rs index 6b0d1afcd8b2891a39fad53f91562e455c7d01a0..6bcc8efbd5d4a941ec6b25c36ac73d0d94d2fdd0 100644 --- a/substrate/frame/bags-list/src/list/mod.rs +++ b/substrate/frame/bags-list/src/list/mod.rs @@ -35,7 +35,7 @@ use frame_election_provider_support::ScoreProvider; use frame_support::{ defensive, ensure, traits::{Defensive, DefensiveOption, Get}, - DefaultNoBound, PalletError, + CloneNoBound, DefaultNoBound, EqNoBound, PalletError, PartialEqNoBound, RuntimeDebugNoBound, }; use scale_info::TypeInfo; use sp_runtime::traits::{Bounded, Zero}; @@ -622,18 +622,27 @@ impl<T: Config<I>, I: 'static> List<T, I> { /// desirable to ensure that there is some element of first-come, first-serve to the list's /// iteration so that there's no incentive to churn ids positioning to improve the chances of /// appearing within the ids set. -#[derive(DefaultNoBound, Encode, Decode, MaxEncodedLen, TypeInfo)] +#[derive( + DefaultNoBound, + Encode, + Decode, + MaxEncodedLen, + TypeInfo, + RuntimeDebugNoBound, + CloneNoBound, + PartialEqNoBound, + EqNoBound, +)] #[codec(mel_bound())] #[scale_info(skip_type_params(T, I))] -#[cfg_attr(feature = "std", derive(frame_support::DebugNoBound, Clone, PartialEq))] pub struct Bag<T: Config<I>, I: 'static = ()> { - head: Option<T::AccountId>, - tail: Option<T::AccountId>, + pub head: Option<T::AccountId>, + pub tail: Option<T::AccountId>, #[codec(skip)] - bag_upper: T::Score, + pub bag_upper: T::Score, #[codec(skip)] - _phantom: PhantomData<I>, + pub _phantom: PhantomData<I>, } impl<T: Config<I>, I: 'static> Bag<T, I> { @@ -822,18 +831,26 @@ impl<T: Config<I>, I: 'static> Bag<T, I> { } /// A Node is the fundamental element comprising the doubly-linked list described by `Bag`. -#[derive(Encode, Decode, MaxEncodedLen, TypeInfo)] +#[derive( + Encode, + Decode, + MaxEncodedLen, + TypeInfo, + CloneNoBound, + PartialEqNoBound, + EqNoBound, + RuntimeDebugNoBound, +)] #[codec(mel_bound())] #[scale_info(skip_type_params(T, I))] -#[cfg_attr(feature = "std", derive(frame_support::DebugNoBound, Clone, PartialEq))] pub struct Node<T: Config<I>, I: 'static = ()> { - pub(crate) id: T::AccountId, - pub(crate) prev: Option<T::AccountId>, - pub(crate) next: Option<T::AccountId>, - pub(crate) bag_upper: T::Score, - pub(crate) score: T::Score, + pub id: T::AccountId, + pub prev: Option<T::AccountId>, + pub next: Option<T::AccountId>, + pub bag_upper: T::Score, + pub score: T::Score, #[codec(skip)] - pub(crate) _phantom: PhantomData<I>, + pub _phantom: PhantomData<I>, } impl<T: Config<I>, I: 'static> Node<T, I> { diff --git a/substrate/frame/conviction-voting/src/lib.rs b/substrate/frame/conviction-voting/src/lib.rs index 3dd2ad24298d344d4122933546406fd3dc8c9fb9..fda97281f16bd64f941d9314a83032f02f22b173 100644 --- a/substrate/frame/conviction-voting/src/lib.rs +++ b/substrate/frame/conviction-voting/src/lib.rs @@ -68,9 +68,9 @@ pub type BlockNumberFor<T, I> = <<T as Config<I>>::BlockNumberProvider as BlockNumberProvider>::BlockNumber; type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source; -type BalanceOf<T, I = ()> = +pub type BalanceOf<T, I = ()> = <<T as Config<I>>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance; -type VotingOf<T, I = ()> = Voting< +pub type VotingOf<T, I = ()> = Voting< BalanceOf<T, I>, <T as frame_system::Config>::AccountId, BlockNumberFor<T, I>, @@ -82,10 +82,10 @@ type DelegatingOf<T, I = ()> = Delegating<BalanceOf<T, I>, <T as frame_system::Config>::AccountId, BlockNumberFor<T, I>>; pub type TallyOf<T, I = ()> = Tally<BalanceOf<T, I>, <T as Config<I>>::MaxTurnout>; pub type VotesOf<T, I = ()> = BalanceOf<T, I>; -type PollIndexOf<T, I = ()> = <<T as Config<I>>::Polls as Polling<TallyOf<T, I>>>::Index; +pub type PollIndexOf<T, I = ()> = <<T as Config<I>>::Polls as Polling<TallyOf<T, I>>>::Index; #[cfg(feature = "runtime-benchmarks")] -type IndexOf<T, I = ()> = <<T as Config<I>>::Polls as Polling<TallyOf<T, I>>>::Index; -type ClassOf<T, I = ()> = <<T as Config<I>>::Polls as Polling<TallyOf<T, I>>>::Class; +pub type IndexOf<T, I = ()> = <<T as Config<I>>::Polls as Polling<TallyOf<T, I>>>::Index; +pub type ClassOf<T, I = ()> = <<T as Config<I>>::Polls as Polling<TallyOf<T, I>>>::Class; #[frame_support::pallet] pub mod pallet { diff --git a/substrate/frame/core-fellowship/src/lib.rs b/substrate/frame/core-fellowship/src/lib.rs index 22ba63b26161d45efea8189e60d24bf0cbb9e04b..77ea937eac7a9519ef50971fa38cbbcb41bde6fe 100644 --- a/substrate/frame/core-fellowship/src/lib.rs +++ b/substrate/frame/core-fellowship/src/lib.rs @@ -241,17 +241,16 @@ pub mod pallet { /// The overall status of the system. #[pallet::storage] - pub(super) type Params<T: Config<I>, I: 'static = ()> = - StorageValue<_, ParamsOf<T, I>, ValueQuery>; + pub type Params<T: Config<I>, I: 'static = ()> = StorageValue<_, ParamsOf<T, I>, ValueQuery>; /// The status of a claimant. #[pallet::storage] - pub(super) type Member<T: Config<I>, I: 'static = ()> = + pub type Member<T: Config<I>, I: 'static = ()> = StorageMap<_, Twox64Concat, T::AccountId, MemberStatusOf<T>, OptionQuery>; /// Some evidence together with the desired outcome for which it was presented. #[pallet::storage] - pub(super) type MemberEvidence<T: Config<I>, I: 'static = ()> = + pub type MemberEvidence<T: Config<I>, I: 'static = ()> = StorageMap<_, Twox64Concat, T::AccountId, (Wish, Evidence<T, I>), OptionQuery>; #[pallet::event] diff --git a/substrate/frame/delegated-staking/src/lib.rs b/substrate/frame/delegated-staking/src/lib.rs index 0dacfe9c55792f53e07fe708323ed6e0f8d5c784..fadc8d290d6f9e7ff05e718b57e0bdaa5e685e4a 100644 --- a/substrate/frame/delegated-staking/src/lib.rs +++ b/substrate/frame/delegated-staking/src/lib.rs @@ -273,12 +273,12 @@ pub mod pallet { /// Implementation note: We are not using a double map with `delegator` and `agent` account /// as keys since we want to restrict delegators to delegate only to one account at a time. #[pallet::storage] - pub(crate) type Delegators<T: Config> = + pub type Delegators<T: Config> = CountedStorageMap<_, Twox64Concat, T::AccountId, Delegation<T>, OptionQuery>; /// Map of `Agent` to their `Ledger`. #[pallet::storage] - pub(crate) type Agents<T: Config> = + pub type Agents<T: Config> = CountedStorageMap<_, Twox64Concat, T::AccountId, AgentLedger<T>, OptionQuery>; // This pallet is not currently written with the intention of exposing any calls. But the diff --git a/substrate/frame/fast-unstake/src/types.rs b/substrate/frame/fast-unstake/src/types.rs index 2a2319ef61296a5781b9ff752d45da1aa7c4cbf6..518840a16a30367974d7ce4a85712081bb57dc83 100644 --- a/substrate/frame/fast-unstake/src/types.rs +++ b/substrate/frame/fast-unstake/src/types.rs @@ -20,7 +20,7 @@ use crate::Config; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ - traits::Currency, BoundedVec, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound, + traits::Currency, BoundedVec, CloneNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound, }; use scale_info::TypeInfo; use sp_staking::{EraIndex, StakingInterface}; @@ -39,14 +39,21 @@ impl<T: Config> frame_support::traits::Get<u32> for MaxChecking<T> { } #[docify::export] -pub(crate) type BalanceOf<T> = +pub type BalanceOf<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance; /// An unstake request. /// /// This is stored in [`crate::Head`] storage item and points to the current unstake request that is /// being processed. #[derive( - Encode, Decode, EqNoBound, PartialEqNoBound, Clone, TypeInfo, RuntimeDebugNoBound, MaxEncodedLen, + Encode, + Decode, + EqNoBound, + PartialEqNoBound, + CloneNoBound, + TypeInfo, + RuntimeDebugNoBound, + MaxEncodedLen, )] #[scale_info(skip_type_params(T))] pub struct UnstakeRequest<T: Config> { diff --git a/substrate/frame/multisig/src/lib.rs b/substrate/frame/multisig/src/lib.rs index 869b4adc2adcea00c274711c4f5dee1228eaca70..2da5ab9c337f0dd7ca75ff8635a1077ae745e852 100644 --- a/substrate/frame/multisig/src/lib.rs +++ b/substrate/frame/multisig/src/lib.rs @@ -74,7 +74,7 @@ macro_rules! log { }; } -type BalanceOf<T> = +pub type BalanceOf<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance; pub type BlockNumberFor<T> = @@ -88,9 +88,9 @@ pub type BlockNumberFor<T> = )] pub struct Timepoint<BlockNumber> { /// The height of the chain at the point in time. - height: BlockNumber, + pub height: BlockNumber, /// The index of the extrinsic at the point in time. - index: u32, + pub index: u32, } /// An open multisig operation. @@ -101,13 +101,13 @@ where MaxApprovals: Get<u32>, { /// The extrinsic when the multisig operation was opened. - when: Timepoint<BlockNumber>, + pub when: Timepoint<BlockNumber>, /// The amount held in reserve of the `depositor`, to be returned once the operation ends. - deposit: Balance, + pub deposit: Balance, /// The account who opened it (i.e. the first to approve it). - depositor: AccountId, + pub depositor: AccountId, /// The approvals achieved so far, including the depositor. Always sorted. - approvals: BoundedVec<AccountId, MaxApprovals>, + pub approvals: BoundedVec<AccountId, MaxApprovals>, } type CallHash = [u8; 32]; @@ -157,7 +157,28 @@ pub mod pallet { /// Weight information for extrinsics in this pallet. type WeightInfo: weights::WeightInfo; - /// Provider for the block number. Normally this is the `frame_system` pallet. + /// Query the current block number. + /// + /// Must return monotonically increasing values when called from consecutive blocks. + /// Can be configured to return either: + /// - the local block number of the runtime via `frame_system::Pallet` + /// - a remote block number, eg from the relay chain through `RelaychainDataProvider` + /// - an arbitrary value through a custom implementation of the trait + /// + /// There is currently no migration provided to "hot-swap" block number providers and it may + /// result in undefined behavior when doing so. Parachains are therefore best off setting + /// this to their local block number provider if they have the pallet already deployed. + /// + /// Suggested values: + /// - Solo- and Relay-chains: `frame_system::Pallet` + /// - Parachains that may produce blocks sparingly or only when needed (on-demand): + /// - already have the pallet deployed: `frame_system::Pallet` + /// - are freshly deploying this pallet: `RelaychainDataProvider` + /// - Parachains with a reliably block production rate (PLO or bulk-coretime): + /// - already have the pallet deployed: `frame_system::Pallet` + /// - are freshly deploying this pallet: no strong recommendation. Both local and remote + /// providers can be used. Relay provider can be a bit better in cases where the + /// parachain is lagging its block production to avoid clock skew. type BlockNumberProvider: BlockNumberProvider; } diff --git a/substrate/frame/nomination-pools/src/lib.rs b/substrate/frame/nomination-pools/src/lib.rs index b45861289a561f2ec33b6f41e225384f83feda89..86545cdee8583c2e29984c9df792bceafc9bce9c 100644 --- a/substrate/frame/nomination-pools/src/lib.rs +++ b/substrate/frame/nomination-pools/src/lib.rs @@ -497,7 +497,8 @@ impl ClaimPermission { TypeInfo, RuntimeDebugNoBound, CloneNoBound, - frame_support::PartialEqNoBound, + PartialEqNoBound, + EqNoBound, )] #[cfg_attr(feature = "std", derive(DefaultNoBound))] #[scale_info(skip_type_params(T))] @@ -1295,8 +1296,17 @@ impl<T: Config> BondedPool<T> { /// A reward pool is not so much a pool anymore, since it does not contain any shares or points. /// Rather, simply to fit nicely next to bonded pool and unbonding pools in terms of terminology. In /// reality, a reward pool is just a container for a few pool-dependent data related to the rewards. -#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebugNoBound)] -#[cfg_attr(feature = "std", derive(Clone, PartialEq, DefaultNoBound))] +#[derive( + Encode, + Decode, + MaxEncodedLen, + TypeInfo, + CloneNoBound, + PartialEqNoBound, + EqNoBound, + RuntimeDebugNoBound, +)] +#[cfg_attr(feature = "std", derive(DefaultNoBound))] #[codec(mel_bound(T: Config))] #[scale_info(skip_type_params(T))] pub struct RewardPool<T: Config> { @@ -1304,19 +1314,19 @@ pub struct RewardPool<T: Config> { /// /// This is updated ONLY when the points in the bonded pool change, which means `join`, /// `bond_extra` and `unbond`, all of which is done through `update_recorded`. - last_recorded_reward_counter: T::RewardCounter, + pub last_recorded_reward_counter: T::RewardCounter, /// The last recorded total payouts of the reward pool. /// /// Payouts is essentially income of the pool. /// /// Update criteria is same as that of `last_recorded_reward_counter`. - last_recorded_total_payouts: BalanceOf<T>, + pub last_recorded_total_payouts: BalanceOf<T>, /// Total amount that this pool has paid out so far to the members. - total_rewards_claimed: BalanceOf<T>, + pub total_rewards_claimed: BalanceOf<T>, /// The amount of commission pending to be claimed. - total_commission_pending: BalanceOf<T>, + pub total_commission_pending: BalanceOf<T>, /// The amount of commission that has been claimed. - total_commission_claimed: BalanceOf<T>, + pub total_commission_claimed: BalanceOf<T>, } impl<T: Config> RewardPool<T> { @@ -1455,15 +1465,24 @@ impl<T: Config> RewardPool<T> { } /// An unbonding pool. This is always mapped with an era. -#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, DefaultNoBound, RuntimeDebugNoBound)] -#[cfg_attr(feature = "std", derive(Clone, PartialEq, Eq))] +#[derive( + Encode, + Decode, + MaxEncodedLen, + TypeInfo, + DefaultNoBound, + RuntimeDebugNoBound, + CloneNoBound, + PartialEqNoBound, + EqNoBound, +)] #[codec(mel_bound(T: Config))] #[scale_info(skip_type_params(T))] pub struct UnbondPool<T: Config> { /// The points in this pool. - points: BalanceOf<T>, + pub points: BalanceOf<T>, /// The funds in the pool. - balance: BalanceOf<T>, + pub balance: BalanceOf<T>, } impl<T: Config> UnbondPool<T> { @@ -1498,17 +1517,26 @@ impl<T: Config> UnbondPool<T> { } } -#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, DefaultNoBound, RuntimeDebugNoBound)] -#[cfg_attr(feature = "std", derive(Clone, PartialEq))] +#[derive( + Encode, + Decode, + MaxEncodedLen, + TypeInfo, + DefaultNoBound, + RuntimeDebugNoBound, + CloneNoBound, + PartialEqNoBound, + EqNoBound, +)] #[codec(mel_bound(T: Config))] #[scale_info(skip_type_params(T))] pub struct SubPools<T: Config> { /// A general, era agnostic pool of funds that have fully unbonded. The pools /// of `Self::with_era` will lazily be merged into into this pool if they are /// older then `current_era - TotalUnbondingPools`. - no_era: UnbondPool<T>, + pub no_era: UnbondPool<T>, /// Map of era in which a pool becomes unbonded in => unbond pools. - with_era: BoundedBTreeMap<EraIndex, UnbondPool<T>, TotalUnbondingPools<T>>, + pub with_era: BoundedBTreeMap<EraIndex, UnbondPool<T>, TotalUnbondingPools<T>>, } impl<T: Config> SubPools<T> { diff --git a/substrate/frame/preimage/src/lib.rs b/substrate/frame/preimage/src/lib.rs index 849ffddf4fb3c0c4e88fbf534a33312d0e2a83b9..744e2d18d67bca99e75136c17bf5a7f5b8586187 100644 --- a/substrate/frame/preimage/src/lib.rs +++ b/substrate/frame/preimage/src/lib.rs @@ -88,12 +88,12 @@ pub enum RequestStatus<AccountId, Ticket> { Requested { maybe_ticket: Option<(AccountId, Ticket)>, count: u32, maybe_len: Option<u32> }, } -type BalanceOf<T> = +pub type BalanceOf<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance; -type TicketOf<T> = <T as Config>::Consideration; +pub type TicketOf<T> = <T as Config>::Consideration; /// Maximum size of preimage we can store is 4mb. -const MAX_SIZE: u32 = 4 * 1024 * 1024; +pub const MAX_SIZE: u32 = 4 * 1024 * 1024; /// Hard-limit on the number of hashes that can be passed to `ensure_updated`. /// /// Exists only for benchmarking purposes. @@ -132,7 +132,7 @@ pub mod pallet { pub struct Pallet<T>(_); #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] + #[pallet::generate_deposit(pub fn deposit_event)] pub enum Event<T: Config> { /// A preimage has been noted. Noted { hash: T::Hash }, @@ -172,16 +172,16 @@ pub mod pallet { /// The request status of a given hash. #[deprecated = "RequestStatusFor"] #[pallet::storage] - pub(super) type StatusFor<T: Config> = + pub type StatusFor<T: Config> = StorageMap<_, Identity, T::Hash, OldRequestStatus<T::AccountId, BalanceOf<T>>>; /// The request status of a given hash. #[pallet::storage] - pub(super) type RequestStatusFor<T: Config> = + pub type RequestStatusFor<T: Config> = StorageMap<_, Identity, T::Hash, RequestStatus<T::AccountId, TicketOf<T>>>; #[pallet::storage] - pub(super) type PreimageFor<T: Config> = + pub type PreimageFor<T: Config> = StorageMap<_, Identity, (T::Hash, u32), BoundedVec<u8, ConstU32<MAX_SIZE>>>; #[pallet::call(weight = T::WeightInfo)] diff --git a/substrate/frame/proxy/src/lib.rs b/substrate/frame/proxy/src/lib.rs index 1fe9772617221c069ccd71543ae1de8e4af0b4b2..594d1721cd41bcb08c7ed3238dad7c19bc225553 100644 --- a/substrate/frame/proxy/src/lib.rs +++ b/substrate/frame/proxy/src/lib.rs @@ -167,7 +167,28 @@ pub mod pallet { #[pallet::constant] type AnnouncementDepositFactor: Get<BalanceOf<Self>>; - /// Provider for the block number. Normally this is the `frame_system` pallet. + /// Query the current block number. + /// + /// Must return monotonically increasing values when called from consecutive blocks. + /// Can be configured to return either: + /// - the local block number of the runtime via `frame_system::Pallet` + /// - a remote block number, eg from the relay chain through `RelaychainDataProvider` + /// - an arbitrary value through a custom implementation of the trait + /// + /// There is currently no migration provided to "hot-swap" block number providers and it may + /// result in undefined behavior when doing so. Parachains are therefore best off setting + /// this to their local block number provider if they have the pallet already deployed. + /// + /// Suggested values: + /// - Solo- and Relay-chains: `frame_system::Pallet` + /// - Parachains that may produce blocks sparingly or only when needed (on-demand): + /// - already have the pallet deployed: `frame_system::Pallet` + /// - are freshly deploying this pallet: `RelaychainDataProvider` + /// - Parachains with a reliably block production rate (PLO or bulk-coretime): + /// - already have the pallet deployed: `frame_system::Pallet` + /// - are freshly deploying this pallet: no strong recommendation. Both local and remote + /// providers can be used. Relay provider can be a bit better in cases where the + /// parachain is lagging its block production to avoid clock skew. type BlockNumberProvider: BlockNumberProvider; } diff --git a/substrate/frame/recovery/src/lib.rs b/substrate/frame/recovery/src/lib.rs index 42fb641983f6308a9809ca8ec856ee2d019ab569..8159bbefa76b1765d7986781887ac373ea694924 100644 --- a/substrate/frame/recovery/src/lib.rs +++ b/substrate/frame/recovery/src/lib.rs @@ -240,7 +240,28 @@ pub mod pallet { + GetDispatchInfo + From<frame_system::Call<Self>>; - /// Provider for the block number. Normally this is the `frame_system` pallet. + /// Query the current block number. + /// + /// Must return monotonically increasing values when called from consecutive blocks. + /// Can be configured to return either: + /// - the local block number of the runtime via `frame_system::Pallet` + /// - a remote block number, eg from the relay chain through `RelaychainDataProvider` + /// - an arbitrary value through a custom implementation of the trait + /// + /// There is currently no migration provided to "hot-swap" block number providers and it may + /// result in undefined behavior when doing so. Parachains are therefore best off setting + /// this to their local block number provider if they have the pallet already deployed. + /// + /// Suggested values: + /// - Solo- and Relay-chains: `frame_system::Pallet` + /// - Parachains that may produce blocks sparingly or only when needed (on-demand): + /// - already have the pallet deployed: `frame_system::Pallet` + /// - are freshly deploying this pallet: `RelaychainDataProvider` + /// - Parachains with a reliably block production rate (PLO or bulk-coretime): + /// - already have the pallet deployed: `frame_system::Pallet` + /// - are freshly deploying this pallet: no strong recommendation. Both local and remote + /// providers can be used. Relay provider can be a bit better in cases where the + /// parachain is lagging its block production to avoid clock skew. type BlockNumberProvider: BlockNumberProvider; /// The currency mechanism. diff --git a/substrate/frame/salary/src/lib.rs b/substrate/frame/salary/src/lib.rs index 6a843625f4a7bc61901b890f79135c183188d354..45c711e21c109f9d897c3dfdd137881349824abc 100644 --- a/substrate/frame/salary/src/lib.rs +++ b/substrate/frame/salary/src/lib.rs @@ -136,12 +136,11 @@ pub mod pallet { /// The overall status of the system. #[pallet::storage] - pub(super) type Status<T: Config<I>, I: 'static = ()> = - StorageValue<_, StatusOf<T, I>, OptionQuery>; + pub type Status<T: Config<I>, I: 'static = ()> = StorageValue<_, StatusOf<T, I>, OptionQuery>; /// The status of a claimant. #[pallet::storage] - pub(super) type Claimant<T: Config<I>, I: 'static = ()> = + pub type Claimant<T: Config<I>, I: 'static = ()> = StorageMap<_, Twox64Concat, T::AccountId, ClaimantStatusOf<T, I>, OptionQuery>; #[pallet::event] diff --git a/substrate/frame/scheduler/src/lib.rs b/substrate/frame/scheduler/src/lib.rs index 80ba7fd06da071a3c0fd96178d8d715dd7a2c150..2ad94ec04df47c24f9df6c13207b7263a26c825b 100644 --- a/substrate/frame/scheduler/src/lib.rs +++ b/substrate/frame/scheduler/src/lib.rs @@ -146,20 +146,20 @@ struct ScheduledV1<Call, BlockNumber> { } /// Information regarding an item to be executed in the future. -#[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq))] -#[derive(Clone, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] +#[derive(Clone, RuntimeDebug, PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo)] pub struct Scheduled<Name, Call, BlockNumber, PalletsOrigin, AccountId> { /// The unique identity for this task, if there is one. - maybe_id: Option<Name>, + pub maybe_id: Option<Name>, /// This task's priority. - priority: schedule::Priority, + pub priority: schedule::Priority, /// The call to be dispatched. - call: Call, + pub call: Call, /// If the call is periodic, then this points to the information concerning that. - maybe_periodic: Option<schedule::Period<BlockNumber>>, + pub maybe_periodic: Option<schedule::Period<BlockNumber>>, /// The origin with which to dispatch the call. - origin: PalletsOrigin, - _phantom: PhantomData<AccountId>, + pub origin: PalletsOrigin, + #[doc(hidden)] + pub _phantom: PhantomData<AccountId>, } impl<Name, Call, BlockNumber, PalletsOrigin, AccountId> @@ -351,7 +351,7 @@ pub mod pallet { /// For v3 -> v4 the previously unbounded identities are Blake2-256 hashed to form the v4 /// identities. #[pallet::storage] - pub(crate) type Lookup<T: Config> = + pub type Lookup<T: Config> = StorageMap<_, Twox64Concat, TaskName, TaskAddress<BlockNumberFor<T>>>; /// Events type. diff --git a/substrate/frame/society/src/lib.rs b/substrate/frame/society/src/lib.rs index 39aa6bf3566b2950248254fea242154a1ccebfb7..03726e6215ca1d0a71fc703e27f49ed3a0fdf85d 100644 --- a/substrate/frame/society/src/lib.rs +++ b/substrate/frame/society/src/lib.rs @@ -658,7 +658,7 @@ pub mod pallet { /// The max number of members for the society at one time. #[pallet::storage] - pub(super) type Parameters<T: Config<I>, I: 'static = ()> = + pub type Parameters<T: Config<I>, I: 'static = ()> = StorageValue<_, GroupParamsFor<T, I>, OptionQuery>; /// Amount of our account balance that is specifically for the next round's bid(s). @@ -709,7 +709,7 @@ pub mod pallet { /// The current bids, stored ordered by the value of the bid. #[pallet::storage] - pub(super) type Bids<T: Config<I>, I: 'static = ()> = + pub type Bids<T: Config<I>, I: 'static = ()> = StorageValue<_, BoundedVec<Bid<T::AccountId, BalanceOf<T, I>>, T::MaxBids>, ValueQuery>; #[pallet::storage] @@ -727,7 +727,7 @@ pub mod pallet { /// Double map from Candidate -> Voter -> (Maybe) Vote. #[pallet::storage] - pub(super) type Votes<T: Config<I>, I: 'static = ()> = StorageDoubleMap< + pub type Votes<T: Config<I>, I: 'static = ()> = StorageDoubleMap< _, Twox64Concat, T::AccountId, @@ -739,7 +739,7 @@ pub mod pallet { /// Clear-cursor for Vote, map from Candidate -> (Maybe) Cursor. #[pallet::storage] - pub(super) type VoteClearCursor<T: Config<I>, I: 'static = ()> = + pub type VoteClearCursor<T: Config<I>, I: 'static = ()> = StorageMap<_, Twox64Concat, T::AccountId, BoundedVec<u8, KeyLenOf<Votes<T, I>>>>; /// At the end of the claim period, this contains the most recently approved members (along with @@ -751,17 +751,17 @@ pub mod pallet { /// The number of challenge rounds there have been. Used to identify stale DefenderVotes. #[pallet::storage] - pub(super) type ChallengeRoundCount<T: Config<I>, I: 'static = ()> = + pub type ChallengeRoundCount<T: Config<I>, I: 'static = ()> = StorageValue<_, RoundIndex, ValueQuery>; /// The defending member currently being challenged, along with a running tally of votes. #[pallet::storage] - pub(super) type Defending<T: Config<I>, I: 'static = ()> = + pub type Defending<T: Config<I>, I: 'static = ()> = StorageValue<_, (T::AccountId, T::AccountId, Tally)>; /// Votes for the defender, keyed by challenge round. #[pallet::storage] - pub(super) type DefenderVotes<T: Config<I>, I: 'static = ()> = + pub type DefenderVotes<T: Config<I>, I: 'static = ()> = StorageDoubleMap<_, Twox64Concat, RoundIndex, Twox64Concat, T::AccountId, Vote>; #[pallet::hooks] diff --git a/substrate/frame/treasury/src/lib.rs b/substrate/frame/treasury/src/lib.rs index 281012ffb4c956ed31913d45332e0f7b7ce742d9..0f1897872cc1f27a2c9275f4879e8f9e1823c455 100644 --- a/substrate/frame/treasury/src/lib.rs +++ b/substrate/frame/treasury/src/lib.rs @@ -324,7 +324,7 @@ pub mod pallet { /// The count of spends that have been made. #[pallet::storage] - pub(crate) type SpendCount<T, I = ()> = StorageValue<_, SpendIndex, ValueQuery>; + pub type SpendCount<T, I = ()> = StorageValue<_, SpendIndex, ValueQuery>; /// Spends that have been approved and being processed. // Hasher: Twox safe since `SpendIndex` is an internal count based index. @@ -345,7 +345,7 @@ pub mod pallet { /// The blocknumber for the last triggered spend period. #[pallet::storage] - pub(crate) type LastSpendPeriod<T, I = ()> = StorageValue<_, BlockNumberFor<T, I>, OptionQuery>; + pub type LastSpendPeriod<T, I = ()> = StorageValue<_, BlockNumberFor<T, I>, OptionQuery>; #[pallet::genesis_config] #[derive(frame_support::DefaultNoBound)] diff --git a/substrate/frame/uniques/src/lib.rs b/substrate/frame/uniques/src/lib.rs index 84f122c08bb7b4c10ee177d78dcfb5e69501e201..01548418a04993b5667210f4d76566e1a4e3aee2 100644 --- a/substrate/frame/uniques/src/lib.rs +++ b/substrate/frame/uniques/src/lib.rs @@ -182,7 +182,7 @@ pub mod pallet { #[pallet::storage] /// The items held by any given account; set out this way so that items owned by a single /// account can be enumerated. - pub(super) type Account<T: Config<I>, I: 'static = ()> = StorageNMap< + pub type Account<T: Config<I>, I: 'static = ()> = StorageNMap< _, ( NMapKey<Blake2_128Concat, T::AccountId>, // owner @@ -197,7 +197,7 @@ pub mod pallet { #[pallet::storage_prefix = "ClassAccount"] /// The collections owned by any given account; set out this way so that collections owned by /// a single account can be enumerated. - pub(super) type CollectionAccount<T: Config<I>, I: 'static = ()> = StorageDoubleMap< + pub type CollectionAccount<T: Config<I>, I: 'static = ()> = StorageDoubleMap< _, Blake2_128Concat, T::AccountId, @@ -246,7 +246,7 @@ pub mod pallet { #[pallet::storage] /// Attributes of a collection. - pub(super) type Attribute<T: Config<I>, I: 'static = ()> = StorageNMap< + pub type Attribute<T: Config<I>, I: 'static = ()> = StorageNMap< _, ( NMapKey<Blake2_128Concat, T::CollectionId>, @@ -271,7 +271,7 @@ pub mod pallet { #[pallet::storage] /// Keeps track of the number of items a collection might have. - pub(super) type CollectionMaxSupply<T: Config<I>, I: 'static = ()> = + pub type CollectionMaxSupply<T: Config<I>, I: 'static = ()> = StorageMap<_, Blake2_128Concat, T::CollectionId, u32, OptionQuery>; #[pallet::event] diff --git a/substrate/frame/uniques/src/types.rs b/substrate/frame/uniques/src/types.rs index e2e170c72f21ae65912147546f789db74b60550b..6451e3800da8d8866a01c970aa4f7ec1d733f745 100644 --- a/substrate/frame/uniques/src/types.rs +++ b/substrate/frame/uniques/src/types.rs @@ -25,16 +25,15 @@ use frame_support::{ use scale_info::TypeInfo; /// A type alias for handling balance deposits. -pub(super) type DepositBalanceOf<T, I = ()> = +pub type DepositBalanceOf<T, I = ()> = <<T as Config<I>>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance; /// A type alias representing the details of a collection. -pub(super) type CollectionDetailsFor<T, I> = +pub type CollectionDetailsFor<T, I> = CollectionDetails<<T as SystemConfig>::AccountId, DepositBalanceOf<T, I>>; /// A type alias for the details of a single item. -pub(super) type ItemDetailsFor<T, I> = - ItemDetails<<T as SystemConfig>::AccountId, DepositBalanceOf<T, I>>; +pub type ItemDetailsFor<T, I> = ItemDetails<<T as SystemConfig>::AccountId, DepositBalanceOf<T, I>>; /// A type alias to represent the price of an item. -pub(super) type ItemPrice<T, I = ()> = +pub type ItemPrice<T, I = ()> = <<T as Config<I>>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance; #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)] diff --git a/substrate/frame/vesting/src/lib.rs b/substrate/frame/vesting/src/lib.rs index 15f8d397f81c9c345348a16bca290d6ab86837cc..9e3e30106f34126f0a61df7854f5358732ff49cf 100644 --- a/substrate/frame/vesting/src/lib.rs +++ b/substrate/frame/vesting/src/lib.rs @@ -96,7 +96,7 @@ const VESTING_ID: LockIdentifier = *b"vesting "; // A value placed in storage that represents the current version of the Vesting storage. // This value is used by `on_runtime_upgrade` to determine whether we run storage migration logic. #[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, MaxEncodedLen, TypeInfo)] -enum Releases { +pub enum Releases { V0, V1, } @@ -179,7 +179,28 @@ pub mod pallet { /// the unvested amount. type UnvestedFundsAllowedWithdrawReasons: Get<WithdrawReasons>; - /// Provider for the block number. + /// Query the current block number. + /// + /// Must return monotonically increasing values when called from consecutive blocks. + /// Can be configured to return either: + /// - the local block number of the runtime via `frame_system::Pallet` + /// - a remote block number, eg from the relay chain through `RelaychainDataProvider` + /// - an arbitrary value through a custom implementation of the trait + /// + /// There is currently no migration provided to "hot-swap" block number providers and it may + /// result in undefined behavior when doing so. Parachains are therefore best off setting + /// this to their local block number provider if they have the pallet already deployed. + /// + /// Suggested values: + /// - Solo- and Relay-chains: `frame_system::Pallet` + /// - Parachains that may produce blocks sparingly or only when needed (on-demand): + /// - already have the pallet deployed: `frame_system::Pallet` + /// - are freshly deploying this pallet: `RelaychainDataProvider` + /// - Parachains with a reliably block production rate (PLO or bulk-coretime): + /// - already have the pallet deployed: `frame_system::Pallet` + /// - are freshly deploying this pallet: no strong recommendation. Both local and remote + /// providers can be used. Relay provider can be a bit better in cases where the + /// parachain is lagging its block production to avoid clock skew. type BlockNumberProvider: BlockNumberProvider<BlockNumber = BlockNumberFor<Self>>; /// Maximum number of vesting schedules an account may have at a given moment. @@ -214,7 +235,7 @@ pub mod pallet { /// /// New networks start with latest version, as determined by the genesis build. #[pallet::storage] - pub(crate) type StorageVersion<T: Config> = StorageValue<_, Releases, ValueQuery>; + pub type StorageVersion<T: Config> = StorageValue<_, Releases, ValueQuery>; #[pallet::pallet] pub struct Pallet<T>(_);