Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Returned error: {"jsonrpc":"2.0","error":"invalid opcode: opcode 0x5f not defined","id":2405066928997542}
-
Duplicate? ethereum.stackexchange.com/questions/150281/… See if this solves your issue.– MakaCommented Jul 21, 2023 at 18:56
-
ethereum.stackexchange.com/questions/150281/… , you can come here to check the answer, i confirmed this worked– AnonymousCommented Jul 22, 2023 at 12:10
2 Answers
0x5F
is EVM opcode PUSH0
that was introduced in the shanghai
update to Ethereum around 5 months ago. Most other EVM-based blockchains still haven't implemented it.
I tested 140 blockchains today and only found these ones (16%) that support PUSH0
currently:
- auroraTestnet
- edgeware
- edgewareTestnet
- gnosis
- chiado
- goerli
- mainnet
- moonbaseAlpha
- moonbeam
- moonriver
- polygonZkEvmTestnet
- pulsechain
- pulsechainV4
- sapphire
- sapphireTestnet
- scrollSepolia
- sepolia
- syscoin
- syscoinTestnet
- taikoTestnetSepolia
Polygon announced last week that they’ve just implemented PUSH0
on their zkEVM blockchain. I’ve tested the testnet and it works. zkEVM mainnet will work from 2023-09-10: Polygon zkEVM: Dragon Fruit Upgrade (with New Opcode) Coming to Mainnet Beta
Hopefully the many other blockchains will follow, as developers want to be able to use the latest version.
In the meantime, in hardhat to prevent use of PUSH0
, you can try setting evmVersion
to a previous version (e.g. paris
, which is the one before shanghai
) whilst still using the latest compiler version (0.8.21 currently):
solidity: {
compilers: [
{
version: `0.8.21`,
settings: {
optimizer: {
enabled: true,
runs: 15000
},
evmVersion: `paris`
}
},
],
},
I think the problem is about the version of solidity. There is a significant update in the latest solidity version 0.8.20 about PUSH0 opcode. please check the following link: https://medium.com/coinmonks/push0-opcode-a-significant-update-in-the-latest-solidity-version-0-8-20-ea028668028a