Use #[pallet::unbounded] tag in FRAME System (#11946)

* use unbounded in system

* update ui tests
This commit is contained in:
Shawn Tabrizi
2022-08-10 14:58:52 +01:00
committed by GitHub
parent e41b90910e
commit 043b1697c7
5 changed files with 20 additions and 15 deletions
+10 -5
View File
@@ -233,7 +233,8 @@ pub mod pallet {
+ Default
+ MaybeDisplay
+ AtLeast32Bit
+ Copy;
+ Copy
+ MaxEncodedLen;
/// The block number type used by the runtime.
type BlockNumber: Parameter
@@ -320,7 +321,7 @@ pub mod pallet {
/// Data to be associated with an account (other than nonce/transaction counter, which this
/// pallet does regardless).
type AccountData: Member + FullCodec + Clone + Default + TypeInfo;
type AccountData: Member + FullCodec + Clone + Default + TypeInfo + MaxEncodedLen;
/// Handler for when a new account has just been created.
type OnNewAccount: OnNewAccount<Self::AccountId>;
@@ -355,7 +356,6 @@ pub mod pallet {
#[pallet::pallet]
#[pallet::generate_store(pub (super) trait Store)]
#[pallet::without_storage_info]
pub struct Pallet<T>(_);
#[pallet::hooks]
@@ -578,6 +578,7 @@ pub mod pallet {
/// Extrinsics data for the current block (maps an extrinsic's index to its data).
#[pallet::storage]
#[pallet::getter(fn extrinsic_data)]
#[pallet::unbounded]
pub(super) type ExtrinsicData<T: Config> =
StorageMap<_, Twox64Concat, u32, Vec<u8>, ValueQuery>;
@@ -593,6 +594,7 @@ pub mod pallet {
/// Digest of the current block, also part of the block header.
#[pallet::storage]
#[pallet::unbounded]
#[pallet::getter(fn digest)]
pub(super) type Digest<T: Config> = StorageValue<_, generic::Digest, ValueQuery>;
@@ -604,6 +606,7 @@ pub mod pallet {
/// Events have a large in-memory size. Box the events to not go out-of-memory
/// just in case someone still reads them from within the runtime.
#[pallet::storage]
#[pallet::unbounded]
pub(super) type Events<T: Config> =
StorageValue<_, Vec<Box<EventRecord<T::Event, T::Hash>>>, ValueQuery>;
@@ -623,12 +626,14 @@ pub mod pallet {
/// the `EventIndex` then in case if the topic has the same contents on the next block
/// no notification will be triggered thus the event might be lost.
#[pallet::storage]
#[pallet::unbounded]
#[pallet::getter(fn event_topics)]
pub(super) type EventTopics<T: Config> =
StorageMap<_, Blake2_128Concat, T::Hash, Vec<(T::BlockNumber, EventIndex)>, ValueQuery>;
/// Stores the `spec_version` and `spec_name` of when the last runtime upgrade happened.
#[pallet::storage]
#[pallet::unbounded]
pub type LastRuntimeUpgrade<T: Config> = StorageValue<_, LastRuntimeUpgradeInfo>;
/// True if we have upgraded so that `type RefCount` is `u32`. False (default) if not.
@@ -690,7 +695,7 @@ pub type Key = Vec<u8>;
pub type KeyValue = (Vec<u8>, Vec<u8>);
/// A phase of a block's execution.
#[derive(Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
#[cfg_attr(feature = "std", derive(Serialize, PartialEq, Eq, Clone))]
pub enum Phase {
/// Applying an extrinsic.
@@ -738,7 +743,7 @@ type EventIndex = u32;
pub type RefCount = u32;
/// Information of an account.
#[derive(Clone, Eq, PartialEq, Default, RuntimeDebug, Encode, Decode, TypeInfo)]
#[derive(Clone, Eq, PartialEq, Default, RuntimeDebug, Encode, Decode, TypeInfo, MaxEncodedLen)]
pub struct AccountInfo<Index, AccountData> {
/// The number of transactions this account has sent.
pub nonce: Index,