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

Gas inefficiencies in KittyMinting #6

Open
Arachnid opened this issue Nov 16, 2017 · 3 comments
Open

Gas inefficiencies in KittyMinting #6

Arachnid opened this issue Nov 16, 2017 · 3 comments

Comments

@Arachnid
Copy link

Description

There are a couple of gas inefficiencies in KittyMinting that could be resolved for significantly lower gas consumption:

  • promoCreationLimit and gen0CreationLimit are both defined as variables. Making them constant would allow the compiler to optimise them out, saving 40k of deployment-time gas, and ~200 gas each time they are read.
  • createPromoKitty increments both variables, costing ~10k. Incrementing only promoCreatedCount, and checking the sum of the two variables instead of each separately, would save ~5k gas at update time.
@dete
Copy link

dete commented Nov 16, 2017

promoCreationLimit and gen0CreationLimit are both defined as variables

Weirdly, I just learned about constant Solidity variables just this morning, I think there some others we can probably fix, also.

createPromoKitty increments both variables

Your suggestion would result in two reads (instead of one) in createGen0Auction, but it's still a net gas savings. We'll definitely look at this!

Thanks again, @Arachnid! Love these reports!

@kimcope
Copy link
Contributor

kimcope commented Nov 21, 2017

Thanks for your participation, @Arachnid! Our team has reviewed your submission, and we are pleased to reward you for your report.

Impact: Low
Likelihood: Low
Points: 50

Please see the final leaderboard here.

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

6 participants