-
Notifications
You must be signed in to change notification settings - Fork 59
Upgrade solidity version to 0.5.4 #393
Conversation
f0330d9 to
a2d4556
Compare
Pull Request Test Coverage Report for Build 4405
💛 - Coveralls |
felix2feng
left a comment
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.
Good job getting this done. Do have a few questions and generally feel a little bit nervous about changing the external dependencies
package.json
Outdated
| }, | ||
| "scripts": { | ||
| "chain": "yarn clean-chain && ganache-cli --db blockchain --networkId 50 --accounts 20 -l 19000000 -e 10000000000 -m 'concert load couple harbor equip island argue ramp clarify fence smart topic'", | ||
| "chain": "yarn clean-chain && ganache-cli --db blockchain --networkId 50 --accounts 20 -l 19000000 -e 10000000000 -m 'concert load couple harbor equip island argue ramp clarify fence smart topic' --allowUnlimitedContractSize", |
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.
Before we merge... let's try to do a test deploy on Kovan and check the gas costs and whether Core could be deployed. This way we can validate whether this flag interferes with deployment
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.
yes i wanted to get this done too, need to make sure we can use the optimizer i think as mentioned here: https://ethereum.stackexchange.com/questions/63426/running-out-of-gas-during-a-deploy-due-to-a-large-number-of-require-statements
| "clean": "rm -rf build; rm -rf transpiled; rm -rf types/generated", | ||
| "clean-chain": "rm -rf blockchain && cp -r snapshots/0x-Kyber blockchain", | ||
| "compile": "truffle compile --all", | ||
| "compile": "./node_modules/.bin/truffle compile --all", |
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.
any reason for this?
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 think this was to use the upgraded version of solc compiler as specified in the truffle.js
https://hackernoon.com/compile-solidity-smart-contracts-faster-in-truffle-projects-eb8bebb61ec3
i think before this, it was still trying to use the old version since truffle v5 by default still uses 0.4.25
| "solc": "^0.4.25", | ||
| "solidity-coverage": "^0.5.11", | ||
| "solc": "^0.5.4", | ||
| "solidity-coverage": "https://github.com/leapdao/solidity-coverage#master", |
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.
Any reason for changing to this?
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.
sc-forks/solidity-parser#18 coverage was failing because of _ in variable names and some other weird stuff that the current version of solidity parser doesn't handle still. we can maybe fork leapdaos too if we want to keep it under us for now
| // Figure out which of the components has the minimum decimal value | ||
| /* solium-disable-next-line security/no-low-level-calls */ | ||
| if (currentComponent.call(bytes4(keccak256("decimals()")))) { | ||
| (bool success, ) = currentComponent.call(abi.encodeWithSignature("decimals()")); |
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.
Interesting new return of .call
| _naturalUnit, | ||
| _name.bytes32ToString(), | ||
| _symbol.bytes32ToString() | ||
| return address( |
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 do we need to wrap this in address?
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 forget the exact error message, but basically it was saying that we were returning an instance of a contract instead of an address and a lot of the solc 0.5 changes are all about being more explicit so have to convert to address i think
| bar := calldataload(36) | ||
| } | ||
|
|
||
| emit LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data); |
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.
This is a breaking change? Can't get msg.value directly?
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.
yea can't use msg.value directly, needs to be in an internal function
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.
Using msg.value in non-payable functions (or introducing it via a modifier) is disallowed as a security feature.
| /** | ||
| * @dev Total number of tokens in existence | ||
| */ | ||
| function totalSupply() external view returns (uint256) { |
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.
any reason this was removed?
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.
It is already defined as a public variable on line 15 here, so the getter should automatically be generated. it was giving me an error about shadowing variables here
…ables of multi-return functions to work with new solc compiler
…d byte, contract to address, and cleaning up DappHub code
77c250e to
2757cb3
Compare
Running
yarn compileand gradually fixing changes.There are a lot of breaking changes with https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html
Following this guide:
https://hackernoon.com/compile-solidity-smart-contracts-faster-in-truffle-projects-eb8bebb61ec3
Example new errors:
https://ethereum.stackexchange.com/questions/8959/solidity-compile-expected-token-comma-got-identifier
https://ethereum.stackexchange.com/questions/63426/running-out-of-gas-during-a-deploy-due-to-a-large-number-of-require-statements
sc-forks/solidity-parser#18
https://hackernoon.com/compile-solidity-smart-contracts-faster-in-truffle-projects-eb8bebb61ec3
Data location must be "calldata" for parameter in external function, but none was given.Data location must be "storage" or "memory" for parameter in function, but none was givenData location must be "memory" for return parameter in function, but none was given.