-
Notifications
You must be signed in to change notification settings - Fork 94
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
Support enum with Compact
prefix
#521
Comments
Is this a practical problem or more or a theoretical edge-case? Just noting that if we change anything here, Polkadot and all parachains will need tons of migrations. |
This is something we want/should support. And better swallow it now than in the future :P This currently for example means you can only have 256 pallets 👀 |
Hmm.... perhaps something like this?
This means that for enums without tags greater or equal to It's not the objectively best way to do this, but would probably be the way to do it with the least amount of churn and without potentially introducing non-determinism somewhere (e.g. on a client <-> runtime boundary where both could use a different version of the codec). I don't think we should ever silently change the on-the-wire format, even in a major version bump, as that would be way too dangerous. Also, side note: for enums specifically the way we encode compact numbers might be a little suboptimal, e.g.:
But I think it's not worth changing just to cover an extra 64 variants as a single byte. |
Currently enums are using
u8
as prefix. This means an enum can only have in maximum256
variants. We need to decide if we just want to migrate everyone toCompact
prefixes by default and then they can use some customattribute
to trigger the oldu8
prefix. Probably the optional enabling of usingCompact
as prefix would be the "sane" way.The text was updated successfully, but these errors were encountered: