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

Solidity 0.5.0 #478

Merged
merged 115 commits into from
Jan 9, 2019
Merged

Solidity 0.5.0 #478

merged 115 commits into from
Jan 9, 2019

Conversation

maxsam4
Copy link
Contributor

@maxsam4 maxsam4 commented Dec 17, 2018

Even after using my refactor tool, there are still a lot of manual changes remaining.
For example, now variables are not available outside their block. So all code like double for loops now have to define vars again. A lot of explicit conversions are no longer allowed directly so they need to change as well. etc.

@maxsam4
Copy link
Contributor Author

maxsam4 commented Dec 17, 2018

Travis is failing cause openzeppelin haven't updated their official package to solidity 0.5.0.

CircleCI's image is debain based instead of ubuntu so it does not have direct access solc binary via ppa. As it's running in docker, it can't use snap either. It needs more config.

Solidity coverage is not working with solidity 0.5.0 so it doesn't matter anyway.

@maxsam4
Copy link
Contributor Author

maxsam4 commented Dec 17, 2018

The project is building fine now (with a custom version of OZ). It will take time to refactor test cases though.

@coveralls
Copy link

coveralls commented Jan 3, 2019

Coverage Status

Coverage decreased (-37.1%) to 60.46% when pulling eefd0a6 on truffle-5 into ef2e32f on dev-3.0.0.

@maxsam4 maxsam4 changed the title [WIP] Solidity 0.5.0 Solidity 0.5.0 Jan 7, 2019
contracts/FeatureRegistry.sol Outdated Show resolved Hide resolved
contracts/interfaces/IOwnable.sol Outdated Show resolved Hide resolved
contracts/interfaces/ISecurityToken.sol Outdated Show resolved Hide resolved
contracts/libraries/Util.sol Show resolved Hide resolved
contracts/modules/Checkpoint/EtherDividendCheckpoint.sol Outdated Show resolved Hide resolved
contracts/modules/STO/USDTieredSTOFactory.sol Outdated Show resolved Hide resolved
@@ -294,27 +286,27 @@ contract SecurityToken is ERC20, ERC20Detailed, ReentrancyGuard, RegistryUpdater
* @param _module address of module to unarchive
*/
function removeModule(address _module) external onlyOwner {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assume this is due to contract size issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes. I totally forgot about this. I also commented out tests that required removal of modules.

Do you prefer to merge this as it as and reduce the size of ST in future or reduce the size before merging?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge and create an issue to uncomment the function as a reminder.

Copy link
Contributor

@satyamakgec satyamakgec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maxsam4. In this PR I have a concern related to styling because lot of places we lost redability. (Ex- return, constructor, function declartion statements etc.).
we could also remove the updatePolyTokenAddress() because it can be handled by the Dmitriy changes (updateFromRegistry()). It also helps to reduce the size little bit.

key = Encoder.getKey("registeredTickers_status", _ticker);
if (getBool(key) != _status)
set(key, _status);
if (getBool(key) != _status) set(key, _status);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the one statement in if is disallowed by the 0.5?, If not then I believe the earlier was better in reading the understanding.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has nothing to do with solidity. It's just style preference. Prettier was originally made for Javascript and JS folks prefer to compress if statements like this. We can revert to original one or keep this change. I am fine with any. I have worked with both styles in the past so they both seem kinda natural to me.

string calldata _ticker,
string calldata _tokenDetails,
bool _divisible
) external whenNotPausedOrOwner {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think styling could be improved.

   function generateSecurityToken(
    string calldata _name,
    string calldata _ticker,
    string calldata _tokenDetails,
    bool _divisible
   ) 
        external 
        whenNotPausedOrOwner
   {
    }

In other functions as well. It makes the code more redable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I prefer the changed style. i.e modifiers in a single line. It's a personal choice though and I am fine with any. I just don't think it's worth it to spend time in refactoring this.

+ 367 * (_month - 2 - (_month - 14) / 12 * 12) / 12
- 3 * ((_year + 4900 + (_month - 14) / 12) / 100) / 4
- OFFSET19700101;
int __days = _day - 32075 + 1461 * (_year + 4800 + (_month - 14) / 12) / 4 + 367 * (_month - 2 - (_month - 14) / 12 * 12) / 12 - 3 * ((_year + 4900 + (_month - 14) / 12) / 100) / 4 - OFFSET19700101;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a nightmare to understand. can't we go as it was written earlier

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We aren't even supposed to change this file. Once bokky updates the library for solidity 0.5, we'll just use his :).

@maxsam4
Copy link
Contributor Author

maxsam4 commented Jan 8, 2019

@satyamakgec The styling changes were done by prettier automatically. We can manually change them to our liking in future but I think, for now, we should just let them be.

@satyamakgec
Copy link
Contributor

hmm... It is not a big task to tackle so we can merge this PR with all the changes.
@comeonbuddy could you please take care of styling in this PR. I will hardly take 2 hours to work it manually.

@adamdossa adamdossa merged commit cd4a7f9 into dev-3.0.0 Jan 9, 2019
@maxsam4 maxsam4 deleted the truffle-5 branch April 9, 2019 07:07
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

6 participants