Trait pallet_state_trie_migration::pallet::Config
source · pub trait Config: Config {
type ControlOrigin: EnsureOrigin<Self::RuntimeOrigin>;
type SignedFilter: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>;
type Currency: InspectHold<Self::AccountId> + Mutate<Self::AccountId> + MutateHold<Self::AccountId, Reason = Self::RuntimeHoldReason> + Balanced<Self::AccountId>;
type RuntimeHoldReason: From<HoldReason>;
type MaxKeyLen: Get<u32>;
type SignedDepositPerItem: Get<<<Self as Config>::Currency as Inspect<<Self as Config>::AccountId>>::Balance>;
type SignedDepositBase: Get<<<Self as Config>::Currency as Inspect<<Self as Config>::AccountId>>::Balance>;
type WeightInfo: WeightInfo;
}
Expand description
Configuration trait of this pallet.
The main purpose of this trait is to act as an interface between this pallet and the runtime in which it is embedded in. A type, function, or constant in this trait is essentially left to be configured by the runtime that includes this pallet.
Consequently, a runtime that wants to include this pallet must implement this trait. Configurations of this pallet.
Required Associated Types§
sourcetype ControlOrigin: EnsureOrigin<Self::RuntimeOrigin>
type ControlOrigin: EnsureOrigin<Self::RuntimeOrigin>
Origin that can control the configurations of this pallet.
sourcetype SignedFilter: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>
type SignedFilter: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>
Filter on which origin that trigger the manual migrations.
sourcetype RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>
type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>
The overarching event type.
sourcetype Currency: InspectHold<Self::AccountId> + Mutate<Self::AccountId> + MutateHold<Self::AccountId, Reason = Self::RuntimeHoldReason> + Balanced<Self::AccountId>
type Currency: InspectHold<Self::AccountId> + Mutate<Self::AccountId> + MutateHold<Self::AccountId, Reason = Self::RuntimeHoldReason> + Balanced<Self::AccountId>
The currency provider type.
sourcetype RuntimeHoldReason: From<HoldReason>
type RuntimeHoldReason: From<HoldReason>
The overarching runtime hold reason.
sourcetype MaxKeyLen: Get<u32>
type MaxKeyLen: Get<u32>
Maximal number of bytes that a key can have.
FRAME itself does not limit the key length.
The concrete value must therefore depend on your storage usage.
A [frame_support::storage::StorageNMap
] for example can have an arbitrary number of
keys which are then hashed and concatenated, resulting in arbitrarily long keys.
Use the state migration RPC to retrieve the length of the longest key in your storage: https://github.com/paritytech/substrate/issues/11642
The migration will halt with a Halted
event if this value is too small.
Since there is no real penalty from over-estimating, it is advised to use a large
value. The default is 512 byte.
Some key lengths for reference:
- [
frame_support::storage::StorageValue
]: 32 byte - [
frame_support::storage::StorageMap
]: 64 byte - [
frame_support::storage::StorageDoubleMap
]: 96 byte
For more info see https://www.shawntabrizi.com/blog/substrate/querying-substrate-storage-via-rpc/
sourcetype SignedDepositPerItem: Get<<<Self as Config>::Currency as Inspect<<Self as Config>::AccountId>>::Balance>
type SignedDepositPerItem: Get<<<Self as Config>::Currency as Inspect<<Self as Config>::AccountId>>::Balance>
The amount of deposit collected per item in advance, for signed migrations.
This should reflect the average storage value size in the worse case.
sourcetype SignedDepositBase: Get<<<Self as Config>::Currency as Inspect<<Self as Config>::AccountId>>::Balance>
type SignedDepositBase: Get<<<Self as Config>::Currency as Inspect<<Self as Config>::AccountId>>::Balance>
The base value of Config::SignedDepositPerItem
.
Final deposit is items * SignedDepositPerItem + SignedDepositBase
.
sourcetype WeightInfo: WeightInfo
type WeightInfo: WeightInfo
The weight information of this pallet.