-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Change m_bytes to unsigned in FixedBytesType #4038
Conversation
You can also click on the Circleci log and find out the reason for failures:
Please adjust the code for it to compile. |
cheers @axic I updated the PR to fix any compilation errors. I don't mind not receiving any bounty for this, although I'd love to contribute more slowly on the easier tickets. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase this over #4036.
libsolidity/ast/Types.h
Outdated
@@ -365,7 +365,7 @@ class FixedPointType: public Type | |||
}; | |||
virtual Category category() const override { return Category::FixedPoint; } | |||
|
|||
explicit FixedPointType(int _totalBits, int _fractionalDigits, Modifier _modifier = Modifier::Unsigned); | |||
explicit FixedPointType(unsigned _totalBits, int _fractionalDigits, Modifier _modifier = Modifier::Unsigned); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you chose to make totalBits
unsigned while leaving fractionalDigits
signed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just changed everything that m_bytes
was connected to from int
to unsigned
along with warning/errors until the compiler was happy. Should I update _factionalDigits
to unsigned as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you rebase it over #4036 then you don't need to.
There is another |
Sorry, but there is at least one compiler error:
|
nice catch |
libsolidity/ast/Types.cpp
Outdated
@@ -600,7 +600,7 @@ FixedPointType::FixedPointType(unsigned _totalBits, unsigned _fractionalDigits, | |||
{ | |||
solAssert( | |||
8 <= m_totalBits && m_totalBits <= 256 && m_totalBits % 8 == 0 && | |||
0 <= m_fractionalDigits && m_fractionalDigits <= 80, | |||
0 < m_fractionalDigits && m_fractionalDigits <= 80, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'm not sure if we actually force m_fractionalDigits
to be nonzero somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I keep it as an int
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just remove the lower bound check.
Please incorporate the last commit into the appropriate bigger one. |
@axic does this look good? |
We have a weird test failure:
restarted the test. |
thanks @chriseth ! |
Fixes #3965.
Closes #4036.
Closes #4010.
🙏 sorry i left a mess on that other PR.
any chance i could poke one of yall to help me set up the local testing environment? realized changing numBytes might lead me down a bit of a rabbit hole, and i didn't want to continuously push! i'll buy yall a round of beers