Currently,. pallet view functions are behind a #[pallet::view_functions_experimental] attribute. We should come up with a plan to stabilize them.
Stabilizing pallet view functions unblocks stabilization of V16 metadata, which exposes the necessary details for clients to interact with view functions.
A couple of things on my mind to confirm:
- Are we happy with the naming (we have "pallet view functions" and "runtime apis"?
- I still wonder if we should just call them "pallet apis" and "runtime apis" for consistency? But I know there has been talk of Runtime View Functions which I assume would replace Runtime APIs?
- Pallet View Functions are called by hashing
$palletName + $methodName ( $argTypeNames ) -> $returnTypeName or something like that, while runtime APIs are called by providing $palletName + _ + $methosName. - AFAIU we do this more complicated approach to enforce immutability of view functions, but this mostly just chanegs the failure mode from "method args invalid" to "method not found" when quering for a method that has changed. Is it worth simplifying the calling approach to be more similar to runtime APIs?
- Simplifying the approach would also mean we don't want to embed a 32 byte query ID with each view function in the metadata (which we do because constructing it requires all of this hashing etc so easier to just provide it rather than have users construct it).
- Anything we need to think about / change to support subscribable view functions in the future?
- I don't think so offhand; the interface stays the same but we track storage accesses under the hood to know when to send updates.
If others think that the answer to each of those is "I'm happy as is" then from my PoV I'm all good to see the mstabilized.
What do others thing? Anything else we need to think about before stabilizing?
\cc @kianenigma @re-gius
Currently,. pallet view functions are behind a
#[pallet::view_functions_experimental]attribute. We should come up with a plan to stabilize them.Stabilizing pallet view functions unblocks stabilization of V16 metadata, which exposes the necessary details for clients to interact with view functions.
A couple of things on my mind to confirm:
$palletName + $methodName ( $argTypeNames ) -> $returnTypeNameor something like that, while runtime APIs are called by providing$palletName + _ + $methosName. - AFAIU we do this more complicated approach to enforce immutability of view functions, but this mostly just chanegs the failure mode from "method args invalid" to "method not found" when quering for a method that has changed. Is it worth simplifying the calling approach to be more similar to runtime APIs?If others think that the answer to each of those is "I'm happy as is" then from my PoV I'm all good to see the mstabilized.
What do others thing? Anything else we need to think about before stabilizing?
\cc @kianenigma @re-gius