Skip to content
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

allow for u8 to be used as hold/freeze reason #5348

Merged
merged 7 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions prdoc/pr_5348.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: allow for u8 to be used as hold/freeze reason

doc:
- audience: Runtime Dev
description: |
Allows for `u8` type to be configured as `HoldReason` and `FreezeReason`

crates:
- name: frame-support
bump: patch
4 changes: 4 additions & 0 deletions substrate/frame/support/src/traits/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ impl VariantCount for () {
const VARIANT_COUNT: u32 = 0;
}

impl VariantCount for u8 {
const VARIANT_COUNT: u32 = 256;
}
kianenigma marked this conversation as resolved.
Show resolved Hide resolved

/// Adapter for `Get<u32>` to access `VARIANT_COUNT` from `trait pub trait VariantCount {`.
pub struct VariantCountOf<T: VariantCount>(core::marker::PhantomData<T>);
impl<T: VariantCount> Get<u32> for VariantCountOf<T> {
Expand Down
Loading