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

check in modifier (canBeStoredWith128Bits) #11

Closed
pauliax opened this issue Nov 18, 2017 · 2 comments
Closed

check in modifier (canBeStoredWith128Bits) #11

pauliax opened this issue Nov 18, 2017 · 2 comments
Labels

Comments

@pauliax
Copy link

pauliax commented Nov 18, 2017

The check in this modifier should be "<="

modifier canBeStoredWith128Bits(uint256 _value) {
    require(_value < 340282366920938463463374607431768211455);
    _;
}

because 128 bits can hold a maximum of 2^128-1 which is equal to 340282366920938463463374607431768211455 so it makes sense (according to the modifier's name) to have a "<=" instead of "<".

by the way, here everything is fine:
modifier canBeStoredWith64Bits(uint256 _value) {
require(_value <= 18446744073709551615);
_;
}

@pauliax
Copy link
Author

pauliax commented Nov 18, 2017

    // sanity check to ensure we don't overflow arithmetic (this big number is 2^128-1).
    require(avePrice < 340282366920938463463374607431768211455);

Same here (KittyMinting.sol)

@dete dete added the wontfix label Nov 19, 2017
@dete
Copy link

dete commented Nov 19, 2017

Great point! Thanks for reporting it, @pauliax!

Please see #13 for some info on how we're planning to replace these checks, based on a Gitter suggestion from @Arachnid.

@dete dete closed this as completed Nov 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants