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

Metadata without documentation #6

Open
olanod opened this issue Jan 25, 2021 · 5 comments
Open

Metadata without documentation #6

olanod opened this issue Jan 25, 2021 · 5 comments

Comments

@olanod
Copy link

olanod commented Jan 25, 2021

I'm playing with the metadata of my chain for a tool that can query data from it that should also run in constrained devices. A big improvement is to send data in SCALE binary format, it reduces the size of the response by half(44k -> 22k) but it's still big. Doing strings metadata.scale | wc -c shows me that 21k of those 22k are strings where most are documentation, it would be nice to be able to have a method or something that can return an encoded version of the metadata without the documentation to keep it as lightweight as possible, specially if we start bundling the type information that will probably make the metadata even bigger.

@chevdor
Copy link

chevdor commented May 19, 2021

Hello @olanod, I find this is a great suggestion. While this does not directly solve your issue, here is a link to the doc of subwasm where I added a receipe for a jq trick that can help you "cleanup" the json you get (after receiving it): https://gitlab.com/chevdor/subwasm#user-content-metadata-json-and-jq-tricks

tldr; cat metadata.json | jq 'del( .. | .documentation?, .default?, .value? )'

That actually brings me to asking you if documentation is the only key you would exclude or if a more generic filter would be required, similar to the jq example above but before transmission?

@jacogr
Copy link

jacogr commented Jul 16, 2021

Switching off should be opt-in, not the default. The ecosystem uses this documentation extensively, explorers, builders, etc.

It really depends on what you actually want to do, so for instance in the polkadot-js extension a completely stripped metadata is passed through containing only calls, since well, it only needs to decode calls. So you really need to tweak it based on what your specific needs are.

@gilescope
Copy link
Contributor

alt maybe (optionally but by default) compress the binary representation as at the moment it looks very compressable? that way everyone benefits.

@ascjones
Copy link
Contributor

AFAIK (and you know probably better than me), the runtime blob is already always compressed now so we get it for free?

@chevdor
Copy link

chevdor commented Apr 26, 2022

The runtime blob is compressed, the metadata coming out of the runtime is not and as I understand, the idea of the OP is to reduce the size of the retrived metadata while keeping it functional.

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

5 participants