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

cargo-contract exits on event decoding failure #738

Closed
pmikolajczyk41 opened this issue Sep 12, 2022 · 0 comments · Fixed by #769
Closed

cargo-contract exits on event decoding failure #738

pmikolajczyk41 opened this issue Sep 12, 2022 · 0 comments · Fixed by #769

Comments

@pmikolajczyk41
Copy link
Member

pmikolajczyk41 commented Sep 12, 2022

Problem statement

As for now, after submitting a transaction to a chain (either call, upload or instantiate) cargo contract listens for events and decodes them. In particular, every event that comes from any contract is decoded using the metadata file corresponding to the 'entry' contract. In case of any failure, the error is propagated up to the user, which cause the whole program to exit and fail.

Such a situation is easily reproducible with any pair of contracts A and B, such that:

  • A calls B
  • B emits an event E
  • E is not compatible with A's metadata (it is sufficient that A doesn't declare any events)

This happens often in any non-trivial dApp and thus makes using cargo-contract impossible to deploy and interact with more interesting examples.

Relevant code

https://github.com/paritytech/cargo-contract/blob/master/crates/cargo-contract/src/cmd/extrinsics/events.rs#L110

Suggested solution

In case of decoding failure, we should just log warning / info that the event couldn't have been properly decoded with provided metadata and just continue.

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

Successfully merging a pull request may close this issue.

1 participant