mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Restructure frame_support macro related exports (#14745)
* make reexports private * make reexports private 2 * make reexports private for runtime-benchmarking * make reexports private for try-runtime * fix for try-runtime * make reexports private for tests * fmt * make reexports private for tests * make reexports private for experimental * fix beefy * fix ui test * fix ui test * fix benches * ".git/.scripts/commands/fmt/fmt.sh" * fix contracts use * wip * wip * do not reexport sp_api::metadata_ir * fix CI checks * fix support tests * ".git/.scripts/commands/fmt/fmt.sh" * Update frame/support/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * import codec directly * fmt * fix node-cli tests --------- Co-authored-by: command-bot <> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -18,31 +18,30 @@
|
||||
//! Dispatch system. Contains a macro for defining runtime modules and
|
||||
//! generating values representing lazy module function calls.
|
||||
|
||||
pub use crate::{
|
||||
codec::{
|
||||
Codec, Decode, Encode, EncodeAsRef, EncodeLike, HasCompact, Input, MaxEncodedLen, Output,
|
||||
},
|
||||
scale_info::TypeInfo,
|
||||
sp_std::{
|
||||
fmt, marker,
|
||||
prelude::{Clone, Eq, PartialEq, Vec},
|
||||
result,
|
||||
},
|
||||
traits::{
|
||||
CallMetadata, GetCallIndex, GetCallMetadata, GetCallName, GetStorageVersion,
|
||||
UnfilteredDispatchable,
|
||||
},
|
||||
pub use crate::traits::{
|
||||
CallMetadata, GetCallIndex, GetCallMetadata, GetCallName, GetStorageVersion,
|
||||
UnfilteredDispatchable,
|
||||
};
|
||||
pub use codec::{
|
||||
Codec, Decode, Encode, EncodeAsRef, EncodeLike, HasCompact, Input, MaxEncodedLen, Output,
|
||||
};
|
||||
pub use scale_info::TypeInfo;
|
||||
pub use sp_runtime::{
|
||||
traits::Dispatchable, transaction_validity::TransactionPriority, DispatchError, RuntimeDebug,
|
||||
};
|
||||
pub use sp_std::{
|
||||
fmt, marker,
|
||||
prelude::{Clone, Eq, PartialEq, Vec},
|
||||
result,
|
||||
};
|
||||
pub use sp_weights::Weight;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_runtime::{
|
||||
generic::{CheckedExtrinsic, UncheckedExtrinsic},
|
||||
traits::SignedExtension,
|
||||
};
|
||||
pub use sp_runtime::{
|
||||
traits::Dispatchable, transaction_validity::TransactionPriority, DispatchError, RuntimeDebug,
|
||||
};
|
||||
pub use sp_weights::Weight;
|
||||
|
||||
/// The return type of a `Dispatchable` in frame. When returned explicitly from
|
||||
/// a dispatchable function it allows overriding the default `PostDispatchInfo`
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
//! Hash utilities.
|
||||
|
||||
use crate::metadata_ir;
|
||||
use codec::{Codec, MaxEncodedLen};
|
||||
use sp_io::hashing::{blake2_128, blake2_256, twox_128, twox_256, twox_64};
|
||||
use sp_metadata_ir as metadata_ir;
|
||||
use sp_std::prelude::Vec;
|
||||
|
||||
// This trait must be kept coherent with frame-support-procedural HasherKind usage
|
||||
|
||||
@@ -32,38 +32,30 @@
|
||||
/// Export ourself as `frame_support` to make tests happy.
|
||||
extern crate self as frame_support;
|
||||
|
||||
/// Private exports that are being used by macros.
|
||||
///
|
||||
/// The exports are not stable and should not be relied on.
|
||||
#[doc(hidden)]
|
||||
pub use sp_tracing;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use codec;
|
||||
#[doc(hidden)]
|
||||
pub use frame_metadata as metadata;
|
||||
#[doc(hidden)]
|
||||
pub use log;
|
||||
#[doc(hidden)]
|
||||
pub use paste;
|
||||
#[doc(hidden)]
|
||||
pub use scale_info;
|
||||
pub use serde;
|
||||
pub use sp_api::metadata_ir;
|
||||
pub use sp_core::{OpaqueMetadata, Void};
|
||||
#[doc(hidden)]
|
||||
pub use sp_core_hashing_proc_macro;
|
||||
#[doc(hidden)]
|
||||
pub use sp_io::{self, storage::root as storage_root};
|
||||
#[cfg(feature = "std")]
|
||||
#[doc(hidden)]
|
||||
pub use sp_runtime::{bounded_btree_map, bounded_vec};
|
||||
#[doc(hidden)]
|
||||
pub use sp_runtime::{RuntimeDebug, StateVersion};
|
||||
#[cfg(feature = "std")]
|
||||
#[doc(hidden)]
|
||||
pub use sp_state_machine::BasicExternalities;
|
||||
#[doc(hidden)]
|
||||
pub use sp_std;
|
||||
#[doc(hidden)]
|
||||
pub use tt_call::*;
|
||||
pub mod __private {
|
||||
pub use codec;
|
||||
pub use frame_metadata as metadata;
|
||||
pub use log;
|
||||
pub use paste;
|
||||
pub use scale_info;
|
||||
pub use serde;
|
||||
pub use sp_core::{OpaqueMetadata, Void};
|
||||
pub use sp_core_hashing_proc_macro;
|
||||
pub use sp_io::{self, storage::root as storage_root};
|
||||
pub use sp_metadata_ir as metadata_ir;
|
||||
#[cfg(feature = "std")]
|
||||
pub use sp_runtime::{bounded_btree_map, bounded_vec};
|
||||
pub use sp_runtime::{RuntimeDebug, StateVersion};
|
||||
#[cfg(feature = "std")]
|
||||
pub use sp_state_machine::BasicExternalities;
|
||||
pub use sp_std;
|
||||
pub use sp_tracing;
|
||||
pub use tt_call::*;
|
||||
}
|
||||
|
||||
#[macro_use]
|
||||
pub mod dispatch;
|
||||
@@ -255,7 +247,7 @@ macro_rules! parameter_types {
|
||||
) => (
|
||||
$( #[ $attr ] )*
|
||||
$vis struct $name $(
|
||||
< $($ty_params),* >( $($crate::sp_std::marker::PhantomData<$ty_params>),* )
|
||||
< $($ty_params),* >( $($crate::__private::sp_std::marker::PhantomData<$ty_params>),* )
|
||||
)?;
|
||||
$crate::parameter_types!(IMPL_CONST $name , $type , $value $( $(, $ty_params)* )?);
|
||||
$crate::parameter_types!( $( $rest )* );
|
||||
@@ -267,7 +259,7 @@ macro_rules! parameter_types {
|
||||
) => (
|
||||
$( #[ $attr ] )*
|
||||
$vis struct $name $(
|
||||
< $($ty_params),* >( $($crate::sp_std::marker::PhantomData<$ty_params>),* )
|
||||
< $($ty_params),* >( $($crate::__private::sp_std::marker::PhantomData<$ty_params>),* )
|
||||
)?;
|
||||
$crate::parameter_types!(IMPL $name, $type, $value $( $(, $ty_params)* )?);
|
||||
$crate::parameter_types!( $( $rest )* );
|
||||
@@ -279,7 +271,7 @@ macro_rules! parameter_types {
|
||||
) => (
|
||||
$( #[ $attr ] )*
|
||||
$vis struct $name $(
|
||||
< $($ty_params),* >( $($crate::sp_std::marker::PhantomData<$ty_params>),* )
|
||||
< $($ty_params),* >( $($crate::__private::sp_std::marker::PhantomData<$ty_params>),* )
|
||||
)?;
|
||||
$crate::parameter_types!(IMPL_STORAGE $name, $type, $value $( $(, $ty_params)* )?);
|
||||
$crate::parameter_types!( $( $rest )* );
|
||||
@@ -332,7 +324,7 @@ macro_rules! parameter_types {
|
||||
impl< $($ty_params),* > $name< $($ty_params),* > {
|
||||
/// Returns the key for this parameter type.
|
||||
pub fn key() -> [u8; 16] {
|
||||
$crate::sp_core_hashing_proc_macro::twox_128!(b":", $name, b":")
|
||||
$crate::__private::sp_core_hashing_proc_macro::twox_128!(b":", $name, b":")
|
||||
}
|
||||
|
||||
/// Set the value of this parameter type in the storage.
|
||||
@@ -397,7 +389,7 @@ macro_rules! parameter_types_impl_thread_local {
|
||||
$crate::parameter_types_impl_thread_local!(
|
||||
IMPL_THREAD_LOCAL $( $vis, $name, $type, $value, )*
|
||||
);
|
||||
$crate::paste::item! {
|
||||
$crate::__private::paste::item! {
|
||||
$crate::parameter_types!(
|
||||
$(
|
||||
$( #[ $attr ] )*
|
||||
@@ -432,7 +424,7 @@ macro_rules! parameter_types_impl_thread_local {
|
||||
}
|
||||
};
|
||||
(IMPL_THREAD_LOCAL $( $vis:vis, $name:ident, $type:ty, $value:expr, )* ) => {
|
||||
$crate::paste::item! {
|
||||
$crate::__private::paste::item! {
|
||||
thread_local! {
|
||||
$(
|
||||
pub static [<$name:snake:upper>]: std::cell::RefCell<$type> =
|
||||
@@ -462,7 +454,7 @@ macro_rules! ord_parameter_types {
|
||||
(IMPL $name:ident , $type:ty , $value:expr) => {
|
||||
impl $crate::traits::SortedMembers<$type> for $name {
|
||||
fn contains(t: &$type) -> bool { &$value == t }
|
||||
fn sorted_members() -> $crate::sp_std::prelude::Vec<$type> { vec![$value] }
|
||||
fn sorted_members() -> $crate::__private::sp_std::prelude::Vec<$type> { vec![$value] }
|
||||
fn count() -> usize { 1 }
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn add(_: &$type) {}
|
||||
@@ -485,9 +477,9 @@ macro_rules! runtime_print {
|
||||
($($arg:tt)+) => {
|
||||
{
|
||||
use core::fmt::Write;
|
||||
let mut w = $crate::sp_std::Writer::default();
|
||||
let mut w = $crate::__private::sp_std::Writer::default();
|
||||
let _ = core::write!(&mut w, $($arg)+);
|
||||
$crate::sp_io::misc::print_utf8(&w.inner())
|
||||
$crate::__private::sp_io::misc::print_utf8(&w.inner())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -684,9 +676,13 @@ macro_rules! assert_noop {
|
||||
$x:expr,
|
||||
$y:expr $(,)?
|
||||
) => {
|
||||
let h = $crate::storage_root($crate::StateVersion::V1);
|
||||
let h = $crate::__private::storage_root($crate::__private::StateVersion::V1);
|
||||
$crate::assert_err!($x, $y);
|
||||
assert_eq!(h, $crate::storage_root($crate::StateVersion::V1), "storage has been mutated");
|
||||
assert_eq!(
|
||||
h,
|
||||
$crate::__private::storage_root($crate::__private::StateVersion::V1),
|
||||
"storage has been mutated"
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -699,9 +695,9 @@ macro_rules! assert_storage_noop {
|
||||
(
|
||||
$x:expr
|
||||
) => {
|
||||
let h = $crate::storage_root($crate::StateVersion::V1);
|
||||
let h = $crate::__private::storage_root($crate::__private::StateVersion::V1);
|
||||
$x;
|
||||
assert_eq!(h, $crate::storage_root($crate::StateVersion::V1));
|
||||
assert_eq!(h, $crate::__private::storage_root($crate::__private::StateVersion::V1));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -801,10 +797,10 @@ pub mod _private {
|
||||
pub mod testing_prelude {
|
||||
pub use super::{
|
||||
assert_err, assert_err_ignore_postinfo, assert_err_with_weight, assert_error_encoded_size,
|
||||
assert_noop, assert_ok, assert_storage_noop, bounded_btree_map, bounded_vec,
|
||||
parameter_types, traits::Get,
|
||||
assert_noop, assert_ok, assert_storage_noop, parameter_types, traits::Get,
|
||||
};
|
||||
pub use sp_arithmetic::assert_eq_error_rate;
|
||||
pub use sp_runtime::{bounded_btree_map, bounded_vec};
|
||||
}
|
||||
|
||||
/// Prelude to be used alongside pallet macro, for ease of use.
|
||||
@@ -830,7 +826,7 @@ pub mod pallet_prelude {
|
||||
IsType, PalletInfoAccess, StorageInfoTrait, StorageVersion, TypedGet,
|
||||
},
|
||||
Blake2_128, Blake2_128Concat, Blake2_256, CloneNoBound, DebugNoBound, EqNoBound, Identity,
|
||||
PartialEqNoBound, RuntimeDebug, RuntimeDebugNoBound, Twox128, Twox256, Twox64Concat,
|
||||
PartialEqNoBound, RuntimeDebugNoBound, Twox128, Twox256, Twox64Concat,
|
||||
};
|
||||
pub use codec::{Decode, Encode, MaxEncodedLen};
|
||||
pub use frame_support::pallet_macros::*;
|
||||
@@ -844,7 +840,7 @@ pub mod pallet_prelude {
|
||||
TransactionTag, TransactionValidity, TransactionValidityError, UnknownTransaction,
|
||||
ValidTransaction,
|
||||
},
|
||||
MAX_MODULE_ERROR_ENCODED_SIZE,
|
||||
RuntimeDebug, MAX_MODULE_ERROR_ENCODED_SIZE,
|
||||
};
|
||||
pub use sp_std::marker::PhantomData;
|
||||
pub use sp_weights::Weight;
|
||||
|
||||
@@ -35,8 +35,9 @@ impl<T, S: Get<u32>> StorageTryAppend<T> for BoundedVec<T, S> {
|
||||
#[cfg(test)]
|
||||
pub mod test {
|
||||
use super::*;
|
||||
use crate::{bounded_vec, traits::ConstU32, Twox128};
|
||||
use crate::{traits::ConstU32, Twox128};
|
||||
use sp_io::TestExternalities;
|
||||
use sp_runtime::bounded_vec;
|
||||
|
||||
#[crate::storage_alias]
|
||||
type Foo = StorageValue<Prefix, BoundedVec<u32, ConstU32<7>>>;
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
// NOTE: could replace unhashed by having only one kind of storage (top trie being the child info
|
||||
// of null length parent storage key).
|
||||
|
||||
pub use crate::sp_io::{KillStorageResult, MultiRemovalResults};
|
||||
use crate::sp_std::prelude::*;
|
||||
use codec::{Codec, Decode, Encode};
|
||||
pub use sp_core::storage::{ChildInfo, ChildType, StateVersion};
|
||||
pub use sp_io::{KillStorageResult, MultiRemovalResults};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
/// Return the value of the item in storage under `key`, or `None` if there is no explicit entry.
|
||||
pub fn get<T: Decode + Sized>(child_info: &ChildInfo, key: &[u8]) -> Option<T> {
|
||||
|
||||
@@ -41,7 +41,7 @@ pub struct StorageNoopGuard(sp_std::vec::Vec<u8>);
|
||||
|
||||
impl Default for StorageNoopGuard {
|
||||
fn default() -> Self {
|
||||
Self(frame_support::storage_root(frame_support::StateVersion::V1))
|
||||
Self(sp_io::storage::root(sp_runtime::StateVersion::V1))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ impl Drop for StorageNoopGuard {
|
||||
return
|
||||
}
|
||||
assert_eq!(
|
||||
frame_support::storage_root(frame_support::StateVersion::V1),
|
||||
sp_io::storage::root(sp_runtime::StateVersion::V1),
|
||||
self.0,
|
||||
"StorageNoopGuard detected wrongful storage changes.",
|
||||
);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
//! Storage counted map type.
|
||||
|
||||
use crate::{
|
||||
metadata_ir::StorageEntryMetadataIR,
|
||||
storage::{
|
||||
generator::StorageMap as _,
|
||||
types::{
|
||||
@@ -32,6 +31,7 @@ use crate::{
|
||||
};
|
||||
use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen, Ref};
|
||||
use sp_io::MultiRemovalResults;
|
||||
use sp_metadata_ir::StorageEntryMetadataIR;
|
||||
use sp_runtime::traits::Saturating;
|
||||
use sp_std::prelude::*;
|
||||
|
||||
@@ -512,11 +512,11 @@ mod test {
|
||||
use super::*;
|
||||
use crate::{
|
||||
hash::*,
|
||||
metadata_ir::{StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR},
|
||||
storage::{bounded_vec::BoundedVec, types::ValueQuery},
|
||||
traits::ConstU32,
|
||||
};
|
||||
use sp_io::{hashing::twox_128, TestExternalities};
|
||||
use sp_metadata_ir::{StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR};
|
||||
|
||||
struct Prefix;
|
||||
impl StorageInstance for Prefix {
|
||||
|
||||
@@ -29,7 +29,7 @@ use crate::{
|
||||
Never,
|
||||
};
|
||||
use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen, Ref};
|
||||
use sp_api::metadata_ir::StorageEntryMetadataIR;
|
||||
use sp_metadata_ir::StorageEntryMetadataIR;
|
||||
use sp_runtime::traits::Saturating;
|
||||
use sp_std::prelude::*;
|
||||
|
||||
@@ -638,8 +638,8 @@ mod test {
|
||||
hash::{StorageHasher as _, *},
|
||||
storage::types::{Key as NMapKey, ValueQuery},
|
||||
};
|
||||
use sp_api::metadata_ir::{StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR};
|
||||
use sp_io::{hashing::twox_128, TestExternalities};
|
||||
use sp_metadata_ir::{StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR};
|
||||
|
||||
struct Prefix;
|
||||
impl StorageInstance for Prefix {
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
//! StoragePrefixedDoubleMap traits and their methods directly.
|
||||
|
||||
use crate::{
|
||||
metadata_ir::{StorageEntryMetadataIR, StorageEntryTypeIR},
|
||||
storage::{
|
||||
types::{OptionQuery, QueryKindTrait, StorageEntryMetadataBuilder},
|
||||
KeyLenOf, StorageAppend, StorageDecodeLength, StoragePrefixedMap, StorageTryAppend,
|
||||
@@ -29,6 +28,7 @@ use crate::{
|
||||
};
|
||||
use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen};
|
||||
use sp_arithmetic::traits::SaturatedConversion;
|
||||
use sp_metadata_ir::{StorageEntryMetadataIR, StorageEntryTypeIR};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
/// A type that allow to store values for `(key1, key2)` couple. Similar to `StorageMap` but allow
|
||||
@@ -734,12 +734,9 @@ where
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::{
|
||||
hash::*,
|
||||
metadata_ir::{StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR},
|
||||
storage::types::ValueQuery,
|
||||
};
|
||||
use crate::{hash::*, storage::types::ValueQuery};
|
||||
use sp_io::{hashing::twox_128, TestExternalities};
|
||||
use sp_metadata_ir::{StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR};
|
||||
|
||||
struct Prefix;
|
||||
impl StorageInstance for Prefix {
|
||||
|
||||
@@ -41,7 +41,7 @@ pub trait KeyGenerator {
|
||||
type HashFn: FnOnce(&[u8]) -> Vec<u8>;
|
||||
type HArg;
|
||||
|
||||
const HASHER_METADATA: &'static [crate::metadata_ir::StorageHasherIR];
|
||||
const HASHER_METADATA: &'static [sp_metadata_ir::StorageHasherIR];
|
||||
|
||||
/// Given a `key` tuple, calculate the final key by encoding each element individually and
|
||||
/// hashing them using the corresponding hasher in the `KeyGenerator`.
|
||||
@@ -74,7 +74,7 @@ impl<H: StorageHasher, K: FullCodec + StaticTypeInfo> KeyGenerator for Key<H, K>
|
||||
type HashFn = Box<dyn FnOnce(&[u8]) -> Vec<u8>>;
|
||||
type HArg = (Self::HashFn,);
|
||||
|
||||
const HASHER_METADATA: &'static [crate::metadata_ir::StorageHasherIR] = &[H::METADATA];
|
||||
const HASHER_METADATA: &'static [sp_metadata_ir::StorageHasherIR] = &[H::METADATA];
|
||||
|
||||
fn final_key<KArg: EncodeLikeTuple<Self::KArg> + TupleToEncodedIter>(key: KArg) -> Vec<u8> {
|
||||
H::hash(&key.to_encoded_iter().next().expect("should have at least one element!"))
|
||||
@@ -114,7 +114,7 @@ impl KeyGenerator for Tuple {
|
||||
for_tuples!( type HArg = ( #(Tuple::HashFn),* ); );
|
||||
type HashFn = Box<dyn FnOnce(&[u8]) -> Vec<u8>>;
|
||||
|
||||
const HASHER_METADATA: &'static [crate::metadata_ir::StorageHasherIR] =
|
||||
const HASHER_METADATA: &'static [sp_metadata_ir::StorageHasherIR] =
|
||||
&[for_tuples!( #(Tuple::Hasher::METADATA),* )];
|
||||
|
||||
fn final_key<KArg: EncodeLikeTuple<Self::KArg> + TupleToEncodedIter>(key: KArg) -> Vec<u8> {
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
//! methods directly.
|
||||
|
||||
use crate::{
|
||||
metadata_ir::{StorageEntryMetadataIR, StorageEntryTypeIR},
|
||||
storage::{
|
||||
types::{OptionQuery, QueryKindTrait, StorageEntryMetadataBuilder},
|
||||
KeyLenOf, StorageAppend, StorageDecodeLength, StoragePrefixedMap, StorageTryAppend,
|
||||
@@ -29,6 +28,7 @@ use crate::{
|
||||
};
|
||||
use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen};
|
||||
use sp_arithmetic::traits::SaturatedConversion;
|
||||
use sp_metadata_ir::{StorageEntryMetadataIR, StorageEntryTypeIR};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
/// A type that allow to store value for given key. Allowing to insert/remove/iterate on values.
|
||||
@@ -511,10 +511,10 @@ mod test {
|
||||
use super::*;
|
||||
use crate::{
|
||||
hash::*,
|
||||
metadata_ir::{StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR},
|
||||
storage::{types::ValueQuery, IterableStorageMap},
|
||||
};
|
||||
use sp_io::{hashing::twox_128, TestExternalities};
|
||||
use sp_metadata_ir::{StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR};
|
||||
|
||||
struct Prefix;
|
||||
impl StorageInstance for Prefix {
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
//! Storage types to build abstraction on storage, they implements storage traits such as
|
||||
//! StorageMap and others.
|
||||
|
||||
use crate::metadata_ir::{StorageEntryMetadataIR, StorageEntryModifierIR};
|
||||
use codec::FullCodec;
|
||||
use sp_metadata_ir::{StorageEntryMetadataIR, StorageEntryModifierIR};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
mod counted_map;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
//! traits and their methods directly.
|
||||
|
||||
use crate::{
|
||||
metadata_ir::{StorageEntryMetadataIR, StorageEntryTypeIR},
|
||||
storage::{
|
||||
types::{
|
||||
EncodeLikeTuple, HasKeyPrefix, HasReversibleKeyPrefix, OptionQuery, QueryKindTrait,
|
||||
@@ -30,6 +29,7 @@ use crate::{
|
||||
traits::{Get, GetDefault, StorageInfo, StorageInstance},
|
||||
};
|
||||
use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen};
|
||||
use sp_metadata_ir::{StorageEntryMetadataIR, StorageEntryTypeIR};
|
||||
use sp_runtime::SaturatedConversion;
|
||||
use sp_std::prelude::*;
|
||||
|
||||
@@ -620,10 +620,10 @@ mod test {
|
||||
use super::*;
|
||||
use crate::{
|
||||
hash::{StorageHasher as _, *},
|
||||
metadata_ir::{StorageEntryModifierIR, StorageHasherIR},
|
||||
storage::types::{Key as NMapKey, ValueQuery},
|
||||
};
|
||||
use sp_io::{hashing::twox_128, TestExternalities};
|
||||
use sp_metadata_ir::{StorageEntryModifierIR, StorageHasherIR};
|
||||
|
||||
struct Prefix;
|
||||
impl StorageInstance for Prefix {
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
//! Storage value type. Implements StorageValue trait and its method directly.
|
||||
|
||||
use crate::{
|
||||
metadata_ir::{StorageEntryMetadataIR, StorageEntryTypeIR},
|
||||
storage::{
|
||||
generator::StorageValue as StorageValueT,
|
||||
types::{OptionQuery, QueryKindTrait, StorageEntryMetadataBuilder},
|
||||
@@ -28,6 +27,7 @@ use crate::{
|
||||
};
|
||||
use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen};
|
||||
use sp_arithmetic::traits::SaturatedConversion;
|
||||
use sp_metadata_ir::{StorageEntryMetadataIR, StorageEntryTypeIR};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
/// A type that allow to store a value.
|
||||
@@ -278,8 +278,9 @@ where
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::{metadata_ir::StorageEntryModifierIR, storage::types::ValueQuery};
|
||||
use crate::storage::types::ValueQuery;
|
||||
use sp_io::{hashing::twox_128, TestExternalities};
|
||||
use sp_metadata_ir::StorageEntryModifierIR;
|
||||
|
||||
struct Prefix;
|
||||
impl StorageInstance for Prefix {
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
// limitations under the License.
|
||||
|
||||
use super::*;
|
||||
use crate::metadata_ir::{
|
||||
use sp_io::{MultiRemovalResults, TestExternalities};
|
||||
use sp_metadata_ir::{
|
||||
PalletStorageMetadataIR, StorageEntryMetadataIR, StorageEntryModifierIR, StorageEntryTypeIR,
|
||||
StorageHasherIR,
|
||||
};
|
||||
use sp_io::{MultiRemovalResults, TestExternalities};
|
||||
use sp_runtime::{generic, traits::BlakeTwo256, BuildStorage};
|
||||
|
||||
pub use self::frame_system::{pallet_prelude::*, Config, Pallet};
|
||||
|
||||
@@ -103,7 +103,7 @@ macro_rules! impl_filter_stack {
|
||||
mod $module {
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
use $crate::sp_std::{boxed::Box, cell::RefCell, mem::{swap, take}, vec::Vec};
|
||||
use $crate::__private::sp_std::{boxed::Box, cell::RefCell, mem::{swap, take}, vec::Vec};
|
||||
use $crate::traits::filter::{Contains, FilterStack};
|
||||
|
||||
thread_local! {
|
||||
|
||||
@@ -42,7 +42,7 @@ pub const DEFENSIVE_OP_INTERNAL_ERROR: &str = "Defensive failure has been trigge
|
||||
#[macro_export]
|
||||
macro_rules! defensive {
|
||||
() => {
|
||||
frame_support::log::error!(
|
||||
frame_support::__private::log::error!(
|
||||
target: "runtime",
|
||||
"{}",
|
||||
$crate::traits::DEFENSIVE_OP_PUBLIC_ERROR
|
||||
@@ -50,7 +50,7 @@ macro_rules! defensive {
|
||||
debug_assert!(false, "{}", $crate::traits::DEFENSIVE_OP_INTERNAL_ERROR);
|
||||
};
|
||||
($error:expr $(,)?) => {
|
||||
frame_support::log::error!(
|
||||
frame_support::__private::log::error!(
|
||||
target: "runtime",
|
||||
"{}: {:?}",
|
||||
$crate::traits::DEFENSIVE_OP_PUBLIC_ERROR,
|
||||
@@ -59,7 +59,7 @@ macro_rules! defensive {
|
||||
debug_assert!(false, "{}: {:?}", $crate::traits::DEFENSIVE_OP_INTERNAL_ERROR, $error);
|
||||
};
|
||||
($error:expr, $proof:expr $(,)?) => {
|
||||
frame_support::log::error!(
|
||||
frame_support::__private::log::error!(
|
||||
target: "runtime",
|
||||
"{}: {:?}: {:?}",
|
||||
$crate::traits::DEFENSIVE_OP_PUBLIC_ERROR,
|
||||
|
||||
@@ -279,7 +279,8 @@ impl StorePreimage for () {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{bounded_vec, BoundedVec};
|
||||
use crate::BoundedVec;
|
||||
use sp_runtime::bounded_vec;
|
||||
|
||||
#[test]
|
||||
fn bounded_size_is_correct() {
|
||||
|
||||
@@ -17,11 +17,10 @@
|
||||
|
||||
//! Traits for encoding data related to pallet's storage items.
|
||||
|
||||
use crate::sp_std::collections::btree_set::BTreeSet;
|
||||
use impl_trait_for_tuples::impl_for_tuples;
|
||||
pub use sp_core::storage::TrackedStorageKey;
|
||||
use sp_runtime::traits::Saturating;
|
||||
use sp_std::prelude::*;
|
||||
use sp_runtime::{traits::Saturating, RuntimeDebug};
|
||||
use sp_std::{collections::btree_set::BTreeSet, prelude::*};
|
||||
|
||||
/// An instance of a pallet in the storage.
|
||||
///
|
||||
@@ -61,7 +60,7 @@ pub trait StorageInstance {
|
||||
|
||||
/// Metadata about storage from the runtime.
|
||||
#[derive(
|
||||
codec::Encode, codec::Decode, crate::RuntimeDebug, Eq, PartialEq, Clone, scale_info::TypeInfo,
|
||||
codec::Encode, codec::Decode, RuntimeDebug, Eq, PartialEq, Clone, scale_info::TypeInfo,
|
||||
)]
|
||||
pub struct StorageInfo {
|
||||
/// Encoded string of pallet name.
|
||||
|
||||
@@ -175,7 +175,7 @@ impl<BlockNumber: Clone + sp_std::fmt::Debug + AtLeast32BitUnsigned> TryState<Bl
|
||||
{
|
||||
result = result.and(try_state_fn(n.clone(), targets.clone()));
|
||||
} else {
|
||||
crate::log::warn!(
|
||||
log::warn!(
|
||||
"Pallet {:?} not found",
|
||||
sp_std::str::from_utf8(pallet_name).unwrap_or_default()
|
||||
);
|
||||
|
||||
@@ -210,8 +210,8 @@ pub trait KeyOwnerProofSystem<Key> {
|
||||
impl<Key> KeyOwnerProofSystem<Key> for () {
|
||||
// The proof and identification tuples is any bottom type to guarantee that the methods of this
|
||||
// implementation can never be called or return anything other than `None`.
|
||||
type Proof = crate::Void;
|
||||
type IdentificationTuple = crate::Void;
|
||||
type Proof = sp_core::Void;
|
||||
type IdentificationTuple = sp_core::Void;
|
||||
|
||||
fn prove(_key: Key) -> Option<Self::Proof> {
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user