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

Input check sequence modification for gas efficiency #1043

Merged
merged 5 commits into from
Jul 20, 2018
Merged

Input check sequence modification for gas efficiency #1043

merged 5 commits into from
Jul 20, 2018

Conversation

lucasgleba
Copy link
Contributor

@lucasgleba lucasgleba commented Jun 24, 2018

πŸš€ Description

The order in which the parameters of two transfer functions are checked to be valid (to avoid over-spending and token-burning) has been altered so that they fail as soon as possible a bigger fraction of the time.

Regular users tend to attempt to over-spend more than they attempt to burn non-burnable tokens. If the contract checks for overspending before assuring tokens are not being burnt, a small amount of gas will be saved in the long term as the average number of operations executed per failed attempt will be smaller.

  • πŸ“˜ I've reviewed the OpenZeppelin Contributor Guidelines
  • βœ… I've added tests where applicable to test my new functionality.
  • πŸ“– I've made sure that my contracts are well-documented.
  • 🎨 I've run the JS/Solidity linters and fixed any issues (npm run lint:all:fix).

lucasgleba and others added 5 commits June 24, 2018 17:43
Users tend to attempt to over-spend more than they attempt to burn non-burnable tokens. If the contract checks for overspending before assuring tokens are not being burnt a slight amount of gas might be saved in the long term.
@nventuro
Copy link
Contributor

Thanks @lucasgleba!

@nventuro nventuro merged commit 1ecda54 into OpenZeppelin:master Jul 20, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants