pallet_messages/migration/v2/
mod.rs1use crate::{Config, MessageIndex, Pallet};
2use common_primitives::{msa::MessageSourceId, schema::SchemaId};
3use core::fmt::Debug;
4use frame_support::{pallet_prelude::*, storage_alias};
5use frame_system::pallet_prelude::BlockNumberFor;
6use sp_runtime::codec::{Decode, Encode};
7
8#[allow(type_alias_bounds)]
10pub(crate) type K1Type<T: Config> = BlockNumberFor<T>;
11#[allow(type_alias_bounds)]
12pub(crate) type K2Type = SchemaId;
13#[allow(type_alias_bounds)]
14pub(crate) type K3Type = MessageIndex;
15
16#[storage_alias]
20pub(crate) type MessagesV2<T: Config> = StorageNMap<
21 Pallet<T>,
22 (
23 storage::Key<Twox64Concat, K1Type<T>>,
24 storage::Key<Twox64Concat, K2Type>,
25 storage::Key<Twox64Concat, K3Type>,
26 ),
27 Message<<T as Config>::MessagesMaxPayloadSizeBytes>,
28 OptionQuery,
29>;
30
31#[storage_alias]
35pub(crate) type DoneV3Migration<T: Config> = StorageValue<Pallet<T>, bool, ValueQuery>;
36
37#[derive(Clone, Default, Encode, Decode, PartialEq, Debug, TypeInfo, Eq, MaxEncodedLen)]
39#[scale_info(skip_type_params(MaxDataSize))]
40#[codec(mel_bound(MaxDataSize: MaxEncodedLen))]
41pub struct Message<MaxDataSize>
42where
43 MaxDataSize: Get<u32> + Debug,
44{
45 pub payload: BoundedVec<u8, MaxDataSize>,
47 pub provider_msa_id: MessageSourceId,
52 pub msa_id: Option<MessageSourceId>,
54}