polkadot-js / apps

Basic Polkadot/Substrate UI for interacting with a Polkadot and Substrate node. This is the main user-facing application, allowing access to all features available on Substrate chains.
https://dotapps.io
Apache License 2.0
1.76k stars 1.55k forks source link

Reading from `pallet-parameters` doesn't work with the default value. #11049

Open kianenigma opened 3 weeks ago

kianenigma commented 3 weeks ago

As per for example:

Screenshot 2024-10-30 at 12 44 50

The default values are specified in the code, and I would hope that they are somewhere present in the metadata. cc @ggwpz

TarikGul commented 3 weeks ago

I'll need to check this with the API itself and see if it poses issues from there as a sanity check.

kianenigma commented 3 weeks ago

Oh yeah, likely an api issue, not an apps one. Feel free to move to the other repo if need be.

ggwpez commented 3 weeks ago

I think this boils down to this issue: https://github.com/paritytech/polkadot-sdk/issues/3238

The parameters storage map can only have one default for all keys - not one default per key.
And the scale-info type system does not seem to provide defaults for generic types either.
So either we change the metadata stuff or add a runtime API to query the params.

kianenigma commented 3 weeks ago

The parameters storage map can only have one default for all keys - not one default per key.

This is only at the metadata level right? In the runtime, we can indeed have a default per parameter item?

ggwpez commented 3 weeks ago

This is only at the metadata level right? In the runtime, we can indeed have a default per parameter item?

Yea, if you query them from within the runtime then it works. But from the outside this is not transparent.