-
Notifications
You must be signed in to change notification settings - Fork 105
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
feat(gstd): Introduce critical hook #3503
Conversation
4dd2dc2
to
af4f5b1
Compare
I am a bit confused by the behaviour of the |
To me it would be more comprehended if I had an option to register my compensation logic in relation to a future returned by some async call. This would clearly say that this functionality is about executing compensation with regards to this async/await. It doesn't seem the implemented functionality is relevant to any other cases. |
What about module docs? |
This is not quite about docs - I read some code which uses some libraries and from reading it, it is vague what happens and how it works |
User-facing API should be per-call i.e. critical section is created, fired, and disposed once corresponding call handling is out of scope |
# Conflicts: # Cargo.toml # pallets/gear/Cargo.toml # pallets/gear/src/tests.rs
# Conflicts: # pallets/gear/Cargo.toml
Anything except comments above LGTM |
@ark0f kind reminder to finish this awesome work |
# Conflicts: # pallets/gear/src/tests.rs
why is it stalling? @DennisInSky @breathx ? |
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.
You know the difficulties arose during taking this design decision better, but I am still not quite happy with the solution as it still doesn't hihjlight that functionality is applicable to async code executed after await completion only. Probably, at least renaming the set_hook
method into something like set_hook_for_async
or moving it into the async_runtime
module would give some hint to users about the context of this method.
I would also showcase that
set_hook(...);
panic!(...);
doesn't cause the hook to get executed. Whereas
some_async(...).await;
take_hook();
panic!(...);
will do
This would be a bit incorrect because it's not about |
# Conflicts: # pallets/gear/src/tests.rs
Release notes:
Introduce critical hook API. Similar to
std::panic::set_hook
but sets on per-message basis and takes into account specific program halts like gas outage, memory overflow, backend error and so on