-
Notifications
You must be signed in to change notification settings - Fork 120
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
Storage inspection command #101
Comments
I added the We first have to define semantics, definitions and structures for a new and better
Maybe we have to restrict the final metadata to not support certain use cases because their metadata format would become too complex otherwise. We might want to create a new issue for this in the ink! repository. |
It looks good (I think!). I wonder can the image be cleaned up using magic technology? |
Perhaps easier to run the command ourselves to see the output 🙈 |
I've obtained a better screengrab 🙃: (source) |
Contract metadata describes the storage in the
layout
section. Astorage
command should be introduced which utilizes this to allow inspection of a contract's storage from the command line.So for the
flipper
:Calling
cargo contract storage --contract <contract_account>
would result in the following:This would work by using the metadata to generate keys and query the
get_storage
rpc: https://github.com/paritytech/substrate/blob/30ecb9b259140a860b20c662fda01b5b2c33e5fa/frame/contracts/rpc/runtime-api/src/lib.rs#L54.The metadata would then be used to decode the results into human readable form, building on the "SCON" work done in #79.
For an initial implementation I think we don't need to do everything in a single PR, we can define a basic implementation that is useful and then add features as follow up PRs.
Lazy and Collections
We would need to consider how to handle the built-in lazy and collection types, they would probably require some custom display code.
Keys
It might be useful to be able to augment the data with the actual storage keys, and also query individual storage keys either by the raw key or by name.
Raw Storage
For debugging of corrupt storage it would be useful to be able to inspect the raw contract storage (without decoding).
The text was updated successfully, but these errors were encountered: