Discovered on https://github.com/ethereum/sourcify/pull/1465 in the test The downloadFunction for the solc-js compilers getSolcJs fails at the import stage for compilers earlier than 0.6.2. Weirdly this does not happen when the server is started and the compiler is downloaded and loaded for a contract but only on the init stage.
To reproduce:
Make sure to run on a non-native platform (ie. no linux-amd64, macos-amd64, windows-amd/64) or override the platform
Check out c710f93b4e452e88086db2b41f58f0d382431ffe
Run the test with cd services/server && npx mocha test/unit/VerificationService.spec.ts
The test will fail with Maximum call stack size exceeded.
Now remove version 0.1.1 on line 36 and the tests should pass.
To compare initializing to downloading on the fly when the server runs:
Instead of 0.1.1 in the mock object add: "0.4.18": "soljson-v0.4.18+commit.9cf6e910.js",
Run the tests and it will fail.
Delete the downloaded 0.4.18 compiler and run the server.
Verify a contract with 0.4.18 e.g. the USDT contract on Eth Mainnet (1) with Etherscan: 0xdac17f958d2ee523a2206206994597c13d831ec7
This time the compiler will download, load successfully and compile the contract.
Discovered on https://github.com/ethereum/sourcify/pull/1465 in the test The
downloadFunction
for the solc-js compilersgetSolcJs
fails at theimport
stage for compilers earlier than0.6.2
. Weirdly this does not happen when the server is started and the compiler is downloaded and loaded for a contract but only on the init stage.To reproduce:
linux-amd64
,macos-amd64
,windows-amd/64
) or override theplatform
c710f93b4e452e88086db2b41f58f0d382431ffe
cd services/server && npx mocha test/unit/VerificationService.spec.ts
The test will fail with
Maximum call stack size exceeded
.0.1.1
on line 36 and the tests should pass.To compare initializing to downloading on the fly when the server runs:
0.1.1
in the mock object add:"0.4.18": "soljson-v0.4.18+commit.9cf6e910.js",
0.4.18
compiler and run the server.0.4.18
e.g. the USDT contract on Eth Mainnet (1) with Etherscan:0xdac17f958d2ee523a2206206994597c13d831ec7