-
Notifications
You must be signed in to change notification settings - Fork 416
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
Mocks updated to use TestDefaultConfig #1410
Conversation
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.
This is a step in the right direction!
There should be more 'deletion' though.
Since we're using default params, there's no need to have all the params defined manually.
@Dinonard I cleanup obvious duplications. But I didn't touch the parameters that were redefined with anything meaningful |
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.
LGTM
2f3ccef
to
3a9bfe4
Compare
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.
From what I have read on the pallet-default-config-example documentation, I think that additional deletions can be made.
type Block = Block; | ||
type DbWeight = (); | ||
type RuntimeOrigin = RuntimeOrigin; | ||
type Nonce = u64; | ||
type Hash = H256; |
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.
I think we can get rid of almost all parameters according to the frame_system::config_preludes::TestDefaultConfig; only keep only Block
(defined as no_default), BlockHashCount
and AccountData
(overwrited).
Even Runtime*
types are being injected as types generated by construct_runtime
(marked as #[inject_runtime_type]
).
} | ||
|
||
parameter_types! { | ||
pub const ExistentialDeposit: u64 = 10; | ||
} | ||
|
||
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)] | ||
impl pallet_balances::Config for Test { |
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.
I'm not sure about the impact on actual tests, but perhaps using all default values might work. For example, having MaxLocks
set to ConstU32<100>
or 1 as the existential deposit might also work. You can find default values for pallet_balances here.
Minimum allowed line rate is |
@ipapandinas I performed the additional cleanup. So the parameters that are left cannot be removed without changing code of the pallet or the test (i tried). |
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.
Nice effort! It's nice to see so many red lines removed - LGTM
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.
Nice! Great work!
Pull Request Summary
Resolves the issue #1350
The following implementations in mocks were wrapped with derive macro to use TestDefaultConfig:
Check list