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:
Juan
2023-08-23 14:30:12 +02:00
committed by GitHub
parent 574592d1cf
commit 878c562cd4
125 changed files with 449 additions and 398 deletions
+12
View File
@@ -2915,6 +2915,7 @@ dependencies = [
"frame-support",
"frame-system",
"frame-try-runtime",
"log",
"pallet-balances",
"pallet-transaction-payment",
"parity-scale-codec",
@@ -2994,6 +2995,7 @@ dependencies = [
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-metadata-ir",
"sp-runtime",
"sp-staking",
"sp-state-machine",
@@ -3046,6 +3048,7 @@ version = "3.0.0"
dependencies = [
"frame-benchmarking",
"frame-executive",
"frame-metadata",
"frame-support",
"frame-support-test-pallet",
"frame-system",
@@ -3058,6 +3061,7 @@ dependencies = [
"sp-arithmetic",
"sp-core",
"sp-io",
"sp-metadata-ir",
"sp-runtime",
"sp-state-machine",
"sp-std",
@@ -6203,6 +6207,7 @@ dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"log",
"pallet-balances",
"parity-scale-codec",
"scale-info",
@@ -6233,6 +6238,7 @@ version = "4.0.0-dev"
dependencies = [
"frame-support",
"frame-system",
"log",
"pallet-timestamp",
"parity-scale-codec",
"scale-info",
@@ -6378,6 +6384,7 @@ dependencies = [
"frame-election-provider-support",
"frame-support",
"frame-system",
"log",
"pallet-authorship",
"pallet-balances",
"pallet-offences",
@@ -6394,6 +6401,7 @@ dependencies = [
"sp-runtime",
"sp-session",
"sp-staking",
"sp-state-machine",
"sp-std",
]
@@ -6418,6 +6426,7 @@ dependencies = [
"sp-io",
"sp-runtime",
"sp-staking",
"sp-state-machine",
"sp-std",
]
@@ -6989,6 +6998,7 @@ dependencies = [
"frame-support",
"frame-system",
"itertools",
"log",
"parity-scale-codec",
"scale-info",
"sp-core",
@@ -7257,6 +7267,7 @@ dependencies = [
"scale-info",
"sp-core",
"sp-io",
"sp-metadata-ir",
"sp-runtime",
"sp-std",
]
@@ -7480,6 +7491,7 @@ dependencies = [
"sp-runtime",
"sp-session",
"sp-staking",
"sp-state-machine",
"sp-std",
"sp-trie",
]
+2 -1
View File
@@ -47,7 +47,7 @@ use frame_support::{
},
ConstantMultiplier, IdentityFee, Weight,
},
BoundedVec, PalletId, RuntimeDebug,
BoundedVec, PalletId,
};
use frame_system::{
limits::{BlockLength, BlockWeights},
@@ -78,6 +78,7 @@ use sp_runtime::{
},
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Percent, Permill, Perquintill,
RuntimeDebug,
};
use sp_std::prelude::*;
#[cfg(any(feature = "std", test))]
+2 -2
View File
@@ -94,6 +94,7 @@ pub mod migration;
mod types;
pub mod weights;
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use sp_runtime::{
@@ -103,13 +104,11 @@ use sp_runtime::{
use sp_std::{convert::TryInto, prelude::*};
use frame_support::{
codec::{Decode, Encode, MaxEncodedLen},
dispatch::{
DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo,
PostDispatchInfo,
},
ensure,
scale_info::TypeInfo,
traits::{
ChangeMembers, Currency, Get, InitializeMembers, IsSubType, OnUnbalanced,
ReservableCurrency,
@@ -117,6 +116,7 @@ use frame_support::{
weights::Weight,
};
use pallet_identity::IdentityField;
use scale_info::TypeInfo;
pub use pallet::*;
pub use types::*;
@@ -25,6 +25,7 @@ use frame_benchmarking::v2::*;
use frame_support::assert_ok;
use frame_system::RawOrigin;
use sp_core::crypto::FromEntropy;
use sp_std::vec;
/// Trait describing the factory function for the `AssetKind` parameter.
pub trait AssetKindFactory<AssetKind> {
+2
View File
@@ -14,6 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
log = { version = "0.4.17", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
sp-std = { version = "8.0.0", default-features = false, path = "../../primitives/std" }
# Needed for various traits. In our case, `OnFinalize`.
@@ -34,6 +35,7 @@ pallet-balances = { version = "4.0.0-dev", path = "../balances" }
default = ["std"]
std = [
"codec/std",
"log/std",
"scale-info/std",
"sp-core/std",
"sp-std/std",
+2 -1
View File
@@ -16,7 +16,8 @@
// limitations under the License.
use super::*;
use frame_support::{log, traits::OnRuntimeUpgrade};
use frame_support::traits::OnRuntimeUpgrade;
use log;
#[cfg(feature = "try-runtime")]
use sp_runtime::TryRuntimeError;
+2
View File
@@ -14,6 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive", "max-encoded-len"] }
log = { version = "0.4.17", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }
@@ -31,6 +32,7 @@ sp-io = { version = "23.0.0", path = "../../primitives/io" }
default = ["std"]
std = [
"codec/std",
"log/std",
"frame-support/std",
"frame-system/std",
"pallet-timestamp/std",
+1 -1
View File
@@ -40,10 +40,10 @@
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
log,
traits::{DisabledValidators, FindAuthor, Get, OnTimestampSet, OneSessionHandler},
BoundedSlice, BoundedVec, ConsensusEngineId, Parameter,
};
use log;
use sp_consensus_aura::{AuthorityIndex, ConsensusLog, Slot, AURA_ENGINE_ID};
use sp_runtime::{
generic::DigestItem,
+2 -2
View File
@@ -30,7 +30,6 @@ use frame_support::{
StorageMapShim, StoredMap, WhitelistedStorageKeys,
},
weights::{IdentityFee, Weight},
RuntimeDebug,
};
use frame_system::{self as system, RawOrigin};
use pallet_transaction_payment::{ChargeTransactionPayment, CurrencyAdapter, Multiplier};
@@ -39,7 +38,8 @@ use sp_core::{hexdisplay::HexDisplay, H256};
use sp_io;
use sp_runtime::{
traits::{BadOrigin, IdentityLookup, SignedExtension, Zero},
ArithmeticError, BuildStorage, DispatchError, DispatchResult, FixedPointNumber, TokenError,
ArithmeticError, BuildStorage, DispatchError, DispatchResult, FixedPointNumber, RuntimeDebug,
TokenError,
};
use std::collections::BTreeSet;
+2 -5
View File
@@ -20,12 +20,9 @@
use crate::{Config, CreditOf, Event, Pallet};
use codec::{Decode, Encode, MaxEncodedLen};
use core::ops::BitOr;
use frame_support::{
traits::{Imbalance, LockIdentifier, OnUnbalanced, WithdrawReasons},
RuntimeDebug,
};
use frame_support::traits::{Imbalance, LockIdentifier, OnUnbalanced, WithdrawReasons};
use scale_info::TypeInfo;
use sp_runtime::Saturating;
use sp_runtime::{RuntimeDebug, Saturating};
/// Simplified reasons for withdrawing balance.
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, MaxEncodedLen, TypeInfo)]
+3 -1
View File
@@ -26,6 +26,7 @@ sp-io = { version = "23.0.0", default-features = false, path = "../../primitives
sp-runtime = { version = "24.0.0", default-features = false, path = "../../primitives/runtime" }
sp-std = { version = "8.0.0", default-features = false, path = "../../primitives/std" }
sp-api = { version = "4.0.0-dev", default-features = false, path = "../../primitives/api" }
sp-state-machine = { version = "0.28.0", default-features = false, path = "../../primitives/state-machine" }
[dev-dependencies]
array-bytes = "6.1"
@@ -51,7 +52,8 @@ std = [
"sp-runtime/std",
"sp-std/std",
"sp-api/std",
"sp-staking/std"
"sp-staking/std",
"sp-state-machine/std"
]
try-runtime = [
"frame-support/try-runtime",
+2 -2
View File
@@ -20,18 +20,18 @@ use std::vec;
use codec::Encode;
use frame_support::{
construct_runtime, parameter_types,
sp_io::TestExternalities,
traits::{ConstU16, ConstU32, ConstU64},
BasicExternalities,
};
use sp_consensus_beefy::mmr::MmrLeafVersion;
use sp_core::H256;
use sp_io::TestExternalities;
use sp_runtime::{
app_crypto::ecdsa::Public,
impl_opaque_keys,
traits::{BlakeTwo256, ConvertInto, IdentityLookup, Keccak256, OpaqueKeys},
BuildStorage,
};
use sp_state_machine::BasicExternalities;
use crate as pallet_beefy_mmr;
+5 -1
View File
@@ -10,6 +10,7 @@ homepage = "https://substrate.io"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] }
log = { version = "0.4.17", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = ["derive", "serde"] }
serde = { version = "1.0.163", optional = true }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
@@ -32,11 +33,13 @@ pallet-timestamp = { version = "4.0.0-dev", path = "../timestamp" }
sp-core = { version = "21.0.0", path = "../../primitives/core" }
sp-io = { version = "23.0.0", path = "../../primitives/io" }
sp-staking = { version = "4.0.0-dev", path = "../../primitives/staking" }
sp-state-machine = { version = "0.28.0", default-features = false, path = "../../primitives/state-machine" }
[features]
default = ["std"]
std = [
"codec/std",
"log/std",
"frame-support/std",
"frame-system/std",
"pallet-authorship/std",
@@ -54,7 +57,8 @@ std = [
"pallet-staking/std",
"pallet-timestamp/std",
"sp-core/std",
"sp-io/std"
"sp-io/std",
"sp-state-machine/std"
]
try-runtime = [
"frame-support/try-runtime",
+1 -4
View File
@@ -35,10 +35,7 @@
//! definition.
use codec::{self as codec, Decode, Encode};
use frame_support::{
log,
traits::{Get, KeyOwnerProofSystem},
};
use frame_support::traits::{Get, KeyOwnerProofSystem};
use frame_system::pallet_prelude::BlockNumberFor;
use log::{error, info};
use sp_consensus_beefy::{EquivocationProof, ValidatorSetId, KEY_TYPE as BEEFY_KEY_TYPE};
+1 -1
View File
@@ -21,7 +21,6 @@ use codec::{Encode, MaxEncodedLen};
use frame_support::{
dispatch::{DispatchResultWithPostInfo, Pays},
log,
pallet_prelude::*,
traits::{Get, OneSessionHandler},
weights::Weight,
@@ -31,6 +30,7 @@ use frame_system::{
ensure_none, ensure_signed,
pallet_prelude::{BlockNumberFor, OriginFor},
};
use log;
use sp_runtime::{
generic::DigestItem,
traits::{IsMember, Member},
+2 -2
View File
@@ -23,12 +23,11 @@ use frame_election_provider_support::{
};
use frame_support::{
construct_runtime, parameter_types,
sp_io::TestExternalities,
traits::{ConstU16, ConstU32, ConstU64, KeyOwnerProofSystem, OnFinalize, OnInitialize},
BasicExternalities,
};
use pallet_session::historical as pallet_session_historical;
use sp_core::{crypto::KeyTypeId, ConstU128, H256};
use sp_io::TestExternalities;
use sp_runtime::{
app_crypto::ecdsa::Public,
curve::PiecewiseLinear,
@@ -38,6 +37,7 @@ use sp_runtime::{
BuildStorage, Perbill,
};
use sp_staking::{EraIndex, SessionIndex};
use sp_state_machine::BasicExternalities;
use crate as pallet_beefy;
+2 -2
View File
@@ -446,13 +446,13 @@ macro_rules! benchmarks_iter {
>:: [< new_call_variant_ $dispatch >] (
$($arg),*
);
let __benchmarked_call_encoded = $crate::frame_support::codec::Encode::encode(
let __benchmarked_call_encoded = $crate::frame_support::__private::codec::Encode::encode(
&__call
);
}: {
let __call_decoded = <
Call<T $(, $instance )?>
as $crate::frame_support::codec::Decode
as $crate::frame_support::__private::codec::Decode
>::decode(&mut &__benchmarked_call_encoded[..])
.expect("call is encoded above, encoding must be correct");
let __origin = $crate::to_origin!($origin $(, $origin_type)?);
+1 -1
View File
@@ -42,13 +42,13 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![recursion_limit = "128"]
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_io::storage;
use sp_runtime::{traits::Hash, RuntimeDebug};
use sp_std::{marker::PhantomData, prelude::*, result};
use frame_support::{
codec::{Decode, Encode, MaxEncodedLen},
dispatch::{
DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo,
Pays, PostDispatchInfo,
+5 -2
View File
@@ -122,7 +122,7 @@ use frame_support::{
ConstU32, Contains, Get, Randomness, Time,
},
weights::Weight,
BoundedVec, DefaultNoBound, RuntimeDebug, RuntimeDebugNoBound,
BoundedVec, DefaultNoBound, RuntimeDebugNoBound,
};
use frame_system::{
ensure_signed,
@@ -136,7 +136,10 @@ use pallet_contracts_primitives::{
};
use scale_info::TypeInfo;
use smallvec::Array;
use sp_runtime::traits::{Convert, Hash, Saturating, StaticLookup, Zero};
use sp_runtime::{
traits::{Convert, Hash, Saturating, StaticLookup, Zero},
RuntimeDebug,
};
use sp_std::{fmt::Debug, prelude::*};
pub use crate::{
@@ -69,7 +69,6 @@ include!(concat!(env!("OUT_DIR"), "/migration_codegen.rs"));
use crate::{weights::WeightInfo, Config, Error, MigrationInProgress, Pallet, Weight, LOG_TARGET};
use codec::{Codec, Decode};
use frame_support::{
codec,
pallet_prelude::*,
traits::{ConstU32, OnRuntimeUpgrade},
};
@@ -23,7 +23,7 @@ use crate::{
CodeHash, Config, Determinism, Pallet, Weight, LOG_TARGET,
};
use codec::{Decode, Encode};
use frame_support::{codec, pallet_prelude::*, storage_alias, DefaultNoBound, Identity};
use frame_support::{pallet_prelude::*, storage_alias, DefaultNoBound, Identity};
#[cfg(feature = "try-runtime")]
use sp_runtime::TryRuntimeError;
use sp_std::prelude::*;
@@ -27,7 +27,6 @@ use crate::{
use codec::{Decode, Encode};
use core::cmp::{max, min};
use frame_support::{
codec,
pallet_prelude::*,
storage_alias,
traits::{
@@ -27,7 +27,7 @@ use crate::{
use sp_runtime::TryRuntimeError;
use codec::{Decode, Encode};
use frame_support::{codec, pallet_prelude::*, storage_alias, DefaultNoBound};
use frame_support::{pallet_prelude::*, storage_alias, DefaultNoBound};
use sp_std::{marker::PhantomData, prelude::*};
mod old {
use super::*;
@@ -25,7 +25,7 @@ use crate::{
};
use codec::{Decode, Encode};
use frame_support::{
codec, pallet_prelude::*, storage_alias, traits::ReservableCurrency, DefaultNoBound, Identity,
pallet_prelude::*, storage_alias, traits::ReservableCurrency, DefaultNoBound, Identity,
};
use scale_info::prelude::format;
use sp_core::hexdisplay::HexDisplay;
@@ -24,7 +24,7 @@ use crate::{
AccountIdOf, BalanceOf, CodeHash, Config, Pallet, TrieId, Weight, LOG_TARGET,
};
use codec::{Decode, Encode};
use frame_support::{codec, pallet_prelude::*, storage_alias, DefaultNoBound};
use frame_support::{pallet_prelude::*, storage_alias, DefaultNoBound};
use sp_runtime::BoundedBTreeMap;
use sp_std::prelude::*;
@@ -32,7 +32,6 @@ use environmental::Vec;
#[cfg(feature = "try-runtime")]
use frame_support::traits::fungible::{Inspect, InspectHold};
use frame_support::{
codec,
pallet_prelude::*,
storage_alias,
traits::{fungible::MutateHold, ReservableCurrency},
@@ -26,11 +26,14 @@ use crate::{
use bitflags::bitflags;
use codec::{Decode, DecodeLimit, Encode, MaxEncodedLen};
use frame_support::{dispatch::DispatchError, ensure, traits::Get, weights::Weight, RuntimeDebug};
use frame_support::{dispatch::DispatchError, ensure, traits::Get, weights::Weight};
use pallet_contracts_primitives::{ExecReturnValue, ReturnFlags};
use pallet_contracts_proc_macro::define_env;
use sp_io::hashing::{blake2_128, blake2_256, keccak_256, sha2_256};
use sp_runtime::traits::{Bounded, Zero};
use sp_runtime::{
traits::{Bounded, Zero},
RuntimeDebug,
};
use sp_std::{fmt, prelude::*};
use wasmi::{core::HostError, errors::LinkerError, Linker, Memory, Store};
+2 -1
View File
@@ -61,6 +61,7 @@
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_arithmetic::traits::{Saturating, Zero};
use sp_runtime::RuntimeDebug;
use sp_std::{marker::PhantomData, prelude::*};
use frame_support::{
@@ -69,7 +70,7 @@ use frame_support::{
traits::{
tokens::Balance as BalanceTrait, EnsureOrigin, EnsureOriginWithArg, Get, RankedMembers,
},
BoundedVec, RuntimeDebug,
BoundedVec,
};
#[cfg(test)]
@@ -159,7 +159,7 @@ mod test {
tests::{Test as T, *},
types::*,
};
use frame_support::bounded_vec;
use sp_runtime::bounded_vec;
#[allow(deprecated)]
#[test]
@@ -23,7 +23,7 @@ use frame_election_provider_support::{
};
pub use frame_support::{assert_noop, assert_ok, pallet_prelude::GetDefault};
use frame_support::{
bounded_vec, parameter_types,
parameter_types,
traits::{ConstU32, Hooks},
weights::{constants, Weight},
BoundedVec,
@@ -42,6 +42,7 @@ use sp_npos_elections::{
ElectionResult, EvaluateSupport,
};
use sp_runtime::{
bounded_vec,
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
BuildStorage, PerU16,
@@ -985,11 +985,10 @@ mod tests {
use codec::Decode;
use frame_benchmarking::Zero;
use frame_election_provider_support::IndexAssignment;
use frame_support::{
assert_noop, assert_ok, bounded_vec, dispatch::Dispatchable, traits::OffchainWorker,
};
use frame_support::{assert_noop, assert_ok, dispatch::Dispatchable, traits::OffchainWorker};
use sp_npos_elections::ElectionScore;
use sp_runtime::{
bounded_vec,
offchain::storage_lock::{BlockAndTime, StorageLock},
traits::ValidateUnsigned,
ModuleError, PerU16, Perbill,
@@ -82,7 +82,7 @@
//! # use frame_election_provider_support::{*, data_provider};
//! # use sp_npos_elections::{Support, Assignment};
//! # use frame_support::traits::ConstU32;
//! # use frame_support::bounded_vec;
//! # use sp_runtime::bounded_vec;
//!
//! type AccountId = u64;
//! type Balance = u64;
@@ -177,14 +177,17 @@ pub mod bounds;
pub mod onchain;
pub mod traits;
use sp_runtime::traits::{Bounded, Saturating, Zero};
use sp_runtime::{
traits::{Bounded, Saturating, Zero},
RuntimeDebug,
};
use sp_std::{fmt::Debug, prelude::*};
pub use bounds::DataProviderBounds;
pub use codec::{Decode, Encode};
/// Re-export the solution generation macro.
pub use frame_election_provider_solution_type::generate_solution_type;
pub use frame_support::{traits::Get, weights::Weight, BoundedVec, RuntimeDebug};
pub use frame_support::{traits::Get, weights::Weight, BoundedVec};
/// Re-export some type as they are used in the interface.
pub use sp_arithmetic::PerThing;
pub use sp_npos_elections::{
@@ -254,7 +254,8 @@ mod tests {
}
mod mock_data_provider {
use frame_support::{bounded_vec, traits::ConstU32};
use frame_support::traits::ConstU32;
use sp_runtime::bounded_vec;
use super::*;
use crate::{data_provider, VoterOf};
@@ -107,6 +107,7 @@ use frame_support::{
},
weights::Weight,
};
use log;
use scale_info::TypeInfo;
use sp_npos_elections::{ElectionResult, ExtendedBalance};
use sp_runtime::{
@@ -309,7 +310,7 @@ pub mod pallet {
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND as f32
};
frame_support::log::debug!(
log::debug!(
target: LOG_TARGET,
"election weight {}s ({:?}) // chain's block weight {}s ({:?})",
to_seconds(&election_weight),
@@ -21,8 +21,9 @@ use super::super::LOG_TARGET;
use crate::{Config, Pallet};
use codec::{Decode, Encode, FullCodec};
use frame_support::{
pallet_prelude::ValueQuery, traits::StorageVersion, weights::Weight, RuntimeDebug, Twox64Concat,
pallet_prelude::ValueQuery, traits::StorageVersion, weights::Weight, Twox64Concat,
};
use sp_runtime::RuntimeDebug;
use sp_std::prelude::*;
#[derive(Encode, Decode, Clone, Default, RuntimeDebug, PartialEq)]
+2
View File
@@ -16,6 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [
"derive",
] }
log = { version = "0.4.17", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }
@@ -40,6 +41,7 @@ default = ["std"]
with-tracing = ["sp-tracing/with-tracing"]
std = [
"codec/std",
"log/std",
"frame-support/std",
"frame-system/std",
"frame-try-runtime/std",
+6 -4
View File
@@ -138,6 +138,8 @@ use sp_runtime::{
};
use sp_std::{marker::PhantomData, prelude::*};
#[cfg(feature = "try-runtime")]
use log;
#[cfg(feature = "try-runtime")]
use sp_runtime::TryRuntimeError;
@@ -252,7 +254,7 @@ where
signature_check: bool,
select: frame_try_runtime::TryStateSelect,
) -> Result<Weight, &'static str> {
frame_support::log::info!(
log::info!(
target: LOG_TARGET,
"try-runtime: executing block #{:?} / state root check: {:?} / signature check: {:?} / try-state-select: {:?}",
block.header().number(),
@@ -289,7 +291,7 @@ where
for e in extrinsics {
if let Err(err) = try_apply_extrinsic(e.clone()) {
frame_support::log::error!(
log::error!(
target: LOG_TARGET, "executing transaction {:?} failed due to {:?}. Aborting the rest of the block execution.",
e,
err,
@@ -308,7 +310,7 @@ where
BlockNumberFor<System>,
>>::try_state(*header.number(), select)
.map_err(|e| {
frame_support::log::error!(target: LOG_TARGET, "failure: {:?}", e);
log::error!(target: LOG_TARGET, "failure: {:?}", e);
e
})?;
drop(_guard);
@@ -338,7 +340,7 @@ where
);
}
frame_support::log::info!(
log::info!(
target: LOG_TARGET,
"try-runtime: Block #{:?} successfully executed",
header.number(),
+2 -2
View File
@@ -61,12 +61,12 @@ use frame_support::{
pallet_prelude::MaxEncodedLen,
storage::bounded_vec::BoundedVec,
traits::{Currency, ExistenceRequirement::KeepAlive, Get, Randomness, ReservableCurrency},
PalletId, RuntimeDebug,
PalletId,
};
pub use pallet::*;
use sp_runtime::{
traits::{AccountIdConversion, Saturating, Zero},
ArithmeticError, DispatchError,
ArithmeticError, DispatchError, RuntimeDebug,
};
use sp_std::prelude::*;
pub use weights::WeightInfo;
+2 -1
View File
@@ -525,12 +525,13 @@ mod tests {
use sp_core::H256;
use sp_runtime::{
bounded_vec,
traits::{BadOrigin, BlakeTwo256, IdentityLookup},
BuildStorage,
};
use frame_support::{
assert_noop, assert_ok, bounded_vec, ord_parameter_types, parameter_types,
assert_noop, assert_ok, ord_parameter_types, parameter_types,
traits::{ConstU32, ConstU64, StorageVersion},
};
use frame_system::EnsureSignedBy;
@@ -13,6 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
log = { version = "0.4.17", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
@@ -32,6 +33,7 @@ itertools = "0.10.3"
default = ["std"]
std = [
"codec/std",
"log/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
@@ -56,8 +56,9 @@
//! NOTE This pallet is experimental and not proven to work in production.
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::{log, weights::Weight};
use frame_support::weights::Weight;
use frame_system::pallet_prelude::{BlockNumberFor, HeaderFor};
use log;
use sp_mmr_primitives::utils;
use sp_runtime::{
traits::{self, One, Saturating},
@@ -18,7 +18,7 @@
//! An MMR storage implementation.
use codec::Encode;
use frame_support::log::{debug, trace};
use log::{debug, trace};
use sp_core::offchain::StorageKind;
use sp_io::offchain_index;
use sp_mmr_primitives::{mmr_lib, mmr_lib::helper, utils::NodesUtils};
+2 -2
View File
@@ -57,14 +57,14 @@ use frame_support::{
ensure,
traits::{Currency, Get, ReservableCurrency},
weights::Weight,
BoundedVec, RuntimeDebug,
BoundedVec,
};
use frame_system::{self as system, pallet_prelude::BlockNumberFor, RawOrigin};
use scale_info::TypeInfo;
use sp_io::hashing::blake2_256;
use sp_runtime::{
traits::{Dispatchable, TrailingZeroInput, Zero},
DispatchError,
DispatchError, RuntimeDebug,
};
use sp_std::prelude::*;
pub use weights::WeightInfo;
+2 -1
View File
@@ -16,7 +16,8 @@
// limitations under the License.
use super::*;
use frame_support::{log, traits::OnRuntimeUpgrade};
use frame_support::traits::OnRuntimeUpgrade;
use log;
#[cfg(feature = "try-runtime")]
use sp_runtime::TryRuntimeError;
@@ -17,9 +17,9 @@
use super::*;
use crate::{mock::*, Event};
use frame_support::{assert_err, assert_noop, assert_ok, assert_storage_noop, bounded_btree_map};
use frame_support::{assert_err, assert_noop, assert_ok, assert_storage_noop};
use pallet_balances::Event as BEvent;
use sp_runtime::{traits::Dispatchable, FixedU128};
use sp_runtime::{bounded_btree_map, traits::Dispatchable, FixedU128};
macro_rules! unbonding_pools_with_era {
($($k:expr => $v:expr),* $(,)?) => {{
@@ -3260,7 +3260,7 @@ mod pool_withdraw_unbonded {
mod withdraw_unbonded {
use super::*;
use frame_support::bounded_btree_map;
use sp_runtime::bounded_btree_map;
#[test]
fn withdraw_unbonded_works_against_slashed_no_era_sub_pool() {
@@ -19,14 +19,14 @@
mod mock;
use frame_support::{assert_noop, assert_ok, bounded_btree_map, traits::Currency};
use frame_support::{assert_noop, assert_ok, traits::Currency};
use mock::*;
use pallet_nomination_pools::{
BondedPools, Error as PoolsError, Event as PoolsEvent, LastPoolId, PoolMember, PoolMembers,
PoolState,
};
use pallet_staking::{CurrentEra, Event as StakingEvent, Payee, RewardDestination};
use sp_runtime::traits::Zero;
use sp_runtime::{bounded_btree_map, traits::Zero};
#[test]
fn pool_lifecycle_e2e() {
+17 -1
View File
@@ -24,11 +24,23 @@ sp-runtime = { version = "24.0.0", default-features = false, path = "../../primi
sp-std = { version = "8.0.0", default-features = false, path = "../../primitives/std" }
sp-core = { version = "21.0.0", path = "../../primitives/core", default-features = false }
sp-io = { version = "23.0.0", path = "../../primitives/io", default-features = false }
sp-metadata-ir = { version = "0.1.0", default-features = false, optional = true, path = "../../primitives/metadata-ir" }
[features]
default = ["std"]
std = ["codec/std", "frame-benchmarking?/std", "frame-support/std", "frame-system/std", "scale-info/std", "sp-core/std", "sp-io/std", "sp-runtime/std", "sp-std/std"]
std = [
"codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"sp-metadata-ir/std"
]
runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "sp-runtime/runtime-benchmarks"]
@@ -37,3 +49,7 @@ try-runtime = [
"frame-system/try-runtime",
"sp-runtime/try-runtime"
]
frame-metadata = [
"sp-metadata-ir"
]
+1 -1
View File
@@ -408,12 +408,12 @@ where
pub(crate) mod mock {
pub use super::*;
pub use frame_support::{
metadata_ir::{StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR},
parameter_types,
storage::{types::ValueQuery, StorageList as _},
StorageNoopGuard,
};
pub use sp_io::{hashing::twox_128, TestExternalities};
pub use sp_metadata_ir::{StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR};
parameter_types! {
pub const ValuesPerNewPage: u32 = 5;
+1 -1
View File
@@ -192,7 +192,7 @@ mod test {
use super::*;
use crate::mock::{Test as T, *};
use frame_support::bounded_vec;
use sp_runtime::bounded_vec;
#[test]
fn migration_works() {
+2 -1
View File
@@ -23,12 +23,13 @@ use super::*;
use crate::mock::*;
use frame_support::{
assert_err, assert_noop, assert_ok, assert_storage_noop, bounded_vec,
assert_err, assert_noop, assert_ok, assert_storage_noop,
traits::{Bounded, BoundedInline, Hash as PreimageHash},
StorageNoopGuard,
};
use pallet_balances::Error as BalancesError;
use sp_core::{blake2_256, H256};
use sp_runtime::bounded_vec;
/// Returns one `Inline`, `Lookup` and `Legacy` item each with different data and hash.
pub fn make_bounded_values() -> (Bounded<Vec<u8>>, Bounded<Vec<u8>>, Bounded<Vec<u8>>) {
+1 -2
View File
@@ -38,7 +38,6 @@ use frame_support::{
dispatch::{DispatchError, GetDispatchInfo},
ensure,
traits::{Currency, Get, InstanceFilter, IsSubType, IsType, OriginTrait, ReservableCurrency},
RuntimeDebug,
};
use frame_system::{self as system, ensure_signed, pallet_prelude::BlockNumberFor};
pub use pallet::*;
@@ -46,7 +45,7 @@ use scale_info::TypeInfo;
use sp_io::hashing::blake2_256;
use sp_runtime::{
traits::{Dispatchable, Hash, Saturating, StaticLookup, TrailingZeroInput, Zero},
DispatchResult,
DispatchResult, RuntimeDebug,
};
use sp_std::prelude::*;
pub use weights::WeightInfo;
+1 -2
View File
@@ -27,10 +27,9 @@ use frame_support::{
assert_noop, assert_ok, derive_impl,
dispatch::DispatchError,
traits::{ConstU32, ConstU64, Contains},
RuntimeDebug,
};
use sp_core::H256;
use sp_runtime::{traits::BlakeTwo256, BuildStorage};
use sp_runtime::{traits::BlakeTwo256, BuildStorage, RuntimeDebug};
type Block = frame_system::mocking::MockBlock<Test>;
+1 -1
View File
@@ -41,6 +41,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![recursion_limit = "128"]
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_arithmetic::traits::Saturating;
use sp_runtime::{
@@ -51,7 +52,6 @@ use sp_runtime::{
use sp_std::{marker::PhantomData, prelude::*};
use frame_support::{
codec::{Decode, Encode, MaxEncodedLen},
dispatch::{DispatchError, DispatchResultWithPostInfo, PostDispatchInfo},
ensure, impl_ensure_origin_with_arg_ignoring_arg,
traits::{EnsureOrigin, EnsureOriginWithArg, PollStatus, Polling, RankedMembers, VoteTally},
+5 -2
View File
@@ -152,13 +152,16 @@
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_runtime::traits::{CheckedAdd, CheckedMul, Dispatchable, SaturatedConversion, StaticLookup};
use sp_runtime::{
traits::{CheckedAdd, CheckedMul, Dispatchable, SaturatedConversion, StaticLookup},
RuntimeDebug,
};
use sp_std::prelude::*;
use frame_support::{
dispatch::{GetDispatchInfo, PostDispatchInfo},
traits::{BalanceStatus, Currency, ReservableCurrency},
BoundedVec, RuntimeDebug,
BoundedVec,
};
pub use pallet::*;
+2 -2
View File
@@ -18,12 +18,12 @@
//! Tests for the module.
use super::*;
use frame_support::{assert_noop, assert_ok, bounded_vec, traits::Currency};
use frame_support::{assert_noop, assert_ok, traits::Currency};
use mock::{
new_test_ext, run_to_block, Balances, BalancesCall, MaxFriends, Recovery, RecoveryCall,
RuntimeCall, RuntimeOrigin, Test,
};
use sp_runtime::traits::BadOrigin;
use sp_runtime::{bounded_vec, traits::BadOrigin};
#[test]
fn basic_setup_works() {
+1 -2
View File
@@ -23,7 +23,7 @@
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_arithmetic::traits::{Saturating, Zero};
use sp_runtime::Perbill;
use sp_runtime::{Perbill, RuntimeDebug};
use sp_std::{marker::PhantomData, prelude::*};
use frame_support::{
@@ -33,7 +33,6 @@ use frame_support::{
tokens::{GetSalary, Pay, PaymentStatus},
RankedMembers,
},
RuntimeDebug,
};
#[cfg(test)]
+2 -1
View File
@@ -21,12 +21,13 @@ use super::*;
use crate as pallet_scored_pool;
use frame_support::{
bounded_vec, construct_runtime, ord_parameter_types, parameter_types,
construct_runtime, ord_parameter_types, parameter_types,
traits::{ConstU32, ConstU64},
};
use frame_system::EnsureSignedBy;
use sp_core::H256;
use sp_runtime::{
bounded_vec,
traits::{BlakeTwo256, IdentityLookup},
BuildStorage,
};
+2
View File
@@ -27,6 +27,7 @@ sp-session = { version = "4.0.0-dev", default-features = false, path = "../../pr
sp-staking = { version = "4.0.0-dev", default-features = false, path = "../../primitives/staking", features = ["serde"] }
sp-std = { version = "8.0.0", default-features = false, path = "../../primitives/std" }
sp-trie = { version = "22.0.0", default-features = false, optional = true, path = "../../primitives/trie" }
sp-state-machine = { version = "0.28.0", default-features = false, path = "../../primitives/state-machine" }
[features]
default = ["historical", "std"]
@@ -45,6 +46,7 @@ std = [
"sp-staking/std",
"sp-std/std",
"sp-trie/std",
"sp-state-machine/std",
]
try-runtime = [
"frame-support/try-runtime",
@@ -13,6 +13,7 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
rand = { version = "0.8.5", default-features = false, features = ["std_rng"] }
frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "../../benchmarking" }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" }
@@ -26,11 +26,9 @@ mod mock;
use sp_runtime::traits::{One, StaticLookup, TrailingZeroInput};
use sp_std::{prelude::*, vec};
use codec::Decode;
use frame_benchmarking::v1::benchmarks;
use frame_support::{
codec::Decode,
traits::{Get, KeyOwnerProofSystem, OnInitialize},
};
use frame_support::traits::{Get, KeyOwnerProofSystem, OnInitialize};
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
use pallet_session::{historical::Pallet as Historical, Pallet as Session, *};
use pallet_staking::{
@@ -378,11 +378,9 @@ pub(crate) mod tests {
};
use sp_runtime::{key_types::DUMMY, testing::UintAuthorityId, BuildStorage};
use sp_state_machine::BasicExternalities;
use frame_support::{
traits::{KeyOwnerProofSystem, OnInitialize},
BasicExternalities,
};
use frame_support::traits::{KeyOwnerProofSystem, OnInitialize};
type Historical = Pallet<Test>;
@@ -150,11 +150,9 @@ mod tests {
offchain::{testing::TestOffchainExt, OffchainDbExt, OffchainWorkerExt, StorageKind},
};
use sp_runtime::{testing::UintAuthorityId, BuildStorage};
use sp_state_machine::BasicExternalities;
use frame_support::{
traits::{KeyOwnerProofSystem, OnInitialize},
BasicExternalities,
};
use frame_support::traits::{KeyOwnerProofSystem, OnInitialize};
type Historical = Pallet<Test>;
+1 -1
View File
@@ -115,8 +115,8 @@ mod mock;
mod tests;
pub mod weights;
use codec::{Decode, MaxEncodedLen};
use frame_support::{
codec::{Decode, MaxEncodedLen},
dispatch::{DispatchError, DispatchResult},
ensure,
traits::{
+1 -1
View File
@@ -32,11 +32,11 @@ use sp_runtime::{
BuildStorage,
};
use sp_staking::SessionIndex;
use sp_state_machine::BasicExternalities;
use frame_support::{
parameter_types,
traits::{ConstU32, ConstU64},
BasicExternalities,
};
impl_opaque_keys! {
+1 -1
View File
@@ -296,7 +296,7 @@ pub mod v10 {
pub mod v9 {
use super::*;
#[cfg(feature = "try-runtime")]
use frame_support::codec::{Decode, Encode};
use codec::{Decode, Encode};
#[cfg(feature = "try-runtime")]
use sp_std::vec::Vec;
+2 -2
View File
@@ -23,7 +23,7 @@ use frame_election_provider_support::{
ElectionProvider, SortedListProvider, Support,
};
use frame_support::{
assert_noop, assert_ok, assert_storage_noop, bounded_vec,
assert_noop, assert_ok, assert_storage_noop,
dispatch::{extract_actual_weight, GetDispatchInfo, WithPostDispatchInfo},
pallet_prelude::*,
traits::{Currency, Get, ReservableCurrency},
@@ -31,7 +31,7 @@ use frame_support::{
use mock::*;
use pallet_balances::Error as BalancesError;
use sp_runtime::{
assert_eq_error_rate,
assert_eq_error_rate, bounded_vec,
traits::{BadOrigin, Dispatchable},
Perbill, Percent, Rounding, TokenError,
};
@@ -1268,8 +1268,8 @@ mod mock {
#[cfg(test)]
mod test {
use super::{mock::*, *};
use frame_support::{bounded_vec, dispatch::*};
use sp_runtime::{traits::Bounded, StateVersion};
use frame_support::dispatch::*;
use sp_runtime::{bounded_vec, traits::Bounded, StateVersion};
#[test]
fn fails_if_no_migration() {
+3 -1
View File
@@ -28,6 +28,7 @@ sp-inherents = { version = "4.0.0-dev", default-features = false, path = "../../
sp-staking = { version = "4.0.0-dev", default-features = false, path = "../../primitives/staking" }
sp-weights = { version = "20.0.0", default-features = false, path = "../../primitives/weights" }
sp-debug-derive = { default-features = false, path = "../../primitives/debug-derive" }
sp-metadata-ir = { version = "0.1.0", default-features = false, path = "../../primitives/metadata-ir" }
tt-call = "1.0.8"
macro_magic = "0.4.2"
frame-support-procedural = { version = "4.0.0-dev", default-features = false, path = "./procedural" }
@@ -76,7 +77,8 @@ std = [
"environmental/std",
"sp-genesis-builder/std",
"frame-system/std",
"sp-debug-derive/std"
"sp-debug-derive/std",
"sp-metadata-ir/std"
]
runtime-benchmarks = [
"frame-system/runtime-benchmarks",
@@ -724,7 +724,7 @@ fn expand_benchmark(
Ok(ident) => ident,
Err(err) => return err.to_compile_error().into(),
};
let codec = quote!(#krate::frame_support::codec);
let codec = quote!(#krate::frame_support::__private::codec);
let traits = quote!(#krate::frame_support::traits);
let setup_stmts = benchmark_def.setup_stmts;
let verify_stmts = benchmark_def.verify_stmts;
@@ -68,10 +68,10 @@ pub fn expand_outer_dispatch(
#[derive(
Clone, PartialEq, Eq,
#scrate::codec::Encode,
#scrate::codec::Decode,
#scrate::scale_info::TypeInfo,
#scrate::RuntimeDebug,
#scrate::__private::codec::Encode,
#scrate::__private::codec::Decode,
#scrate::__private::scale_info::TypeInfo,
#scrate::__private::RuntimeDebug,
)]
pub enum RuntimeCall {
#variant_defs
@@ -166,7 +166,7 @@ pub fn expand_outer_dispatch(
type PostInfo = #scrate::dispatch::PostDispatchInfo;
fn dispatch(self, origin: RuntimeOrigin) -> #scrate::dispatch::DispatchResultWithPostInfo {
if !<Self::RuntimeOrigin as #scrate::traits::OriginTrait>::filter_call(&origin, &self) {
return #scrate::sp_std::result::Result::Err(
return #scrate::__private::sp_std::result::Result::Err(
#system_path::Error::<#runtime>::CallFiltered.into()
);
}
@@ -67,8 +67,8 @@ pub fn expand_outer_config(
#types
use #scrate::serde as __genesis_config_serde_import__;
#[derive(#scrate::serde::Serialize, #scrate::serde::Deserialize, Default)]
use #scrate::__private::serde as __genesis_config_serde_import__;
#[derive(#scrate::__private::serde::Serialize, #scrate::__private::serde::Deserialize, Default)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
#[serde(crate = "__genesis_config_serde_import__")]
@@ -86,7 +86,7 @@ pub fn expand_outer_config(
&self,
storage: &mut #scrate::sp_runtime::Storage,
) -> std::result::Result<(), String> {
#scrate::BasicExternalities::execute_with_storage(storage, || {
#scrate::__private::BasicExternalities::execute_with_storage(storage, || {
<Self as #scrate::traits::BuildGenesisConfig>::build(&self);
Ok(())
})
@@ -38,9 +38,9 @@ pub fn expand_outer_freeze_reason(pallet_decls: &[Pallet], scrate: &TokenStream)
/// A reason for placing a freeze on funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen,
#scrate::scale_info::TypeInfo,
#scrate::RuntimeDebug,
#scrate::__private::codec::Encode, #scrate::__private::codec::Decode, #scrate::__private::codec::MaxEncodedLen,
#scrate::__private::scale_info::TypeInfo,
#scrate::__private::RuntimeDebug,
)]
pub enum RuntimeFreezeReason {
#( #freeze_reason_variants )*
@@ -38,9 +38,9 @@ pub fn expand_outer_hold_reason(pallet_decls: &[Pallet], scrate: &TokenStream) -
/// A reason for placing a hold on funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen,
#scrate::scale_info::TypeInfo,
#scrate::RuntimeDebug,
#scrate::__private::codec::Encode, #scrate::__private::codec::Decode, #scrate::__private::codec::MaxEncodedLen,
#scrate::__private::scale_info::TypeInfo,
#scrate::__private::RuntimeDebug,
)]
pub enum RuntimeHoldReason {
#( #hold_reason_variants )*
@@ -58,17 +58,17 @@ pub fn expand_outer_inherent(
trait InherentDataExt {
fn create_extrinsics(&self) ->
#scrate::sp_std::vec::Vec<<#block as #scrate::sp_runtime::traits::Block>::Extrinsic>;
#scrate::__private::sp_std::vec::Vec<<#block as #scrate::sp_runtime::traits::Block>::Extrinsic>;
fn check_extrinsics(&self, block: &#block) -> #scrate::inherent::CheckInherentsResult;
}
impl InherentDataExt for #scrate::inherent::InherentData {
fn create_extrinsics(&self) ->
#scrate::sp_std::vec::Vec<<#block as #scrate::sp_runtime::traits::Block>::Extrinsic>
#scrate::__private::sp_std::vec::Vec<<#block as #scrate::sp_runtime::traits::Block>::Extrinsic>
{
use #scrate::inherent::ProvideInherent;
let mut inherents = #scrate::sp_std::vec::Vec::new();
let mut inherents = #scrate::__private::sp_std::vec::Vec::new();
#(
#pallet_attrs
@@ -91,7 +91,7 @@ pub fn expand_outer_inherent(
use #scrate::traits::{IsSubType, ExtrinsicCall};
use #scrate::sp_runtime::traits::Block as _;
use #scrate::_private::sp_inherents::Error;
use #scrate::log;
use #scrate::__private::log;
let mut result = #scrate::inherent::CheckInherentsResult::new();
@@ -38,9 +38,9 @@ pub fn expand_outer_lock_id(pallet_decls: &[Pallet], scrate: &TokenStream) -> To
/// An identifier for each lock placed on funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen,
#scrate::scale_info::TypeInfo,
#scrate::RuntimeDebug,
#scrate::__private::codec::Encode, #scrate::__private::codec::Decode, #scrate::__private::codec::MaxEncodedLen,
#scrate::__private::scale_info::TypeInfo,
#scrate::__private::RuntimeDebug,
)]
pub enum RuntimeLockId {
#( #lock_id_variants )*
@@ -61,7 +61,7 @@ pub fn expand_runtime_metadata(
quote! {
#attr
#scrate::metadata_ir::PalletMetadataIR {
#scrate::__private::metadata_ir::PalletMetadataIR {
name: stringify!(#name),
index: #index,
storage: #storage,
@@ -77,7 +77,7 @@ pub fn expand_runtime_metadata(
quote! {
impl #runtime {
fn metadata_ir() -> #scrate::metadata_ir::MetadataIR {
fn metadata_ir() -> #scrate::__private::metadata_ir::MetadataIR {
// Each runtime must expose the `runtime_metadata()` to fetch the runtime API metadata.
// The function is implemented by calling `impl_runtime_apis!`.
//
@@ -96,23 +96,23 @@ pub fn expand_runtime_metadata(
// `Deref` needs a reference for resolving the function call.
let rt = #runtime;
let ty = #scrate::scale_info::meta_type::<#extrinsic>();
let address_ty = #scrate::scale_info::meta_type::<
let ty = #scrate::__private::scale_info::meta_type::<#extrinsic>();
let address_ty = #scrate::__private::scale_info::meta_type::<
<<#extrinsic as #scrate::sp_runtime::traits::Extrinsic>::SignaturePayload as #scrate::sp_runtime::traits::SignaturePayload>::SignatureAddress
>();
let call_ty = #scrate::scale_info::meta_type::<
let call_ty = #scrate::__private::scale_info::meta_type::<
<#extrinsic as #scrate::sp_runtime::traits::Extrinsic>::Call
>();
let signature_ty = #scrate::scale_info::meta_type::<
let signature_ty = #scrate::__private::scale_info::meta_type::<
<<#extrinsic as #scrate::sp_runtime::traits::Extrinsic>::SignaturePayload as #scrate::sp_runtime::traits::SignaturePayload>::Signature
>();
let extra_ty = #scrate::scale_info::meta_type::<
let extra_ty = #scrate::__private::scale_info::meta_type::<
<<#extrinsic as #scrate::sp_runtime::traits::Extrinsic>::SignaturePayload as #scrate::sp_runtime::traits::SignaturePayload>::SignatureExtra
>();
#scrate::metadata_ir::MetadataIR {
pallets: #scrate::sp_std::vec![ #(#pallets),* ],
extrinsic: #scrate::metadata_ir::ExtrinsicMetadataIR {
#scrate::__private::metadata_ir::MetadataIR {
pallets: #scrate::__private::sp_std::vec![ #(#pallets),* ],
extrinsic: #scrate::__private::metadata_ir::ExtrinsicMetadataIR {
ty,
version: <#extrinsic as #scrate::sp_runtime::traits::ExtrinsicMetadata>::VERSION,
address_ty,
@@ -125,39 +125,39 @@ pub fn expand_runtime_metadata(
>::SignedExtensions as #scrate::sp_runtime::traits::SignedExtension
>::metadata()
.into_iter()
.map(|meta| #scrate::metadata_ir::SignedExtensionMetadataIR {
.map(|meta| #scrate::__private::metadata_ir::SignedExtensionMetadataIR {
identifier: meta.identifier,
ty: meta.ty,
additional_signed: meta.additional_signed,
})
.collect(),
},
ty: #scrate::scale_info::meta_type::<#runtime>(),
ty: #scrate::__private::scale_info::meta_type::<#runtime>(),
apis: (&rt).runtime_metadata(),
outer_enums: #scrate::metadata_ir::OuterEnumsIR {
call_enum_ty: #scrate::scale_info::meta_type::<
outer_enums: #scrate::__private::metadata_ir::OuterEnumsIR {
call_enum_ty: #scrate::__private::scale_info::meta_type::<
<#runtime as #system_path::Config>::RuntimeCall
>(),
event_enum_ty: #scrate::scale_info::meta_type::<RuntimeEvent>(),
error_enum_ty: #scrate::scale_info::meta_type::<RuntimeError>(),
event_enum_ty: #scrate::__private::scale_info::meta_type::<RuntimeEvent>(),
error_enum_ty: #scrate::__private::scale_info::meta_type::<RuntimeError>(),
}
}
}
pub fn metadata() -> #scrate::metadata::RuntimeMetadataPrefixed {
pub fn metadata() -> #scrate::__private::metadata::RuntimeMetadataPrefixed {
// Note: this always returns the V14 version. The runtime API function
// must be deprecated.
#scrate::metadata_ir::into_v14(#runtime::metadata_ir())
#scrate::__private::metadata_ir::into_v14(#runtime::metadata_ir())
}
pub fn metadata_at_version(version: u32) -> Option<#scrate::OpaqueMetadata> {
#scrate::metadata_ir::into_version(#runtime::metadata_ir(), version).map(|prefixed| {
#scrate::OpaqueMetadata::new(prefixed.into())
pub fn metadata_at_version(version: u32) -> Option<#scrate::__private::OpaqueMetadata> {
#scrate::__private::metadata_ir::into_version(#runtime::metadata_ir(), version).map(|prefixed| {
#scrate::__private::OpaqueMetadata::new(prefixed.into())
})
}
pub fn metadata_versions() -> #scrate::sp_std::vec::Vec<u32> {
#scrate::metadata_ir::supported_versions()
pub fn metadata_versions() -> #scrate::__private::sp_std::vec::Vec<u32> {
#scrate::__private::metadata_ir::supported_versions()
}
}
}
@@ -220,8 +220,8 @@ fn expand_pallet_metadata_events(
quote! {
Some(
#scrate::metadata_ir::PalletEventMetadataIR {
ty: #scrate::scale_info::meta_type::<#pallet_event>()
#scrate::__private::metadata_ir::PalletEventMetadataIR {
ty: #scrate::__private::scale_info::meta_type::<#pallet_event>()
}
)
}
@@ -105,25 +105,25 @@ pub fn expand_outer_origin(
#[derive(Clone)]
pub struct RuntimeOrigin {
caller: OriginCaller,
filter: #scrate::sp_std::rc::Rc<Box<dyn Fn(&<#runtime as #system_path::Config>::RuntimeCall) -> bool>>,
filter: #scrate::__private::sp_std::rc::Rc<Box<dyn Fn(&<#runtime as #system_path::Config>::RuntimeCall) -> bool>>,
}
#[cfg(not(feature = "std"))]
impl #scrate::sp_std::fmt::Debug for RuntimeOrigin {
impl #scrate::__private::sp_std::fmt::Debug for RuntimeOrigin {
fn fmt(
&self,
fmt: &mut #scrate::sp_std::fmt::Formatter,
) -> #scrate::sp_std::result::Result<(), #scrate::sp_std::fmt::Error> {
fmt: &mut #scrate::__private::sp_std::fmt::Formatter,
) -> #scrate::__private::sp_std::result::Result<(), #scrate::__private::sp_std::fmt::Error> {
fmt.write_str("<wasm:stripped>")
}
}
#[cfg(feature = "std")]
impl #scrate::sp_std::fmt::Debug for RuntimeOrigin {
impl #scrate::__private::sp_std::fmt::Debug for RuntimeOrigin {
fn fmt(
&self,
fmt: &mut #scrate::sp_std::fmt::Formatter,
) -> #scrate::sp_std::result::Result<(), #scrate::sp_std::fmt::Error> {
fmt: &mut #scrate::__private::sp_std::fmt::Formatter,
) -> #scrate::__private::sp_std::result::Result<(), #scrate::__private::sp_std::fmt::Error> {
fmt.debug_struct("Origin")
.field("caller", &self.caller)
.field("filter", &"[function ptr]")
@@ -139,7 +139,7 @@ pub fn expand_outer_origin(
fn add_filter(&mut self, filter: impl Fn(&Self::Call) -> bool + 'static) {
let f = self.filter.clone();
self.filter = #scrate::sp_std::rc::Rc::new(Box::new(move |call| {
self.filter = #scrate::__private::sp_std::rc::Rc::new(Box::new(move |call| {
f(call) && filter(call)
}));
}
@@ -150,7 +150,7 @@ pub fn expand_outer_origin(
as #scrate::traits::Contains<<#runtime as #system_path::Config>::RuntimeCall>
>::contains;
self.filter = #scrate::sp_std::rc::Rc::new(Box::new(filter));
self.filter = #scrate::__private::sp_std::rc::Rc::new(Box::new(filter));
}
fn set_caller_from(&mut self, other: impl Into<Self>) {
@@ -197,8 +197,8 @@ pub fn expand_outer_origin(
}
#[derive(
Clone, PartialEq, Eq, #scrate::RuntimeDebug, #scrate::codec::Encode,
#scrate::codec::Decode, #scrate::scale_info::TypeInfo, #scrate::codec::MaxEncodedLen,
Clone, PartialEq, Eq, #scrate::__private::RuntimeDebug, #scrate::__private::codec::Encode,
#scrate::__private::codec::Decode, #scrate::__private::scale_info::TypeInfo, #scrate::__private::codec::MaxEncodedLen,
)]
#[allow(non_camel_case_types)]
pub enum OriginCaller {
@@ -206,7 +206,7 @@ pub fn expand_outer_origin(
system(#system_path::Origin<#runtime>),
#caller_variants
#[allow(dead_code)]
Void(#scrate::Void)
Void(#scrate::__private::Void)
}
// For backwards compatibility and ease of accessing these functions.
@@ -252,7 +252,7 @@ pub fn expand_outer_origin(
impl TryFrom<OriginCaller> for #system_path::Origin<#runtime> {
type Error = OriginCaller;
fn try_from(x: OriginCaller)
-> #scrate::sp_std::result::Result<#system_path::Origin<#runtime>, OriginCaller>
-> #scrate::__private::sp_std::result::Result<#system_path::Origin<#runtime>, OriginCaller>
{
if let OriginCaller::system(l) = x {
Ok(l)
@@ -275,7 +275,7 @@ pub fn expand_outer_origin(
fn from(x: OriginCaller) -> Self {
let mut o = RuntimeOrigin {
caller: x,
filter: #scrate::sp_std::rc::Rc::new(Box::new(|_| true)),
filter: #scrate::__private::sp_std::rc::Rc::new(Box::new(|_| true)),
};
#scrate::traits::OriginTrait::reset_filter(&mut o);
@@ -284,7 +284,7 @@ pub fn expand_outer_origin(
}
}
impl From<RuntimeOrigin> for #scrate::sp_std::result::Result<#system_path::Origin<#runtime>, RuntimeOrigin> {
impl From<RuntimeOrigin> for #scrate::__private::sp_std::result::Result<#system_path::Origin<#runtime>, RuntimeOrigin> {
/// NOTE: converting to pallet origin loses the origin filter information.
fn from(val: RuntimeOrigin) -> Self {
if let OriginCaller::system(l) = val.caller {
@@ -394,7 +394,7 @@ fn expand_origin_pallet_conversions(
}
#attr
impl From<RuntimeOrigin> for #scrate::sp_std::result::Result<#pallet_origin, RuntimeOrigin> {
impl From<RuntimeOrigin> for #scrate::__private::sp_std::result::Result<#pallet_origin, RuntimeOrigin> {
/// NOTE: converting to pallet origin loses the origin filter information.
fn from(val: RuntimeOrigin) -> Self {
if let OriginCaller::#variant_name(l) = val.caller {
@@ -410,7 +410,7 @@ fn expand_origin_pallet_conversions(
type Error = OriginCaller;
fn try_from(
x: OriginCaller,
) -> #scrate::sp_std::result::Result<#pallet_origin, OriginCaller> {
) -> #scrate::__private::sp_std::result::Result<#pallet_origin, OriginCaller> {
if let OriginCaller::#variant_name(l) = x {
Ok(l)
} else {
@@ -424,7 +424,7 @@ fn expand_origin_pallet_conversions(
type Error = ();
fn try_from(
x: &'a OriginCaller,
) -> #scrate::sp_std::result::Result<&'a #pallet_origin, ()> {
) -> #scrate::__private::sp_std::result::Result<&'a #pallet_origin, ()> {
if let OriginCaller::#variant_name(l) = x {
Ok(&l)
} else {
@@ -438,7 +438,7 @@ fn expand_origin_pallet_conversions(
type Error = ();
fn try_from(
x: &'a RuntimeOrigin,
) -> #scrate::sp_std::result::Result<&'a #pallet_origin, ()> {
) -> #scrate::__private::sp_std::result::Result<&'a #pallet_origin, ()> {
if let OriginCaller::#variant_name(l) = &x.caller {
Ok(&l)
} else {
@@ -159,10 +159,10 @@ pub fn expand_outer_enum(
#[derive(
#event_custom_derives
#scrate::codec::Encode,
#scrate::codec::Decode,
#scrate::scale_info::TypeInfo,
#scrate::RuntimeDebug,
#scrate::__private::codec::Encode,
#scrate::__private::codec::Decode,
#scrate::__private::scale_info::TypeInfo,
#scrate::__private::RuntimeDebug,
)]
#[allow(non_camel_case_types)]
pub enum #enum_name_ident {
@@ -247,7 +247,7 @@ fn expand_enum_conversion(
impl TryInto<#pallet_enum> for #enum_name_ident {
type Error = ();
fn try_into(self) -> #scrate::sp_std::result::Result<#pallet_enum, Self::Error> {
fn try_into(self) -> #scrate::__private::sp_std::result::Result<#pallet_enum, Self::Error> {
match self {
Self::#variant_name(evt) => Ok(evt),
_ => Err(()),
@@ -273,8 +273,8 @@ fn generate_error_impl(scrate: &TokenStream, enum_ty: OuterEnumType) -> TokenStr
pub fn from_dispatch_error(err: #scrate::sp_runtime::DispatchError) -> Option<Self> {
let #scrate::sp_runtime::DispatchError::Module(module_error) = err else { return None };
let bytes = #scrate::codec::Encode::encode(&module_error);
#scrate::codec::Decode::decode(&mut &bytes[..]).ok()
let bytes = #scrate::__private::codec::Encode::encode(&module_error);
#scrate::__private::codec::Decode::decode(&mut &bytes[..]).ok()
}
}
}
@@ -38,9 +38,9 @@ pub fn expand_outer_slash_reason(pallet_decls: &[Pallet], scrate: &TokenStream)
/// A reason for slashing funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen,
#scrate::scale_info::TypeInfo,
#scrate::RuntimeDebug,
#scrate::__private::codec::Encode, #scrate::__private::codec::Decode, #scrate::__private::codec::MaxEncodedLen,
#scrate::__private::scale_info::TypeInfo,
#scrate::__private::RuntimeDebug,
)]
pub enum RuntimeSlashReason {
#( #slash_reason_variants )*
@@ -94,11 +94,11 @@
//! ```
//! This call has some implicit pallet parts, thus it will expand to:
//! ```ignore
//! frame_support::tt_call! {
//! frame_support::__private::tt_call! {
//! macro = [{ pallet_balances::tt_default_parts }]
//! ~~> frame_support::match_and_insert! {
//! target = [{
//! frame_support::tt_call! {
//! frame_support::__private::tt_call! {
//! macro = [{ frame_system::tt_default_parts }]
//! ~~> frame_support::match_and_insert! {
//! target = [{
@@ -280,7 +280,7 @@ fn construct_runtime_implicit_to_explicit(
let pallet_name = &pallet.name;
let pallet_instance = pallet.instance.as_ref().map(|instance| quote::quote!(::<#instance>));
expansion = quote::quote!(
#frame_support::tt_call! {
#frame_support::__private::tt_call! {
macro = [{ #pallet_path::tt_default_parts }]
frame_support = [{ #frame_support }]
~~> #frame_support::match_and_insert! {
@@ -316,7 +316,7 @@ fn construct_runtime_explicit_to_explicit_expanded(
let pallet_name = &pallet.name;
let pallet_instance = pallet.instance.as_ref().map(|instance| quote::quote!(::<#instance>));
expansion = quote::quote!(
#frame_support::tt_call! {
#frame_support::__private::tt_call! {
macro = [{ #pallet_path::tt_extra_parts }]
frame_support = [{ #frame_support }]
~~> #frame_support::match_and_insert! {
@@ -428,7 +428,7 @@ fn construct_runtime_final_expansion(
#[derive(
Clone, Copy, PartialEq, Eq, #scrate::sp_runtime::RuntimeDebug,
#scrate::scale_info::TypeInfo
#scrate::__private::scale_info::TypeInfo
)]
pub struct #name;
impl #scrate::sp_runtime::traits::GetRuntimeBlockType for #name {
@@ -453,7 +453,7 @@ fn construct_runtime_final_expansion(
#[doc(hidden)]
trait InternalConstructRuntime {
#[inline(always)]
fn runtime_metadata(&self) -> #scrate::sp_std::vec::Vec<#scrate::metadata_ir::RuntimeApiMetadataIR> {
fn runtime_metadata(&self) -> #scrate::__private::sp_std::vec::Vec<#scrate::__private::metadata_ir::RuntimeApiMetadataIR> {
Default::default()
}
}
@@ -700,10 +700,10 @@ fn decl_pallet_runtime_setup(
impl #scrate::traits::PalletInfo for PalletInfo {
fn index<P: 'static>() -> Option<usize> {
let type_id = #scrate::sp_std::any::TypeId::of::<P>();
let type_id = #scrate::__private::sp_std::any::TypeId::of::<P>();
#(
#pallet_attrs
if type_id == #scrate::sp_std::any::TypeId::of::<#names>() {
if type_id == #scrate::__private::sp_std::any::TypeId::of::<#names>() {
return Some(#indices)
}
)*
@@ -712,10 +712,10 @@ fn decl_pallet_runtime_setup(
}
fn name<P: 'static>() -> Option<&'static str> {
let type_id = #scrate::sp_std::any::TypeId::of::<P>();
let type_id = #scrate::__private::sp_std::any::TypeId::of::<P>();
#(
#pallet_attrs
if type_id == #scrate::sp_std::any::TypeId::of::<#names>() {
if type_id == #scrate::__private::sp_std::any::TypeId::of::<#names>() {
return Some(#name_strings)
}
)*
@@ -724,10 +724,10 @@ fn decl_pallet_runtime_setup(
}
fn module_name<P: 'static>() -> Option<&'static str> {
let type_id = #scrate::sp_std::any::TypeId::of::<P>();
let type_id = #scrate::__private::sp_std::any::TypeId::of::<P>();
#(
#pallet_attrs
if type_id == #scrate::sp_std::any::TypeId::of::<#names>() {
if type_id == #scrate::__private::sp_std::any::TypeId::of::<#names>() {
return Some(#module_names)
}
)*
@@ -736,10 +736,10 @@ fn decl_pallet_runtime_setup(
}
fn crate_version<P: 'static>() -> Option<#scrate::traits::CrateVersion> {
let type_id = #scrate::sp_std::any::TypeId::of::<P>();
let type_id = #scrate::__private::sp_std::any::TypeId::of::<P>();
#(
#pallet_attrs
if type_id == #scrate::sp_std::any::TypeId::of::<#names>() {
if type_id == #scrate::__private::sp_std::any::TypeId::of::<#names>() {
return Some(
<#pallet_structs as #scrate::traits::PalletInfoAccess>::crate_version()
)
@@ -760,7 +760,7 @@ fn decl_integrity_test(scrate: &TokenStream2) -> TokenStream2 {
#[test]
pub fn runtime_integrity_tests() {
#scrate::sp_tracing::try_init_simple();
#scrate::__private::sp_tracing::try_init_simple();
<AllPalletsWithSystem as #scrate::traits::IntegrityTest>::integrity_test();
}
}
@@ -781,7 +781,7 @@ fn decl_static_assertions(
);
quote! {
#scrate::tt_call! {
#scrate::__private::tt_call! {
macro = [{ #path::tt_error_token }]
frame_support = [{ #scrate }]
~~> #scrate::assert_error_encoded_size! {
@@ -275,9 +275,9 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
#frame_support::CloneNoBound,
#frame_support::EqNoBound,
#frame_support::PartialEqNoBound,
#frame_support::codec::Encode,
#frame_support::codec::Decode,
#frame_support::scale_info::TypeInfo,
#frame_support::__private::codec::Encode,
#frame_support::__private::codec::Decode,
#frame_support::__private::scale_info::TypeInfo,
)]
#[codec(encode_bound())]
#[codec(decode_bound())]
@@ -287,7 +287,7 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
#[doc(hidden)]
#[codec(skip)]
__Ignore(
#frame_support::sp_std::marker::PhantomData<(#type_use_gen,)>,
#frame_support::__private::sp_std::marker::PhantomData<(#type_use_gen,)>,
#frame_support::Never,
),
#(
@@ -394,8 +394,8 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
match self {
#(
Self::#fn_name { #( #args_name_pattern, )* } => {
#frame_support::sp_tracing::enter_span!(
#frame_support::sp_tracing::trace_span!(stringify!(#fn_name))
#frame_support::__private::sp_tracing::enter_span!(
#frame_support::__private::sp_tracing::trace_span!(stringify!(#fn_name))
);
#maybe_allow_attrs
<#pallet_ident<#type_use_gen>>::#fn_name(origin, #( #args_name, )* )
@@ -419,8 +419,8 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
impl<#type_impl_gen> #pallet_ident<#type_use_gen> #where_clause {
#[doc(hidden)]
pub fn call_functions() -> #frame_support::metadata_ir::PalletCallMetadataIR {
#frame_support::scale_info::meta_type::<#call_ident<#type_use_gen>>().into()
pub fn call_functions() -> #frame_support::__private::metadata_ir::PalletCallMetadataIR {
#frame_support::__private::scale_info::meta_type::<#call_ident<#type_use_gen>>().into()
}
}
)
@@ -54,7 +54,7 @@ pub fn expand_constants(def: &mut Def) -> proc_macro2::TokenStream {
default_byte_impl: quote::quote!(
let value = <<T as Config #trait_use_gen>::#ident as
#frame_support::traits::Get<#const_type>>::get();
#frame_support::codec::Encode::encode(&value)
#frame_support::__private::codec::Encode::encode(&value)
),
metadata_name: None,
}
@@ -69,7 +69,7 @@ pub fn expand_constants(def: &mut Def) -> proc_macro2::TokenStream {
doc: const_.doc.clone(),
default_byte_impl: quote::quote!(
let value = <Pallet<#type_use_gen>>::#ident();
#frame_support::codec::Encode::encode(&value)
#frame_support::__private::codec::Encode::encode(&value)
),
metadata_name: const_.metadata_name.clone(),
}
@@ -85,11 +85,11 @@ pub fn expand_constants(def: &mut Def) -> proc_macro2::TokenStream {
let default_byte_impl = &const_.default_byte_impl;
quote::quote!({
#frame_support::metadata_ir::PalletConstantMetadataIR {
#frame_support::__private::metadata_ir::PalletConstantMetadataIR {
name: #ident_str,
ty: #frame_support::scale_info::meta_type::<#const_type>(),
ty: #frame_support::__private::scale_info::meta_type::<#const_type>(),
value: { #default_byte_impl },
docs: #frame_support::sp_std::vec![ #( #doc ),* ],
docs: #frame_support::__private::sp_std::vec![ #( #doc ),* ],
}
})
});
@@ -99,9 +99,9 @@ pub fn expand_constants(def: &mut Def) -> proc_macro2::TokenStream {
#[doc(hidden)]
pub fn pallet_constants_metadata()
-> #frame_support::sp_std::vec::Vec<#frame_support::metadata_ir::PalletConstantMetadataIR>
-> #frame_support::__private::sp_std::vec::Vec<#frame_support::__private::metadata_ir::PalletConstantMetadataIR>
{
#frame_support::sp_std::vec![ #( #consts ),* ]
#frame_support::__private::sp_std::vec![ #( #consts ),* ]
}
}
)
@@ -163,9 +163,9 @@ pub fn expand_documentation(def: &mut Def) -> proc_macro2::TokenStream {
#[doc(hidden)]
pub fn pallet_documentation_metadata()
-> #frame_support::sp_std::vec::Vec<&'static str>
-> #frame_support::__private::sp_std::vec::Vec<&'static str>
{
#frame_support::sp_std::vec![ #( #docs ),* ]
#frame_support::__private::sp_std::vec![ #( #docs ),* ]
}
}
)
@@ -44,7 +44,7 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream {
$caller:tt
frame_support = [{ $($frame_support:ident)::* }]
} => {
$($frame_support::)*tt_return! {
$($frame_support::)*__private::tt_return! {
$caller
}
};
@@ -62,7 +62,7 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream {
#[doc(hidden)]
#[codec(skip)]
__Ignore(
#frame_support::sp_std::marker::PhantomData<(#type_use_gen)>,
#frame_support::__private::sp_std::marker::PhantomData<(#type_use_gen)>,
#frame_support::Never,
)
);
@@ -98,9 +98,9 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream {
// derive TypeInfo for error metadata
error_item.attrs.push(syn::parse_quote! {
#[derive(
#frame_support::codec::Encode,
#frame_support::codec::Decode,
#frame_support::scale_info::TypeInfo,
#frame_support::__private::codec::Encode,
#frame_support::__private::codec::Decode,
#frame_support::__private::scale_info::TypeInfo,
#frame_support::PalletError,
)]
});
@@ -115,11 +115,11 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream {
}
quote::quote_spanned!(error.attr_span =>
impl<#type_impl_gen> #frame_support::sp_std::fmt::Debug for #error_ident<#type_use_gen>
impl<#type_impl_gen> #frame_support::__private::sp_std::fmt::Debug for #error_ident<#type_use_gen>
#config_where_clause
{
fn fmt(&self, f: &mut #frame_support::sp_std::fmt::Formatter<'_>)
-> #frame_support::sp_std::fmt::Result
fn fmt(&self, f: &mut #frame_support::__private::sp_std::fmt::Formatter<'_>)
-> #frame_support::__private::sp_std::fmt::Result
{
f.write_str(self.as_str())
}
@@ -148,7 +148,7 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream {
#config_where_clause
{
fn from(err: #error_ident<#type_use_gen>) -> Self {
use #frame_support::codec::Encode;
use #frame_support::__private::codec::Encode;
let index = <
<T as #frame_system::Config>::PalletInfo
as #frame_support::traits::PalletInfo
@@ -172,7 +172,7 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream {
$caller:tt
frame_support = [{ $($frame_support:ident)::* }]
} => {
$($frame_support::)*tt_return! {
$($frame_support::)*__private::tt_return! {
$caller
error = [{ #error_ident }]
}
@@ -87,7 +87,7 @@ pub fn expand_event(def: &mut Def) -> proc_macro2::TokenStream {
#[doc(hidden)]
#[codec(skip)]
__Ignore(
#frame_support::sp_std::marker::PhantomData<(#event_use_gen)>,
#frame_support::__private::sp_std::marker::PhantomData<(#event_use_gen)>,
#frame_support::Never,
)
);
@@ -109,9 +109,9 @@ pub fn expand_event(def: &mut Def) -> proc_macro2::TokenStream {
#frame_support::EqNoBound,
#frame_support::PartialEqNoBound,
#frame_support::RuntimeDebugNoBound,
#frame_support::codec::Encode,
#frame_support::codec::Decode,
#frame_support::scale_info::TypeInfo,
#frame_support::__private::codec::Encode,
#frame_support::__private::codec::Decode,
#frame_support::__private::scale_info::TypeInfo,
)]
));
@@ -39,7 +39,7 @@ pub fn expand_genesis_build(def: &mut Def) -> proc_macro2::TokenStream {
impl<#type_impl_gen> #frame_support::sp_runtime::BuildStorage for #gen_cfg_ident<#gen_cfg_use_gen> #where_clause
{
fn assimilate_storage(&self, storage: &mut sp_runtime::Storage) -> std::result::Result<(), std::string::String> {
#frame_support::BasicExternalities::execute_with_storage(storage, || {
#frame_support::__private::BasicExternalities::execute_with_storage(storage, || {
self.build();
Ok(())
})
@@ -79,7 +79,7 @@ pub fn expand_genesis_config(def: &mut Def) -> proc_macro2::TokenStream {
let genesis_config_item =
&mut def.item.content.as_mut().expect("Checked by def parser").1[genesis_config.index];
let serde_crate = format!("{}::serde", frame_support);
let serde_crate = format!("{}::__private::serde", frame_support);
match genesis_config_item {
syn::Item::Enum(syn::ItemEnum { attrs, .. }) |
@@ -38,7 +38,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
let log_runtime_upgrade = if has_runtime_upgrade {
// a migration is defined here.
quote::quote! {
#frame_support::log::info!(
#frame_support::__private::log::info!(
target: #frame_support::LOG_TARGET,
"⚠️ {} declares internal migrations (which *might* execute). \
On-chain `{:?}` vs current storage version `{:?}`",
@@ -50,7 +50,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
} else {
// default.
quote::quote! {
#frame_support::log::debug!(
#frame_support::__private::log::debug!(
target: #frame_support::LOG_TARGET,
"✅ no migration for {}",
pallet_name,
@@ -64,7 +64,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
as
#frame_support::traits::PalletInfo
>::name::<Self>().expect("No name found for the pallet! This usually means that the pallet wasn't added to `construct_runtime!`.");
#frame_support::log::debug!(
#frame_support::__private::log::debug!(
target: #frame_support::LOG_TARGET,
"🩺 try-state pallet {:?}",
pallet_name,
@@ -97,7 +97,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
#frame_support::traits::PalletInfo
>::name::<Self>().unwrap_or("<unknown pallet name>");
#frame_support::log::error!(
#frame_support::__private::log::error!(
target: #frame_support::LOG_TARGET,
"{}: On chain storage version {:?} doesn't match current storage version {:?}.",
pallet_name,
@@ -119,7 +119,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
#frame_support::traits::PalletInfo
>::name::<Self>().unwrap_or("<unknown pallet name>");
#frame_support::log::error!(
#frame_support::__private::log::error!(
target: #frame_support::LOG_TARGET,
"{}: On chain storage version {:?} is set to non zero, \
while the pallet is missing the `#[pallet::storage_version(VERSION)]` attribute.",
@@ -141,8 +141,8 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
for #pallet_ident<#type_use_gen> #where_clause
{
fn on_finalize(n: #frame_system::pallet_prelude::BlockNumberFor::<T>) {
#frame_support::sp_tracing::enter_span!(
#frame_support::sp_tracing::trace_span!("on_finalize")
#frame_support::__private::sp_tracing::enter_span!(
#frame_support::__private::sp_tracing::trace_span!("on_finalize")
);
<
Self as #frame_support::traits::Hooks<
@@ -175,8 +175,8 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
fn on_initialize(
n: #frame_system::pallet_prelude::BlockNumberFor::<T>
) -> #frame_support::weights::Weight {
#frame_support::sp_tracing::enter_span!(
#frame_support::sp_tracing::trace_span!("on_initialize")
#frame_support::__private::sp_tracing::enter_span!(
#frame_support::__private::sp_tracing::trace_span!("on_initialize")
);
<
Self as #frame_support::traits::Hooks<
@@ -191,8 +191,8 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
for #pallet_ident<#type_use_gen> #where_clause
{
fn on_runtime_upgrade() -> #frame_support::weights::Weight {
#frame_support::sp_tracing::enter_span!(
#frame_support::sp_tracing::trace_span!("on_runtime_update")
#frame_support::__private::sp_tracing::enter_span!(
#frame_support::__private::sp_tracing::trace_span!("on_runtime_update")
);
// log info about the upgrade.
@@ -211,7 +211,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<#frame_support::sp_std::vec::Vec<u8>, #frame_support::sp_runtime::TryRuntimeError> {
fn pre_upgrade() -> Result<#frame_support::__private::sp_std::vec::Vec<u8>, #frame_support::sp_runtime::TryRuntimeError> {
<
Self
as
@@ -220,7 +220,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(state: #frame_support::sp_std::vec::Vec<u8>) -> Result<(), #frame_support::sp_runtime::TryRuntimeError> {
fn post_upgrade(state: #frame_support::__private::sp_std::vec::Vec<u8>) -> Result<(), #frame_support::sp_runtime::TryRuntimeError> {
#post_storage_version_check
<
@@ -251,7 +251,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
for #pallet_ident<#type_use_gen> #where_clause
{
fn integrity_test() {
#frame_support::sp_io::TestExternalities::default().execute_with(|| {
#frame_support::__private::sp_io::TestExternalities::default().execute_with(|| {
<
Self as #frame_support::traits::Hooks<
#frame_system::pallet_prelude::BlockNumberFor::<T>
@@ -54,7 +54,7 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream {
if let Some(field) = pallet_item.fields.iter_mut().next() {
if field.ty == syn::parse_quote!(_) {
field.ty = syn::parse_quote!(
#frame_support::sp_std::marker::PhantomData<(#type_use_gen)>
#frame_support::__private::sp_std::marker::PhantomData<(#type_use_gen)>
);
}
}
@@ -82,9 +82,9 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream {
quote::quote_spanned!(def.pallet_struct.attr_span =>
impl<#type_impl_gen> #pallet_ident<#type_use_gen> #config_where_clause {
#[doc(hidden)]
pub fn error_metadata() -> Option<#frame_support::metadata_ir::PalletErrorMetadataIR> {
Some(#frame_support::metadata_ir::PalletErrorMetadataIR {
ty: #frame_support::scale_info::meta_type::<#error_ident<#type_use_gen>>()
pub fn error_metadata() -> Option<#frame_support::__private::metadata_ir::PalletErrorMetadataIR> {
Some(#frame_support::__private::metadata_ir::PalletErrorMetadataIR {
ty: #frame_support::__private::scale_info::meta_type::<#error_ident<#type_use_gen>>()
})
}
}
@@ -93,7 +93,7 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream {
quote::quote_spanned!(def.pallet_struct.attr_span =>
impl<#type_impl_gen> #pallet_ident<#type_use_gen> #config_where_clause {
#[doc(hidden)]
pub fn error_metadata() -> Option<#frame_support::metadata_ir::PalletErrorMetadataIR> {
pub fn error_metadata() -> Option<#frame_support::__private::metadata_ir::PalletErrorMetadataIR> {
None
}
}
@@ -139,10 +139,10 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream {
#storages_where_clauses
{
fn storage_info()
-> #frame_support::sp_std::vec::Vec<#frame_support::traits::StorageInfo>
-> #frame_support::__private::sp_std::vec::Vec<#frame_support::traits::StorageInfo>
{
#[allow(unused_mut)]
let mut res = #frame_support::sp_std::vec![];
let mut res = #frame_support::__private::sp_std::vec![];
#(
#(#storage_cfg_attrs)*
@@ -179,8 +179,8 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream {
let whitelisted_storage_keys_impl = quote::quote![
use #frame_support::traits::{StorageInfoTrait, TrackedStorageKey, WhitelistedStorageKeys};
impl<#type_impl_gen> WhitelistedStorageKeys for #pallet_ident<#type_use_gen> #storages_where_clauses {
fn whitelisted_storage_keys() -> #frame_support::sp_std::vec::Vec<TrackedStorageKey> {
use #frame_support::sp_std::vec;
fn whitelisted_storage_keys() -> #frame_support::__private::sp_std::vec::Vec<TrackedStorageKey> {
use #frame_support::__private::sp_std::vec;
vec![#(
TrackedStorageKey::new(#whitelisted_storage_idents::<#type_use_gen>::hashed_key().to_vec())
),*]
@@ -264,7 +264,7 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream {
#config_where_clause
{
fn count() -> usize { 1 }
fn infos() -> #frame_support::sp_std::vec::Vec<#frame_support::traits::PalletInfoData> {
fn infos() -> #frame_support::__private::sp_std::vec::Vec<#frame_support::traits::PalletInfoData> {
use #frame_support::traits::PalletInfoAccess;
let item = #frame_support::traits::PalletInfoData {
index: Self::index(),
@@ -272,7 +272,7 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream {
module_name: Self::module_name(),
crate_version: Self::crate_version(),
};
#frame_support::sp_std::vec![item]
#frame_support::__private::sp_std::vec![item]
}
}
@@ -421,7 +421,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream {
#(#cfg_attrs)*
{
<#full_ident as #frame_support::storage::StorageEntryMetadataBuilder>::build_metadata(
#frame_support::sp_std::vec![
#frame_support::__private::sp_std::vec![
#( #docs, )*
],
&mut entries,
@@ -492,7 +492,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream {
impl<#type_impl_gen> #pallet_ident<#type_use_gen> #completed_where_clause {
#[doc = #getter_doc_line]
pub fn #getter<KArg>(k: KArg) -> #query where
KArg: #frame_support::codec::EncodeLike<#key>,
KArg: #frame_support::__private::codec::EncodeLike<#key>,
{
<
#full_ident as #frame_support::storage::StorageMap<#key, #value>
@@ -518,7 +518,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream {
impl<#type_impl_gen> #pallet_ident<#type_use_gen> #completed_where_clause {
#[doc = #getter_doc_line]
pub fn #getter<KArg>(k: KArg) -> #query where
KArg: #frame_support::codec::EncodeLike<#key>,
KArg: #frame_support::__private::codec::EncodeLike<#key>,
{
// NOTE: we can't use any trait here because CountedStorageMap
// doesn't implement any.
@@ -544,8 +544,8 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream {
impl<#type_impl_gen> #pallet_ident<#type_use_gen> #completed_where_clause {
#[doc = #getter_doc_line]
pub fn #getter<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> #query where
KArg1: #frame_support::codec::EncodeLike<#key1>,
KArg2: #frame_support::codec::EncodeLike<#key2>,
KArg1: #frame_support::__private::codec::EncodeLike<#key1>,
KArg2: #frame_support::__private::codec::EncodeLike<#key2>,
{
<
#full_ident as
@@ -791,8 +791,8 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream {
#completed_where_clause
{
#[doc(hidden)]
pub fn storage_metadata() -> #frame_support::metadata_ir::PalletStorageMetadataIR {
#frame_support::metadata_ir::PalletStorageMetadataIR {
pub fn storage_metadata() -> #frame_support::__private::metadata_ir::PalletStorageMetadataIR {
#frame_support::__private::metadata_ir::PalletStorageMetadataIR {
prefix: <
<T as #frame_system::Config>::PalletInfo as
#frame_support::traits::PalletInfo
@@ -800,7 +800,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream {
.expect("No name found for the pallet in the runtime! This usually means that the pallet wasn't added to `construct_runtime!`."),
entries: {
#[allow(unused_mut)]
let mut entries = #frame_support::sp_std::vec![];
let mut entries = #frame_support::__private::sp_std::vec![];
#( #entries_builder )*
entries
},
@@ -96,7 +96,7 @@ pub fn expand_tt_default_parts(def: &mut Def) -> proc_macro2::TokenStream {
$caller:tt
frame_support = [{ $($frame_support:ident)::* }]
} => {
$($frame_support)*::tt_return! {
$($frame_support)*::__private::tt_return! {
$caller
tokens = [{
expanded::{
@@ -126,7 +126,7 @@ pub fn expand_tt_default_parts(def: &mut Def) -> proc_macro2::TokenStream {
$caller:tt
frame_support = [{ $($frame_support:ident)::* }]
} => {
$($frame_support)*::tt_return! {
$($frame_support)*::__private::tt_return! {
$caller
tokens = [{
expanded::{
@@ -120,9 +120,9 @@ impl CompositeDef {
let derive_attr: syn::Attribute = syn::parse_quote! {
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen,
#scrate::scale_info::TypeInfo,
#scrate::RuntimeDebug,
#scrate::__private::codec::Encode, #scrate::__private::codec::Decode, #scrate::__private::codec::MaxEncodedLen,
#scrate::__private::scale_info::TypeInfo,
#scrate::__private::RuntimeDebug,
)]
};
item.attrs.push(derive_attr);
@@ -124,7 +124,7 @@ fn generate_field_types(
res = Some(None);
} else if meta.path.is_ident("compact") {
let field_ty = &field.ty;
res = Some(Some(quote::quote!(#scrate::codec::Compact<#field_ty>)));
res = Some(Some(quote::quote!(#scrate::__private::codec::Compact<#field_ty>)));
} else if meta.path.is_ident("compact") {
res = Some(Some(meta.value()?.parse()?));
}
@@ -622,7 +622,7 @@ fn generate_storage_instance(
quote! {
#visibility struct #counter_name< #impl_generics >(
#crate_::sp_std::marker::PhantomData<(#type_generics)>
#crate_::__private::sp_std::marker::PhantomData<(#type_generics)>
) #where_clause;
impl<#impl_generics> #crate_::traits::StorageInstance
@@ -647,7 +647,7 @@ fn generate_storage_instance(
let code = quote! {
#[allow(non_camel_case_types)]
#visibility struct #name< #impl_generics >(
#crate_::sp_std::marker::PhantomData<(#type_generics)>
#crate_::__private::sp_std::marker::PhantomData<(#type_generics)>
) #where_clause;
impl<#impl_generics> #crate_::traits::StorageInstance
@@ -49,9 +49,9 @@ impl syn::parse::Parse for CreateTtReturnMacroDef {
}
/// A proc macro that accepts a name and any number of key-value pairs, to be used to create a
/// declarative macro that follows tt-call conventions and simply calls [`tt_call::tt_return`],
/// accepting an optional `frame-support` argument and returning the key-value pairs that were
/// supplied to the proc macro.
/// declarative macro that follows tt-call conventions and simply calls
/// [`tt_call::tt_return`], accepting an optional `frame-support` argument and returning
/// the key-value pairs that were supplied to the proc macro.
///
/// # Example
/// ```ignore
@@ -67,7 +67,7 @@ impl syn::parse::Parse for CreateTtReturnMacroDef {
/// $caller:tt
/// $(frame_support = [{ $($frame_support:ident)::* }])?
/// } => {
/// frame_support::tt_return! {
/// frame_support::__private::tt_return! {
/// $caller
/// foo = [{ bar }]
/// }
@@ -94,7 +94,7 @@ pub fn create_tt_return_macro(input: proc_macro::TokenStream) -> proc_macro::Tok
$caller:tt
$(frame_support = [{ $($frame_support:ident)::* }])?
} => {
#frame_support::tt_return! {
#frame_support::__private::tt_return! {
$caller
#(
#keys = [{ #values }]
+17 -18
View File
@@ -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`
+1 -1
View File
@@ -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
+44 -48
View File
@@ -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>>>;
+2 -2
View File
@@ -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> {

Some files were not shown because too many files have changed in this diff Show More