asm.js build of soljson 0.4.25 fails on node.js 14+
See original GitHub issueIt seems that legacy version 0.4.25
does not work for any contracts.
My code:
const path = require('path');
const fs = require('fs');
const solc = require('solc');
solc.loadRemoteVersion('v0.4.25+commit.59dbf8f1', function(err, solcSnapshot) {
if (err) {
console.error(err);
} else {
const input = {
language: 'Solidity',
sources: {
'test.sol': {
content: fs.readFileSync(path.join(__dirname, 'testContract.sol'), {encoding: 'utf-8'}),
}
},
settings: {
outputSelection: {
'*': {
'*': ['*']
}
}
}
};
const output = JSON.parse(solcSnapshot.compile(JSON.stringify(input)));
console.log(output);
}
});
The contract is as simple as this:
pragma solidity ^0.4.25;
contract C{}
Output:
RangeError: Maximum call stack size exceeded
at Object.$db [as dynCall_viiiiii] (soljson-v0.4.25+commit.59dbf8f1.js:12:120931)
at invoke_viiiiii (soljson-v0.4.25+commit.59dbf8f1.js:1:1118207)
at Array.pva (soljson-v0.4.25+commit.59dbf8f1.js:13:29030)
at Object.M9a [as dynCall_vi] (soljson-v0.4.25+commit.59dbf8f1.js:12:99033)
at invoke_vi (soljson-v0.4.25+commit.59dbf8f1.js:1:1115011)
at Array.xta (soljson-v0.4.25+commit.59dbf8f1.js:10:704784)
at Object.Dfb [as dynCall_iii] (soljson-v0.4.25+commit.59dbf8f1.js:12:130740)
at invoke_iii (soljson-v0.4.25+commit.59dbf8f1.js:1:1119442)
at Array.vta (soljson-v0.4.25+commit.59dbf8f1.js:10:703080)
at Object.Yfb [as dynCall_iiiiii] (soljson-v0.4.25+commit.59dbf8f1.js:12:131900)
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.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
asm.js build of soljson 0.4.25 fails on node.js 14+ -
It seems that legacy version 0.4.25 does not work for any contracts. My code: const path = require('path'); const fs = require('fs'); ...
Read more >Invalid member of stdlib) while trying to compile solidity 0.4.17 ...
25 binary: asm.js build of soljson 0.4.25 fails on node.js 14+ #537. Unfortunately I don't know what is the cause but if ...
Read more >Events | Node.js v19.3.0 Documentation
When an error occurs within an EventEmitter instance, the typical action is for an 'error' event to be emitted. These are treated as...
Read more >AWS Lambda function errors in Node.js
When your code raises an error, Lambda generates a JSON representation of the error. This error document appears in the invocation log and,...
Read more >Npm install error(fails) - M220JS - MongoDB
Hi , I downloaded the mflix-js project and used npm install and it started to show ... installing npm i node-gyp , but...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
v16.4.2
andv14.16.0
). No error onv12.22.0
.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
loadRemoteVersion()
to download the wasm one when available.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).
Default size was
984
on my system: