-
Notifications
You must be signed in to change notification settings - Fork 695
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
Use frame umbrella crate in pallet-babe
& pallet-staking-reward-curve
#6412
base: master
Are you sure you want to change the base?
Use frame umbrella crate in pallet-babe
& pallet-staking-reward-curve
#6412
Conversation
pallet-babe
pallet-babe
& staking/reward-curve
pallet-babe
& staking/reward-curve
pallet-babe
& pallet-staking-reward-curve
deps::sp_runtime::generic::DigestItem, | ||
prelude::*, | ||
traits::{ | ||
DisabledValidators, EstimateNextSessionRotation, FindAuthor, IsMember, |
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.
A few of these seems general enough to go to prelude:
IsMember
, FindAuthor
, OnTimestampSet
.
Rule of thumb: If you can foresee it being useful in any pallet, then prelude. Else, domain specifc mod (e.g. mod traits
).
"frame/std", | ||
"log/std", | ||
"pallet-authorship/std", | ||
"pallet-balances/std", |
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.
Should not be needed if these pallets are only needed for tests.
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.
Some small changes needed, but looks good so far.
@re-gius can you also review this please?
}; | ||
|
||
/// Other error/result types for runtime | ||
/// Other error/result types for runtime. |
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 comment is not correct anymore, you need to change it or add new items in a separate line.
@@ -528,7 +540,11 @@ pub mod derive { | |||
} | |||
|
|||
pub mod hashing { |
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.
you can name it cryptography
, I don't think hashing
makes sense with the new items
} verify { | ||
|
||
#[extrinsic_call] | ||
_(equivocation_proof1); |
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.
check_equivocation_proof
is not a Runtime call, you need #[block]
here
@@ -79,14 +79,14 @@ pub fn build(input: TokenStream) -> TokenStream { | |||
let declaration = generate_piecewise_linear(points); | |||
let test_module = generate_test_module(&input); | |||
|
|||
let imports = match crate_name("sp-runtime") { |
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 doesn't seem to work (see CI errors)
Description
Modifying pallet-babe and pallet-staking-reward-curve to use umbrella crate whilst adding a few types and preludes I deemed necessary for other pallets to potentially use as well.
These modifications are inspired by #5995
Review Notes
Some notable changes to umbrella crate preludes:
Exporting arithmetic prelude since this is used a lot throughout various pallets.
Exporting a few crypto primitives in the
hashing
prelude.Maybe we should rename
hashing
tocryptography
, something more general to encompass hashing and cryptographic methods such as VRFs.Updated pallet-staking-reward-curve proc-macro to use umbrella crate since it was being used in pallet-babe.
Polkadot address: 15Ug5Xtwf8wpD5PCKZcetXMh8NadVm3hHWBn8NQan3cqD