argotorg / argotorg/solc-js

Exception in an import callback leaves the compiler in an inconsistent state, leading to `You shall not have another CompilerStack aside me` error on next compilation

Open
#675 13 comments 0 reactions 0 assignees View on GitHub
bug :bug: high effort medium impact must have
Dominant language
TypeScript
Stars
1.5k
Forks
349
Avg merge
8m
Merged PRs (30d)
1

Description

Hi, I'm getting an internal exception error but I'm not too sure why. I'm running solc on an express server.

### Steps to getting this error:
1) Compile a contract that has invalid imports
2) Try to compile a contract that has valid imports
3) `solc.compile()` throws error

### Error i'm getting:
```
{
errors: [
{
component: 'general',
formattedMessage: 'Internal exception in StandardCompiler::compile: /solidity/libsolidity/interface/CompilerStack.cpp(107): Throw in function solidity::frontend::CompilerStack::CompilerStack(ReadCallback::Callback)\n' +
'Dynamic exception type: boost::wrapexcept\n' +
'std::exception::what: You shall not have another CompilerStack aside me.\n' +
'[solidity::util::tag_comment*] = You shall not have another CompilerStack aside me.\n',
message: 'Internal exception in StandardCompiler::compile: /solidity/libsolidity/interface/CompilerStack.cpp(107): Throw in function solidity::frontend::CompilerStack::CompilerStack(ReadCallback::Callback)\n' +
'Dynamic exception type: boost::wrapexcept\n' +
'std::exception::what: You shall not have another CompilerStack aside me.\n' +
'[solidity::util::tag_comment*] = You shall not have another CompilerStack aside me.\n',
severity: 'error',
type: 'InternalCompilerError'
}
]
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the sequence through solc.compile(): first compile a contract with invalid imports, then compile one with valid imports. Inspect the CompilerStack.cpp location reported in the error and the import read callback path. Done means a failed import compilation does not leave the next compilation throwing “You shall not have another CompilerStack aside me.”

Written by the indexing model from the issue text.

Assessment

Tech stack
express, solidity, typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.