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

Restructure frame_support::dispatch macro related exports #14817

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
1dfc9b4
make reexports private
juangirini Aug 10, 2023
dccfaeb
make reexports private 2
juangirini Aug 10, 2023
9706353
make reexports private for runtime-benchmarking
juangirini Aug 10, 2023
7d6c124
make reexports private for try-runtime
juangirini Aug 10, 2023
87fd6de
fix for try-runtime
juangirini Aug 10, 2023
1ffc743
make reexports private for tests
juangirini Aug 10, 2023
222b45d
rebase and fix conflicts
juangirini Aug 10, 2023
e795557
fmt
juangirini Aug 10, 2023
4c9ef13
make reexports private for tests
juangirini Aug 10, 2023
4d0b806
make reexports private for experimental
juangirini Aug 10, 2023
e32c82f
fix beefy
juangirini Aug 10, 2023
4386de3
fix ui test
juangirini Aug 10, 2023
54657c0
fix ui test
juangirini Aug 10, 2023
3566961
fix benches
juangirini Aug 14, 2023
08de067
Merge branch 'master' into jg/restructure-macro-related-exports
juangirini Aug 14, 2023
c419d4a
".git/.scripts/commands/fmt/fmt.sh"
Aug 14, 2023
b931ecb
fix contracts use
juangirini Aug 15, 2023
f4e5f55
wip
juangirini Aug 15, 2023
4ecbfff
wip
juangirini Aug 15, 2023
b7eaa34
Merge remote-tracking branch 'origin/master' into jg/restructure-macr…
juangirini Aug 15, 2023
095356c
do not reexport sp_api::metadata_ir
juangirini Aug 16, 2023
3bc2ddc
Merge branch 'master' into jg/restructure-macro-related-exports
juangirini Aug 16, 2023
3816fc4
fix CI checks
juangirini Aug 16, 2023
32f74a6
fix support tests
juangirini Aug 16, 2023
7d7d73b
".git/.scripts/commands/fmt/fmt.sh"
Aug 16, 2023
86ddd81
Update frame/support/src/lib.rs
juangirini Aug 17, 2023
5d00dfd
import codec directly
juangirini Aug 17, 2023
a6a4e3d
fmt
juangirini Aug 17, 2023
4df379c
Merge remote-tracking branch 'origin/master' into jg/restructure-macr…
Aug 17, 2023
d32e625
wip
juangirini Aug 17, 2023
5eb43f1
wip
juangirini Aug 17, 2023
b09e913
remove benchmarking private exports
juangirini Aug 18, 2023
50651b7
fix zepter warning
juangirini Aug 18, 2023
6889b65
fix imports
juangirini Aug 18, 2023
024765e
partially fix node-cli tests
juangirini Aug 18, 2023
0fcc322
fix node-cli tests
juangirini Aug 18, 2023
8c95104
Merge branch 'jg/restructure-macro-related-exports' into jg/restructu…
juangirini Aug 18, 2023
fdb2be4
fix node-cli build
juangirini Aug 18, 2023
8c72509
fix zepter warning
juangirini Aug 18, 2023
fb6f332
fix test
juangirini Aug 18, 2023
713a8ef
fix ui test
juangirini Aug 18, 2023
daf3dcb
Merge remote-tracking branch 'origin/master' into jg/restructure-macr…
Aug 21, 2023
ea40484
Merge branch 'jg/restructure-macro-related-exports' into jg/restructu…
juangirini Aug 21, 2023
e94e54b
Merge remote-tracking branch 'origin/master' into jg/restructure-macr…
Aug 22, 2023
96c726e
Merge remote-tracking branch 'origin/jg/restructure-macro-related-exp…
Aug 22, 2023
0b429e2
restructure dispatch macro related exports
juangirini Aug 23, 2023
d8c10ce
Merge branch 'master' into jg/restructure-benchmarking-macro-related-…
juangirini Aug 23, 2023
6398e06
Merge branch 'master' into jg/restructure-benchmarking-macro-related-…
juangirini Aug 23, 2023
35d4e7d
rebase and fix conflicts
juangirini Aug 23, 2023
46eb3b0
rebase and fix conflicts
juangirini Aug 23, 2023
55f3ab2
fix ci
juangirini Aug 23, 2023
f5a2c37
Merge branch 'jg/restructure-benchmarking-macro-related-exports' into…
juangirini Aug 23, 2023
a808102
remove unnecessary imports
juangirini Aug 24, 2023
08c6e5b
remove unnecessary imports
juangirini Aug 24, 2023
b6414ca
add import back
juangirini Aug 24, 2023
0cd5bc9
add import back
juangirini Aug 24, 2023
2ffc5f4
Merge branch 'jg/restructure-benchmarking-macro-related-exports' into…
juangirini Aug 24, 2023
4fff5dd
add import back
juangirini Aug 24, 2023
bda3e58
Merge branch 'master' into jg/restructure-dispatch-macro-related-exports
juangirini Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions frame/alliance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,13 @@ use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use sp_runtime::{
traits::{Saturating, StaticLookup, Zero},
RuntimeDebug,
traits::{Dispatchable, Saturating, StaticLookup, Zero},
DispatchError, RuntimeDebug,
};
use sp_std::{convert::TryInto, prelude::*};

use frame_support::{
dispatch::{
DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo,
PostDispatchInfo,
},
dispatch::{DispatchResult, DispatchResultWithPostInfo, GetDispatchInfo, PostDispatchInfo},
ensure,
traits::{
ChangeMembers, Currency, Get, InitializeMembers, IsSubType, OnUnbalanced,
Expand Down
5 changes: 1 addition & 4 deletions frame/assets/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ use super::*;
use frame_benchmarking::v1::{
account, benchmarks_instance_pallet, whitelist_account, whitelisted_caller, BenchmarkError,
};
use frame_support::{
dispatch::UnfilteredDispatchable,
traits::{EnsureOrigin, Get},
};
use frame_support::traits::{EnsureOrigin, Get, UnfilteredDispatchable};
use frame_system::RawOrigin as SystemOrigin;
use sp_runtime::traits::Bounded;
use sp_std::prelude::*;
Expand Down
4 changes: 2 additions & 2 deletions frame/assets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ pub use types::*;
use scale_info::TypeInfo;
use sp_runtime::{
traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedSub, Saturating, StaticLookup, Zero},
ArithmeticError, TokenError,
ArithmeticError, DispatchError, TokenError,
};
use sp_std::prelude::*;

use frame_support::{
dispatch::{DispatchError, DispatchResult},
dispatch::DispatchResult,
ensure,
pallet_prelude::DispatchResultWithPostInfo,
storage::KeyPrefixIterator,
Expand Down
8 changes: 2 additions & 6 deletions frame/benchmarking/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@

//! Interfaces, types and utils for benchmarking a FRAME runtime.
use codec::{Decode, Encode};
use frame_support::{
dispatch::{DispatchError, DispatchErrorWithPostInfo},
pallet_prelude::*,
traits::StorageInfo,
};
use frame_support::{dispatch::DispatchErrorWithPostInfo, pallet_prelude::*, traits::StorageInfo};
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use sp_io::hashing::blake2_256;
use sp_runtime::traits::TrailingZeroInput;
use sp_runtime::{traits::TrailingZeroInput, DispatchError};
use sp_std::{prelude::Box, vec::Vec};
use sp_storage::TrackedStorageKey;

Expand Down
8 changes: 5 additions & 3 deletions frame/collective/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_io::storage;
use sp_runtime::{traits::Hash, RuntimeDebug};
use sp_runtime::{
traits::{Dispatchable, Hash},
DispatchError, RuntimeDebug,
};
use sp_std::{marker::PhantomData, prelude::*, result};

use frame_support::{
dispatch::{
DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo,
Pays, PostDispatchInfo,
DispatchResult, DispatchResultWithPostInfo, GetDispatchInfo, Pays, PostDispatchInfo,
},
ensure, impl_ensure_origin_with_arg_ignoring_arg,
traits::{
Expand Down
11 changes: 6 additions & 5 deletions frame/contracts/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ use crate::{
};
use frame_support::{
crypto::ecdsa::ECDSAExt,
dispatch::{
fmt::Debug, DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable,
},
dispatch::{DispatchResult, DispatchResultWithPostInfo},
ensure,
storage::{with_transaction, TransactionOutcome},
traits::{
Expand All @@ -47,8 +45,11 @@ use sp_core::{
Get,
};
use sp_io::{crypto::secp256k1_ecdsa_recover_compressed, hashing::blake2_256};
use sp_runtime::traits::{Convert, Hash, Zero};
use sp_std::{marker::PhantomData, mem, prelude::*, vec::Vec};
use sp_runtime::{
traits::{Convert, Dispatchable, Hash, Zero},
DispatchError,
};
use sp_std::{fmt::Debug, marker::PhantomData, mem, prelude::*, vec::Vec};

pub type AccountIdOf<T> = <T as frame_system::Config>::AccountId;
pub type MomentOf<T> = <<T as Config>::Time as Time>::Moment;
Expand Down
6 changes: 2 additions & 4 deletions frame/contracts/src/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@

use crate::{exec::ExecError, Config, Error};
use frame_support::{
dispatch::{
DispatchError, DispatchErrorWithPostInfo, DispatchResultWithPostInfo, PostDispatchInfo,
},
dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, PostDispatchInfo},
weights::Weight,
DefaultNoBound,
};
use sp_core::Get;
use sp_runtime::traits::Zero;
use sp_runtime::{traits::Zero, DispatchError};
use sp_std::marker::PhantomData;

#[cfg(test)]
Expand Down
9 changes: 3 additions & 6 deletions frame/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ use crate::{
use codec::{Codec, Decode, Encode, HasCompact, MaxEncodedLen};
use environmental::*;
use frame_support::{
dispatch::{
DispatchError, Dispatchable, GetDispatchInfo, Pays, PostDispatchInfo, RawOrigin,
WithPostDispatchInfo,
},
dispatch::{GetDispatchInfo, Pays, PostDispatchInfo, RawOrigin, WithPostDispatchInfo},
ensure,
error::BadOrigin,
traits::{
Expand All @@ -137,8 +134,8 @@ use pallet_contracts_primitives::{
use scale_info::TypeInfo;
use smallvec::Array;
use sp_runtime::{
traits::{Convert, Hash, Saturating, StaticLookup, Zero},
RuntimeDebug,
traits::{Convert, Dispatchable, Hash, Saturating, StaticLookup, Zero},
DispatchError, RuntimeDebug,
};
use sp_std::{fmt::Debug, prelude::*};

Expand Down
4 changes: 3 additions & 1 deletion frame/contracts/src/migration/v15.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::{
AccountIdOf, BalanceOf, CodeHash, Config, HoldReason, Pallet, TrieId, Weight, LOG_TARGET,
};
#[cfg(feature = "try-runtime")]
use frame_support::{dispatch::Vec, traits::fungible::InspectHold};
use frame_support::traits::fungible::InspectHold;
use frame_support::{
pallet_prelude::*,
storage_alias,
Expand All @@ -43,6 +43,8 @@ use sp_core::hexdisplay::HexDisplay;
#[cfg(feature = "try-runtime")]
use sp_runtime::TryRuntimeError;
use sp_runtime::{traits::Zero, Saturating};
#[cfg(feature = "try-runtime")]
use sp_std::vec::Vec;

mod old {
use super::*;
Expand Down
3 changes: 1 addition & 2 deletions frame/contracts/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use crate::{
};
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
dispatch::DispatchError,
storage::child::{self, ChildInfo},
weights::Weight,
CloneNoBound, DefaultNoBound,
Expand All @@ -37,7 +36,7 @@ use sp_core::Get;
use sp_io::KillStorageResult;
use sp_runtime::{
traits::{Hash, Saturating, Zero},
BoundedBTreeMap, DispatchResult, RuntimeDebug,
BoundedBTreeMap, DispatchError, DispatchResult, RuntimeDebug,
};
use sp_std::{marker::PhantomData, prelude::*};

Expand Down
5 changes: 2 additions & 3 deletions frame/contracts/src/storage/meter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use crate::{
};

use frame_support::{
dispatch::{fmt::Debug, DispatchError},
ensure,
traits::{
fungible::{Mutate, MutateHold},
Expand All @@ -37,9 +36,9 @@ use frame_support::{
use sp_api::HashT;
use sp_runtime::{
traits::{Saturating, Zero},
FixedPointNumber, FixedU128,
DispatchError, FixedPointNumber, FixedU128,
};
use sp_std::{marker::PhantomData, vec, vec::Vec};
use sp_std::{fmt::Debug, marker::PhantomData, vec, vec::Vec};

/// Deposit that uses the native fungible's balance type.
pub type DepositOf<T> = Deposit<BalanceOf<T>>;
Expand Down
4 changes: 2 additions & 2 deletions frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use assert_matches::assert_matches;
use codec::Encode;
use frame_support::{
assert_err, assert_err_ignore_postinfo, assert_err_with_weight, assert_noop, assert_ok,
dispatch::{DispatchError, DispatchErrorWithPostInfo, PostDispatchInfo},
dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo},
parameter_types,
storage::child,
traits::{
Expand All @@ -61,7 +61,7 @@ use sp_keystore::{testing::MemoryKeystore, KeystoreExt};
use sp_runtime::{
testing::H256,
traits::{BlakeTwo256, Convert, Hash, IdentityLookup},
AccountId32, BuildStorage, Perbill, TokenError,
AccountId32, BuildStorage, DispatchError, Perbill, TokenError,
};

type Block = frame_system::mocking::MockBlock<Test>;
Expand Down
4 changes: 2 additions & 2 deletions frame/contracts/src/wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ use crate::{
};
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
dispatch::{DispatchError, DispatchResult},
dispatch::DispatchResult,
ensure,
traits::{fungible::MutateHold, tokens::Precision::BestEffort},
};
use sp_core::Get;
use sp_runtime::RuntimeDebug;
use sp_runtime::{DispatchError, RuntimeDebug};
use sp_std::prelude::*;
use wasmi::{Instance, Linker, Memory, MemoryType, StackLimits, Store};

Expand Down
4 changes: 2 additions & 2 deletions frame/contracts/src/wasm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ use crate::{

use bitflags::bitflags;
use codec::{Decode, DecodeLimit, Encode, MaxEncodedLen};
use frame_support::{dispatch::DispatchError, ensure, traits::Get, weights::Weight};
use frame_support::{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},
RuntimeDebug,
DispatchError, RuntimeDebug,
};
use sp_std::{fmt, prelude::*};
use wasmi::{core::HostError, errors::LinkerError, Linker, Memory, Store};
Expand Down
13 changes: 10 additions & 3 deletions frame/conviction-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#![cfg_attr(not(feature = "std"), no_std)]

use frame_support::{
dispatch::{DispatchError, DispatchResult},
dispatch::DispatchResult,
ensure,
traits::{
fungible, Currency, Get, LockIdentifier, LockableCurrency, PollStatus, Polling,
Expand All @@ -38,7 +38,7 @@ use frame_support::{
use frame_system::pallet_prelude::BlockNumberFor;
use sp_runtime::{
traits::{AtLeast32BitUnsigned, Saturating, StaticLookup, Zero},
ArithmeticError, Perbill,
ArithmeticError, DispatchError, Perbill,
};
use sp_std::prelude::*;

Expand Down Expand Up @@ -86,8 +86,15 @@ type ClassOf<T, I = ()> = <<T as Config<I>>::Polls as Polling<TallyOf<T, I>>>::C
#[frame_support::pallet]
pub mod pallet {
use super::*;
use frame_support::{pallet_prelude::*, traits::ClassCountOf};
use frame_support::{
pallet_prelude::{
DispatchResultWithPostInfo, IsType, StorageDoubleMap, StorageMap, ValueQuery,
},
traits::ClassCountOf,
Twox64Concat,
};
use frame_system::pallet_prelude::*;
use sp_runtime::BoundedVec;

#[pallet::pallet]
pub struct Pallet<T, I = ()>(_);
Expand Down
4 changes: 2 additions & 2 deletions frame/election-provider-multi-phase/src/unsigned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -984,12 +984,12 @@ mod tests {
};
use codec::Decode;
use frame_election_provider_support::IndexAssignment;
use frame_support::{assert_noop, assert_ok, dispatch::Dispatchable, traits::OffchainWorker};
use frame_support::{assert_noop, assert_ok, traits::OffchainWorker};
use sp_npos_elections::ElectionScore;
use sp_runtime::{
bounded_vec,
offchain::storage_lock::{BlockAndTime, StorageLock},
traits::{ValidateUnsigned, Zero},
traits::{Dispatchable, ValidateUnsigned, Zero},
ModuleError, PerU16, Perbill,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#![allow(dead_code)]

use frame_support::{
assert_ok, dispatch::UnfilteredDispatchable, parameter_types, traits, traits::Hooks,
assert_ok, parameter_types, traits,
traits::{Hooks, UnfilteredDispatchable},
weights::constants,
};
use frame_system::EnsureRoot;
Expand Down
4 changes: 2 additions & 2 deletions frame/lottery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub mod weights;

use codec::{Decode, Encode};
use frame_support::{
dispatch::{DispatchResult, Dispatchable, GetDispatchInfo},
dispatch::{DispatchResult, GetDispatchInfo},
ensure,
pallet_prelude::MaxEncodedLen,
storage::bounded_vec::BoundedVec,
Expand All @@ -65,7 +65,7 @@ use frame_support::{
};
pub use pallet::*;
use sp_runtime::{
traits::{AccountIdConversion, Saturating, Zero},
traits::{AccountIdConversion, Dispatchable, Saturating, Zero},
ArithmeticError, DispatchError, RuntimeDebug,
};
use sp_std::prelude::*;
Expand Down
3 changes: 1 addition & 2 deletions frame/multisig/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

use super::*;
use frame_support::{
dispatch::GetStorageVersion,
traits::{OnRuntimeUpgrade, WrapperKeepOpaque},
traits::{GetStorageVersion, OnRuntimeUpgrade, WrapperKeepOpaque},
Identity,
};

Expand Down
3 changes: 1 addition & 2 deletions frame/nfts/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" }
pallet-nfts = { version = "4.0.0-dev", default-features = false, path = "../../nfts" }
sp-api = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/api" }

[features]
default = [ "std" ]
std = [ "codec/std", "frame-support/std", "pallet-nfts/std", "sp-api/std" ]
std = [ "codec/std", "pallet-nfts/std", "sp-api/std" ]
2 changes: 1 addition & 1 deletion frame/nfts/runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#![cfg_attr(not(feature = "std"), no_std)]

use codec::{Decode, Encode};
use frame_support::dispatch::Vec;
use sp_api::vec::Vec;

sp_api::decl_runtime_apis! {
pub trait NftsApi<AccountId, CollectionId, ItemId>
Expand Down
3 changes: 1 addition & 2 deletions frame/nfts/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ use frame_benchmarking::v1::{
};
use frame_support::{
assert_ok,
dispatch::UnfilteredDispatchable,
traits::{EnsureOrigin, Get},
traits::{EnsureOrigin, Get, UnfilteredDispatchable},
BoundedVec,
};
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin as SystemOrigin};
Expand Down
Loading