-
Notifications
You must be signed in to change notification settings - Fork 125
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
Add EventReport and failed xt check to examples #615
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really clean. But I'm still missing the 'little' differences between submit_and_watch_extrinsic_until_without_event
and submit_and_watch_extrinsic_until
.
submit_and_watch_extrinsic_until_without_event
doesn't thrown an error when the extrinsic has failed onchain.- how can we get the triggered events when the extrinsic has failed?
let balance_of_bob = api.get_account_data(&bob).unwrap().unwrap_or_default().free; | ||
println!("[+] Bob's Free Balance is {balance_of_bob}\n"); | ||
|
||
// First we want to see the events of a failed extrinsic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you want to do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Input - let me do something about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #617: I think that should be done in a different PR, as it affects the API. What do you think?
Regarding your point of
submit_and_watch_extrinsic_until_without_event doesn't thrown an error when the extrinsic has failed onchain.
What do you propose for this? I think the comments are quite telling already.. so I removed thewithout_events
from the examples. It should not be used if one does not know what one is doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#617 makes sense. Adding the report to the Error gives access to all the information we have collected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
submit_and_watch_extrinsic_until_without_event doesn't thrown an error when the extrinsic has failed onchain.
What do you propose for this? I think the comments are quite telling already.. so I removed thewithout_events
from the examples. It should not be used if one does not know what one is doing.
Not showing any examples is just a way of forcing the user not to use it. Is that really what we want?
I'm not sure the comments are clear enough. Because we're talking about an error when an extrinsic has failed on the chain, and not an event, the user may think that submit_and_watch_extrinsic_until_without_event
informs her when an extrinsic fails on the chain. Without studying the code, they may miss this point.
Maybe add an example check_extrinsic_without_events
similar to check_extrinsic_events
? We could do it in another issue. Maybe I'm too picky, so it's up to you to decide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a follow up issue in #627
6b89e24
to
35181d3
Compare
The following has been changed:
Examples
DefaultRuntimeConfig
instead of Polkadot Config and added a little more text.submit_and_watch_extrinsic_until_without_event
tosubmit_and_watch_extrinsic_until
. Reasoning:submit_and_watch_extrinsic_until_without_events
does not check if the extrinsic has failed, which might lead to confusion. So I'd suggest to usesubmit_and_watch_extrinsic_until
instead, which checks for failure if possible, and if not (due to watching not long enough), it acts the very same assubmit_and_watch_extrinsic_until_without_events
.event_callback
tosubscribe_events
. I believe that's more descriptive.event_error_details
check_extrinsic_events
ExtrinsicReport
contains with an descriptiveprintln
message. It also checks the returned events.Tests
author_tests
to check for:TransactionStatus
None
orSome
as one would expected. I therefore also changed fromsubmit_and_watch_extrinsic_until_without_events
tosubmit_and_watch_extrinsic_until
. To still testsubmit_and_watch_extrinsic_until_without_events
I added two new tests further below.closes #591