Solidity 0.6 to 0.7
-
Function Visibility: Functions without visibility specifiers now default to internal instead of public.
-
Constructor Syntax: Constructors must be defined using the constructor keyword rather than a function with the same name as the contract.
-
address payable: Explicit conversions from address to address payable and vice versa are now required.
-
Function Overloading: Stricter checks on function overloading, especially with external functions.
-
ABI Encoder v2: Enabled by default for increased stability and better encoding/decoding.
-
safe Keyword: Removal of the safe keyword.
-
The getter for public state variables returns memory instead of storage.
-
Mandatory specification of calldata data location for parameters of external functions.
-
Introduction of the Error data type for custom error messages.
-
Returns bytes32 instead of uint.
-
The revert and require statements now support error messages as arguments.
-
Linearization of inheritance using C3 Linearization.
-
The delete keyword can now be used to set arrays and structs to their default values.
-
String literals can now be converted to bytes directly.
-
Enhancements and changes in Yul (the intermediate language for Solidity).
-
Introduction of the receive keyword for functions specifically to receive Ether.
-
fallback function split into receive and fallback.
-
Clarification and enforcement of modifier precedence.
-
More flexible and consistent tuple assignments.
-
Base constructor arguments must be provided explicitly in derived contracts.
Solidity 0.7 to 0.8
-
Default behavior is to revert on integer overflow and underflow (SafeMath-like behavior).
-
Introduction of custom error types to replace string-based revert reasons, which saves gas.
-
More improvements and optimizations in ABI encoding and decoding.
-
Introduction of block.chainid to retrieve the chain ID.
-
ecrecover now returns an address instead of bytes32.
-
Contracts cannot inherit from themselves.
-
Introduction of the type() function to retrieve information about types, including the max and min values for integers.
-
Introduction of the immutable keyword for state variables that can be assigned only once and are constant thereafter.
-
Introduction of the abstract keyword for contracts that cannot be instantiated.
-
Mandatory use of the override keyword when overriding functions and state variables.
-
Introduction of the Error(string) type for revert reasons, improving gas efficiency.
-
enum types now support explicit type conversions.
-
Function selectors can now be used directly for low-level call operations.
-
Introduction of block.basefee for EIP-1559.
-
Improved handling and operations for signed integers, including checked and unchecked arithmetic.
-
Inline assembly is more tightly integrated and checked for correctness.
-
Enhanced try/catch syntax for handling errors in external calls.
-
Improved checks for multiple inheritance to ensure consistency and correctness.
-
Better specification and control over storage layout, reducing risks of storage conflicts.
-
Improved gas estimation accuracy for complex transactions.
-
Functions can now return multiple values more consistently and predictably.
-
Improved initialization syntax and handling for structs and arrays.
-
Consistent enforcement of visibility specifiers across all elements.
-
Increased the maximum size limit for contracts, allowing for more complex contracts.
-
More informative and detailed compiler error messages to aid in debugging.
-
Numerous compiler optimizations for better performance and reduced gas usage.
These changes significantly enhance the safety, usability, and efficiency of Solidity, reflecting the ongoing evolution and improvement of the language.