diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index ad0da135b31cd38c3e75fcbb869c6df35ea347c4..33dcf43ccb590d2a962e35a4eba5d2efb68787e6 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -698,7 +698,6 @@ pub mod pallet { /// The ongoing queries. #[pallet::storage] - #[pallet::getter(fn query)] pub(super) type Queries<T: Config> = StorageMap<_, Blake2_128Concat, QueryId, QueryStatus<BlockNumberFor<T>>, OptionQuery>; @@ -707,7 +706,6 @@ pub mod pallet { /// Key is the blake2 256 hash of (origin, versioned `Assets`) pair. Value is the number of /// times this pair has been trapped (usually just 1 if it exists at all). #[pallet::storage] - #[pallet::getter(fn asset_trap)] pub(super) type AssetTraps<T: Config> = StorageMap<_, Identity, H256, u32, ValueQuery>; /// Default version to encode XCM when latest version of destination is unknown. If `None`, @@ -1565,6 +1563,20 @@ impl<T: Config> QueryHandler for Pallet<T> { } impl<T: Config> Pallet<T> { + /// The ongoing queries. + pub fn query(query_id: &QueryId) -> Option<QueryStatus<BlockNumberFor<T>>>> { + Queries::<T>::get(query_id) + } + + /// The existing asset traps. + /// + /// Key is the blake2 256 hash of (origin, versioned `Assets`) pair. + /// Value is the number of times this pair has been trapped + /// (usually just 1 if it exists at all). + pub fn asset_trap(&H256) -> u32 { + AssetTraps::<T>::get(&trap_id) + } + /// Find `TransferType`s for `assets` and fee identified through `fee_asset_item`, when /// transferring to `dest`. /// diff --git a/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs b/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs index 025cda3707594b6d57433b2a94f3cc5c64d8a83f..3c425ca38efdaeecdd00effc024a9b263fd37ecc 100644 --- a/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs +++ b/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs @@ -169,11 +169,9 @@ pub mod mock_msg_queue { impl<T: Config> Pallet<T> {} #[pallet::storage] - #[pallet::getter(fn parachain_id)] pub(super) type ParachainId<T: Config> = StorageValue<_, ParaId, ValueQuery>; #[pallet::storage] - #[pallet::getter(fn received_dmp)] /// A queue of received DMP messages pub(super) type ReceivedDmp<T: Config> = StorageValue<_, Vec<Xcm<T::RuntimeCall>>, ValueQuery>; @@ -208,6 +206,14 @@ pub mod mock_msg_queue { } impl<T: Config> Pallet<T> { + pub fn parachain_id() -> ParaId { + ParachainId::<T>::get() + } + + pub fn received_dmp() -> Vec<Xcm<T::RuntimeCall>> { + ReceivedDmp::<T>::get() + } + pub fn set_para_id(para_id: ParaId) { ParachainId::<T>::put(para_id); } @@ -234,8 +240,9 @@ pub mod mock_msg_queue { Outcome::Complete { used } => (Ok(used), Event::Success(Some(hash))), // As far as the caller is concerned, this was dispatched without error, so // we just report the weight used. - Outcome::Incomplete { used, error } => - (Ok(used), Event::Fail(Some(hash), error)), + Outcome::Incomplete { used, error } => { + (Ok(used), Event::Fail(Some(hash), error)) + }, } }, Err(()) => (Err(XcmError::UnhandledXcmVersion), Event::BadVersion(Some(hash))),