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

Support state_traceBlock #2518

Closed
xlc opened this issue Jul 16, 2022 · 6 comments
Closed

Support state_traceBlock #2518

xlc opened this issue Jul 16, 2022 · 6 comments

Comments

@xlc
Copy link
Contributor

xlc commented Jul 16, 2022

It is super useful to be able to replay block and fetch all changed storages for that particular block

paritytech/substrate#9642

@tomaka
Copy link
Contributor

tomaka commented Jul 18, 2022

There are a couple of issues with that:

  • The spans require a runtime specifically compiled for tracing. Smoldot will never support that, as it always fetches the runtime from the chain (the only exceptions being codeSubstitutes in the chain spec)
  • It would require implementing parsing the metadata in smoldot.

It seems to me that state_traceBlock could be replaced with a more generic version of state_call that returns the list of storage changes, and leaving to the frontend the task of turning these changes into events. But that's out of scope of this repo.

@xlc
Copy link
Contributor Author

xlc commented Jul 18, 2022

All I really need is all the changed storages within a given block so the tracing API is not necessary.
I don't think it is possible to implement a runtime API to do this. On the other hand, I don't know the storage layer details but it maybe possible to simply retrieve those data? Otherwise can always replay the block to collect those information.

@tomaka
Copy link
Contributor

tomaka commented Jul 18, 2022

I don't think it is possible to implement a runtime API to do this.

What I mean is that you could use state_call to call Core_execute_block manually, passing as parameter the header and body of the block. If state_call then additionally returned the list of changes in the storage, that would have the same effect as state_traceBlock.

@xlc
Copy link
Contributor Author

xlc commented Jul 18, 2022

Ok so we need a version of state_call that returns changed storages a have a new rpc call does that? Should I make an issue to Substrate get have it implemented there first and then follow up here?

@tomaka
Copy link
Contributor

tomaka commented Jul 18, 2022

No, IMO any extension to the JSON-RPC API should go in https://github.com/paritytech/json-rpc-interface-spec/

However there's another problem with the idea of using state_call("Core_execute_block", ...), which is that the frontend would need to manually tweak the header to remove the seal.

I think I'll just add state_traceBlock to smoldot.

@xlc
Copy link
Contributor Author

xlc commented Aug 7, 2022

This actually requires wasm override which just doesn't make sense on light client so I will close this.

@xlc xlc closed this as completed Aug 7, 2022
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