0

i'm testing my Smart Contract with Truffle and Ganache, everything works fine while using hadfork version "Petersburg", but when i switch to Byzantium i receive this error while truffle performs deploy:

Compiling your contracts...
===========================
√ Fetching solc version list from solc-bin. Attempt #1
> Compiling .\contracts\Migrations.sol
> Compiling .\contracts\MyContract.sol
√ Fetching solc version list from solc-bin. Attempt #1
> Artifacts written to C:\Users\[...]\AppData\Local\Temp\test-202032-8352-17dkmqb.vs9r
> Compiled successfully using:
   - solc: 0.5.17+commit.d19bba13.Emscripten.clang

Error: Returned error: VM Exception while processing transaction: invalid opcode    at PromiEvent (C:\Users\User-PC\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\promievent.js:9:1)
    at TruffleContract.setCompleted (C:\Users\User-PC\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\execute.js:169:1)
    at Migration._deploy (C:\Users\User-PC\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\migration.js:93:

Truffle and Ganache are both updated to the latest version. i'm using web3 1.2

The Smart Contract is ok, i also did a lot of test and debuging on remix.

Any suggestion?

1 Answer 1

1

IIRC, solc 0.5.17 is pre-Byzantium and you need to transition to 0.5.2? (not 100% sure which one). Perhaps a kind soul will chime in with the exact version cutoff or else check the release notes for the first release with Byzantium support.

You can instruct truffle to use a specific solc version truffle-config.json. You may have to refactor the contract source code to achieve a successful compile with a newer compiler.

Hope it helps.

1
  • it works with version 0.5.2, but the transaction object doesn't seem to be updated to Byzantium, it shiuld contain the new "receipt" field with status inside it, that is what i'm targeting. but i need it to be like result.receipt.status
    – spawn85
    Commented Apr 2, 2020 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.