-
Notifications
You must be signed in to change notification settings - Fork 334
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
Allow submessage callbacks only on error #854
Comments
Sounds good. I would just make clear that this is about the reply, not about the
I would avoid representing a a two state flag in a 3 state type. Option's in Rust do not allow omitting them so they are not like |
Ah, I did not know that, good point. |
|
Hmm... I don't see a use for that one (basically no need to optimize gas for unhandled errors). But maybe you could convince me otherwise. Oh, wait you mean for a name for this field? I like |
Yes. I think it better describes what you build. You want to toggle the reply (i.e. execution of the |
I will think more on naming, but it seems that we are in agreement on everything but a good name |
|
If we are going for complete, let's make a 3 way flag: |
Yeah, nice. |
When we make a submessage, we can handle both success and errors from the released message. However, this comes at a cost of paying the instantiation gas cost of the original module for each submessage.
For some use cases, eg. mapping errors in #762, we only want to handle if an error arises, and don't care about the return values. Since we assume errors are not the normal case, we add a lot of gas overhead to all the callbacks we ignore. It would be more efficient to be able to filter these out in Go, and just get callbacks on error if that is what we want.
In particular, I want to extend
SubMsg
with one more field:If only_error is set to
true
, then we only make the response callback if there was an error (incl running out of gas), otherwise, just handle it like a message.I made
only_error
as anOption
because I feel it is usually unset and we can make the normal JSON smaller (and use less gas) by simply omitting the field.Some(true)
may be a bit wordy, butNone
andfalse
are the same, which is the typical case. (I can change it to justbool
if there is disagreement)The text was updated successfully, but these errors were encountered: