apps
apps copied to clipboard
Can't issue vote extrinsic via Extrinsics tab with conviction
When entering a vote via Extrinsics tab (not via the Democracy tab), it accepts the vote as a Boolean instead of a Vote struct, which means that there is no place to enter conviction.

I haven't dug into the Polkadot-JS side of the code, but from reading the Substrate code, I believe this might be due to it reading only the first element of the Vote struct here, which is a bool, but not reading the second element, conviction: https://github.com/paritytech/substrate/blob/caff191bc1bfa48688037c6024ee3a2a1cbeb084/frame/democracy/src/vote.rs#L27
To generate all the above it needs to do deep-inspection on all the types and then build up a structure for it that allows entry for the fields. In this case the API types is 100% correct, however there is a catch when it comes to the UI.
The Vote
requires a non-standard specialized codec serialization on the API-layer, i.e. non-struct-like and to implement that on the UI it also (in addition to the heavy lifting the API already does) needs to explicitly understand this type and needs to have a specific UI component for the element itself.
There is nothing wrong with the API types in this case (otherwise the democracy app won't work), rather that the UI does not implement a specific full-entry renderer for this type. Which it may seem like a struct on the Rust code itself, the SCALE serialization itself is not struct-like, but rather a compact-like representation.
TL:DR This is actually a know item where the component should be expanded, but the cost of doing has always outweighed the benefit. So have been one (of a few) components that don't render 100% as inputs.
You might be able to just present a dropdown of:
Nay 0.1x => 0x00
Nay 1x => 0x01
Nay 2x => 0x02
Nay 3x => 0x03
Nay 4x => 0x04
Nay 5x => 0x05
Aye 0.1x => 0x80
Aye 1x => 0x81
Aye 2x => 0x82
Aye 3x => 0x83
Aye 4x => 0x84
Aye 5x => 0x85
And then pass that hex value directly to the vote
parameter.
Sure, the point is that the Vote component still refers to the pre-conviction era with display-only adjustments - so it actually already has a conviction dropdown, but it it is only used when displaying already-submitted values, i.e. it is explicitly removed when entering values -
https://github.com/polkadot-js/apps/blob/master/packages/react-params/src/Param/Vote.tsx
It is 15 mins for somebody familiar, 45 minutes for somebody unfamiliar - but there is a bunch of 15-45 stuff higher up the queue which has higher priority :) And since the vote is available via democracy, it slips even further down the list.
So the basics are there, it is not massive effort, and should be done "at some point in the future".
Hey @jacogr just to add a small note here. It seems that one of the main issues is when trying to vote with proxies. The Democracy UI (Democracy tab) does not recognize the proxy account. So users go for extrinsic -> proxy.proxy .....
And no conviction can be set there.
Thanks!
That is a different issue altogether then - the proxy handling is done in the signer UI, aka you submit, when an account has a proxy it allows you to select it at that point.
If that doesn't work, it should be logged seperately with details as to what happens.
Thanks @jacogr for the answer. I've created a separated issue here: https://github.com/polkadot-js/apps/issues/6838
Extrinsics does allow for conviction (I believe this is due to some changes a couple of months back to adjust type param detection).
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.