-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
migrate alliance, fast-unstake and bags list to use derive-impl #1636
Changes from all commits
49b6757
e9b5626
b304cfd
cd8513b
b3ae7ce
a319f93
97f953e
e652c54
5965703
3c74110
bfcb62d
917f54f
ed28c1c
8f99359
581e218
38f196f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,7 @@ use sp_runtime::{BuildStorage, TokenError}; | |
type Block = frame_system::mocking::MockBlockU32<Test>; | ||
|
||
frame_support::construct_runtime!( | ||
pub enum Test | ||
{ | ||
pub enum Test { | ||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>}, | ||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, | ||
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>}, | ||
|
@@ -43,24 +42,15 @@ frame_support::construct_runtime!( | |
impl frame_system::Config for Test { | ||
type Block = Block; | ||
type BlockHashCount = ConstU32<250>; | ||
type RuntimeOrigin = RuntimeOrigin; | ||
type RuntimeCall = RuntimeCall; | ||
type RuntimeEvent = RuntimeEvent; | ||
type BaseCallFilter = TestBaseCallFilter; | ||
type PalletInfo = PalletInfo; | ||
type OnSetCode = (); | ||
|
||
type AccountData = pallet_balances::AccountData<u64>; | ||
// This pallet wishes to overwrite this. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not aware tbh, but somehow in the test setu they wishes to on;y allow balances and remark transactions. Probably to test that any call filter here cannot be bipassed by being wrapped in a multisig. |
||
type BaseCallFilter = TestBaseCallFilter; | ||
} | ||
|
||
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig as pallet_balances::DefaultConfig)] | ||
impl pallet_balances::Config for Test { | ||
type RuntimeEvent = RuntimeEvent; | ||
type RuntimeHoldReason = (); | ||
type ReserveIdentifier = [u8; 8]; | ||
type DustRemoval = (); | ||
type AccountStore = System; | ||
type ExistentialDeposit = ConstU64<1>; | ||
} | ||
|
||
pub struct TestBaseCallFilter; | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -877,6 +877,8 @@ pub fn inject_runtime_type(_: TokenStream, tokens: TokenStream) -> TokenStream { | |||
if item.ident != "RuntimeCall" && | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd love to see docs on these macros There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docs are available here:
|
||||
item.ident != "RuntimeEvent" && | ||||
item.ident != "RuntimeOrigin" && | ||||
item.ident != "RuntimeHoldReason" && | ||||
item.ident != "RuntimeFreezeReason" && | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be good to modify the error message as well. |
||||
item.ident != "PalletInfo" | ||||
{ | ||||
return syn::Error::new_spanned( | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, when we have
#[inject_runtime_type]
here, does it actually mean that the RHS here can be anything we want, and it wouldn't matter?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be any type (as long as it is a valid type identifier) and any type is valid because in
DefaultConfig
it is merely atype RuntimeHoldReason
with no bounds.