mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
BREAKING: Rename Call & Event (#11981)
* rename Event to RuntimeEvent * rename Call * rename in runtimes * small fix * rename Event * small fix & rename RuntimeCall back to Call for now * small fixes * more renaming * a bit more renaming * fmt * small fix * commit * prep for renaming associated types * fix * rename associated Event type * rename to RuntimeEvent * commit * merge conflict fixes & fmt * additional renaming * fix. * fix decl_event * rename in tests * remove warnings * remove accidental rename * . * commit * update .stderr * fix in test * update .stderr * TRYBUILD=overwrite * docs * fmt * small change in docs * rename PalletEvent to Event * rename Call to RuntimeCall * renamed at wrong places :P * rename Call * rename * rename associated type * fix * fix & fmt * commit * frame-support-test * passing tests * update docs * rustdoc fix * update .stderr * wrong code in docs * merge fix * fix in error message * update .stderr * docs & error message * . * merge fix * merge fix * fmt * fmt * merge fix * more fixing * fmt * remove unused * fmt * fix Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -250,9 +250,9 @@ impl system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type BlockNumber = BlockNumber;
|
||||
type AccountId = AccountId;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type DbWeight = ();
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ frame_support::construct_runtime!(
|
||||
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
#[test]
|
||||
fn check_modules_error_type() {
|
||||
@@ -373,7 +373,7 @@ fn check_modules_error_type() {
|
||||
message: Some("Something")
|
||||
})),
|
||||
);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -422,53 +422,53 @@ fn event_codec() {
|
||||
use codec::Encode;
|
||||
|
||||
let event = system::Event::<Runtime>::ExtrinsicSuccess;
|
||||
assert_eq!(Event::from(event).encode()[0], 30);
|
||||
assert_eq!(RuntimeEvent::from(event).encode()[0], 30);
|
||||
|
||||
let event = module1::Event::<Runtime, module1::Instance1>::A(test_pub());
|
||||
assert_eq!(Event::from(event).encode()[0], 31);
|
||||
assert_eq!(RuntimeEvent::from(event).encode()[0], 31);
|
||||
|
||||
let event = module2::Event::A;
|
||||
assert_eq!(Event::from(event).encode()[0], 32);
|
||||
assert_eq!(RuntimeEvent::from(event).encode()[0], 32);
|
||||
|
||||
let event = module1::Event::<Runtime, module1::Instance2>::A(test_pub());
|
||||
assert_eq!(Event::from(event).encode()[0], 33);
|
||||
assert_eq!(RuntimeEvent::from(event).encode()[0], 33);
|
||||
|
||||
let event = nested::module3::Event::A;
|
||||
assert_eq!(Event::from(event).encode()[0], 34);
|
||||
assert_eq!(RuntimeEvent::from(event).encode()[0], 34);
|
||||
|
||||
let event = module3::Event::A;
|
||||
assert_eq!(Event::from(event).encode()[0], 35);
|
||||
assert_eq!(RuntimeEvent::from(event).encode()[0], 35);
|
||||
|
||||
let event = module1::Event::<Runtime, module1::Instance5>::A(test_pub());
|
||||
assert_eq!(Event::from(event).encode()[0], 4);
|
||||
assert_eq!(RuntimeEvent::from(event).encode()[0], 4);
|
||||
|
||||
let event = module1::Event::<Runtime, module1::Instance6>::A(test_pub());
|
||||
assert_eq!(Event::from(event).encode()[0], 1);
|
||||
assert_eq!(RuntimeEvent::from(event).encode()[0], 1);
|
||||
|
||||
let event = module1::Event::<Runtime, module1::Instance7>::A(test_pub());
|
||||
assert_eq!(Event::from(event).encode()[0], 2);
|
||||
assert_eq!(RuntimeEvent::from(event).encode()[0], 2);
|
||||
|
||||
let event = module1::Event::<Runtime, module1::Instance8>::A(test_pub());
|
||||
assert_eq!(Event::from(event).encode()[0], 12);
|
||||
assert_eq!(RuntimeEvent::from(event).encode()[0], 12);
|
||||
|
||||
let event = module1::Event::<Runtime, module1::Instance9>::A(test_pub());
|
||||
assert_eq!(Event::from(event).encode()[0], 13);
|
||||
assert_eq!(RuntimeEvent::from(event).encode()[0], 13);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn call_codec() {
|
||||
use codec::Encode;
|
||||
assert_eq!(Call::System(system::Call::noop {}).encode()[0], 30);
|
||||
assert_eq!(Call::Module1_1(module1::Call::fail {}).encode()[0], 31);
|
||||
assert_eq!(Call::Module2(module2::Call::fail {}).encode()[0], 32);
|
||||
assert_eq!(Call::Module1_2(module1::Call::fail {}).encode()[0], 33);
|
||||
assert_eq!(Call::NestedModule3(nested::module3::Call::fail {}).encode()[0], 34);
|
||||
assert_eq!(Call::Module3(module3::Call::fail {}).encode()[0], 35);
|
||||
assert_eq!(Call::Module1_4(module1::Call::fail {}).encode()[0], 3);
|
||||
assert_eq!(Call::Module1_6(module1::Call::fail {}).encode()[0], 1);
|
||||
assert_eq!(Call::Module1_7(module1::Call::fail {}).encode()[0], 2);
|
||||
assert_eq!(Call::Module1_8(module1::Call::fail {}).encode()[0], 12);
|
||||
assert_eq!(Call::Module1_9(module1::Call::fail {}).encode()[0], 13);
|
||||
assert_eq!(RuntimeCall::System(system::Call::noop {}).encode()[0], 30);
|
||||
assert_eq!(RuntimeCall::Module1_1(module1::Call::fail {}).encode()[0], 31);
|
||||
assert_eq!(RuntimeCall::Module2(module2::Call::fail {}).encode()[0], 32);
|
||||
assert_eq!(RuntimeCall::Module1_2(module1::Call::fail {}).encode()[0], 33);
|
||||
assert_eq!(RuntimeCall::NestedModule3(nested::module3::Call::fail {}).encode()[0], 34);
|
||||
assert_eq!(RuntimeCall::Module3(module3::Call::fail {}).encode()[0], 35);
|
||||
assert_eq!(RuntimeCall::Module1_4(module1::Call::fail {}).encode()[0], 3);
|
||||
assert_eq!(RuntimeCall::Module1_6(module1::Call::fail {}).encode()[0], 1);
|
||||
assert_eq!(RuntimeCall::Module1_7(module1::Call::fail {}).encode()[0], 2);
|
||||
assert_eq!(RuntimeCall::Module1_8(module1::Call::fail {}).encode()[0], 12);
|
||||
assert_eq!(RuntimeCall::Module1_9(module1::Call::fail {}).encode()[0], 13);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -537,7 +537,7 @@ fn call_name() {
|
||||
#[test]
|
||||
fn call_metadata() {
|
||||
use frame_support::dispatch::{CallMetadata, GetCallMetadata};
|
||||
let call = Call::Module3(module3::Call::<Runtime>::aux_4 {});
|
||||
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() };
|
||||
assert_eq!(metadata, expected);
|
||||
@@ -553,7 +553,7 @@ fn get_call_names() {
|
||||
#[test]
|
||||
fn get_module_names() {
|
||||
use frame_support::dispatch::GetCallMetadata;
|
||||
let module_names = Call::get_module_names();
|
||||
let module_names = RuntimeCall::get_module_names();
|
||||
assert_eq!(
|
||||
[
|
||||
"System",
|
||||
@@ -575,13 +575,13 @@ fn get_module_names() {
|
||||
#[test]
|
||||
fn call_subtype_conversion() {
|
||||
use frame_support::{dispatch::CallableCallFor, traits::IsSubType};
|
||||
let call = Call::Module3(module3::Call::<Runtime>::fail {});
|
||||
let call = RuntimeCall::Module3(module3::Call::<Runtime>::fail {});
|
||||
let subcall: Option<&CallableCallFor<Module3, Runtime>> = call.is_sub_type();
|
||||
let subcall_none: Option<&CallableCallFor<Module2, Runtime>> = call.is_sub_type();
|
||||
assert_eq!(Some(&module3::Call::<Runtime>::fail {}), subcall);
|
||||
assert_eq!(None, subcall_none);
|
||||
|
||||
let from = Call::from(subcall.unwrap().clone());
|
||||
let from = RuntimeCall::from(subcall.unwrap().clone());
|
||||
assert_eq!(from, call);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u64;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
|
||||
+8
-17
@@ -1,28 +1,19 @@
|
||||
error: Unexpected tokens, expected one of `=`, `,`
|
||||
--> $DIR/both_use_and_excluded_parts.rs:29:43
|
||||
--> tests/construct_runtime_ui/both_use_and_excluded_parts.rs:29:43
|
||||
|
|
||||
29 | Pallet: pallet exclude_parts { Pallet } use_parts { Pallet },
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0412]: cannot find type `Call` in this scope
|
||||
--> $DIR/both_use_and_excluded_parts.rs:18:64
|
||||
|
|
||||
18 | pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
| ^^^^ not found in this scope
|
||||
|
|
||||
help: consider importing one of these items
|
||||
|
|
||||
1 | use crate::pallet::Call;
|
||||
|
|
||||
1 | use frame_support_test::Call;
|
||||
|
|
||||
1 | use frame_system::Call;
|
||||
|
|
||||
1 | use test_pallet::Call;
|
||||
error[E0412]: cannot find type `RuntimeCall` in this scope
|
||||
--> tests/construct_runtime_ui/both_use_and_excluded_parts.rs:18:64
|
||||
|
|
||||
18 | pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
| - ^^^^^^^^^^^ not found in this scope
|
||||
| |
|
||||
| help: you might be missing a type parameter: `<RuntimeCall>`
|
||||
|
||||
error[E0412]: cannot find type `Runtime` in this scope
|
||||
--> $DIR/both_use_and_excluded_parts.rs:20:25
|
||||
--> tests/construct_runtime_ui/both_use_and_excluded_parts.rs:20:25
|
||||
|
|
||||
20 | impl pallet::Config for Runtime {}
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
||||
@@ -20,7 +20,7 @@ pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u64;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
|
||||
+8
-17
@@ -1,28 +1,19 @@
|
||||
error: Invalid pallet part specified, the pallet `Pallet` doesn't have the `Call` part. Available parts are: `Pallet`, `Storage`.
|
||||
--> $DIR/exclude_undefined_part.rs:34:34
|
||||
--> tests/construct_runtime_ui/exclude_undefined_part.rs:34:34
|
||||
|
|
||||
34 | Pallet: pallet exclude_parts { Call },
|
||||
| ^^^^
|
||||
|
||||
error[E0412]: cannot find type `Call` in this scope
|
||||
--> $DIR/exclude_undefined_part.rs:23:64
|
||||
|
|
||||
23 | pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
| ^^^^ not found in this scope
|
||||
|
|
||||
help: consider importing one of these items
|
||||
|
|
||||
1 | use crate::pallet::Call;
|
||||
|
|
||||
1 | use frame_support_test::Call;
|
||||
|
|
||||
1 | use frame_system::Call;
|
||||
|
|
||||
1 | use test_pallet::Call;
|
||||
error[E0412]: cannot find type `RuntimeCall` in this scope
|
||||
--> tests/construct_runtime_ui/exclude_undefined_part.rs:23:64
|
||||
|
|
||||
23 | pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
| - ^^^^^^^^^^^ not found in this scope
|
||||
| |
|
||||
| help: you might be missing a type parameter: `<RuntimeCall>`
|
||||
|
||||
error[E0412]: cannot find type `Runtime` in this scope
|
||||
--> $DIR/exclude_undefined_part.rs:25:25
|
||||
--> tests/construct_runtime_ui/exclude_undefined_part.rs:25:25
|
||||
|
|
||||
25 | impl pallet::Config for Runtime {}
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
||||
@@ -6,7 +6,7 @@ pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u32;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl test_pallet::Config for Runtime {}
|
||||
|
||||
@@ -15,13 +15,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
|
||||
@@ -40,7 +40,7 @@ pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u32;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
@@ -49,13 +49,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
|
||||
@@ -15,7 +15,7 @@ pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u32;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
@@ -24,13 +24,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
|
||||
@@ -15,7 +15,7 @@ pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u32;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
@@ -24,13 +24,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
|
||||
@@ -45,36 +45,3 @@ help: if you import `Event`, refer to it directly
|
||||
57 - }
|
||||
58 - }
|
||||
|
|
||||
|
||||
error[E0412]: cannot find type `Event` in module `pallet`
|
||||
--> tests/construct_runtime_ui/undefined_event_part.rs:49:1
|
||||
|
|
||||
49 | / construct_runtime! {
|
||||
50 | | pub enum Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
| |_^ not found in `pallet`
|
||||
|
|
||||
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider importing one of these items
|
||||
|
|
||||
1 | use crate::Event;
|
||||
|
|
||||
1 | use frame_system::Event;
|
||||
|
|
||||
help: if you import `Event`, refer to it directly
|
||||
|
|
||||
49 - construct_runtime! {
|
||||
50 - pub enum Runtime where
|
||||
51 - Block = Block,
|
||||
52 - NodeBlock = Block,
|
||||
53 - UncheckedExtrinsic = UncheckedExtrinsic
|
||||
54 - {
|
||||
55 - System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
56 - Pallet: pallet::{Pallet, Event},
|
||||
57 - }
|
||||
58 - }
|
||||
|
|
||||
|
||||
+3
-3
@@ -15,7 +15,7 @@ pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u32;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
@@ -24,13 +24,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
|
||||
@@ -15,7 +15,7 @@ pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u32;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
@@ -24,13 +24,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
|
||||
@@ -15,7 +15,7 @@ pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u32;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
@@ -24,13 +24,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
|
||||
+3
-3
@@ -15,7 +15,7 @@ pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u32;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
@@ -24,13 +24,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
|
||||
+2
-2
@@ -15,14 +15,14 @@ error: `Pallet` does not have #[pallet::validate_unsigned] defined, perhaps you
|
||||
|
|
||||
= note: this error originates in the macro `pallet::__substrate_validate_unsigned_check::is_validate_unsigned_part_defined` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: no variant or associated item named `Pallet` found for enum `Call` in the current scope
|
||||
error[E0599]: no variant or associated item named `Pallet` found for enum `RuntimeCall` in the current scope
|
||||
--> tests/construct_runtime_ui/undefined_validate_unsigned_part.rs:56:3
|
||||
|
|
||||
49 | construct_runtime! {
|
||||
| ------------------ variant or associated item `Pallet` not found here
|
||||
...
|
||||
56 | Pallet: pallet::{Pallet, ValidateUnsigned},
|
||||
| ^^^^^^ variant or associated item not found in `Call`
|
||||
| ^^^^^^ variant or associated item not found in `RuntimeCall`
|
||||
|
||||
error[E0599]: no function or associated item named `pre_dispatch` found for struct `pallet::Pallet` in the current scope
|
||||
--> tests/construct_runtime_ui/undefined_validate_unsigned_part.rs:49:1
|
||||
|
||||
@@ -20,7 +20,7 @@ pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u64;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
|
||||
@@ -1,28 +1,19 @@
|
||||
error: Invalid pallet part specified, the pallet `Pallet` doesn't have the `Call` part. Available parts are: `Pallet`, `Storage`.
|
||||
--> $DIR/use_undefined_part.rs:34:30
|
||||
--> tests/construct_runtime_ui/use_undefined_part.rs:34:30
|
||||
|
|
||||
34 | Pallet: pallet use_parts { Call },
|
||||
| ^^^^
|
||||
|
||||
error[E0412]: cannot find type `Call` in this scope
|
||||
--> $DIR/use_undefined_part.rs:23:64
|
||||
|
|
||||
23 | pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
| ^^^^ not found in this scope
|
||||
|
|
||||
help: consider importing one of these items
|
||||
|
|
||||
1 | use crate::pallet::Call;
|
||||
|
|
||||
1 | use frame_support_test::Call;
|
||||
|
|
||||
1 | use frame_system::Call;
|
||||
|
|
||||
1 | use test_pallet::Call;
|
||||
error[E0412]: cannot find type `RuntimeCall` in this scope
|
||||
--> tests/construct_runtime_ui/use_undefined_part.rs:23:64
|
||||
|
|
||||
23 | pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
| - ^^^^^^^^^^^ not found in this scope
|
||||
| |
|
||||
| help: you might be missing a type parameter: `<RuntimeCall>`
|
||||
|
||||
error[E0412]: cannot find type `Runtime` in this scope
|
||||
--> $DIR/use_undefined_part.rs:25:25
|
||||
--> tests/construct_runtime_ui/use_undefined_part.rs:25:25
|
||||
|
|
||||
25 | impl pallet::Config for Runtime {}
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
||||
@@ -50,7 +50,7 @@ mod module1 {
|
||||
where
|
||||
<Self as system::Config>::BlockNumber: From<u32>,
|
||||
{
|
||||
type Event: From<Event<Self, I>> + Into<<Self as system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self, I>> + Into<<Self as system::Config>::RuntimeEvent>;
|
||||
type Origin: From<Origin<Self, I>>;
|
||||
type SomeParameter: Get<u32>;
|
||||
type GenericType: Default + Clone + Codec + EncodeLike + TypeInfo;
|
||||
@@ -154,7 +154,7 @@ mod module2 {
|
||||
|
||||
pub trait Config<I = DefaultInstance>: system::Config {
|
||||
type Amount: Parameter + Default;
|
||||
type Event: From<Event<Self, I>> + Into<<Self as system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self, I>> + Into<<Self as system::Config>::RuntimeEvent>;
|
||||
type Origin: From<Origin<Self, I>>;
|
||||
}
|
||||
|
||||
@@ -233,35 +233,35 @@ mod module3 {
|
||||
}
|
||||
|
||||
impl module1::Config<module1::Instance1> for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Origin = Origin;
|
||||
type SomeParameter = ConstU32<100>;
|
||||
type GenericType = u32;
|
||||
}
|
||||
impl module1::Config<module1::Instance2> for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Origin = Origin;
|
||||
type SomeParameter = ConstU32<100>;
|
||||
type GenericType = u32;
|
||||
}
|
||||
impl module2::Config for Runtime {
|
||||
type Amount = u16;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Origin = Origin;
|
||||
}
|
||||
impl module2::Config<module2::Instance1> for Runtime {
|
||||
type Amount = u32;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Origin = Origin;
|
||||
}
|
||||
impl module2::Config<module2::Instance2> for Runtime {
|
||||
type Amount = u32;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Origin = Origin;
|
||||
}
|
||||
impl module2::Config<module2::Instance3> for Runtime {
|
||||
type Amount = u64;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Origin = Origin;
|
||||
}
|
||||
impl module3::Config for Runtime {
|
||||
@@ -280,9 +280,9 @@ impl system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type BlockNumber = BlockNumber;
|
||||
type AccountId = AccountId;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type DbWeight = ();
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ frame_support::construct_runtime!(
|
||||
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
fn new_test_ext() -> sp_io::TestExternalities {
|
||||
GenesisConfig {
|
||||
|
||||
@@ -155,7 +155,7 @@ pub type BlockNumber = u64;
|
||||
pub type Index = u64;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
impl system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
@@ -163,9 +163,9 @@ impl system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type BlockNumber = BlockNumber;
|
||||
type AccountId = AccountId;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type DbWeight = ();
|
||||
}
|
||||
|
||||
|
||||
@@ -134,10 +134,10 @@ impl nested::module::Config for RuntimeOriginTest {}
|
||||
impl module::Config for RuntimeOriginTest {}
|
||||
|
||||
pub struct BaseCallFilter;
|
||||
impl Contains<Call> for BaseCallFilter {
|
||||
fn contains(c: &Call) -> bool {
|
||||
impl Contains<RuntimeCall> for BaseCallFilter {
|
||||
fn contains(c: &RuntimeCall) -> bool {
|
||||
match c {
|
||||
Call::NestedModule(_) => true,
|
||||
RuntimeCall::NestedModule(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
@@ -149,9 +149,9 @@ impl system::Config for RuntimeOriginTest {
|
||||
type Origin = Origin;
|
||||
type BlockNumber = BlockNumber;
|
||||
type AccountId = u32;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type DbWeight = ();
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ frame_support::construct_runtime!(
|
||||
pub type Signature = sr25519::Signature;
|
||||
pub type BlockNumber = u64;
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
|
||||
#[test]
|
||||
@@ -192,7 +192,7 @@ fn origin_default_filter() {
|
||||
assert_eq!(Origin::from(nested::module::Origin).filter_call(&rejected_call), false);
|
||||
|
||||
let mut origin = Origin::from(Some(0));
|
||||
origin.add_filter(|c| matches!(c, Call::Module(_)));
|
||||
origin.add_filter(|c| matches!(c, RuntimeCall::Module(_)));
|
||||
assert_eq!(origin.filter_call(&accepted_call), false);
|
||||
assert_eq!(origin.filter_call(&rejected_call), false);
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ pub mod pallet {
|
||||
|
||||
type Balance: Parameter + Default + TypeInfo;
|
||||
|
||||
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
#[pallet::extra_constants]
|
||||
@@ -477,7 +477,7 @@ pub mod pallet2 {
|
||||
where
|
||||
<Self as frame_system::Config>::AccountId: From<SomeType1> + SomeAssociation1,
|
||||
{
|
||||
type Event: From<Event> + IsType<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
@@ -579,13 +579,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
@@ -601,7 +601,7 @@ impl frame_system::Config for Runtime {
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
impl pallet::Config for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type MyGetParam = ConstU32<10>;
|
||||
type MyGetParam2 = ConstU32<11>;
|
||||
type MyGetParam3 = MyGetParam3;
|
||||
@@ -609,7 +609,7 @@ impl pallet::Config for Runtime {
|
||||
}
|
||||
|
||||
impl pallet2::Config for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
}
|
||||
|
||||
impl pallet4::Config for Runtime {}
|
||||
@@ -621,7 +621,7 @@ impl pallet3::Config for Runtime {
|
||||
|
||||
pub type Header = sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo256>;
|
||||
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, (), ()>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, RuntimeCall, (), ()>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Runtime where
|
||||
@@ -639,10 +639,10 @@ frame_support::construct_runtime!(
|
||||
}
|
||||
);
|
||||
|
||||
// Test that the part `Call` is excluded from Example2 and included in Example4.
|
||||
fn _ensure_call_is_correctly_excluded_and_included(call: Call) {
|
||||
// Test that the part `RuntimeCall` is excluded from Example2 and included in Example4.
|
||||
fn _ensure_call_is_correctly_excluded_and_included(call: RuntimeCall) {
|
||||
match call {
|
||||
Call::System(_) | Call::Example(_) | Call::Example4(_) => (),
|
||||
RuntimeCall::System(_) | RuntimeCall::Example(_) | RuntimeCall::Example4(_) => (),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -665,7 +665,7 @@ fn transactional_works() {
|
||||
.iter()
|
||||
.map(|e| &e.event)
|
||||
.collect::<Vec<_>>(),
|
||||
vec![&Event::Example(pallet::Event::Something(0))],
|
||||
vec![&RuntimeEvent::Example(pallet::Event::Something(0))],
|
||||
);
|
||||
})
|
||||
}
|
||||
@@ -730,7 +730,7 @@ fn inherent_expand() {
|
||||
let inherents = InherentData::new().create_extrinsics();
|
||||
|
||||
let expected = vec![UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo_no_post_info {}),
|
||||
function: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
signature: None,
|
||||
}];
|
||||
assert_eq!(expected, inherents);
|
||||
@@ -745,11 +745,11 @@ fn inherent_expand() {
|
||||
),
|
||||
vec![
|
||||
UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo_no_post_info {}),
|
||||
function: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
signature: None,
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo { foo: 1, bar: 0 }),
|
||||
function: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 0 }),
|
||||
signature: None,
|
||||
},
|
||||
],
|
||||
@@ -767,11 +767,11 @@ fn inherent_expand() {
|
||||
),
|
||||
vec![
|
||||
UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo_no_post_info {}),
|
||||
function: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
signature: None,
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo { foo: 0, bar: 0 }),
|
||||
function: RuntimeCall::Example(pallet::Call::foo { foo: 0, bar: 0 }),
|
||||
signature: None,
|
||||
},
|
||||
],
|
||||
@@ -788,7 +788,7 @@ fn inherent_expand() {
|
||||
Digest::default(),
|
||||
),
|
||||
vec![UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo_storage_layer { foo: 0 }),
|
||||
function: RuntimeCall::Example(pallet::Call::foo_storage_layer { foo: 0 }),
|
||||
signature: None,
|
||||
}],
|
||||
);
|
||||
@@ -806,7 +806,7 @@ fn inherent_expand() {
|
||||
Digest::default(),
|
||||
),
|
||||
vec![UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo_no_post_info {}),
|
||||
function: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
signature: Some((1, (), ())),
|
||||
}],
|
||||
);
|
||||
@@ -825,11 +825,11 @@ fn inherent_expand() {
|
||||
),
|
||||
vec![
|
||||
UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo { foo: 1, bar: 1 }),
|
||||
function: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 1 }),
|
||||
signature: None,
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo_storage_layer { foo: 0 }),
|
||||
function: RuntimeCall::Example(pallet::Call::foo_storage_layer { foo: 0 }),
|
||||
signature: None,
|
||||
},
|
||||
],
|
||||
@@ -847,15 +847,15 @@ fn inherent_expand() {
|
||||
),
|
||||
vec![
|
||||
UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo { foo: 1, bar: 1 }),
|
||||
function: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 1 }),
|
||||
signature: None,
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo_storage_layer { foo: 0 }),
|
||||
function: RuntimeCall::Example(pallet::Call::foo_storage_layer { foo: 0 }),
|
||||
signature: None,
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo_no_post_info {}),
|
||||
function: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
signature: None,
|
||||
},
|
||||
],
|
||||
@@ -873,15 +873,15 @@ fn inherent_expand() {
|
||||
),
|
||||
vec![
|
||||
UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo { foo: 1, bar: 1 }),
|
||||
function: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 1 }),
|
||||
signature: None,
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo { foo: 1, bar: 0 }),
|
||||
function: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 0 }),
|
||||
signature: Some((1, (), ())),
|
||||
},
|
||||
UncheckedExtrinsic {
|
||||
function: Call::Example(pallet::Call::foo_no_post_info {}),
|
||||
function: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
|
||||
signature: None,
|
||||
},
|
||||
],
|
||||
@@ -925,7 +925,7 @@ fn pallet_expand_deposit_event() {
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[0].event,
|
||||
Event::Example(pallet::Event::Something(3)),
|
||||
RuntimeEvent::Example(pallet::Event::Something(3)),
|
||||
);
|
||||
})
|
||||
}
|
||||
@@ -1064,27 +1064,27 @@ fn pallet_hooks_expand() {
|
||||
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[0].event,
|
||||
Event::Example(pallet::Event::Something(10)),
|
||||
RuntimeEvent::Example(pallet::Event::Something(10)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[1].event,
|
||||
Event::Example2(pallet2::Event::Something(11)),
|
||||
RuntimeEvent::Example2(pallet2::Event::Something(11)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[2].event,
|
||||
Event::Example(pallet::Event::Something(20)),
|
||||
RuntimeEvent::Example(pallet::Event::Something(20)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[3].event,
|
||||
Event::Example2(pallet2::Event::Something(21)),
|
||||
RuntimeEvent::Example2(pallet2::Event::Something(21)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[4].event,
|
||||
Event::Example(pallet::Event::Something(30)),
|
||||
RuntimeEvent::Example(pallet::Event::Something(30)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[5].event,
|
||||
Event::Example2(pallet2::Event::Something(31)),
|
||||
RuntimeEvent::Example2(pallet2::Event::Something(31)),
|
||||
);
|
||||
})
|
||||
}
|
||||
@@ -1110,27 +1110,27 @@ fn all_pallets_type_reversed_order_is_correct() {
|
||||
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[0].event,
|
||||
Event::Example2(pallet2::Event::Something(11)),
|
||||
RuntimeEvent::Example2(pallet2::Event::Something(11)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[1].event,
|
||||
Event::Example(pallet::Event::Something(10)),
|
||||
RuntimeEvent::Example(pallet::Event::Something(10)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[2].event,
|
||||
Event::Example2(pallet2::Event::Something(21)),
|
||||
RuntimeEvent::Example2(pallet2::Event::Something(21)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[3].event,
|
||||
Event::Example(pallet::Event::Something(20)),
|
||||
RuntimeEvent::Example(pallet::Event::Something(20)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[4].event,
|
||||
Event::Example2(pallet2::Event::Something(31)),
|
||||
RuntimeEvent::Example2(pallet2::Event::Something(31)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[5].event,
|
||||
Event::Example(pallet::Event::Something(30)),
|
||||
RuntimeEvent::Example(pallet::Event::Something(30)),
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ mod pallet_old {
|
||||
+ Into<u64>
|
||||
+ Default
|
||||
+ SomeAssociation;
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self>> + Into<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
@@ -120,7 +120,7 @@ pub mod pallet {
|
||||
+ scale_info::StaticTypeInfo;
|
||||
#[pallet::constant]
|
||||
type SomeConst: Get<Self::Balance>;
|
||||
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
@@ -229,13 +229,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
@@ -251,19 +251,19 @@ impl frame_system::Config for Runtime {
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
impl pallet::Config for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SomeConst = ConstU64<10>;
|
||||
type Balance = u64;
|
||||
}
|
||||
impl pallet_old::Config for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SomeConst = ConstU64<10>;
|
||||
type Balance = u64;
|
||||
}
|
||||
|
||||
pub type Header = sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo256>;
|
||||
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, (), ()>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, RuntimeCall, (), ()>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Runtime where
|
||||
|
||||
@@ -30,7 +30,7 @@ mod pallet_old {
|
||||
pub trait Config<I: Instance = DefaultInstance>: frame_system::Config {
|
||||
type SomeConst: Get<Self::Balance>;
|
||||
type Balance: Parameter + codec::HasCompact + From<u32> + Into<u64> + Default;
|
||||
type Event: From<Event<Self, I>> + Into<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self, I>> + Into<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
@@ -105,7 +105,8 @@ pub mod pallet {
|
||||
+ scale_info::StaticTypeInfo;
|
||||
#[pallet::constant]
|
||||
type SomeConst: Get<Self::Balance>;
|
||||
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self, I>>
|
||||
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
@@ -212,13 +213,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
@@ -231,39 +232,39 @@ impl frame_system::Config for Runtime {
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
impl pallet::Config for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SomeConst = ConstU64<10>;
|
||||
type Balance = u64;
|
||||
}
|
||||
impl pallet::Config<pallet::Instance2> for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SomeConst = ConstU64<10>;
|
||||
type Balance = u64;
|
||||
}
|
||||
impl pallet::Config<pallet::Instance3> for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SomeConst = ConstU64<10>;
|
||||
type Balance = u64;
|
||||
}
|
||||
impl pallet_old::Config for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SomeConst = ConstU64<10>;
|
||||
type Balance = u64;
|
||||
}
|
||||
impl pallet_old::Config<pallet_old::Instance2> for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SomeConst = ConstU64<10>;
|
||||
type Balance = u64;
|
||||
}
|
||||
impl pallet_old::Config<pallet_old::Instance3> for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SomeConst = ConstU64<10>;
|
||||
type Balance = u64;
|
||||
}
|
||||
|
||||
pub type Header = sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo256>;
|
||||
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, (), ()>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, RuntimeCall, (), ()>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Runtime where
|
||||
|
||||
@@ -42,7 +42,8 @@ pub mod pallet {
|
||||
#[pallet::constant]
|
||||
type MyGetParam: Get<u32>;
|
||||
type Balance: Parameter + Default + scale_info::StaticTypeInfo;
|
||||
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self, I>>
|
||||
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
@@ -253,7 +254,8 @@ pub mod pallet2 {
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config<I: 'static = ()>: frame_system::Config {
|
||||
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self, I>>
|
||||
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
@@ -288,13 +290,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
@@ -310,25 +312,25 @@ impl frame_system::Config for Runtime {
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
impl pallet::Config for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type MyGetParam = ConstU32<10>;
|
||||
type Balance = u64;
|
||||
}
|
||||
impl pallet::Config<pallet::Instance1> for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type MyGetParam = ConstU32<10>;
|
||||
type Balance = u64;
|
||||
}
|
||||
impl pallet2::Config for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
}
|
||||
impl pallet2::Config<pallet::Instance1> for Runtime {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
}
|
||||
|
||||
pub type Header = sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo256>;
|
||||
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, (), ()>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, RuntimeCall, (), ()>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Runtime where
|
||||
@@ -433,7 +435,7 @@ fn pallet_expand_deposit_event() {
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[0].event,
|
||||
Event::Example(pallet::Event::Something(3)),
|
||||
RuntimeEvent::Example(pallet::Event::Something(3)),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -444,7 +446,7 @@ fn pallet_expand_deposit_event() {
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[0].event,
|
||||
Event::Instance1Example(pallet::Event::Something(3)),
|
||||
RuntimeEvent::Instance1Example(pallet::Event::Something(3)),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -668,27 +670,27 @@ fn pallet_hooks_expand() {
|
||||
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[0].event,
|
||||
Event::Example(pallet::Event::Something(10)),
|
||||
RuntimeEvent::Example(pallet::Event::Something(10)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[1].event,
|
||||
Event::Instance1Example(pallet::Event::Something(11)),
|
||||
RuntimeEvent::Instance1Example(pallet::Event::Something(11)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[2].event,
|
||||
Event::Example(pallet::Event::Something(20)),
|
||||
RuntimeEvent::Example(pallet::Event::Something(20)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[3].event,
|
||||
Event::Instance1Example(pallet::Event::Something(21)),
|
||||
RuntimeEvent::Instance1Example(pallet::Event::Something(21)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[4].event,
|
||||
Event::Example(pallet::Event::Something(30)),
|
||||
RuntimeEvent::Example(pallet::Event::Something(30)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Pallet::<Runtime>::events()[5].event,
|
||||
Event::Instance1Example(pallet::Event::Something(31)),
|
||||
RuntimeEvent::Instance1Example(pallet::Event::Something(31)),
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ mod pallet {
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config {
|
||||
type Bar;
|
||||
type Event: IsType<<Self as frame_system::Config>::Event> + From<Event<Self>>;
|
||||
type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent> + From<Event<Self>>;
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
error: Invalid usage of Event, `Config` contains no associated type `Event`, but enum `Event` is declared (in use of `#[pallet::event]`). An Event associated type must be declare on trait `Config`.
|
||||
error: Invalid usage of RuntimeEvent, `Config` contains no associated type `RuntimeEvent`, but enum `Event` is declared (in use of `#[pallet::event]`). An RuntimeEvent associated type must be declare on trait `Config`.
|
||||
--> $DIR/event_not_in_trait.rs:1:1
|
||||
|
|
||||
1 | #[frame_support::pallet]
|
||||
|
||||
@@ -6,7 +6,7 @@ mod pallet {
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config {
|
||||
type Bar;
|
||||
type Event;
|
||||
type RuntimeEvent;
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error: Invalid `type Event`, associated type `Event` is reserved and must bound: `IsType<<Self as frame_system::Config>::Event>`
|
||||
error: Invalid `type RuntimeEvent`, associated type `RuntimeEvent` is reserved and must bound: `IsType<<Self as frame_system::Config>::RuntimeEvent>`
|
||||
--> $DIR/event_type_invalid_bound.rs:9:3
|
||||
|
|
||||
9 | type Event;
|
||||
9 | type RuntimeEvent;
|
||||
| ^^^^
|
||||
|
||||
@@ -6,7 +6,7 @@ mod pallet {
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config {
|
||||
type Bar;
|
||||
type Event: IsType<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error: Invalid `type Event`, associated type `Event` is reserved and must bound: `From<Event>` or `From<Event<Self>>` or `From<Event<Self, I>>`
|
||||
error: Invalid `type RuntimeEvent`, associated type `RuntimeEvent` is reserved and must bound: `From<Event>` or `From<Event<Self>>` or `From<Event<Self, I>>`
|
||||
--> $DIR/event_type_invalid_bound_2.rs:9:3
|
||||
|
|
||||
9 | type Event: IsType<<Self as frame_system::Config>::Event>;
|
||||
9 | type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
| ^^^^
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
pub trait Trait: frame_system::Config {
|
||||
type Balance: frame_support::dispatch::Parameter;
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self>> + Into<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
frame_support::decl_storage! {
|
||||
@@ -108,7 +108,7 @@ mod tests {
|
||||
type TestHeader = sp_runtime::generic::Header<u64, sp_runtime::traits::BlakeTwo256>;
|
||||
type TestUncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<
|
||||
<Runtime as frame_system::Config>::AccountId,
|
||||
<Runtime as frame_system::Config>::Call,
|
||||
<Runtime as frame_system::Config>::RuntimeCall,
|
||||
(),
|
||||
SignedExtra,
|
||||
>;
|
||||
@@ -130,12 +130,12 @@ mod tests {
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
type Hash = sp_core::H256;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = TestHeader;
|
||||
type Event = ();
|
||||
type RuntimeEvent = ();
|
||||
type BlockHashCount = ConstU64<250>;
|
||||
type DbWeight = ();
|
||||
type BlockWeights = ();
|
||||
@@ -153,6 +153,6 @@ mod tests {
|
||||
|
||||
impl pallet_test::Trait for Runtime {
|
||||
type Balance = u32;
|
||||
type Event = ();
|
||||
type RuntimeEvent = ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ pub type BlockNumber = u64;
|
||||
pub type Index = u64;
|
||||
pub type Header = sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo256>;
|
||||
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, (), ()>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, RuntimeCall, (), ()>;
|
||||
|
||||
impl frame_system::Config for Runtime {
|
||||
type BlockWeights = ();
|
||||
@@ -89,13 +89,13 @@ impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
@@ -255,11 +255,11 @@ fn storage_layer_commit_then_rollback() {
|
||||
fn storage_layer_in_pallet_call() {
|
||||
TestExternalities::default().execute_with(|| {
|
||||
use sp_runtime::traits::Dispatchable;
|
||||
let call1 = Call::MyPallet(pallet::Call::set_value { value: 2 });
|
||||
let call1 = RuntimeCall::MyPallet(pallet::Call::set_value { value: 2 });
|
||||
assert_ok!(call1.dispatch(Origin::signed(0)));
|
||||
assert_eq!(Value::<Runtime>::get(), 2);
|
||||
|
||||
let call2 = Call::MyPallet(pallet::Call::set_value { value: 1 });
|
||||
let call2 = RuntimeCall::MyPallet(pallet::Call::set_value { value: 1 });
|
||||
assert_noop!(call2.dispatch(Origin::signed(0)), Error::<Runtime>::Revert);
|
||||
});
|
||||
}
|
||||
@@ -270,11 +270,11 @@ fn storage_layer_in_decl_pallet_call() {
|
||||
use frame_support::StorageValue;
|
||||
use sp_runtime::traits::Dispatchable;
|
||||
|
||||
let call1 = Call::DeclPallet(decl_pallet::Call::set_value { value: 2 });
|
||||
let call1 = RuntimeCall::DeclPallet(decl_pallet::Call::set_value { value: 2 });
|
||||
assert_ok!(call1.dispatch(Origin::signed(0)));
|
||||
assert_eq!(decl_pallet::DeclValue::get(), 2);
|
||||
|
||||
let call2 = Call::DeclPallet(decl_pallet::Call::set_value { value: 1 });
|
||||
let call2 = RuntimeCall::DeclPallet(decl_pallet::Call::set_value { value: 1 });
|
||||
assert_noop!(call2.dispatch(Origin::signed(0)), "Revert!");
|
||||
// Calling the function directly also works with storage layers.
|
||||
assert_noop!(decl_pallet::Module::<Runtime>::set_value(Origin::signed(1), 1), "Revert!");
|
||||
|
||||
@@ -25,12 +25,12 @@ pub trait Config: 'static + Eq + Clone {
|
||||
type Origin: Into<Result<RawOrigin<Self::AccountId>, Self::Origin>>
|
||||
+ From<RawOrigin<Self::AccountId>>;
|
||||
|
||||
type BaseCallFilter: frame_support::traits::Contains<Self::Call>;
|
||||
type BaseCallFilter: frame_support::traits::Contains<Self::RuntimeCall>;
|
||||
type BlockNumber: Decode + Encode + EncodeLike + Clone + Default + scale_info::TypeInfo;
|
||||
type Hash;
|
||||
type AccountId: Encode + EncodeLike + Decode + scale_info::TypeInfo;
|
||||
type Call;
|
||||
type Event: From<Event<Self>>;
|
||||
type RuntimeCall;
|
||||
type RuntimeEvent: From<Event<Self>>;
|
||||
type PalletInfo: frame_support::traits::PalletInfo;
|
||||
type DbWeight: Get<RuntimeDbWeight>;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ frame_support::decl_module! {
|
||||
}
|
||||
|
||||
impl<T: Config> Module<T> {
|
||||
pub fn deposit_event(_event: impl Into<T::Event>) {}
|
||||
pub fn deposit_event(_event: impl Into<T::RuntimeEvent>) {}
|
||||
}
|
||||
|
||||
frame_support::decl_event!(
|
||||
|
||||
Reference in New Issue
Block a user