Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Runtime event parsing #743

Closed
ggwpez opened this issue Dec 13, 2022 · 1 comment · Fixed by #767
Closed

Runtime event parsing #743

ggwpez opened this issue Dec 13, 2022 · 1 comment · Fixed by #767
Labels
bug Something isn't working

Comments

@ggwpez
Copy link
Member

ggwpez commented Dec 13, 2022

It is currently not possible to parse the runtime::Event type. To hack around this it is possible to skip the Phase like such:

let mut data = event.bytes();
let event = <(subxt::events::Phase, kusama::Event)>::decode(&mut data).map(|r| r.1);

But it would be nice to have something like as_runtime_event. I am not sure if as_root_event is supposed to do that, but it does not do.
The advantage is that it would enable one to easily parse all events of a runtime, instead of just pallet specific ones.

@jsdw
Copy link
Collaborator

jsdw commented Jan 10, 2023

Thanks for the report!

.as_root_event() is expected to do this, but it looks like it's given too many bytes at the moment so it's broken. We should fix that, and then what you'd like to do will be possible with that function.

That said, what you've done should work. If you find that it works sometimes and fails other times, it may be because there is some difference between the metadata you used to codegen and the current state of the node?

In any case, we will enmdeavour to fix .as_root_event() so that it does what you expect!

@jsdw jsdw added the bug Something isn't working label Jan 10, 2023
@jsdw jsdw closed this as completed in #767 Jan 11, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants