foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Installing solc behind a proxy fails

Open davebryson opened this issue 2 years ago • 3 comments

Component

Forge

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

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

0.2.0

What command(s) is the bug in?

forge build

Operating System

macOS (Apple Silicon)

Describe the bug

Installing solc on a new project fails with invalid peer certificate: UnknownIssuer. I'm pretty sure this is due to the corporate MITM proxy I'm behind. Is there another way to manually install solc as a work around?

davebryson avatar Sep 02 '22 00:09 davebryson

hmm

this may be related https://www.reddit.com/r/rust/comments/vy5bof/rust_with_reqwest_behind_a_local_http_proxy_burp/

we use https://github.com/roynalnaruto/svm-rs/ to install svm

which is its own cli tool

pre-built apple silicon solc builds are fetched from https://github.com/roynalnaruto/solc-builds/tree/fc7263e8b571b6a4c754d443fa4b7b4236b4735f/macosx/aarch64

we check if they're installed like this

~/.svm/0.8.16/solc-0.8.16

~/.svm/0.8.16/solc-0.8.16 --version

solc, the solidity compiler commandline interface
Version: 0.8.16+commit.07a7930e.Darwin.appleclang

mattsse avatar Sep 02 '22 12:09 mattsse

@mattsse Thanks for the response. Adding the feature native-tls to the reqwest dependency in svm solved the problem. I used svm separately to install a solc version. Forge then worked perfectly

davebryson avatar Sep 02 '22 12:09 davebryson

I see, will check if there's a workaround for rustls as well

mattsse avatar Sep 02 '22 13:09 mattsse

We are also hitting this issue - any ideas on a work around? I assume this is due to corporate machine setup

jamesmorgan avatar Dec 28 '22 10:12 jamesmorgan

this seems to be a common issue: https://github.com/denoland/deno/issues/10312

https://github.com/rustls/rustls/issues/731

does installing via svm directly work?

could you share the error output so we can track down where exactly this is thrown?

mattsse avatar Dec 28 '22 11:12 mattsse

@mattsse @jamesmorgan I solved the issue by making one small change to SVM and rebuilding locally. Specifically, I changed this line: https://github.com/roynalnaruto/svm-rs/blob/master/Cargo.toml#L41 to:

reqwest = { version = "^0.11.7", default-features = false, features = ["json", "native-tls"] }

and installed SVM separately. Foundary worked without issue after that - even updates.

I no longer have details about the specific error output. But essentially is was related to an SSL CERT error when installing foundary rs, a common issue with MITM corporate proxies

davebryson avatar Dec 28 '22 14:12 davebryson

I got around this issue by using @davebryson method whilst installing solc however this same error is thrown when trying to deploy a contract using a script and there seems to be no obvious workaround. Will there be native tls support anytime soon?

forge script script/Deploy.s.sol --rpc-url $SEPOLIA_RPC_URL --broadcast --verify -vvvv
Error: 
error sending request for url (https://eth-sepolia.g.alchemy.com/v2/{API_KEY): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer

Context:
- Error #0: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer
- Error #1: invalid peer certificate contents: invalid peer certificate: UnknownIssuer

callum-elvidge avatar Mar 20 '23 14:03 callum-elvidge

Hi @callum-elvidge would you be able to re-run the experiment now that Foundry uses Alloy?

If valid I propose we move this to https://github.com/foundry-rs/compilers/issues

zerosnacks avatar Jun 26 '24 11:06 zerosnacks