foundry: forge build fails when contract pragma >=0.8.15

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (2457e5f 2022-06-16T00:04:29.19997Z)

What command(s) is the bug in?

forge build

Operating System

macOS (Intel)

Describe the bug

running forge build fails if the contract pragma is 0.8.15

example:

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.15;

contract Contract {}

debug output:

[⠃] Compiling...2022-06-16T11:16:11.692503Z ERROR ethers_solc::resolver: failed to resolve versions
[⠊] Compiling...
[⠒] Unable to resolve import: "forge-std/Script.sol" with remappings:
        src/=/Users/sbacha/latest-sol/src/
        script/=/Users/sbacha/latest-sol/script/
Error:
   0: Discovered incompatible solidity versions in following
      : script/Contract.s.sol (^0.8.13) imports:
          src/Contract.sol (^0.8.15)
      Discovered incompatible solidity versions in following
      : src/Contract.sol (^0.8.15) imports:

Location:
   cli/src/compile.rs:100

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   2: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   3: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   4: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   5: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   6: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   7: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   8: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>
   9: __mh_execute_header<unknown>
      at <unknown source file>:<unknown line>

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 25 (15 by maintainers)

Most upvoted comments

Closed that above pr as I figured out why it wasn’t working for me.

Turns out I have a local git defender check that interferes with forge-std being built. Once I set up the git defender, I was able to successfully install with forge init hello_foundry --force --no-commit

963f3c42a12513c03a0ad95265710456

Same here, did foundryup before.

can’t reproduce this on today’s nightly and intel mac

can you try removing rm -rf ~/.svm/0.8.15 ?

@roynalnaruto looks like we have some issue with the newest M1 native release

You saved me @ebaizel 🙇🏼 thanks alot

Status on this?

working wrt intel latest release

We’re getting the releases from solc’s own list on platforms they support, so the issue seems to be upstream? cc @mattsse

Edit: https://github.com/foundry-rs/foundry/issues/2003#issuecomment-1158234632

963f3c42a12513c03a0ad95265710456

Same here, did foundryup before.

I am not getting a checksum error , this is new