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
asm.js build of soljson 0.4.25 fails on node.js 14+ #537
Comments
I can confirm the problem on 0.4.25, though I'm getting a different stack trace:
Interestingly, it happens only on newer node.js versions (tried Also, the wasm 0.4.25 binary does not have this problem. I recommend using this binary over the asm.js one anyway. Not sure if there's anything we can do to fix this particular asm.js binary for newer node.js. At least we should update |
@cameel Thanks for pinpointing the problem. FYI, my node version is |
More binaries might be affected by this: (Invalid asm.js: Invalid member of stdlib) while trying to compile solidity 0.4.17. |
FYI @cameel, I just noticed a similar error for 0.4.18+commit.9cf6e910.js
Node v16.14.2 and soljson-v0.4.18+commit.9cf6e910.js Stacktrace(node:4047597) V8: /home/amal/.config/truffle-nodejs/compilers/node_modules/soljson-v0.4.18+commit.9cf6e910.js:3 Invalid asm.js: Invalid member of stdlib
at compileFunction (<anonymous>)
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at Object.require (node:internal/modules/cjs/helpers:102:18)
at VersionRange.getCachedSolcByFileName (/home/amal/work/truffle/packages/compile-solidity/src/compilerSupplier/loadingStrategies/VersionRange.ts:94:38)
at VersionRange.getCachedSolcByVersionRange (/home/amal/work/truffle/packages/compile-solidity/src/compilerSupplier/loadingStrategies/VersionRange.ts:114:17)
at VersionRange.<anonymous> (/home/amal/work/truffle/packages/compile-solidity/src/compilerSupplier/loadingStrategies/VersionRange.ts:42:19)
at Generator.next (<anonymous>)
at /home/amal/work/truffle/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:8:71
at new Promise (<anonymous>)
at __awaiter (/home/amal/work/truffle/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:4:12)
at VersionRange.load (/home/amal/work/truffle/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:44:16)
at CompilerSupplier.<anonymous> (/home/amal/work/truffle/packages/compile-solidity/src/compilerSupplier/index.ts:69:35)
at Generator.next (<anonymous>)
at /home/amal/work/truffle/packages/compile-solidity/dist/compilerSupplier/index.js:8:71
at new Promise (<anonymous>)
at __awaiter (/home/amal/work/truffle/packages/compile-solidity/dist/compilerSupplier/index.js:4:12)
at CompilerSupplier.load (/home/amal/work/truffle/packages/compile-solidity/dist/compilerSupplier/index.js:41:16)
at /home/amal/work/truffle/packages/compile-solidity/src/run.js:230:32
at Generator.next (<anonymous>)
at /home/amal/work/truffle/packages/compile-solidity/dist/run.js:7:71
at new Promise (<anonymous>)
at __awaiter (/home/amal/work/truffle/packages/compile-solidity/dist/run.js:3:12)
at invokeCompiler (/home/amal/work/truffle/packages/compile-solidity/dist/run.js:187:12)
at /home/amal/work/truffle/packages/compile-solidity/src/run.js:46:49
at Generator.next (<anonymous>)
at /home/amal/work/truffle/packages/compile-solidity/dist/run.js:7:71
at new Promise (<anonymous>)
at __awaiter (/home/amal/work/truffle/packages/compile-solidity/dist/run.js:3:12)
at run (/home/amal/work/truffle/packages/compile-solidity/dist/run.js:19:12)
at Object.<anonymous> (/home/amal/work/truffle/packages/compile-solidity/src/index.js:62:33)
at Generator.next (<anonymous>)
at /home/amal/work/truffle/packages/compile-solidity/dist/index.js:7:71
at new Promise (<anonymous>)
at __awaiter (/home/amal/work/truffle/packages/compile-solidity/dist/index.js:3:12)
at Object.sources (/home/amal/work/truffle/packages/compile-solidity/dist/index.js:54:16)
at /home/amal/work/truffle/packages/fetch-and-compile/lib/fetch.ts:145:37
at Generator.next (<anonymous>)
at fulfilled (/home/amal/work/truffle/packages/fetch-and-compile/lib/fetch.ts:5:58) |
Thanks for the report! Honestly, I'm not sure what to do about this issue. It looks more like a node.js issue, especially given that these binaries used to work. I did some searching and found an old thread about the same error happening in Remix. This comment from @axic seems the most relevant:
So to move this forward we'd probably need to report it upstream. |
@cds-amal Also, any reason you're still using the asm.js binaries? We have equivalent wasm builds and these should really be preferred since they're also faster. This issue is pretty low on the priority list mostly because of this - wasm builds do not have that problem and should be better in all respects so switching to them is not just a workaround, it's the right solution here. |
Hi @cameel, Truffle sources solc.js from the two endpoints below (in order). How can I identify a wasm build? The following file doesn't have the string
|
Basically, if you use https://binaries.soliditylang.org/emscripten-wasm32/ you'll get only wasm binaries. You can use https://binaries.soliditylang.org/emscripten-asmjs/ as a fallback. If you want to detect the wasm ones on your own, presence of |
I'm not too sure how to go about replacing the asm.js by the wasm one, but in my case increasing the stack-size got it to pass (for node 16). node --stack-size=2000 index.js Default size was node --v8-options | grep -B0 -A1 stack-size
--stack-size (default size of stack region v8 is allowed to use (in kBytes))
type: int default: 984 |
The error was: ``` RangeError: Maximum call stack size exceeded ``` Refs: ethereum/solc-js#537
It seems that legacy version
0.4.25
does not work for any contracts.My code:
The contract is as simple as this:
Output:
There is a similar issue #496. But the problem is not solved at all. That issue is closed only because the creator changed the compiler version. But this walkaround solution is not applicable to me. I am reproducing verified contracts on Etherscan and need to compile the contract using the exactly the same compiler version as required in the contract verification.
The text was updated successfully, but these errors were encountered: