Use buidler's RC for compiling and testing #739
Closed
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.
Hi! This PR upgrades Buidler (and
buidler-truffle5
) to the RC of the next major version. This should let you remove the need of an extra setup for your legacy contracts. These are the things I had to do:I moved the legacy contracts in the
legacy
directory to thecontracts
directory.I changed the buidler config to use the new
solidity
configuration, that supports multiple compiler versions. I used the same versions that you were using before.I had to comment out the
buidler-ast-doc
andbuidler-gas-reporter
plugins because they don't work with the new pipeline yet.The hardest part was adapting the tests. One of the changes in buidler's new compilation pipeline is that artifacts don't live in a flat structure in the artifacts directory. Instead, they replicate the directory structure of the contracts. This means that now you can have contracts with the same name, without one artifact being written over the other.
But this comes with a cost: now if you have two contracts named
Foo
you can't doartifacts.require('Foo')
, because there's no way to know which one you want. In those scenarios, you have to use the Fully Qualified Name, for examplecontracts/Foo.sol:Foo
. When there's only one contract with that name, this is not necessary.Since the tests have a lot of stuff that I don't understand, I added a helper
disambiguateContract
and I used it in severalrequire
s. Of course you are free to solve that issue however you want, I did it that way because it seemed like the less intrusive option.Almost all tests pass with the new setup. The ones that don't are caused by a bug that we just found out, related to linking ambiguous artifacts with a truffle artifact. We'll fix that tomorrow, so I'll probably update this PR with that.
I only tried to compile the contracts and run the tests. There are probably other things you do in your normal workflow, and there's a good chance that some of them stop working. Please let me know when that happens and I'll try to help!
Hope you enjoy it 😃