-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Replace solc dependency with a thin solidity_compile wrapper #6073
base: robust-compiler-downloader
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
hardhatTotal size of the bundle: List of dependencies (sorted by size)
|
v-next/hardhat/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.ts
Outdated
Show resolved
Hide resolved
// eslint-disable-next-line no-restricted-syntax -- should we use a HardhatError here? | ||
throw new Error( | ||
'Could not find the "compile" function in the solc library', | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we should throw a HardhatError
here?
type Compile = ( | ||
input: string, | ||
callbackPtr: number | null, | ||
callbackContextPtr?: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an odd type, but we either want to skip this argument or provide an explicit null. That depends on the version of solc that we're going to be using.
const output = isVersion6OrNewer | ||
? compile(input, null, null) | ||
: compile(input, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The underlying compile functions expect explicit values as far as I understand. Also, their arguments differ depending on the version being used.
} | ||
|
||
function versionToSemver(version: string): string { | ||
// FIXME: parse more detail, but this is a good start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation of this function is a direct copy from solc-js.
…ild-system/compiler/solcjs-wrapper.ts
Resolves #6071
This is a follow-up to #6056
In this PR, I replace the solc-js dependency with a thin wrapper over the
solidity_compile
method.It was created by extracting the parts of the solc-js package (https://github.com/ethereum/solc-js) that we were actually using.