-
Notifications
You must be signed in to change notification settings - Fork 15
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
Changes for Economic Protocol scenario 3 - "contract pays for gas" #352
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.
I've got some things I''d like to see some work on, and also some broader remarks.
My main concern this mechanism's implementation is that the contract must remember to always set the value of the economic buffer at the end of a function it exports. This because otherwise the previous value will be used. This is and of itself is not a problem, but it does become an issue when we don't make this clear/ergonomic to the user.
We can choose one of two options afaics:
- Have the host set the "default" value every time the contract is called, erasing the need for the contract to do it.
- Modify the
wrap_call
functions to make this ergonomic to the user.
There's other things interspersed below, but one thing I'd like to mention is an aesthetic concern - what do we name what is now called "buffer b"? Certainly we don't want to just keep that name. Maybe "economic buffer"?
Re: My main concern this mechanism's implementation is that the contract must remember to always set the value of the economic buffer at the end of a function it exports. This because otherwise the previous value will be used. This is and of itself is not a problem, but it does become an issue when we don't make this clear/ergonomic to the user. Problem of previous value is taken care of, but only for the top call (in call_inner, see As for other remarks, they are good remarks IMO and I will follow on most of them. Not sure about CallReceipt remark yet, will need to analyse it more and provide feedback after that. |
I addressed all Ed's review suggestions except for 2: (please also see the comments above)
|
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.
I think we should introduce an easy way for the contract to set the economic mode after each exposed function. My proposal would be to have it be done using the wrap_call
helpers that we already have.
This is because the economic buffer is copied from any contract called, and then passed along. To make sure that no contract makes a decision on how to spend the funds for another, I think this should definitely be provided.
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.
LGTM!
Changes for Economic Protocol scenario 3 - "contract pays for gas" and "contract earns fee" parts
Implements issues #350 and #353