argotorg / argotorg/solc-js

asm.js build of soljson 0.4.25 fails on node.js 14+

Open
#537 9 comments 1 reaction 0 assignees View on GitHub
bug :bug:
Dominant language
TypeScript
Stars
1.5k
Forks
349
Avg merge
8m
Merged PRs (30d)
1

Description

It seems that legacy version `0.4.25` does not work for any contracts.

My code:
```javascript
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:
```Solidity
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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure through solc.loadRemoteVersion with soljson-v0.4.25+commit.59dbf8f1 on Node.js 14+ and the minimal Solidity contract shown. Compare the behavior with issue #496 and verify that the legacy compiler can compile the example without a call-stack overflow while preserving the required compiler version.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, solidity
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.