Skip to content

Fix: [Referenda Tracks] Resolve representation issues that are breaking PJS apps #7671

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

pandres95
Copy link
Contributor

@pandres95 pandres95 commented Feb 22, 2025

This Pull Request fixes the following issues present with PJS derived from #2072

  • Represents Tracks constant as a Vec<(TrackId, TrackInfo)> instead of Vec<Track>, so tracks iteration in PJS apps Governance hook remains as how it was before, and

Screenshot 2025-02-22 at 12 31 28 pm

  • Encapsulates [u8; N] from name field in a StringLike structure that represents its TypeInfo as a &str and encodes as such. This fixes errors present in PJS apps that treat name as a javascript string.

Screenshot 2025-02-22 at 12 31 18 pm

@pandres95 pandres95 marked this pull request as ready for review February 22, 2025 18:03
@pandres95 pandres95 requested a review from a team as a code owner February 22, 2025 18:03
@pandres95 pandres95 force-pushed the fix/represent-tracks-constant-as-a-vec-id-info-tuple branch from 6fe1641 to f7f6920 Compare February 22, 2025 18:26
…y like a string

change(pallet-referenda): create const function that helps construct `StringLike` to reduce changes in tracks definitions

fix: fmt
@pandres95 pandres95 force-pushed the fix/represent-tracks-constant-as-a-vec-id-info-tuple branch from e8538fe to 44b58c7 Compare February 22, 2025 18:42
@pandres95 pandres95 requested a review from ggwpez February 24, 2025 11:59
@paritytech-review-bot paritytech-review-bot bot requested a review from a team February 24, 2025 11:59
@pandres95
Copy link
Contributor Author

@ggwpez @gui1117 @bkchr any additional comments, suggestions, or improvements for this fix?

@pandres95 pandres95 requested a review from bkchr February 26, 2025 16:26
@kianenigma
Copy link
Contributor

Are we going to merge this, or revert as per #7661?

@pandres95
Copy link
Contributor Author

Are we going to merge this, or revert as per #7661?

I'm expecting to have the change @gui1117 requested today, so we can proceed with merging this one. Probably would be nice to have a quick round of reviews before merging, but IIUC this PR seems like a good fix for the current reviewers.

@pandres95 pandres95 force-pushed the fix/represent-tracks-constant-as-a-vec-id-info-tuple branch from 36f5d50 to 28ad818 Compare March 13, 2025 05:16
@paritytech-review-bot paritytech-review-bot bot requested a review from a team March 13, 2025 05:16
@pandres95
Copy link
Contributor Author

  • @bkchr fmt/docs changes done.
  • @gui1117 used your approach of having a const version that uses StringLike while preserving array for internal storage. Works like a charm (only 3 changed files, incl. Prdoc). Thanks ✨

@gui1117 gui1117 added the T2-pallets This PR/Issue is related to a particular pallet. label Mar 20, 2025
@ggwpez ggwpez added the A4-backport-stable2503 Pull request must be backported to the stable2503 release branch label Mar 21, 2025
@ggwpez ggwpez enabled auto-merge March 21, 2025 11:14
@ggwpez ggwpez added this pull request to the merge queue Mar 21, 2025
Merged via the queue into paritytech:master with commit 467d1f6 Mar 21, 2025
249 of 256 checks passed
@paritytech-release-backport-bot

Created backport PR for stable2503:

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin backport-7671-to-stable2503
git worktree add --checkout .worktree/backport-7671-to-stable2503 backport-7671-to-stable2503
cd .worktree/backport-7671-to-stable2503
git reset --hard HEAD^
git cherry-pick -x 467d1f642c8d5d6b11c45e5212f546af86b6f6e4
git push --force-with-lease

@pandres95 pandres95 deleted the fix/represent-tracks-constant-as-a-vec-id-info-tuple branch March 21, 2025 15:27
EgorPopelyaev added a commit that referenced this pull request Mar 26, 2025
Backport #7671 into `stable2503` from pandres95.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Pablo Andrés Dorado Suárez <[email protected]>
Co-authored-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Egor_P <[email protected]>
pandres95 added a commit to virto-network/polkadot-sdk that referenced this pull request Apr 23, 2025
…ng PJS apps (paritytech#7671)

This Pull Request fixes the following issues present with PJS derived
from paritytech#2072

- Represents `Tracks` constant as a `Vec<(TrackId, TrackInfo)>` instead
of `Vec<Track>`, so tracks iteration in PJS apps _Governance_ hook
remains as how it was before, and

![Screenshot 2025-02-22 at 12 31
28 pm](https://github.com/user-attachments/assets/a075b0b2-8984-43cc-9e72-99996de0ae1b)

- Encapsulates `[u8; N]` from `name` field in a `StringLike` structure
that represents its `TypeInfo` as a `&str` and encodes as such. This
fixes errors present in PJS apps that treat `name` as a javascript
`string`.

![Screenshot 2025-02-22 at 12 31
18 pm](https://github.com/user-attachments/assets/361a4f10-47b7-496d-9591-bc37afcf5ee1)

---------

Co-authored-by: Guillaume Thiolliere <[email protected]>
Co-authored-by: Oliver Tale-Yazdi <[email protected]>
pandres95 added a commit to virto-network/polkadot-sdk that referenced this pull request Apr 23, 2025
…ng PJS apps (paritytech#7671)

This Pull Request fixes the following issues present with PJS derived
from paritytech#2072

- Represents `Tracks` constant as a `Vec<(TrackId, TrackInfo)>` instead
of `Vec<Track>`, so tracks iteration in PJS apps _Governance_ hook
remains as how it was before, and

![Screenshot 2025-02-22 at 12 31
28 pm](https://github.com/user-attachments/assets/a075b0b2-8984-43cc-9e72-99996de0ae1b)

- Encapsulates `[u8; N]` from `name` field in a `StringLike` structure
that represents its `TypeInfo` as a `&str` and encodes as such. This
fixes errors present in PJS apps that treat `name` as a javascript
`string`.

![Screenshot 2025-02-22 at 12 31
18 pm](https://github.com/user-attachments/assets/361a4f10-47b7-496d-9591-bc37afcf5ee1)

---------

Co-authored-by: Guillaume Thiolliere <[email protected]>
Co-authored-by: Oliver Tale-Yazdi <[email protected]>
pandres95 added a commit to virto-network/polkadot-sdk that referenced this pull request Apr 23, 2025
…ng PJS apps (paritytech#7671)

This Pull Request fixes the following issues present with PJS derived
from paritytech#2072

- Represents `Tracks` constant as a `Vec<(TrackId, TrackInfo)>` instead
of `Vec<Track>`, so tracks iteration in PJS apps _Governance_ hook
remains as how it was before, and

![Screenshot 2025-02-22 at 12 31
28 pm](https://github.com/user-attachments/assets/a075b0b2-8984-43cc-9e72-99996de0ae1b)

- Encapsulates `[u8; N]` from `name` field in a `StringLike` structure
that represents its `TypeInfo` as a `&str` and encodes as such. This
fixes errors present in PJS apps that treat `name` as a javascript
`string`.

![Screenshot 2025-02-22 at 12 31
18 pm](https://github.com/user-attachments/assets/361a4f10-47b7-496d-9591-bc37afcf5ee1)

---------

Co-authored-by: Guillaume Thiolliere <[email protected]>
Co-authored-by: Oliver Tale-Yazdi <[email protected]>
ordian added a commit that referenced this pull request Apr 28, 2025
* master: (26 commits)
  Snowbridge V2 (#7402)
  [AHM] Revert multi-block election, slashing and staking client pallets (#7939)
  docs: update local ci execution instruction (#8003)
  Upgrade deps to eliminate ancient dependencies (#7999)
  Removed `pallet:getter` from XCM pallets (#7916)
  Add digest processor xcm emulator (#7915)
  Fix: [Referenda Tracks] Resolve representation issues that are breaking PJS apps (#7671)
  Improve XCMP weight metering (#7963)
  bump version of zombienet-sdk (#7964)
  rpc-v2/archive: Rename archive call method result to value (#7885)
  Bump parachains runtime api to 13 (#7981)
  `bp-runtime`: make macro expansion not rely on `sp-std` in scope. (#7978)
  [CI/CD] Refactor backports flow so that it can determine automatically where to do a backport based on labels (#7976)
  Treasury: update expire date on payout (#7958) (#7959)
  `fatxpool`: report_invalid: do not ban Future/Stale txs from re-entering the view (#7777)
  Fix XCM Barrier Rejection Handling to Return Incomplete with Weight (#7843)
  Bump openssl from 0.10.64 to 0.10.70 (#7442)
  runtime-api: remove redundant version checks (#7610)
  Upgrade link-checker cache to v4 (#7874)
  Updating readmes (#7950)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A4-backport-stable2503 Pull request must be backported to the stable2503 release branch T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants