Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solidity Version Mismatch in Hardhat (0.8.20 vs. 0.8.26) #268

Open
inspirezuza opened this issue Feb 5, 2025 · 1 comment
Open

Solidity Version Mismatch in Hardhat (0.8.20 vs. 0.8.26) #268

inspirezuza opened this issue Feb 5, 2025 · 1 comment

Comments

@inspirezuza
Copy link

inspirezuza commented Feb 5, 2025

I'm encountering a Solidity version mismatch when trying to compile my Hardhat project. My hardhat.config.ts specifies Solidity 0.8.20, but my yarn.lock file has [email protected], which causes a compilation error:

// Staker.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20; //Do not change the solidity version as it negatively impacts submission grading

Source file requires different compiler version (current compiler is 0.8.26+commit.8a97fa7a.Emscripten.clang)

Project Details

  • Hardhat Config (hardhat.config.ts):
    const config: HardhatUserConfig = {
      solidity: {
        compilers: [
          {
            version: "0.8.20",
          },
        ],
      },
    };
  • Yarn Lock (yarn.lock extract):
    "solc@npm:0.8.26": 
      version: 0.8.26
    
  • Error Message:
    Source file requires different compiler version (current compiler is 0.8.26+commit.8a97fa7a.Emscripten.clang)
    

Steps to Reproduce

npx [email protected] -e challenge-1-decentralized-staking challenge-1-decentralized-staking

I’m wondering would simply updating Hardhat to use 0.8.26 be safe, or could it affect grading?

@rin-st
Copy link
Member

rin-st commented Feb 5, 2025

Could you say exactly how to reproduce the error?

yarn deploy works for me without errors

npx [email protected] -e challenge-1-decentralized-staking challenge-1-decentralized-staking command from Steps to Reproduce too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants