Skip to content
This repository has been archived by the owner on Apr 11, 2021. It is now read-only.

feat: Working towards 1.0 release #31

Merged
merged 4 commits into from
Mar 24, 2021
Merged

Conversation

smartcontracts
Copy link
Contributor

@smartcontracts smartcontracts commented Mar 24, 2021

Description
Big PR to clean up a lot of complex logic. Entirely removes ethereumjs-vm-related code. Removes waffle, truffle, and ganache 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:

  • Update README to reflect changed plugins
  • Update package.json to remove old files

@platocrat
Copy link
Contributor

If only there was a way to turn this PR into an NFT

@gakonst gakonst marked this pull request as ready for review March 24, 2021 13:31
@smartcontracts
Copy link
Contributor Author

+309 −8,219

LOL

Copy link

@gakonst gakonst left a 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
}
}
}
Copy link

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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants