Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit df383f2

Browse files
juangirinibkchr
andauthored
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 <[email protected]> * import codec directly * fmt * fix node-cli tests --------- Co-authored-by: command-bot <> Co-authored-by: Bastian Köcher <[email protected]>
1 parent 1631c8e commit df383f2

File tree

125 files changed

+449
-398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+449
-398
lines changed

Cargo.lock

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/node/runtime/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use frame_support::{
4747
},
4848
ConstantMultiplier, IdentityFee, Weight,
4949
},
50-
BoundedVec, PalletId, RuntimeDebug,
50+
BoundedVec, PalletId,
5151
};
5252
use frame_system::{
5353
limits::{BlockLength, BlockWeights},
@@ -78,6 +78,7 @@ use sp_runtime::{
7878
},
7979
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
8080
ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Percent, Permill, Perquintill,
81+
RuntimeDebug,
8182
};
8283
use sp_std::prelude::*;
8384
#[cfg(any(feature = "std", test))]

frame/alliance/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ pub mod migration;
9494
mod types;
9595
pub mod weights;
9696

97+
use codec::{Decode, Encode, MaxEncodedLen};
9798
use frame_support::pallet_prelude::*;
9899
use frame_system::pallet_prelude::*;
99100
use sp_runtime::{
@@ -103,20 +104,19 @@ use sp_runtime::{
103104
use sp_std::{convert::TryInto, prelude::*};
104105

105106
use frame_support::{
106-
codec::{Decode, Encode, MaxEncodedLen},
107107
dispatch::{
108108
DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo,
109109
PostDispatchInfo,
110110
},
111111
ensure,
112-
scale_info::TypeInfo,
113112
traits::{
114113
ChangeMembers, Currency, Get, InitializeMembers, IsSubType, OnUnbalanced,
115114
ReservableCurrency,
116115
},
117116
weights::Weight,
118117
};
119118
use pallet_identity::IdentityField;
119+
use scale_info::TypeInfo;
120120

121121
pub use pallet::*;
122122
pub use types::*;

frame/asset-rate/src/benchmarking.rs

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use frame_benchmarking::v2::*;
2525
use frame_support::assert_ok;
2626
use frame_system::RawOrigin;
2727
use sp_core::crypto::FromEntropy;
28+
use sp_std::vec;
2829

2930
/// Trait describing the factory function for the `AssetKind` parameter.
3031
pub trait AssetKindFactory<AssetKind> {

frame/assets/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
1414

1515
[dependencies]
1616
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
17+
log = { version = "0.4.17", default-features = false }
1718
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
1819
sp-std = { version = "8.0.0", default-features = false, path = "../../primitives/std" }
1920
# Needed for various traits. In our case, `OnFinalize`.
@@ -34,6 +35,7 @@ pallet-balances = { version = "4.0.0-dev", path = "../balances" }
3435
default = ["std"]
3536
std = [
3637
"codec/std",
38+
"log/std",
3739
"scale-info/std",
3840
"sp-core/std",
3941
"sp-std/std",

frame/assets/src/migration.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
// limitations under the License.
1717

1818
use super::*;
19-
use frame_support::{log, traits::OnRuntimeUpgrade};
19+
use frame_support::traits::OnRuntimeUpgrade;
20+
use log;
2021

2122
#[cfg(feature = "try-runtime")]
2223
use sp_runtime::TryRuntimeError;

frame/aura/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
1414

1515
[dependencies]
1616
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive", "max-encoded-len"] }
17+
log = { version = "0.4.17", default-features = false }
1718
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
1819
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
1920
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" }
3132
default = ["std"]
3233
std = [
3334
"codec/std",
35+
"log/std",
3436
"frame-support/std",
3537
"frame-system/std",
3638
"pallet-timestamp/std",

frame/aura/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040

4141
use codec::{Decode, Encode, MaxEncodedLen};
4242
use frame_support::{
43-
log,
4443
traits::{DisabledValidators, FindAuthor, Get, OnTimestampSet, OneSessionHandler},
4544
BoundedSlice, BoundedVec, ConsensusEngineId, Parameter,
4645
};
46+
use log;
4747
use sp_consensus_aura::{AuthorityIndex, ConsensusLog, Slot, AURA_ENGINE_ID};
4848
use sp_runtime::{
4949
generic::DigestItem,

frame/balances/src/tests/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use frame_support::{
3030
StorageMapShim, StoredMap, WhitelistedStorageKeys,
3131
},
3232
weights::{IdentityFee, Weight},
33-
RuntimeDebug,
3433
};
3534
use frame_system::{self as system, RawOrigin};
3635
use pallet_transaction_payment::{ChargeTransactionPayment, CurrencyAdapter, Multiplier};
@@ -39,7 +38,8 @@ use sp_core::{hexdisplay::HexDisplay, H256};
3938
use sp_io;
4039
use sp_runtime::{
4140
traits::{BadOrigin, IdentityLookup, SignedExtension, Zero},
42-
ArithmeticError, BuildStorage, DispatchError, DispatchResult, FixedPointNumber, TokenError,
41+
ArithmeticError, BuildStorage, DispatchError, DispatchResult, FixedPointNumber, RuntimeDebug,
42+
TokenError,
4343
};
4444
use std::collections::BTreeSet;
4545

frame/balances/src/types.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@
2020
use crate::{Config, CreditOf, Event, Pallet};
2121
use codec::{Decode, Encode, MaxEncodedLen};
2222
use core::ops::BitOr;
23-
use frame_support::{
24-
traits::{Imbalance, LockIdentifier, OnUnbalanced, WithdrawReasons},
25-
RuntimeDebug,
26-
};
23+
use frame_support::traits::{Imbalance, LockIdentifier, OnUnbalanced, WithdrawReasons};
2724
use scale_info::TypeInfo;
28-
use sp_runtime::Saturating;
25+
use sp_runtime::{RuntimeDebug, Saturating};
2926

3027
/// Simplified reasons for withdrawing balance.
3128
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, MaxEncodedLen, TypeInfo)]

frame/beefy-mmr/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ sp-io = { version = "23.0.0", default-features = false, path = "../../primitives
2626
sp-runtime = { version = "24.0.0", default-features = false, path = "../../primitives/runtime" }
2727
sp-std = { version = "8.0.0", default-features = false, path = "../../primitives/std" }
2828
sp-api = { version = "4.0.0-dev", default-features = false, path = "../../primitives/api" }
29+
sp-state-machine = { version = "0.28.0", default-features = false, path = "../../primitives/state-machine" }
2930

3031
[dev-dependencies]
3132
array-bytes = "6.1"
@@ -51,7 +52,8 @@ std = [
5152
"sp-runtime/std",
5253
"sp-std/std",
5354
"sp-api/std",
54-
"sp-staking/std"
55+
"sp-staking/std",
56+
"sp-state-machine/std"
5557
]
5658
try-runtime = [
5759
"frame-support/try-runtime",

frame/beefy-mmr/src/mock.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ use std::vec;
2020
use codec::Encode;
2121
use frame_support::{
2222
construct_runtime, parameter_types,
23-
sp_io::TestExternalities,
2423
traits::{ConstU16, ConstU32, ConstU64},
25-
BasicExternalities,
2624
};
2725
use sp_consensus_beefy::mmr::MmrLeafVersion;
2826
use sp_core::H256;
27+
use sp_io::TestExternalities;
2928
use sp_runtime::{
3029
app_crypto::ecdsa::Public,
3130
impl_opaque_keys,
3231
traits::{BlakeTwo256, ConvertInto, IdentityLookup, Keccak256, OpaqueKeys},
3332
BuildStorage,
3433
};
34+
use sp_state_machine::BasicExternalities;
3535

3636
use crate as pallet_beefy_mmr;
3737

frame/beefy/Cargo.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ homepage = "https://substrate.io"
1010

1111
[dependencies]
1212
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] }
13+
log = { version = "0.4.17", default-features = false }
1314
scale-info = { version = "2.5.0", default-features = false, features = ["derive", "serde"] }
1415
serde = { version = "1.0.163", optional = true }
1516
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" }
3233
sp-core = { version = "21.0.0", path = "../../primitives/core" }
3334
sp-io = { version = "23.0.0", path = "../../primitives/io" }
3435
sp-staking = { version = "4.0.0-dev", path = "../../primitives/staking" }
36+
sp-state-machine = { version = "0.28.0", default-features = false, path = "../../primitives/state-machine" }
3537

3638
[features]
3739
default = ["std"]
3840
std = [
3941
"codec/std",
42+
"log/std",
4043
"frame-support/std",
4144
"frame-system/std",
4245
"pallet-authorship/std",
@@ -54,7 +57,8 @@ std = [
5457
"pallet-staking/std",
5558
"pallet-timestamp/std",
5659
"sp-core/std",
57-
"sp-io/std"
60+
"sp-io/std",
61+
"sp-state-machine/std"
5862
]
5963
try-runtime = [
6064
"frame-support/try-runtime",

frame/beefy/src/equivocation.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@
3535
//! definition.
3636
3737
use codec::{self as codec, Decode, Encode};
38-
use frame_support::{
39-
log,
40-
traits::{Get, KeyOwnerProofSystem},
41-
};
38+
use frame_support::traits::{Get, KeyOwnerProofSystem};
4239
use frame_system::pallet_prelude::BlockNumberFor;
4340
use log::{error, info};
4441
use sp_consensus_beefy::{EquivocationProof, ValidatorSetId, KEY_TYPE as BEEFY_KEY_TYPE};

frame/beefy/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use codec::{Encode, MaxEncodedLen};
2121

2222
use frame_support::{
2323
dispatch::{DispatchResultWithPostInfo, Pays},
24-
log,
2524
pallet_prelude::*,
2625
traits::{Get, OneSessionHandler},
2726
weights::Weight,
@@ -31,6 +30,7 @@ use frame_system::{
3130
ensure_none, ensure_signed,
3231
pallet_prelude::{BlockNumberFor, OriginFor},
3332
};
33+
use log;
3434
use sp_runtime::{
3535
generic::DigestItem,
3636
traits::{IsMember, Member},

frame/beefy/src/mock.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ use frame_election_provider_support::{
2323
};
2424
use frame_support::{
2525
construct_runtime, parameter_types,
26-
sp_io::TestExternalities,
2726
traits::{ConstU16, ConstU32, ConstU64, KeyOwnerProofSystem, OnFinalize, OnInitialize},
28-
BasicExternalities,
2927
};
3028
use pallet_session::historical as pallet_session_historical;
3129
use sp_core::{crypto::KeyTypeId, ConstU128, H256};
30+
use sp_io::TestExternalities;
3231
use sp_runtime::{
3332
app_crypto::ecdsa::Public,
3433
curve::PiecewiseLinear,
@@ -38,6 +37,7 @@ use sp_runtime::{
3837
BuildStorage, Perbill,
3938
};
4039
use sp_staking::{EraIndex, SessionIndex};
40+
use sp_state_machine::BasicExternalities;
4141

4242
use crate as pallet_beefy;
4343

frame/benchmarking/src/v1.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -446,13 +446,13 @@ macro_rules! benchmarks_iter {
446446
>:: [< new_call_variant_ $dispatch >] (
447447
$($arg),*
448448
);
449-
let __benchmarked_call_encoded = $crate::frame_support::codec::Encode::encode(
449+
let __benchmarked_call_encoded = $crate::frame_support::__private::codec::Encode::encode(
450450
&__call
451451
);
452452
}: {
453453
let __call_decoded = <
454454
Call<T $(, $instance )?>
455-
as $crate::frame_support::codec::Decode
455+
as $crate::frame_support::__private::codec::Decode
456456
>::decode(&mut &__benchmarked_call_encoded[..])
457457
.expect("call is encoded above, encoding must be correct");
458458
let __origin = $crate::to_origin!($origin $(, $origin_type)?);

frame/collective/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@
4242
#![cfg_attr(not(feature = "std"), no_std)]
4343
#![recursion_limit = "128"]
4444

45+
use codec::{Decode, Encode, MaxEncodedLen};
4546
use scale_info::TypeInfo;
4647
use sp_io::storage;
4748
use sp_runtime::{traits::Hash, RuntimeDebug};
4849
use sp_std::{marker::PhantomData, prelude::*, result};
4950

5051
use frame_support::{
51-
codec::{Decode, Encode, MaxEncodedLen},
5252
dispatch::{
5353
DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo,
5454
Pays, PostDispatchInfo,

0 commit comments

Comments
 (0)