argotorg / argotorg/solc-js

RuntimeError: abort(Error: <Insert my error here>). Build with -s ASSERTIONS=1 for more info.

Open
#493 7 comments 6 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.5k
Forks
349
Avg merge
8m
Merged PRs (30d)
1

Description

Hi!

**EDIT**: I've created a repo with a _minimal example_ of the bug, for people to try out and confirm: https://github.com/iAmMichaelConnor/solc-error-demo

solc version: 0.7.1 (& tested with 0.7.4)
node version: 12.18.2 (& tested with latest lts v15.0.1)

I'm writing a node.js application which imports solc-js in one `.mjs` file to compile a solidity file and output the AST.

During development, whenever my application breaks and throws an error, the console spits out a solc-related error. Strangely, the solc-related error will throw even for code that isn't _using_ solc. It appears the file `./node_modules/solc/soljson.js` is somehow 'wrapping' my error messages.

A consequence of this is that every time my application throws an error, the console is filled with the thousands of lines of code contained in the file `./node_modules/solc/soljson.js`.

Below is an example console output upon my app erroring. (Notice that the _actual_ error is unrelated to solc; I'm accidentally `push`ing to `undefined` elsewhere in my app. In fact, at this stage of my app's code, solc has been long finished with, and will not be called upon again).

```
Error: TypeError: Cannot read property 'push' of undefined
Error: TypeError: Cannot read property 'push' of undefined
/Users/em137vl/Documents/git/sprinkles/node_modules/solc/soljson.js:1
null;var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram="./this.program";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;

// I'VE OMITTED THE THOUSANDS OF LINES FROM THE MIDDLE OF `./node_modules/solc/soljson.js`

ledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;function exit(status,implicit){if(implicit&&noExitRuntime&&status===0){return}if(noExitRuntime){}else{ABORT=true;EXITSTATUS=status;exitRuntime();if(Module["onExit"])Module["onExit"](status)}quit_(status,new ExitStatus(status))}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}noExitRuntime=true;run();

RuntimeError: abort(Error: TypeError: Cannot read property 'push' of undefined). Build with -s ASSERTIONS=1 for more info.
at process.abort (~/git/my-project/node_modules/solc/soljson.js:1:13938)
at process.emit (events.js:315:20)
at processEmit [as emit] (~/git/my-project/node_modules/signal-exit/index.js:161:32)
at processPromiseRejections (internal/process/promises.js:209:33)
at processTicksAndRejections (internal/process/task_queues.js:98:32)
```

Any ideas to stop solc wrapping errors?

Many thanks!

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the minimal example at github.com/iAmMichaelConnor/solc-error-demo, using the reported solc and Node versions. Start by tracing how solc/soljson.js handles unrelated application errors; done means those errors no longer produce solc abort output and thousands of lines from soljson.js.

Written by the indexing model from the issue text.

Assessment

Tech stack
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.