OpenZeppelin / openzeppelin-contracts

OpenZeppelin Contracts is a library for secure smart contract development.
https://openzeppelin.com/contracts
MIT License
25k stars 11.81k forks source link

Error: Unsupported language version '0.8.27'. #5219

Open majinbot opened 2 months ago

majinbot commented 2 months ago

Hello, I will get the stack trace printed below if I try running any HH task with your plugin imported in HH config import "@openzeppelin/hardhat-upgrades".

We ruled any HH fault with @alcuadrado, whom just released support for latest solc: https://github.com/NomicFoundation/hardhat/issues/5723

Released in Hardhat v2.22.11.

bun run compile
$ hardhat compile
An unexpected error occurred:

Error: Unsupported language version '0.8.27'.
    at tryRemoveNonStructNatSpec (/home/node_modules/@openzeppelin/upgrades-core/src/utils/make-namespaced.ts:183:22)
    at makeNamespacedInput (/home/node_modules/@openzeppelin/upgrades-core/src/utils/make-namespaced.ts:158:28)
    at OverriddenTaskDefinition._action (/home/node_modules/@openzeppelin/hardhat-upgrades/src/index.ts:102:31)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Environment._runTaskDefinition (/home/node_modules/hardhat/src/internal/core/runtime-environment.ts:351:14)
    at async Environment.run (/home/node_modules/hardhat/src/internal/core/runtime-environment.ts:184:14)
    at async SimpleTaskDefinition.action (/home/node_modules/hardhat/src/builtin-tasks/compile.ts:1024:37)
    at async Environment._runTaskDefinition (/home/node_modules/hardhat/src/internal/core/runtime-environment.ts:351:14)
    at async Environment.run (/home/node_modules/hardhat/src/internal/core/runtime-environment.ts:184:14)
    at async /home/node_modules/hardhat/src/builtin-tasks/compile.ts:464:28 {
  code: 'GenericFailure'
}

💻 Environment

interpreter: Bun 1.1.28

deps:

    "devDependencies": {
        "@biomejs/biome": "^1.9.2",
        "@nomicfoundation/hardhat-foundry": "^1.1.2",
        "@nomicfoundation/hardhat-toolbox": "^5.0.0",
        "@openzeppelin/hardhat-upgrades": "^3.3.0",
        "@typechain/ethers-v6": "^0.5.1",
        "@typechain/hardhat": "^9.1.0",
        "@types/bun": "latest",
        "@types/chai": "^4.3.19",
        "@types/mocha": "^10.0.8",
        "@types/node": "^22.5.5",
        "dotenv": "^16.4.5",
        "ethers": "^6.13.2",
        "hardhat": "^2.22.11",
        "hardhat-contract-sizer": "^2.10.0",
        "tasai": "^1.0.0",
        "ts-node": "^10.9.2"
    },
    "peerDependencies": {
        "typescript": "^5.5.4"
    },
    "dependencies": {
        "@openzeppelin/contracts": "^5.0.2",
        "@openzeppelin/contracts-upgradeable": "^5.0.2"
    }

📝 Details

HH config

    solidity: {
        version: "0.8.27",
        settings: {
            optimizer: {
                enabled: true,
                runs: 999999,
            },
            viaIR: true,
        },
    },
Juglipaff commented 2 months ago

For me, this is mitigated by manually providing the latest @nomicfoundation/slang commit in package.json, deleting node_modules with package-lock.json, and doing npm i.

"overrides": {
    "@openzeppelin/upgrades-core": {
      "@nomicfoundation/slang": "git://github.com/NomicFoundation/slang.git#15c437c6c4902cd43e0027f750ba59e8f22f47f9"
    }
 }

Note that this is a temporary solution before the new @nomicfoundation/slang version release.

cairoeth commented 1 month ago

@majinbot im not able to replicate the error with the sample hardhat project and the configs you shared. slang released support for v0.8.27 (and also 0.8.28) so i think it should be working ok. can you let me know if the issue persists?