-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix[Referenda]: Use BoundedVec<u8> as field type for TrackInfo::name
#7667
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
Conversation
| pub struct TrackInfo<Balance, Moment, const N: usize = DEFAULT_MAX_TRACK_NAME_LEN> { | ||
| /// Name of this track. | ||
| #[codec(encoded_as = "ArrayLikeVec<N>")] | ||
| pub name: [u8; N], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this changed to an array and not a static Str as before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is to be able to decode it from storage, the intention is to be able to have tracks defined in storage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That's the reason.
@gui1117 I tried changing the approach to use BoundedVec as it encodes better, but then there's the problem of needing to allocate memory while statically initializing the tracks data variables in the runtimes.
That approach requires reviving the usage of lazy_static (which I guess we don't like it very much @bkchr).
|
it should be checked that this works with pjs, and if not we should wait for pjs to be fixed. |
|
Also this doesn't fix the fact that |
|
I initially noticed the above committed solution ( So, I tried changing the structure to use
The problem is mostly solved by using I can propose a fix in polkadot-js/apps#11310 for the components, but using
|
Vec<u8> as associated encoding type for TrackInfoBoundedVec<u8> as field type for TrackInfo::name
1e353be to
ddfc42c
Compare
ddfc42c to
5f58579
Compare



This PR fixes an issue that appeared after merging #2072 to
stable2503, where encoding breaking changes cause issues on PJS.