This repository has been archived by the owner on Apr 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If only there was a way to turn this PR into an NFT |
+309 −8,219 LOL |
gakonst
approved these changes
Mar 24, 2021
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, my favorite kind of PR.
Let's add a note to the read me that the Artifacts will appear in a new artifacts-ovm
folder, instead of how they were before (artifacts/{name}-ovm.json)
Comment on lines
-133
to
-168
// Filter out any "No input sources specified" errors, but only if one of the two compilations | ||
// threw the error. Basically, it might be intended for only one of the EVM or OVM compilers to | ||
// be compiling contracts, but something went wrong if *both* compilers recieve no input. | ||
let errors = (ovmOutput.errors || []).concat(evmOutput.errors || []) | ||
const filtered = errors.filter((error: any) => { | ||
return error.message !== 'No input sources specified.' | ||
}) | ||
|
||
// Make sure we only saw one of those "No input sources specified." errors. | ||
if (errors.length === filtered.length + 1) { | ||
errors = filtered | ||
} | ||
|
||
// Transfer over any OVM outputs to the EVM output, with an identifier. | ||
for (const fileName of Object.keys(ovmOutput.contracts || {})) { | ||
if (Object.keys(evmOutput.contracts || {}).includes(fileName)) { | ||
for (const contractName of Object.keys(ovmOutput.contracts[fileName])) { | ||
const contractOutput = ovmOutput.contracts[fileName][contractName] | ||
|
||
// Need to fix any link references in the OVM outputs. Otherwise we'll be trying to link | ||
// an OVM-compiled contract to EVM-compiled contracts. | ||
const linkRefs = contractOutput.evm?.bytecode?.linkReferences | ||
for (const linkRefFileName of Object.keys(linkRefs || {})) { | ||
for (const [linkRefName, linkRefOutput] of Object.entries( | ||
linkRefs[linkRefFileName] | ||
)) { | ||
delete linkRefs[linkRefFileName][linkRefName] | ||
linkRefs[linkRefFileName][`${linkRefName}-ovm`] = linkRefOutput | ||
} | ||
} | ||
|
||
// OVM compiler output is signified by adding -ovm to the output name. | ||
evmOutput.contracts[fileName][`${contractName}-ovm`] = contractOutput | ||
} | ||
} | ||
} |
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.
Note to reader: This can be removed because we're adding a new artifacts-ovm
path to store them there.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Big PR to clean up a lot of complex logic. Entirely removes
ethereumjs-vm
-related code. Removeswaffle
,truffle
, andganache
tooling for now. Vastly simplifies compiler plugin by writing to a different artifacts folder instead of using*-ovm.json
. Has the effect of also vastly simplifying every other plugin.Remaining tasks: