Note: Version 0.4.0 is unable to compile libraries. Please upgrade to 0.4.1.
This release deliberately breaks backwards compatibility mostly to enforce some safety features. The most important change is that you have to explicitly specify if functions can receive ether via the
payable modifier. Furthermore, more situations cause exceptions to be thrown.
Minimal changes to be made for upgrade:
payableto all functions that want to receive Ether (including the constructor and the fallback function).
- Add version pragma to each file:
pragma solidity ^0.4.0;
- Source files have to specify the compiler version they are compatible with using e.g.
pragma solidity ^0.4.0;or
pragma solidity >=0.4.0 <0.4.8;
- Functions that want to receive Ether have to specify the
payablemodifier (otherwise they throw).
- Contracts that want to receive Ether with a plain “send”
have to implement a fallback function with the
payablemodifier. Contracts now throw if no payable fallback function is defined and no function matches the signature.
- Failing contract creation through “new” throws.
- Division / modulus by zero throws.
- Function call throws if target contract does not have code
- Modifiers are required to contain
if (false) _as a workaround if needed).
- Modifiers: return does not skip part in modifier after
- Placeholder statement
_in modifier now requires explicit
ecrecovernow returns zero if the input is malformed (it previously returned garbage).
constantkeyword cannot be used for constructors or the fallback function.
interface(Solidity interface) output option
- JSON AST: General cleanup, renamed many nodes to match their C++ names.
- JSON output:
- Moved (and reworked) standard library contracts from inside the compiler to github.com/ethereum/solidity/std
import owned;do not work anymore).
- Confusing and undocumented keyword
- New reserved words:
- Hexadecimal string literals:
- Internal: Inline assembly usable by the code generator.
- Commandline interface: Using
-as filename allows reading from stdin.
- Interface JSON: Fallback function is now part of the ABI.
- Interface: Version string now semver compatible.
- Code generator: Do not provide “new account gas” if we know the called account exists.
- JSON AST: Nodes were added at wrong parent
- Why3 translator: Crash fix for exponentiation
- Commandline Interface: linking libraries with underscores in their name.
- Type Checker: Fallback function cannot return data anymore.
- Code Generator: Fix crash when
sha3()was used on unsupported types.
- Code Generator: Manually set gas stipend for
Lots of changes to the documentation mainly by voluntary external contributors.
A big thank you to all contributors who helped make this release possible!
Download the new version of Solidity here.