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

solc update to 0.4.18 (use view and pure 🎉) #169

Merged
merged 5 commits into from
Jan 9, 2018
Merged

solc update to 0.4.18 (use view and pure 🎉) #169

merged 5 commits into from
Jan 9, 2018

Conversation

izqui
Copy link
Contributor

@izqui izqui commented Jan 8, 2018

Closes #167

Also locks critical contracts to 0.4.18 and 'interfaces' to ^0.4.18, so it closes #158 and closes #160 (cc @sohkai please review this)

Didn't bother to update anything ERC677 or MiniMe as those are getting replace soon.

@izqui izqui added this to the 0.5 code freeze milestone Jan 8, 2018
@izqui izqui requested a review from sohkai January 8, 2018 13:19
@coveralls
Copy link

Coverage Status

Coverage remained the same at 84.741% when pulling 47e2e59 on solc-update into 3852188 on dev.

@izqui
Copy link
Contributor Author

izqui commented Jan 8, 2018

Ready for review

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 84.865% when pulling 730a2db on solc-update into 3852188 on dev.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 84.865% when pulling 7edbd2d on solc-update into 3852188 on dev.

Copy link
Contributor

@sohkai sohkai left a comment

Choose a reason for hiding this comment

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

🎉 🎉 🎉

@@ -22,7 +23,7 @@ contract DelegateProxy {
}
}

function isContract(address _target) constant internal returns (bool) {
function isContract(address _target) internal view returns (bool) {
Copy link
Contributor

@sohkai sohkai Jan 9, 2018

Choose a reason for hiding this comment

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

@izqui Do you know if there's a list of assembly opcodes that force a function to be view instead of pure somewhere? The solidity docs are ambiguous as to which ones might do, but I noticed this is marked view (due to extcodesize?) while the ones that deal purely with memory are marked pure.

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 it is checked at compile-time @sohkai, so anything that calls SSTORE or SLOAD will error out. No runtime enforcement

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK they're not enforced at compile-time yet (see warnings in the docs).

I'm guessing any instruction that deals with on-chain storage will force view, so:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pure is for functions that dont access state (storage nor memory outside function scope)
View for functions that only read state (sload)
Functions that can modify state dont have special modifiers.

@@ -359,11 +361,11 @@ contract MiniMeToken is Controlled {
bool _transfersEnabled
) public returns(address)
{
if (_snapshotBlock == 0)
_snapshotBlock = block.number;
uint256 snapshot = _snapshotBlock == 0 ? block.number - 1 : _snapshotBlock;
Copy link
Contributor

Choose a reason for hiding this comment

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

Was there a reason for changing this to be block.number - 1 rather than block.number when _snapshotBlock == 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there is a small race condition that can happen if using the same block number. We don't use it anywhere but fixed it jic

@@ -1,5 +1,7 @@
pragma solidity ^0.4.6;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we update this to ^0.4.18 as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't bother to update anything ERC677 or MiniMe as those are getting replace soon.

Copy link
Contributor

@sohkai sohkai left a comment

Choose a reason for hiding this comment

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

🎉 🎉 🎉

@@ -1,4 +1,4 @@
pragma solidity 0.4.15;
pragma solidity 0.4.18;
Copy link

@renexdev renexdev Jan 11, 2018

Choose a reason for hiding this comment

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

Is there some special restriction on putting/avoiding the ^ flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. All files that are used as interfaces have the ^, files that will be deployed have a compiler version fixed for security reasons. In the case of aragon apps all have to be fixed

Choose a reason for hiding this comment

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

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.

Upgrade truffle and solc and use 'view' and 'pure' Required solidity version
5 participants