eosnetworkfoundation / evm-public-docs

EOS EVM related documents for the public
MIT License
2 stars 0 forks source link

EVM version selection when compiling contracts #11

Open yarkinwho opened 1 year ago

yarkinwho commented 1 year ago

Some developers are encountering problems during contract deployment reporting "Bad Instruction" (my guess is the new PUSH0). Set EVM version to Istanbul when compiling the contract can solve the problem (at least for the case I see).

I believe now latest solidity compilers starts to use this new opcode, it's no longer safe to ignore the EVM version settings. We should add something to docs about this.

nsjames commented 1 year ago

We have something about this in the docs already (https://docs.eosnetwork.com/evm/miscellaneous/evm-compatibility#push0-opcode) but the issue is that a lot of the defaults for tooling now use v0.8.20

OpenZeppelin contracts is a prime example. If you npm i @openzeppelin/contracts without specifying a version, then you will get contracts that are pragma solidity ^0.8.20;

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol