Skip to content
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

Strict transaction value handling #563

Closed
axic opened this issue May 12, 2016 · 1 comment
Closed

Strict transaction value handling #563

axic opened this issue May 12, 2016 · 1 comment

Comments

@axic
Copy link
Member

axic commented May 12, 2016

I think it time to consider adding more safety mechanisms into Solidity. One good candidate is cleaning up the handling of transaction values.

Any method (including the fallback) silently accepts transaction values, it has to manually ensured and dealt with. Please check #562 for the fallback change proposal.

I propose a breaking change so that every method accepting transaction values must explicitly mark methods accordingly with the acceptValue keyword.

  1. Any other non-private/internal method should start with a check for transaction value and should throw if it is non-zero. This could be eventually moved into the ABI dispatcher. If no method is marked as value acceptor, then it is a simple once-off check in the dispatcher.

  2. Libraries should reject values in all cases. This means a once-off check in the dispatcher.

  3. The same restrictions apply to the fallback method, on top of what Strict fallback handling #562 proposes.

  4. For interface JSON definition see Payable as a parameter in the ABI interface JSON #500

Some of the above could be accomplished with a modifier, albeit without the strictness and the option to optimise it (i.e. in the ABI dispatcher):

modifier rejectValue {
  if (msg.value != 0)  throw;
  _
}
@axic
Copy link
Member Author

axic commented Sep 6, 2016

Fixed in #665.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants