-
Notifications
You must be signed in to change notification settings - Fork 824
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: Add an error code on the metering middleware #1951
Conversation
ping @webmaster128 |
cd9ba3e
to
15a34bf
Compare
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.
Looks good, some first thoughts
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.
The structure and design looks reasonable to me! I have some feedback about some of the implementation details though!
20b43b8
to
6b21f17
Compare
This PR covers all functionality required for #1931 – very cool. Freel free to reject my suggestions and personal preferences if you don't like them. One more thing that I can think of (but don't need on my own), is the ability to reset the error. Imagine a use case where Wasm runs for a while and hits a safety limit. Now the user has the choice to resume the execution. Then it would be nice if you could increase the limit and reset the error. |
6b21f17
to
84d2647
Compare
@webmaster128 @syrusakbary what do you think of reseting the error each time we call |
I think there is two layers of abstraction here:
In 1., the values are independent and it it would be very confusing if they affect each other when setting them. However, we can think about exposing 2. to user, where
This would remove the impossible state error = 1 and points > 0 from the user's handling code. |
@webmaster128 thanks for the suggestion. I like the second proposition. @syrusakbary @nlewycky what do you think about that? |
92fd1f9
to
780be36
Compare
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.
Cool API
780be36
to
9f4450f
Compare
9f4450f
to
2b0d254
Compare
bors try |
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.
Great work. Some ideas, feel free to dismiss. The only thing we should clean up one way or another is the exports.
cebbe48
to
b382cfa
Compare
b382cfa
to
3c33325
Compare
bors r+ |
This is a proposition for #1931.
Basically, the metering middleware now injects a new global,
error_code
with its own helperget_error_code
which will allow the host to correctly handle metering errors. Now, aremaining_points == 0
anderror_code != NoError
means the execution of the guest module consumed all the gas points.Review