Failing to deploy smart contracts with solidity and truffle suite since upgrading to solc version 0.8.20

194 views Asked by At

I've recently been working on blockchain development. I'm using truffle suite and ganache as a testing environment. So far I've been compiling with an earlier version of solidity, without any problem whatsoever. Recently, for my project, i had to implement tokens, since i'm using @openzeppelin ERC20 tokens i had to switch to solidity version 0.8.20 (since compilation of ERC20.sol requires it). Since then i'm not able to deploy my contracts anymore. I'm getting the same error Note that the contract was deploying fine before recompiling it with sol 0.8.20 Also note that compilation works fine, except for some warnings, that seems to be non related to this issue as far as I'm concerned: here's the compilation output

For reference this is my truffle version output

these are the contracts: MyTokens.sol MyElection.sol

These are the migrations scripts: 2_deploy_voting_system.js 3_tokens_migration.js

I basically tried to update the version of solidity, tried to deploy one contract singularly, but nothing came of it. As far as i know there shouldn't be any compatibility issues with truffle/ganache and solidity 0.8.20. Also the error is pretty generic and not really indicative of the problem, but i think that the fact that the error spawned out of nowhere after upgrading the compiler signals a compatibility error.

1

There are 1 answers

0
user23294135 On

faced the same issue. I could finally solve it by

  1. uncommenting the evmVersion specification in the truffle-config.js and
  2. set it to "london".

So the compilers-sepficiation in my truffle-config.js looks like this:

compilers: { solc: { version: "^0.8.20", evmVersion: "london" } },