-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Downloading SOLC behind proxy - HardhatError: HH502: Couldn't download compiler versions list. Please check your connection. #1280
Comments
I found the task name subtask(TASK_COMPILE_SOLIDITY_RUN_SOLCJS) |
@fvictorio Do you think that there is any way to use this check for the solidity compiler in PR#913 to skip the binary process entirely and just use the solcjs compiler? |
how do I set this option |
any updates here @cdesch ? |
Hi @okwme! I made PR#1291 to add proxy support. @fvictorio is going to take a look at it this week. |
Hope this feature can be added soon, thanks hardhat team. |
Would it be easier if HardHat allowed the I don't like to compare HardHat with Truffle, but it is a nice feature in Truffle to specify that the
|
@cdesch Thank you for pushing this pr that seems to be introduced with 2.3.3. Did this version finally work out for you? |
This was included in version 2.4.0. You can now set the |
@martinoss it works with the It would be nice if you could manually provide the solidity compiler To get around this, I did some reverse engineering and provided the
Of course, you have to provide the right I think on MacOS, the default path might be:
and Windows might be something like:
Your mileage may vary. Good Luck. |
@cdesch i'm curious about this. Can you describe more about this offline use case? Why don't you have internet access? Thanks! |
Hi @alcuadrado. I wouldn't call it completely offline, but isolated or restricted mostly from many internet resources and offline at points in time. For example, let's that you had a Continuous Integration and Continuous Delivery pipeline (like, Jenkins, GitHub CI or GitLab CI) on an internal platform like GitHub Enterprise or GitLab Enterprise. This is pretty normal for many businesses and can be setup a variety of ways on different projects. We now want to use those tools with a HH project to automatically build, lint, test, security audit, and deploy our Smart Contracts into dev/review environment and possibly promote them into production. To do this, each step might be broken down into smaller steps that run on docker containers and also deployed on docker containers to where-ever they may run. In some or many instances, the deployment of docker containers that run apps assume that they have everything on everything on it to when running and may not need internet access. For example, if we had an ExpressJS app, the Dockerfile would install of the NodeJS/npm dependencies, copy the source code and build (or transpile for TypeScript) and produce a runnable image (kind of like this example from dockerhub). Internet access to NPM or an internal NPM registry was needed for the build of the docker image, but not running it. Applications with greater complexity probably have multiple build steps in place of just one Dockerfile. If we took that ExpressJS app container image that we just made, we could then run it in something like kubernetes, AWS or on a internal server. The ExpressJS app this example has no expectation using any internet access because all of the resources were provided for it and it can just run. Locking down network access to the environment adds additional security in many cases and we know all it needs incoming network path to the port running Express. Let's add HardHat to our ExpressJS App and let's say it does something. Everything works great until we run This isn't a knock against the way HardHat does this currently. I think it is awesome that HardHat sorts things out for you by automatically getting the right solidity compilers for your system! The complexity of For those who might say something like "What about Mainnet or Rinky? Don't you need internet access for that?". Forget about Mainnet and Rinky. You can run your own geth node or you can run Quorum, or HyperLedger Fabric or the AWS blockchain or something else. Just because you are working with SmartContracts and solidity doesn't mean they have to go on the Mainnet. Does that help a bit? |
Even since I posted the Dockerfile, I added:
Why? I dunno. It should be the same in the docker container but for some reason it wants |
Yes! This works! Thank you! |
@cdesch thanks for your detailed response! What you described makes a lot of sense. As @fvictorio pointed out, this is now handled by overriding a task. We may add a less involved way to achieve it in the future. |
If you found your way to this issue because your @FleekHQ builds that rely on @nomiclabs Hardhat are flaky and fail 80% of the time because the build step says, it can't download the soldity compiler, you might be able to work around that by using a custom build image (Note, you can also commit solidity compilers to your repo and overwrite the hardhat subtask to enforce using it, like demonstrated here, but that'd add another 10-20 MBs to your repo). Since I need pnpm for my builds I'm using my own build image on Fleek anyway. You can find FROM node:16-buster
RUN mkdir -p /root/.cache/hardhat-nodejs/compilers/linux-amd64 \
&& wget -O /root/.cache/hardhat-nodejs/compilers/linux-amd64/solc-linux-amd64-v0.8.7+commit.e28d00a7 https://binaries.soliditylang.org/linux-amd64/solc-linux-amd64-v0.8.7+commit.e28d00a7
RUN npm i -g pnpm V1.1 of my image contains the 0.8.7 compiler at the path where hardhat's compiler loader is looking for it and hence doesn't need to download it and can't fail anymore \0/ |
That is similar to how I configured my docker builds. I had a base container image with the |
I faced similar issue. However, for me hardhat is not able to download list of compiler versions behind corporate proxy. Tried a lot of things. No luck. After a lot of trial and errors, found a way to make this work. Download |
My issue is resolved by simply adding my own proxy config in the "hardhat.config.js" file: // set proxy
const { ProxyAgent, setGlobalDispatcher } = require("undici");
const proxyAgent = new ProxyAgent('http://127.0.0.1:7890'); // change to yours
setGlobalDispatcher(proxyAgent); |
thank you |
1 similar comment
thank you |
thx |
Hi, I solved the problem by letting hardhat to cache locally. Dockerfile.
compose.yml
|
I cannot compile the contracts because the compiler goes out to
https://solc-bin.ethereum.org/windows-amd64/list.json
to fetch them. This is blocked by a proxy.How do I...
OR
yarn add solc
) and disable HardHat from checking for a compiler?Error:
The text was updated successfully, but these errors were encountered: