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

Custom metadata values; consider adding codegen #1113

Closed
jsdw opened this issue Aug 8, 2023 · 1 comment
Closed

Custom metadata values; consider adding codegen #1113

jsdw opened this issue Aug 8, 2023 · 1 comment

Comments

@jsdw
Copy link
Collaborator

jsdw commented Aug 8, 2023

See #1106 (comment) for context.

Being arbitrary, some of the types and values in the custom hashmap may not line up (and so codegen should be lenient and just ignore any errors), and the string names are also arbitrary and need not be valid idents or anything.

That said, one could expose codegen for the cases where things appear to line up and the names are ident-ish. It'd be cool to be able to do let query = runtime::custom().foo(); api.custom().at(&query) to access things in custom, decoded to some concrete type (if possible). If the names aren't ident-ish and the values don't point at valid type IDs or whatever then we can just skip them.

If we did add static codegen, we'd also need to have validation logic like we do for constatns etc to check that the codegen we have is still applicable to the node we're talking to.

Given that custom metadata is much more likely to vary a bunch inbetween nodes, I think for now I'd hold off on doing this and wait to see whether there's a need.

Until then, people can still manually decode the bytes into whatever type via a decode_as_type impl

@jsdw
Copy link
Collaborator Author

jsdw commented Aug 22, 2023

Closed by #1117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants