Skip to content

Input check sequence modification for gas efficiency#1043

Merged
nventuro merged 5 commits into
OpenZeppelin:masterfrom
lucasgleba:master
Jul 20, 2018
Merged

Input check sequence modification for gas efficiency#1043
nventuro merged 5 commits into
OpenZeppelin:masterfrom
lucasgleba:master

Conversation

@lucasgleba

@lucasgleba lucasgleba commented Jun 24, 2018

Copy link
Copy Markdown
Contributor

🚀 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
Copy Markdown
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.

2 participants