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

Allow explicit call ordering within a pallet #10408

Closed
joepetrowski opened this issue Dec 2, 2021 · 5 comments · Fixed by #11381
Closed

Allow explicit call ordering within a pallet #10408

joepetrowski opened this issue Dec 2, 2021 · 5 comments · Fixed by #11381
Labels
J0-enhancement An additional feature request.

Comments

@joepetrowski
Copy link
Contributor

Similar to explicit ordering in the construct_runtime macro, we could annotate calls within a pallet with an index. This would have a few advantages, namely the ability to remove a function without affecting the indices of other calls.

This could be useful in pallet versioning and transaction version, where a pallet's version would need to increment when there is a breaking change to these indices/function signatures. By leaving call indices empty on function removal, wallets/signers don't need to worry about signing an unintended call as it would be null.

Transaction version could either increment on pallet version changes or be reserved for changes in the serialization (e.g. signed extensions).

@joepetrowski joepetrowski added the J0-enhancement An additional feature request. label Dec 2, 2021
@apopiak
Copy link
Contributor

apopiak commented Dec 2, 2021

IMO the transaction_version would still need to change on removal, but the migration would be trivial.

@bkchr
Copy link
Member

bkchr commented Dec 2, 2021

IMO the transaction_version would still need to change on removal, but the migration would be trivial.

No, because there would be no harm. The call would fail to decode, aka nothing serious would happen.

@KiChjang
Copy link
Contributor

KiChjang commented May 7, 2022

Was trying to implement this lately, but found out that enum discriminants on non-unit variants are experimental. We'll need to figure out another mechanism for associating an index with every call in the enum, and use that to encode/decode correctly.

@xlc
Copy link
Contributor

xlc commented May 7, 2022

scale codec does support macro attributes to specific encode index

@bkchr
Copy link
Member

bkchr commented May 7, 2022

Yeah and we use exactly this in construct_runtime! for pallets.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants