Skip to content
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

Sort MultiAssets on extrinsic submission #4537

Closed
KiChjang opened this issue Feb 7, 2022 · 5 comments
Closed

Sort MultiAssets on extrinsic submission #4537

KiChjang opened this issue Feb 7, 2022 · 5 comments

Comments

@KiChjang
Copy link
Contributor

KiChjang commented Feb 7, 2022

As it was found out in paritytech/cumulus#892, extrinsics will fail if the MultiAssets parameter is not properly sorted. We should then ensure that the frontend UI sorts the Vec on submission.

@jacogr
Copy link
Member

jacogr commented Feb 7, 2022

It is very unlikely to be done in the UI itself - the extrinsics builder is completely generic and has no idea as to what it actually submits. There really is no transaction logic in there.

If done via modals, then yes, it needs to always work so anywhere where txs are constructed with the UI dev help (via modal where the params are fixed), it makes sense.

If the request is for the extrinsics page, that would need to happen on the API layer. (BTreeMap is likewise required to be sorted and done on that level)

@jacogr jacogr transferred this issue from polkadot-js/apps Feb 7, 2022
@KiChjang
Copy link
Contributor Author

KiChjang commented Feb 7, 2022

I just remembered that there's also one important detail for the teleport_asset or reserve_transfer_asset extrinsics -- the 4th parameter is fee_asset_item, which is an index of the assets vec that indicates which asset in the vec is used to pay for the weights.

If we haphazardly reorder the assets vec, we'd invalidate this index, and so I think the better solution here may just be to create new UI elements specifically for these two extrinsics. I'm not sure if this is a cleaner way though, I could be wrong.

@jacogr
Copy link
Member

jacogr commented Feb 8, 2022

Good point that I didn't think of.

PS: Bonus point for using "haphazardly" in this context, it made my morning

@jacogr
Copy link
Member

jacogr commented Jul 6, 2022

Closing, cannot really be done on the API - it is types agnostic. (Not sure if the UI wants this either, since it "just displays and doesn't interpret", but that is up to that layer)

@jacogr jacogr closed this as completed Jul 6, 2022
@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Jul 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants