compound-finance / compound-protocol

The Compound On-Chain Protocol
https://compound.finance/developers
BSD 3-Clause "New" or "Revised" License
1.89k stars 1.21k forks source link

Compilation fails because of different solidity versions #238

Open rappie opened 1 year ago

rappie commented 1 year ago

The protocol code uses 0.5.16 and the tests use 0.8.10.

When I to run yarn test I get the following error:

$ yarn test
yarn run v1.22.19
$ ./script/test
Skipping Scenario Rebuild (set rebuild=true to force)
Compiling Solidity contracts...
(node:1823557) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1823557) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
(node:1823557) Warning: Accessing non-existent property 'VERSION' of module exports inside circular dependency
Compiling contracts {contracts,contracts/**,tests/Contracts}/*.sol with solc to /home/rappie/Desktop/targets/compound/compound-protocol/.build/contracts.json...
Error: Command failed: solc --combined-json bin,abi,metadata --metadata-literal --optimize --allow-paths contracts,tests/Contracts --evm-version istanbul {contracts,contracts/**,tests/Contracts}/*.sol
contracts/BaseJumpRateModelV2.sol:2:1: Error: Source file requires different compiler version (current compiler is 0.5.16+commit.9c3226ce.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.8.10;
^----------------------^

...
<many more of the same error>
...

I've tried multiple ways to compile, always with the same error: