/ troubleshooting

EVM Contract Execution Failed with Solidity v0.5.x Instructions

Error

Several new instructions were introduced in Solidity v0.5.x, like SHL(0x1b)/SHR(0x1c).
If you compile any contract with >=v0.5.5, SHR would be used in the function selector.
WX20190916-151907

But if you try to deploy a contract compiled with solidity ^0.5.5, or to execute new opcodes like SHR/SHL on a private chain, you may hit an unexpected 'execution failed'. When debugging it, you'll find that the execution halt suddenly right at the SHR opcode. (In most of the case, it happens when you connect remix with a localhost geth and try to deploy a contract)

Reason

This is because geth didn't enable a feature relates to the new opcode set.
You need to enable ConstantinopleBlock in your genesis.json. After the blocknum that ConstantinopleBlock goes in to effects, new opcodes should be executed as expected.

Solution

Add these two lines in your genesis.json, restart geth.

{
   "config": {
      ...
      "constantinopleBlock":0,
      "constantinopleFixBlock":0
   },
   ...
}

Reference

https://github.com/ethereum/go-ethereum/issues/19521

EVM Contract Execution Failed with Solidity v0.5.x Instructions
Share this