HoldReason: Improve usage#13869
Conversation
`HoldReason` was switched recently to use the `composite_enum` attribute that will merge the enums from all pallets in the runtime to `RuntimeHoldReason`. `pallet-nis` was still requiring that the variant was passed as constant to call `hold`. The proper implementation is to use the `HoldReason` from inside the pallet directly when calling `hold`. This is done by adding a `RuntimeHoldReason` as type to the `Config` trait and requiring that `Currency` is using the same reason. Besides that the pr changes the name `HoldIdentifier` in `pallet_balances::Config` to `RuntimeHoldReason`.
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
KiChjang
left a comment
There was a problem hiding this comment.
Not sure if Gav would approve the name change from HoldIdentifier to RuntimeHoldReason, but LGTM otherwise.
Naming here just follows |
|
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Do we need to open a cumulus companion PR? |
Yes, I will do this shortly. Was the fractionalization already released on Westmint? |
|
the companion PR was merged yesterday |
|
bot merge |
* Companion: Substrate#13869 paritytech/substrate#13869 * update lockfile for {"substrate"} * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: parity-processbot <>
* Companion for: Substrate#13869 paritytech/substrate#13869 * Fix * Warning * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <>
* Companion for: Substrate#13869 paritytech/substrate#13869 * Fix * Warning * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <>
* Companion for: Substrate#13869 paritytech/substrate#13869 * Fix * Warning * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <>
* HoldReason: Improve usage `HoldReason` was switched recently to use the `composite_enum` attribute that will merge the enums from all pallets in the runtime to `RuntimeHoldReason`. `pallet-nis` was still requiring that the variant was passed as constant to call `hold`. The proper implementation is to use the `HoldReason` from inside the pallet directly when calling `hold`. This is done by adding a `RuntimeHoldReason` as type to the `Config` trait and requiring that `Currency` is using the same reason. Besides that the pr changes the name `HoldIdentifier` in `pallet_balances::Config` to `RuntimeHoldReason`. * Update frame/nis/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Review comment * Fixes --------- Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Companion: Substrate#13869 paritytech/substrate#13869 * update lockfile for {"substrate"} * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: parity-processbot <>
* Companion for: Substrate#13869 paritytech/substrate#13869 * Fix * Warning * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <>
* HoldReason: Improve usage `HoldReason` was switched recently to use the `composite_enum` attribute that will merge the enums from all pallets in the runtime to `RuntimeHoldReason`. `pallet-nis` was still requiring that the variant was passed as constant to call `hold`. The proper implementation is to use the `HoldReason` from inside the pallet directly when calling `hold`. This is done by adding a `RuntimeHoldReason` as type to the `Config` trait and requiring that `Currency` is using the same reason. Besides that the pr changes the name `HoldIdentifier` in `pallet_balances::Config` to `RuntimeHoldReason`. * Update frame/nis/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Review comment * Fixes --------- Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
HoldReasonwas switched recently to use thecomposite_enumattribute that will merge the enums from all pallets in the runtime toRuntimeHoldReason.pallet-niswas still requiring that the variant was passed as constant to callhold. The proper implementation is to use theHoldReasonfrom inside the pallet directly when callinghold. This is done by adding aRuntimeHoldReasonas type to theConfigtrait and requiring thatCurrencyis using the same reason. Besides that the pr changes the nameHoldIdentifierinpallet_balances::ConfigtoRuntimeHoldReason.Downstream code changes
For the
pallet_balances::Configtrait you need to changeHoldIdentifiertoRuntimeHoldReasonand pass theRuntimeHoldReasonthat is being generated byconstruct_runtime!.For the
pallet_nis::Configtrait you need to removeHoldReasonas this is not being handled internally of the pallet, but you need to addRuntimeHoldReasonwhich you also need to set toRuntimeHoldReasonthat is being generated byconstruct_runtime!.polkadot companion: paritytech/polkadot#7119
cumulus companion: paritytech/cumulus#2631