Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add HoldReason to the NIS pallet #13823

Merged
merged 4 commits into from
Apr 6, 2023

Conversation

KiChjang
Copy link
Contributor

@KiChjang KiChjang commented Apr 5, 2023

Partial paritytech/polkadot-sdk#236.

Adds the HoldReason as a composite_enum to the NIS pallet. Also fixes a couple of naming bugs and adds more tests.

@KiChjang KiChjang added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Apr 5, 2023
#[pallet::composite_enum]
pub enum HoldReason {
/// The NIS Pallet has reserved it for a non-fungible receipt.
#[codec(index = 0)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary, but it's there to ensure that the codec index remains unchanged by being explicit.

@@ -35,6 +35,7 @@ pub fn expand_outer_freeze_reason(pallet_decls: &[Pallet], scrate: &TokenStream)
}

quote! {
/// A reason for placing a freeze on funds.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to forward the real docs put on top of the type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that what this is already doing? It's documenting a type that is expanded by the proc macro.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't forwarding the docs that I as a user put onto the type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay, so the problem is that RuntimeFreezeReason is never exposed to the user -- it's generated by construct_runtime. The only way that this would make sense is if we forward the doc comments on the pallet's FreezeReason, which I think is already what we do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh okay, missed that this is the runtime level declaration.

@KiChjang
Copy link
Contributor Author

KiChjang commented Apr 6, 2023

bot merge

@paritytech-processbot paritytech-processbot bot merged commit c0793b5 into master Apr 6, 2023
@paritytech-processbot paritytech-processbot bot deleted the kckyeung/nis-hold-reason branch April 6, 2023 06:24
gpestana pushed a commit that referenced this pull request Apr 23, 2023
* Add HoldReason to the NIS pallet

* Rename composable_enum to composite_enum

* Add encoding test

* Add more doc comments
nathanwhit pushed a commit to nathanwhit/substrate that referenced this pull request Jul 19, 2023
* Add HoldReason to the NIS pallet

* Rename composable_enum to composite_enum

* Add encoding test

* Add more doc comments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants