-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
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
v-next/hardhat/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.ts
Outdated
Show resolved
Hide resolved
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
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.
LGTM, but I'd wait for @alcuadrado's review on this one since he's more familiar with solc
v-next/hardhat/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-runner.ts
Outdated
Show resolved
Hide resolved
v-next/hardhat/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.ts
Outdated
Show resolved
Hide resolved
I've only just realised I merged the solc replacement as part of #6056. Now, I also merged this one because after merging the other one, this one ended up consisting only of the changes requested in the review here. @alcuadrado I put together a branch on which I revert the solc wrapper changes altogether in case we want to roll them back for now: v-next...revert-solcjs-compile-wrapper |
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.