When compiling solidity contracts, you are able to set evm version. What does this mean and what are its implications?
evm version specifies what opcodes are allowed to be used by specifiying the hardfork name.
For example, selecting shanghai
as the evm version will make use of the push0
opcode along with opcodes introduced in previous hardforks.
On ethereum mainnet, you can safely use the latest hardfork as the evm version. However, other L1s and L2s may not support those opcodes
Its important to understand if the EVM equivalent chain you are deploying to supports all the opcodes specified at your evm version. Deploying with an evm version you chain does not support will lead to failed deployments
Note: you are able to set the highest version of solidity on whatever chain you are deploying to as long as you specify the correct evmVersion supported on that chain
Dencun
→ Fork from Mar 13, 2024
Shanghai
→ Fork from Apr 12, 2023
Arbitrum
Avalanche
Base
Optimism
Polygon
Paris
(POW to POS) → Fork from Sep 15, 2022
Blast
Binance
(Nearly all EVM chains support paris hardfork)