-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[feature request] Add metadata dump
subcommand
#10418
Comments
Substrate itself can not decode the metadata and that would also break when there is a runtime upgrade and the node wasn't upgraded yet. |
I'd imagine the command would essentially do:
Why wouldn't that work? |
You only want the SCALE encoded metadata? I mean that could be fine, but then you also can just call the RPC method. |
Yep. The context here is writing integration tests for |
Can you elaborate this? About what node do we also actually speak here? The substrate one or Polkadot or what? |
The context is this PR where we add a With a Is your concern here that we add too many commands of dubious usefulness? |
I thought about this again and realized that we already have CLI commands optional. So yeah, we could probably provide such a CLI command and chain implementors then can add this if required. |
However, we could not support strip docs, because we can not decode the metadata. For format I'm also not sure what you mean with json? |
Yeah that won't work. I think we might want to provide a way to strip docs in some form at some point – they are only useful for dynamic UIs – but right now we can't implement that. :/ As for the format, that's a brain fart on my end. I was thinking about decoding the metadata. |
Given the nature of Metadata potentially changing block to block, this is a very strange CLI command. I hope it doesnt trick people in the ecosystem to start using this in ways it shouldnt be used. |
This is something we should prevent. I mean I have removed some of the changing things recently and we should also create a test for this to ensure that metadata doesn't change. |
I mean changing because of runtime upgrades, which could happen all the time depending on the chain. |
I thought about this again and I think this use case should just be done with: https://github.com/chevdor/subwasm Then you can just point it to a wasm file (instead of a running node) and let it extract metadata from there. |
A use case for this feature request was that, given some The way we do this currently is to start a substrate node, make the RPC call to acquire metadata and then kill it. This command would simplify that process for us, basically :) |
Yeah I get it, but people would also need to add this cli command to their cli. This stuff isn't coming automatically. But for testing you could also just give it the wasm binary? There isn't that much difference if you provide a node or the runtime directly? |
For testing in
subxt
it would be useful to have ametadata dump
subcommand that outputs the metdata tostdout
.Options:
--format
/-f
: acceptsjson
orhex
(default)--strip-docs
: do not include doc strings--output
/-o
: output to a file at the given pathSome context
The text was updated successfully, but these errors were encountered: