Restructure dispatch macro related exports (#1162)

* restructure dispatch macro related exports

* moved Dispatchable to lib.rs

* fix .gitignore final newline

* ".git/.scripts/commands/fmt/fmt.sh"

* fix rustdocs

* wip

---------

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
Co-authored-by: command-bot <>
Co-authored-by: ordian <write@reusable.software>
This commit is contained in:
Juan
2023-08-31 13:08:44 +02:00
committed by GitHub
parent d6af073aa5
commit bdbe982970
84 changed files with 195 additions and 244 deletions
@@ -578,14 +578,14 @@ fn call_weight_should_attach_to_call_enum() {
#[test]
fn call_name() {
use frame_support::dispatch::GetCallName;
use frame_support::traits::GetCallName;
let name = module3::Call::<Runtime>::aux_4 {}.get_call_name();
assert_eq!("aux_4", name);
}
#[test]
fn call_metadata() {
use frame_support::dispatch::{CallMetadata, GetCallMetadata};
use frame_support::traits::{CallMetadata, GetCallMetadata};
let call = RuntimeCall::Module3(module3::Call::<Runtime>::aux_4 {});
let metadata = call.get_call_metadata();
let expected = CallMetadata { function_name: "aux_4".into(), pallet_name: "Module3".into() };
@@ -594,14 +594,14 @@ fn call_metadata() {
#[test]
fn get_call_names() {
use frame_support::dispatch::GetCallName;
use frame_support::traits::GetCallName;
let call_names = module3::Call::<Runtime>::get_call_names();
assert_eq!(["fail", "aux_1", "aux_2", "aux_3", "aux_4", "operational"], call_names);
}
#[test]
fn get_module_names() {
use frame_support::dispatch::GetCallMetadata;
use frame_support::traits::GetCallMetadata;
let module_names = RuntimeCall::get_module_names();
assert_eq!(
[
+3 -5
View File
@@ -17,10 +17,7 @@
use frame_support::{
assert_ok,
dispatch::{
DispatchClass, DispatchInfo, Dispatchable, GetDispatchInfo, Parameter, Pays,
UnfilteredDispatchable,
},
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Parameter, Pays},
dispatch_context::with_context,
pallet_prelude::{StorageInfoTrait, ValueQuery},
parameter_types,
@@ -28,6 +25,7 @@ use frame_support::{
traits::{
ConstU32, GetCallIndex, GetCallName, GetStorageVersion, OnFinalize, OnGenesis,
OnInitialize, OnRuntimeUpgrade, PalletError, PalletInfoAccess, StorageVersion,
UnfilteredDispatchable,
},
weights::{RuntimeDbWeight, Weight},
};
@@ -37,7 +35,7 @@ use sp_io::{
TestExternalities,
};
use sp_runtime::{
traits::{Extrinsic as ExtrinsicT, SignaturePayload as SignaturePayloadT},
traits::{Dispatchable, Extrinsic as ExtrinsicT, SignaturePayload as SignaturePayloadT},
DispatchError, ModuleError,
};
@@ -16,11 +16,14 @@
// limitations under the License.
use frame_support::{
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Pays, UnfilteredDispatchable},
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Pays},
pallet_prelude::ValueQuery,
parameter_types,
storage::unhashed,
traits::{ConstU32, GetCallName, OnFinalize, OnGenesis, OnInitialize, OnRuntimeUpgrade},
traits::{
ConstU32, GetCallName, OnFinalize, OnGenesis, OnInitialize, OnRuntimeUpgrade,
UnfilteredDispatchable,
},
weights::Weight,
};
use sp_io::{